mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix many long to int conversion warnings:
- fix usage of Index (API) versus StorageIndex (when multiple indexes are stored) - use StorageIndex(val) when the input has already been check - use internal::convert_index<StorageIndex>(val) when val is potentially unsafe (directly comes from user input)
This commit is contained in:
@@ -112,13 +112,13 @@ Index SparseLUImpl<Scalar,StorageIndex>::column_dfs(const Index m, const Index j
|
||||
// krow was visited before, go to the next nonz;
|
||||
if (kmark == jcol) continue;
|
||||
|
||||
dfs_kernel(jcol, perm_r, nseg, glu.lsub, segrep, repfnz, xprune, marker2, parent,
|
||||
dfs_kernel(StorageIndex(jcol), perm_r, nseg, glu.lsub, segrep, repfnz, xprune, marker2, parent,
|
||||
xplore, glu, nextl, krow, traits);
|
||||
} // for each nonzero ...
|
||||
|
||||
Index fsupc, jptr, jm1ptr, ito, ifrom, istop;
|
||||
Index nsuper = glu.supno(jcol);
|
||||
Index jcolp1 = jcol + 1;
|
||||
Index fsupc;
|
||||
StorageIndex nsuper = glu.supno(jcol);
|
||||
StorageIndex jcolp1 = StorageIndex(jcol) + 1;
|
||||
Index jcolm1 = jcol - 1;
|
||||
|
||||
// check to see if j belongs in the same supernode as j-1
|
||||
@@ -129,8 +129,8 @@ Index SparseLUImpl<Scalar,StorageIndex>::column_dfs(const Index m, const Index j
|
||||
else
|
||||
{
|
||||
fsupc = glu.xsup(nsuper);
|
||||
jptr = glu.xlsub(jcol); // Not yet compressed
|
||||
jm1ptr = glu.xlsub(jcolm1);
|
||||
StorageIndex jptr = glu.xlsub(jcol); // Not yet compressed
|
||||
StorageIndex jm1ptr = glu.xlsub(jcolm1);
|
||||
|
||||
// Use supernodes of type T2 : see SuperLU paper
|
||||
if ( (nextl-jptr != jptr-jm1ptr-1) ) jsuper = emptyIdxLU;
|
||||
@@ -148,13 +148,13 @@ Index SparseLUImpl<Scalar,StorageIndex>::column_dfs(const Index m, const Index j
|
||||
{ // starts a new supernode
|
||||
if ( (fsupc < jcolm1-1) )
|
||||
{ // >= 3 columns in nsuper
|
||||
ito = glu.xlsub(fsupc+1);
|
||||
StorageIndex ito = glu.xlsub(fsupc+1);
|
||||
glu.xlsub(jcolm1) = ito;
|
||||
istop = ito + jptr - jm1ptr;
|
||||
StorageIndex istop = ito + jptr - jm1ptr;
|
||||
xprune(jcolm1) = istop; // intialize xprune(jcol-1)
|
||||
glu.xlsub(jcol) = istop;
|
||||
|
||||
for (ifrom = jm1ptr; ifrom < nextl; ++ifrom, ++ito)
|
||||
for (StorageIndex ifrom = jm1ptr; ifrom < nextl; ++ifrom, ++ito)
|
||||
glu.lsub(ito) = glu.lsub(ifrom);
|
||||
nextl = ito; // = istop + length(jcol)
|
||||
}
|
||||
@@ -166,8 +166,8 @@ Index SparseLUImpl<Scalar,StorageIndex>::column_dfs(const Index m, const Index j
|
||||
// Tidy up the pointers before exit
|
||||
glu.xsup(nsuper+1) = jcolp1;
|
||||
glu.supno(jcolp1) = nsuper;
|
||||
xprune(jcol) = nextl; // Intialize upper bound for pruning
|
||||
glu.xlsub(jcolp1) = nextl;
|
||||
xprune(jcol) = StorageIndex(nextl); // Intialize upper bound for pruning
|
||||
glu.xlsub(jcolp1) = StorageIndex(nextl);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user