31 #ifndef EIGEN_SPARSELU_MEMORY 32 #define EIGEN_SPARSELU_MEMORY 39 template<
typename Index>
40 inline Index
LUnumTempV(Index& m, Index& w, Index& t, Index& b)
42 return (std::max)(m, (t+b)*w);
45 template<
typename Scalar,
typename Index>
48 return (2*w + 4 +
LUNoMarker) * m *
sizeof(Index) + (w + 1) * m *
sizeof(Scalar);
62 template <
typename Scalar,
typename Index>
63 template <
typename VectorType>
70 if(num_expansions == 0 || keep_prev)
73 new_len = Index(alpha * length);
77 old_vec = vec.segment(0,nbElts);
84 catch(std::bad_alloc& )
86 if ( !num_expansions )
102 alpha = (alpha + 1)/2;
103 new_len = Index(alpha * length);
108 catch(std::bad_alloc& )
111 if ( tries > 10)
return new_len;
113 }
while (!vec.size());
118 vec.segment(0, nbElts) = old_vec;
122 if(num_expansions) ++num_expansions;
138 template <
typename Scalar,
typename Index>
143 glu.
nzumax = glu.
nzlumax = (std::max)(fillratio * annz, m*n);
144 glu.
nzlmax = (std::max)(Index(4), fillratio) * annz / 4;
148 tempSpace = (2*panel_size + 4 +
LUNoMarker) * m *
sizeof(Index) + (panel_size + 1) * m *
sizeof(Scalar);
151 Index estimated_size;
152 estimated_size = (5 * n + 5) *
sizeof(Index) + tempSpace
154 return estimated_size;
160 glu.
xsup.resize(n+1);
161 glu.
supno.resize(n+1);
162 glu.
xlsub.resize(n+1);
164 glu.
xusub.resize(n+1);
171 expand<ScalarVector>(glu.
lusup, glu.
nzlumax, 0, 0, num_expansions);
172 expand<ScalarVector>(glu.
ucol,glu.
nzumax, 0, 0, num_expansions);
173 expand<IndexVector>(glu.
lsub,glu.
nzlmax, 0, 0, num_expansions);
174 expand<IndexVector>(glu.
usub,glu.
nzumax, 0, 1, num_expansions);
176 catch(std::bad_alloc& )
185 }
while (!glu.
lusup.size() || !glu.
ucol.size() || !glu.
lsub.size() || !glu.
usub.size());
203 template <
typename Scalar,
typename Index>
204 template <
typename VectorType>
209 failed_size = this->expand<VectorType>(vec, maxlen, nbElts, 1, num_expansions);
211 failed_size = this->expand<VectorType>(vec, maxlen, nbElts, 0, num_expansions);
222 #endif // EIGEN_SPARSELU_MEMORY
iterative scaling algorithm to equilibrate rows and column norms in matrices
Index LUTempSpace(Index &m, Index &w)
Index memXpand(VectorType &vec, Index &maxlen, Index nbElts, MemType memtype, Index &num_expansions)
Expand the existing storage.
Index LUnumTempV(Index &m, Index &w, Index &t, Index &b)
Index expand(VectorType &vec, Index &length, Index nbElts, Index keep_prev, Index &num_expansions)
Index memInit(Index m, Index n, Index annz, Index lwork, Index fillratio, Index panel_size, GlobalLU_t &glu)
Allocate various working space for the numerical factorization phase.