mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
release of tvmet (inactive for 2 years and developer unreachable) as the basis for eigen2, because it provides seemingly good expression template mechanisms, we want that, and it would take years to reinvent that wheel. We'll see. So this commit imports the last tvmet release.
45 lines
771 B
C++
45 lines
771 B
C++
#include <iostream>
|
|
#include <iomanip>
|
|
#include <algorithm>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <tvmet/Matrix.h>
|
|
#include <tvmet/Vector.h>
|
|
|
|
using namespace std;
|
|
using namespace tvmet;
|
|
|
|
typedef Vector<double,3> vector3d;
|
|
typedef Matrix<double,3,3> matrix33d;
|
|
|
|
int main()
|
|
{
|
|
matrix33d m1;
|
|
|
|
std::generate(m1.begin(), m1.end(), std::rand);
|
|
|
|
vector3d vc0( col(m1, 0) );
|
|
vector3d vc1( col(m1, 1) );
|
|
vector3d vc2( col(m1, 2) );
|
|
|
|
vector3d vr0( row(m1, 0) );
|
|
vector3d vr1( row(m1, 1) );
|
|
vector3d vr2( row(m1, 2) );
|
|
|
|
|
|
cout << std::setw(12) << m1 << endl;
|
|
|
|
cout << "col vectors:" << endl;
|
|
cout << vc0 << endl;
|
|
cout << vc1 << endl;
|
|
cout << vc2 << endl;
|
|
|
|
cout << "row vectors:" << endl;
|
|
cout << vr0 << endl;
|
|
cout << vr1 << endl;
|
|
cout << vr2 << endl;
|
|
|
|
}
|
|
|