NUMCXX  0.13.20181108
Numerical library for small projects and teaching purposes
13-numcxx-lapack.cxx

Use of lapack solver for dense matrices

#include <iostream>
#include <limits>
int main(void)
{
int n=5000;
F=1.0;
for (int i=0;i<n;i++)
{
A(i,i)=3.0;
if (i>0) A(i,i-1)=-1;
if (i<n-1) A(i,i+1)=-1;
}
numcxx::DSolverLapackLU LapackSolver(A);
LapackSolver.solve(U,F);
double residual=normi(A*U-F);
std::cout << "residual:" << residual << std::endl;
}