function_taking_ref.cpp File Reference

Go to the source code of this file.

Functions

float inv_cond (const Eigen::Ref< const Eigen::MatrixXf > &a)
 
int main ()
 

Function Documentation

◆ inv_cond()

float inv_cond ( const Eigen::Ref< const Eigen::MatrixXf > &  a)

Definition at line 4 of file function_taking_ref.cpp.

5 {
6  const Eigen::VectorXf sing_vals = a.jacobiSvd().singularValues();
7  return sing_vals(sing_vals.size()-1) / sing_vals(0);
8 }
EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT
Definition: EigenBase.h:69
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:182

◆ main()

int main ( )

Definition at line 10 of file function_taking_ref.cpp.

11 {
13  std::cout << "matrix m:\n" << m << "\n\n";
14  std::cout << "inv_cond(m): " << inv_cond(m) << "\n";
15  std::cout << "inv_cond(m(1:3,1:3)): " << inv_cond(m.topLeftCorner(3,3)) << "\n";
16  std::cout << "inv_cond(m+I): " << inv_cond(m+Eigen::MatrixXf::Identity(4, 4)) << "\n";
17 }
Matrix3f m
static const RandomReturnType Random()
Definition: Random.h:114
static const IdentityReturnType Identity()
float inv_cond(const Eigen::Ref< const Eigen::MatrixXf > &a)