mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-15 07:10:37 +08:00
c10f069b6b
Renamed "MatrixBase::extract() const" to "MatrixBase::part() const" * Renamed static functions identity, zero, ones, random with an upper case first letter: Identity, Zero, Ones and Random.
7 lines
434 B
C++
7 lines
434 B
C++
typedef Matrix<float,Dynamic,2> DataMatrix;
|
|
// let's generate some samples on the 3D plane of equation z = 2x+3y (with some noise)
|
|
DataMatrix samples = DataMatrix::Random(12,2);
|
|
VectorXf elevations = 2*samples.col(0) + 3*samples.col(1) + VectorXf::Random(12)*0.1;
|
|
// and let's solve samples * x = elevations in least square sense:
|
|
cout << (samples.adjoint() * samples).cholesky().solve((samples.adjoint()*elevations).eval()) << endl;
|