mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Clang-format tests, examples, libraries, benchmarks, etc.
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
3252ecc7a4
commit
46e9cdb7fe
@@ -6,9 +6,8 @@ init init_obj;
|
||||
// [init]
|
||||
#include <Eigen/Dense>
|
||||
|
||||
int main()
|
||||
{
|
||||
Eigen::MatrixXd A(2,2);
|
||||
int main() {
|
||||
Eigen::MatrixXd A(2, 2);
|
||||
A << 2, -1, 1, 3;
|
||||
std::cout << "Here is the input matrix A before decomposition:\n" << A << "\n";
|
||||
std::cout << "[init]\n";
|
||||
@@ -23,8 +22,10 @@ int main()
|
||||
std::cout << "[matrixLU]\n";
|
||||
|
||||
std::cout << "[solve]\n";
|
||||
Eigen::MatrixXd A0(2,2); A0 << 2, -1, 1, 3;
|
||||
Eigen::VectorXd b(2); b << 1, 2;
|
||||
Eigen::MatrixXd A0(2, 2);
|
||||
A0 << 2, -1, 1, 3;
|
||||
Eigen::VectorXd b(2);
|
||||
b << 1, 2;
|
||||
Eigen::VectorXd x = lu.solve(b);
|
||||
std::cout << "Residual: " << (A0 * x - b).norm() << "\n";
|
||||
std::cout << "[solve]\n";
|
||||
@@ -36,15 +37,15 @@ int main()
|
||||
std::cout << "[modifyA]\n";
|
||||
|
||||
std::cout << "[recompute]\n";
|
||||
A0 = A; // save A
|
||||
A0 = A; // save A
|
||||
lu.compute(A);
|
||||
x = lu.solve(b);
|
||||
std::cout << "Residual: " << (A0 * x - b).norm() << "\n";
|
||||
std::cout << "[recompute]\n";
|
||||
|
||||
std::cout << "[recompute_bis0]\n";
|
||||
Eigen::MatrixXd A1(2,2);
|
||||
A1 << 5,-2,3,4;
|
||||
Eigen::MatrixXd A1(2, 2);
|
||||
A1 << 5, -2, 3, 4;
|
||||
lu.compute(A1);
|
||||
std::cout << "Here is the input matrix A1 after decomposition:\n" << A1 << "\n";
|
||||
std::cout << "[recompute_bis0]\n";
|
||||
@@ -53,5 +54,4 @@ int main()
|
||||
x = lu.solve(b);
|
||||
std::cout << "Residual: " << (A1 * x - b).norm() << "\n";
|
||||
std::cout << "[recompute_bis1]\n";
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user