NESSi  v1.0.2
The NonEquilibrium Systems Simulation Library

◆ real_sq_solve()

void linalg::real_sq_solve ( double *  ad,
double *  bd,
double *  xd,
int  dim 
)

Solve a linear equation ax=b.

Purpose

Solve a linear equation ax=b for a given real square matrx ( \(a\)) and a real vector ( \(b\)).

Parameters
ad

A real square matrix given as a pointer.

bd

A real vector given as a pointer.

xd

A real vector into which the solution is set. Given as a pointer.

dim

Size of the matrix and the vector

Definition at line 106 of file linalg_eigen.cpp.

References get_dvector(), set_dmatrix(), and set_dvector().

107 {
108  dmatrix A_eigen;
109  dvector b_eigen,X_eigen;
110  set_dmatrix(n,a,A_eigen);
111  set_dvector(n,b,b_eigen);
112  Eigen::FullPivLU<dmatrix> lu(A_eigen);
113  X_eigen=lu.solve(b_eigen);
114  get_dvector(n,x,X_eigen);
115 }
void get_dvector(int n, void *a, dvector &A)
void set_dmatrix(int n, void *a, dmatrix &A)
void set_dvector(int n, void *a, dvector &A)
+ Here is the call graph for this function: