Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101934917
function_taking_ref.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
Sat, Feb 15, 08:08
Size
594 B
Mime Type
text/x-c
Expires
Mon, Feb 17, 08:08 (1 d, 14 h)
Engine
blob
Format
Raw Data
Handle
24249073
Attached To
rDLMA Diffusion limited mixed aggregation
function_taking_ref.cpp
View Options
#include <iostream>
#include <Eigen/SVD>
using namespace Eigen;
using namespace std;
float inv_cond(const Ref<const MatrixXf>& a)
{
const VectorXf sing_vals = a.jacobiSvd().singularValues();
return sing_vals(sing_vals.size()-1) / sing_vals(0);
}
int main()
{
Matrix4f m = Matrix4f::Random();
cout << "matrix m:" << endl << m << endl << endl;
cout << "inv_cond(m): " << inv_cond(m) << endl;
cout << "inv_cond(m(1:3,1:3)): " << inv_cond(m.topLeftCorner(3,3)) << endl;
cout << "inv_cond(m+I): " << inv_cond(m+Matrix4f::Identity()) << endl;
}
Event Timeline
Log In to Comment