Shapeworks Studio
2.1
Shape analysis software suite
|
A matrix or vector expression mapping an existing expressions. More...
#include <Ref.h>
Public Types | |
typedef RefBase< Ref > | Base |
Public Types inherited from Eigen::RefBase< Ref< PlainObjectType, Options, StrideType > > | |
typedef MapBase< Ref< PlainObjectType, Options, StrideType > > | Base |
Public Member Functions | |
template<typename Derived > | |
Ref (PlainObjectBase< Derived > &expr, typename internal::enable_if< bool(Traits::template match< Derived >::MatchAtCompileTime), Derived >::type *=0) | |
template<typename Derived > | |
Ref (const DenseBase< Derived > &expr, typename internal::enable_if< bool(internal::is_lvalue< Derived >::value &&bool(Traits::template match< Derived >::MatchAtCompileTime)), Derived >::type *=0, int=Derived::ThisConstantIsPrivateInPlainObjectBase) | |
Public Member Functions inherited from Eigen::RefBase< Ref< PlainObjectType, Options, StrideType > > | |
Index | innerStride () const |
Index | outerStride () const |
Additional Inherited Members | |
Protected Types inherited from Eigen::RefBase< Ref< PlainObjectType, Options, StrideType > > | |
typedef Stride< StrideType::OuterStrideAtCompileTime, StrideType::InnerStrideAtCompileTime > | StrideBase |
Protected Member Functions inherited from Eigen::RefBase< Ref< PlainObjectType, Options, StrideType > > | |
void | construct (Expression &expr) |
Protected Attributes inherited from Eigen::RefBase< Ref< PlainObjectType, Options, StrideType > > | |
StrideBase | m_stride |
A matrix or vector expression mapping an existing expressions.
PlainObjectType | the equivalent matrix type of the mapped data |
Options | specifies whether the pointer is #Aligned , or #Unaligned . The default is #Unaligned . |
StrideType | optionally specifies strides. By default, Ref implies a contiguous storage along the inner dimension (inner stride==1), but accept a variable outer stride (leading dimension). This can be overridden by specifying strides. The type passed here must be a specialization of the Stride template, see examples below. |
This class permits to write non template functions taking Eigen's object as parameters while limiting the number of copies. A Ref<> object can represent either a const expression or a l-value:
In the in-out case, the input argument must satisfies the constraints of the actual Ref<> type, otherwise a compilation issue will be triggered. By default, a Ref<VectorXf> can reference any dense vector expression of float having a contiguous memory layout. Likewise, a Ref<MatrixXf> can reference any column major dense matrix expression of float whose column's elements are contiguously stored with the possibility to have a constant space inbetween each column, i.e.: the inner stride mmust be equal to 1, but the outer-stride (or leading dimension), can be greater than the number of rows.
In the const case, if the input expression does not match the above requirement, then it is evaluated into a temporary before being passed to the function. Here are some examples:
The range of inputs that can be referenced without temporary can be enlarged using the last two template parameter. Here is an example accepting an innerstride!=1:
The downside here is that the function foo3 might be significantly slower than foo1 because it won't be able to exploit vectorization, and will involved more expensive address computations even if the input is contiguously stored in memory. To overcome this issue, one might propose to overloads internally calling a template function, e.g.: