Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120214071
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
Wed, Jul 2, 17:12
Size
371 B
Mime Type
text/x-c
Expires
Fri, Jul 4, 17:12 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27156539
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