mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
some small improvements to the page on functions taking eigen objects.
- make the beginning more precise - make the first example be a full selfcontained compiled example, no need for all the others, but having the first one doesn't hurt.
This commit is contained in:
18
doc/examples/function_taking_eigenbase.cpp
Normal file
18
doc/examples/function_taking_eigenbase.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <iostream>
|
||||
#include <Eigen/Core>
|
||||
using namespace Eigen;
|
||||
|
||||
template <typename Derived>
|
||||
void print_size(const EigenBase<Derived>& b)
|
||||
{
|
||||
std::cout << "size (rows, cols): " << b.size() << " (" << b.rows()
|
||||
<< ", " << b.cols() << ")" << std::endl;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
Vector3f v;
|
||||
print_size(v);
|
||||
// v.asDiagonal() returns a 3x3 diagonal matrix pseudo-expression
|
||||
print_size(v.asDiagonal());
|
||||
}
|
||||
Reference in New Issue
Block a user