NUMCXX  0.13.20181108
Numerical library for small projects and teaching purposes
Functions
15-numcxx-umfpack.cxx File Reference
+ Include dependency graph for 15-numcxx-umfpack.cxx:

Go to the source code of this file.

Functions

int main (void)
 

Function Documentation

int main ( void  )
Examples:
15-numcxx-umfpack.cxx.

Definition at line 14 of file 15-numcxx-umfpack.cxx.

15 {
16  int n=5000;
17  numcxx::DSparseMatrix A(n,n);
18  numcxx::DArray1 U(n);
19  numcxx::DArray1 F(n);
20 
21  F=1.0;
22  for (int i=0;i<n;i++)
23  {
24  A(i,i)=3.0;
25  if (i>0) A(i,i-1)=-1;
26  if (i<n-1) A(i,i+1)=-1;
27  }
28  A.flush();
29 
30  numcxx::DSolverUMFPACK UmfpackSolver(A);
31  UmfpackSolver.update(A);
32  UmfpackSolver.solve(U,F);
33  double residual=normi(A*U-F);
34 
35  std::cout << "residual:" << residual << std::endl;
36 }
Sparse matrix class using CRS storage scheme.
A::value_type normi(const A &a)
Maximum norm of array or expression.
Definition: util.ixx:26
One dimensional array class.
Definition: tarray1.hxx:31
Bridge class for using umfpack as solver for vmatrix.

+ Here is the call graph for this function: