MCPcopy Create free account
hub / github.com/Derious/cuMPC / main

Function main

dependence/eigen-3.4.0/bench/spbench/test_sparseLU.cpp:17–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15using namespace Eigen;
16
17int main(int argc, char **args)
18{
19// typedef complex<double> scalar;
20 typedef double scalar;
21 SparseMatrix<scalar, ColMajor> A;
22 typedef SparseMatrix<scalar, ColMajor>::Index Index;
23 typedef Matrix<scalar, Dynamic, Dynamic> DenseMatrix;
24 typedef Matrix<scalar, Dynamic, 1> DenseRhs;
25 Matrix<scalar, Dynamic, 1> b, x, tmp;
26// SparseLU<SparseMatrix<scalar, ColMajor>, AMDOrdering<int> > solver;
27// #ifdef EIGEN_METIS_SUPPORT
28// SparseLU<SparseMatrix<scalar, ColMajor>, MetisOrdering<int> > solver;
29// std::cout<< "ORDERING : METIS\n";
30// #else
31 SparseLU<SparseMatrix<scalar, ColMajor>, COLAMDOrdering<int> > solver;
32 std::cout<< "ORDERING : COLAMD\n";
33// #endif
34
35 ifstream matrix_file;
36 string line;
37 int n;
38 BenchTimer timer;
39
40 // Set parameters
41 /* Fill the matrix with sparse matrix stored in Matrix-Market coordinate column-oriented format */
42 if (argc < 2) assert(false && "please, give the matrix market file ");
43 loadMarket(A, args[1]);
44 cout << "End charging matrix " << endl;
45 bool iscomplex=false, isvector=false;
46 int sym;
47 getMarketHeader(args[1], sym, iscomplex, isvector);
48// if (iscomplex) { cout<< " Not for complex matrices \n"; return -1; }
49 if (isvector) { cout << "The provided file is not a matrix file\n"; return -1;}
50 if (sym != 0) { // symmetric matrices, only the lower part is stored
51 SparseMatrix<scalar, ColMajor> temp;
52 temp = A;
53 A = temp.selfadjointView<Lower>();
54 }
55 n = A.cols();
56 /* Fill the right hand side */
57
58 if (argc > 2)
59 loadMarketVector(b, args[2]);
60 else
61 {
62 b.resize(n);
63 tmp.resize(n);
64// tmp.setRandom();
65 for (int i = 0; i < n; i++) tmp(i) = i;
66 b = A * tmp ;
67 }
68
69 /* Compute the factorization */
70// solver.isSymmetric(true);
71 timer.start();
72// solver.compute(A);
73 solver.analyzePattern(A);
74 timer.stop();

Callers

nothing calls this directly

Calls 15

loadMarketFunction · 0.85
getMarketHeaderFunction · 0.85
loadMarketVectorFunction · 0.85
nnzLMethod · 0.80
nnzUMethod · 0.80
colsMethod · 0.45
resizeMethod · 0.45
startMethod · 0.45
analyzePatternMethod · 0.45
stopMethod · 0.45
valueMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected