File indexing completed on 2025-04-19 09:06:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef EIGEN_SPARSELU_UTILS_H
0012 #define EIGEN_SPARSELU_UTILS_H
0013
0014 namespace RivetEigen {
0015 namespace internal {
0016
0017
0018
0019
0020 template <typename Scalar, typename StorageIndex>
0021 void SparseLUImpl<Scalar,StorageIndex>::countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu)
0022 {
0023 nnzL = 0;
0024 nnzU = (glu.xusub)(n);
0025 Index nsuper = (glu.supno)(n);
0026 Index jlen;
0027 Index i, j, fsupc;
0028 if (n <= 0 ) return;
0029
0030 for (i = 0; i <= nsuper; i++)
0031 {
0032 fsupc = glu.xsup(i);
0033 jlen = glu.xlsub(fsupc+1) - glu.xlsub(fsupc);
0034
0035 for (j = fsupc; j < glu.xsup(i+1); j++)
0036 {
0037 nnzL += jlen;
0038 nnzU += j - fsupc + 1;
0039 jlen--;
0040 }
0041 }
0042 }
0043
0044
0045
0046
0047
0048
0049
0050
0051 template <typename Scalar, typename StorageIndex>
0052 void SparseLUImpl<Scalar,StorageIndex>::fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu)
0053 {
0054 Index fsupc, i, j, k, jstart;
0055
0056 StorageIndex nextl = 0;
0057 Index nsuper = (glu.supno)(n);
0058
0059
0060 for (i = 0; i <= nsuper; i++)
0061 {
0062 fsupc = glu.xsup(i);
0063 jstart = glu.xlsub(fsupc);
0064 glu.xlsub(fsupc) = nextl;
0065 for (j = jstart; j < glu.xlsub(fsupc + 1); j++)
0066 {
0067 glu.lsub(nextl) = perm_r(glu.lsub(j));
0068 nextl++;
0069 }
0070 for (k = fsupc+1; k < glu.xsup(i+1); k++)
0071 glu.xlsub(k) = nextl;
0072 }
0073
0074 glu.xlsub(n) = nextl;
0075 }
0076
0077 }
0078
0079 }
0080 #endif