76 eigen_assert((m > 0 && m == n) &&
"Please give a non - empty matrix");
83 VectorXd Dr(m), Dc(n), DrRes(m), DcRes(n);
84 double EpsRow = 1.0, EpsCol = 1.0;
90 for (
int k = 0; k < m_matrix.outerSize(); ++k) {
91 for (
typename MatrixType::InnerIterator it(m_matrix, k); it; ++it) {
92 if (Dr(it.row()) < abs(it.value())) Dr(it.row()) = abs(it.value());
94 if (Dc(it.col()) < abs(it.value())) Dc(it.col()) = abs(it.value());
97 for (
int i = 0; i < m; ++i) {
98 Dr(i) = numext::sqrt(Dr(i));
100 for (
int i = 0; i < n; ++i) {
101 Dc(i) = numext::sqrt(Dc(i));
104 for (
int i = 0; i < m; ++i) {
107 for (
int i = 0; i < n; ++i) {
113 for (
int k = 0; k < m_matrix.outerSize(); ++k) {
114 for (
typename MatrixType::InnerIterator it(m_matrix, k); it; ++it) {
115 it.valueRef() = it.value() / (Dr(it.row()) * Dc(it.col()));
117 if (DrRes(it.row()) < abs(it.value())) DrRes(it.row()) = abs(it.value());
119 if (DcRes(it.col()) < abs(it.value())) DcRes(it.col()) = abs(it.value());
122 DrRes.array() = (1 - DrRes.array()).abs();
123 EpsRow = DrRes.maxCoeff();
124 DcRes.array() = (1 - DcRes.array()).abs();
125 EpsCol = DcRes.maxCoeff();
127 }
while ((EpsRow > m_tol || EpsCol > m_tol) && (its < m_maxits));
128 m_isInitialized =
true;