mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Updates to the Sparse unsupported solvers module.
* change Sparse* specialization's signatures from <..., int Backend> to <..., typename Backend>. Update SparseExtra accordingly to use structs instead of the SparseBackend enum. * add SparseLDLT Cholmod specialization * for Cholmod and UmfPack, SparseLU, SparseLLT and SparseLDLT now use ei_solve_retval and have the new solve() method (to be closer to the 3.0 API). * fix doc
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
#include <iostream>
|
||||
#include <Eigen/Dense>
|
||||
|
||||
using namespace std;
|
||||
using namespace Eigen;
|
||||
|
||||
int main()
|
||||
{
|
||||
Eigen::MatrixXf m(2,4);
|
||||
Eigen::VectorXf v(2);
|
||||
|
||||
m << 1, 2, 6, 9,
|
||||
3, 1, 7, 2;
|
||||
|
||||
v << 2,
|
||||
3;
|
||||
|
||||
MatrixXf::Index index;
|
||||
// find nearest neighbour
|
||||
(m.colwise() - v).colwise().squaredNorm().minCoeff(&index);
|
||||
|
||||
cout << "Nearest neighbour is column " << index << ":" << endl;
|
||||
cout << m.col(index) << endl;
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
#include <iostream>
|
||||
#include <Eigen/Dense>
|
||||
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
Eigen::MatrixXf mat(2,4);
|
||||
Eigen::MatrixXf v(2);
|
||||
|
||||
mat << 1, 2, 6, 9,
|
||||
3, 1, 7, 2;
|
||||
|
||||
v << 0,
|
||||
1;
|
||||
|
||||
//add v to each column of m
|
||||
mat.colwise() += v;
|
||||
|
||||
std::cout << "Broadcasting result: " << std::endl;
|
||||
std::cout << mat << std::endl;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#include <Eigen/Dense>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace Eigen;
|
||||
|
||||
int main()
|
||||
{
|
||||
VectorXf v(2);
|
||||
MatrixXf m(2,2), n(2,2);
|
||||
|
||||
v << 2,
|
||||
5;
|
||||
|
||||
m << 0,2,
|
||||
3,4;
|
||||
|
||||
n << 1,2,
|
||||
3,4;
|
||||
|
||||
cout << "v.norm() = " << m.norm() << endl;
|
||||
cout << "m.norm() = " << m.norm() << endl;
|
||||
cout << "n.norm() = " << m.norm() << endl;
|
||||
cout << endl;
|
||||
cout << "v.squaredNorm() = " << v.squaredNorm() << endl;
|
||||
cout << "m.squaredNorm() = " << m.squaredNorm() << endl;
|
||||
cout << "n.squaredNorm() = " << n.squaredNorm() << endl;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
#include <iostream>
|
||||
#include <Eigen/Dense>
|
||||
|
||||
using namespace std;
|
||||
using namespace Eigen;
|
||||
|
||||
int main()
|
||||
{
|
||||
Eigen::MatrixXf m(2,2);
|
||||
|
||||
m << 1, 2,
|
||||
3, 4;
|
||||
|
||||
//get location of maximum
|
||||
MatrixXf::Index maxRow, maxCol;
|
||||
m.maxCoeff(&maxRow, &maxCol);
|
||||
|
||||
//get location of minimum
|
||||
MatrixXf::Index minRow, minCol;
|
||||
m.minCoeff(&minRow, &minCol);
|
||||
|
||||
cout << "Max at: " <<
|
||||
maxRow << "," << maxCol << endl;
|
||||
cout << "Min at: " <<
|
||||
minRow << "," << minCol << endl;
|
||||
}
|
||||
Reference in New Issue
Block a user