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

Go to the source code of this file.

Functions

int main (void)
 

Function Documentation

int main ( void  )
Examples:
13-numcxx-lapack.cxx.

Definition at line 11 of file 13-numcxx-lapack.cxx.

12 {
13  int n=5000;
14  numcxx::DMatrix A(n,n);
15  numcxx::DArray1 F(n);
16  numcxx::DArray1 U(n);
17 
18 
19  F=1.0;
20  for (int i=0;i<n;i++)
21  {
22  A(i,i)=3.0;
23  if (i>0) A(i,i-1)=-1;
24  if (i<n-1) A(i,i+1)=-1;
25  }
26 
27  numcxx::DSolverLapackLU LapackSolver(A);
28  LapackSolver.solve(U,F);
29  double residual=normi(A*U-F);
30 
31  std::cout << "residual:" << residual << std::endl;
32 }
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
Dense matrix class.
Definition: tmatrix.hxx:38
Lapack LU factorization class.

+ Here is the call graph for this function: