21#ifndef EIGEN_SPARSE_AMD_H
22#define EIGEN_SPARSE_AMD_H
30template<
typename T0,
typename T1>
inline bool amd_marked(
const T0*
w,
const T1&
j) {
return w[
j]<0; }
34template<
typename StorageIndex>
35static StorageIndex cs_wclear (StorageIndex mark, StorageIndex lemax, StorageIndex *
w, StorageIndex
n)
38 if(mark < 2 || (mark + lemax < 0))
40 for(k = 0; k <
n; k++)
49template<
typename StorageIndex>
50StorageIndex
cs_tdfs(StorageIndex
j, StorageIndex k, StorageIndex *
head,
const StorageIndex *next, StorageIndex *
post, StorageIndex *
stack)
52 StorageIndex
i,
p,
top = 0;
83template<
typename Scalar,
typename StorageIndex>
88 StorageIndex d,
dk,
dext,
lemax = 0,
e,
elenk,
eln,
i,
j, k,
k1,
89 k2,
k3,
jlast,
ln,
dense,
nzmax,
mindeg = 0,
nvi,
nvj,
nvk, mark,
wnvi,
90 ok,
nel = 0,
p,
p1,
p2,
p3,
p4,
pj,
pk,
pk1,
pk2,
pn, q, t, h;
92 StorageIndex
n = StorageIndex(
C.
cols());
93 dense = std::max<StorageIndex> (16, StorageIndex(10 * sqrt(
double(
n))));
96 StorageIndex
cnz = StorageIndex(
C.nonZeros());
103 StorageIndex*
len = W;
104 StorageIndex*
nv = W + (
n+1);
105 StorageIndex* next = W + 2*(
n+1);
106 StorageIndex*
head = W + 3*(
n+1);
107 StorageIndex*
elen = W + 4*(
n+1);
108 StorageIndex* degree = W + 5*(
n+1);
109 StorageIndex*
w = W + 6*(
n+1);
110 StorageIndex*
hhead = W + 7*(
n+1);
111 StorageIndex* last = perm.indices().data();
114 StorageIndex*
Cp =
C.outerIndexPtr();
115 StorageIndex*
Ci =
C.innerIndexPtr();
116 for(k = 0; k <
n; k++)
121 for(
i = 0;
i <=
n;
i++)
135 for(
i = 0;
i <
n;
i++)
177 if(next[k] != -1) last[next[k]] = -1;
186 for(
j = 0;
j <
n;
j++)
194 for(q = 0,
p = 0;
p <
cnz; )
229 if((
nvi =
nv[
i]) <= 0)
continue;
233 if(next[
i] != -1) last[next[
i]] = last[
i];
236 next[last[
i]] = next[
i];
240 head[degree[
i]] = next[
i];
284 for(h = 0, d = 0,
p =
p1;
p <=
p2;
p++)
309 if((
nvj =
nv[
j]) <= 0)
continue;
326 degree[
i] = std::min<StorageIndex> (degree[
i], d);
345 if(
nv[
i] >= 0)
continue;
349 for(;
i != -1 && next[
i] != -1;
i = next[
i], mark++)
355 for(
j = next[
i];
j != -1; )
360 if(
w[
Ci[
p]] != mark)
ok = 0;
384 if((
nvi = -
nv[
i]) <= 0)
continue;
387 d = std::min<StorageIndex> (d,
n -
nel -
nvi);
408 for(
j =
n;
j >= 0;
j--)
410 if(
nv[
j] > 0)
continue;
414 for(
e =
n;
e >= 0;
e--)
416 if(
nv[
e] <= 0)
continue;
423 for(k = 0,
i = 0;
i <=
n;
i++)
428 perm.indices().conservativeResize(
n);
int n
Definition BiCGSTAB_simple.cpp:1
int i
Definition BiCGSTAB_step_by_step.cpp:9
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE FixedSegmentReturnType< internal::get_fixed_value< NType >::value >::Type head(NType n)
Definition BlockMethods.h:1208
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Vector3f p1
Definition MatrixBase_all.cpp:2
RowVector3d w
Definition Matrix_resize_int.cpp:3
#define ei_declare_aligned_stack_constructed_variable(TYPE, NAME, SIZE, BUFFER)
Definition Memory.h:768
float * p
Definition Tutorial_Map_using.cpp:9
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition PlainObjectBase.h:145
StorageIndex cs_tdfs(StorageIndex j, StorageIndex k, StorageIndex *head, const StorageIndex *next, StorageIndex *post, StorageIndex *stack)
Definition Amd.h:50
T amd_flip(const T &i)
Definition Amd.h:28
T amd_unflip(const T &i)
Definition Amd.h:29
bool amd_marked(const T0 *w, const T1 &j)
Definition Amd.h:30
void amd_mark(const T0 *w, const T1 &j)
Definition Amd.h:31
void minimum_degree_ordering(SparseMatrix< Scalar, ColMajor, StorageIndex > &C, PermutationMatrix< Dynamic, Dynamic, StorageIndex > &perm)
Definition Amd.h:84
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
Definition BandTriangularSolver.h:13
Definition ForwardDeclarations.h:17
std::ptrdiff_t j
Definition tut_arithmetic_redux_minmax.cpp:2