Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102018769
TutorialLinAlgExComputeSolveError.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Feb 16, 06:12
Size
371 B
Mime Type
text/x-c
Expires
Tue, Feb 18, 06:12 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24249210
Attached To
rDLMA Diffusion limited mixed aggregation
TutorialLinAlgExComputeSolveError.cpp
View Options
#include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd A = MatrixXd::Random(100,100);
MatrixXd b = MatrixXd::Random(100,50);
MatrixXd x = A.fullPivLu().solve(b);
double relative_error = (A*x - b).norm() / b.norm(); // norm() is L2 norm
cout << "The relative error is:\n" << relative_error << endl;
}
Event Timeline
Log In to Comment