31 #ifndef EIGEN_SPARSELU_MEMORY 32 #define EIGEN_SPARSELU_MEMORY 44 template<
typename Scalar>
47 return (2*w + 4 +
LUNoMarker) * m *
sizeof(
Index) + (w + 1) * m *
sizeof(Scalar);
61 template <
typename Scalar,
typename StorageIndex>
62 template <
typename VectorType>
69 if(num_expansions == 0 || keep_prev)
76 old_vec = vec.segment(0,nbElts);
79 #ifdef EIGEN_EXCEPTIONS 85 #ifdef EIGEN_EXCEPTIONS 86 catch(std::bad_alloc& )
108 alpha = (alpha + 1)/2;
110 #ifdef EIGEN_EXCEPTIONS 116 #ifdef EIGEN_EXCEPTIONS 117 catch(std::bad_alloc& )
123 if ( tries > 10)
return new_len;
125 }
while (!vec.size());
130 vec.segment(0, nbElts) = old_vec;
134 if(num_expansions) ++num_expansions;
150 template <
typename Scalar,
typename StorageIndex>
155 glu.
nzumax = glu.
nzlumax = (std::min)(fillratio * (annz+1) / n, m) * n;
159 tempSpace = (2*panel_size + 4 +
LUNoMarker) * m *
sizeof(
Index) + (panel_size + 1) * m *
sizeof(Scalar);
162 Index estimated_size;
163 estimated_size = (5 * n + 5) *
sizeof(
Index) + tempSpace
165 return estimated_size;
171 glu.
xsup.resize(n+1);
172 glu.
supno.resize(n+1);
173 glu.
xlsub.resize(n+1);
175 glu.
xusub.resize(n+1);
180 if( (expand<ScalarVector>(glu.
lusup, glu.
nzlumax, 0, 0, num_expansions)<0)
181 || (expand<ScalarVector>(glu.
ucol, glu.
nzumax, 0, 0, num_expansions)<0)
182 || (expand<IndexVector> (glu.
lsub, glu.
nzlmax, 0, 0, num_expansions)<0)
183 || (expand<IndexVector> (glu.
usub, glu.
nzumax, 0, 1, num_expansions)<0) )
191 }
while (!glu.
lusup.size() || !glu.
ucol.size() || !glu.
lsub.size() || !glu.
usub.size());
207 template <
typename Scalar,
typename StorageIndex>
208 template <
typename VectorType>
213 failed_size = this->expand<VectorType>(vec, maxlen, nbElts, 1, num_expansions);
215 failed_size = this->expand<VectorType>(vec, maxlen, nbElts, 0, num_expansions);
226 #endif // EIGEN_SPARSELU_MEMORY Index LUTempSpace(Index &m, Index &w)
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half() max(const half &a, const half &b)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Index LUnumTempV(Index &m, Index &w, Index &t, Index &b)
Index memXpand(VectorType &vec, Index &maxlen, Index nbElts, MemType memtype, Index &num_expansions)
Expand the existing storage.
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.
EIGEN_DEVICE_FUNC const Scalar & b
Index expand(VectorType &vec, Index &length, Index nbElts, Index keep_prev, Index &num_expansions)