Bugzilla – Attachment 283 Details for
Bug 481
Unified object for Matrix, Block, Map
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
This bugzilla service is closed. All entries have been migrated to
https://gitlab.com/libeigen/eigen
usage exemples
ref.cpp (text/plain), 1.57 KB, created by
Gael Guennebaud
on 2012-07-02 16:24:17 UTC
(
hide
)
Description:
usage exemples
Filename:
MIME Type:
Creator:
Gael Guennebaud
Created:
2012-07-02 16:24:17 UTC
Size:
1.57 KB
patch
obsolete
>#include <iostream> >#include <Eigen/Dense> >using namespace Eigen; > >void foo1(Ref<VectorXf> a) { } >void foo2(const Ref<const VectorXf>& a) { } >void foo3(Ref<VectorXf,0,InnerStride<> > a) { } >void foo4(const Ref<const VectorXf,0,InnerStride<> >& a) { } >void foo5(Ref<MatrixXf,0,OuterStride<> > A) { } >void foo6(const Ref<const MatrixXf,0,OuterStride<> >& A) { } > >int main() >{ > VectorXcf ca(10); > VectorXf a(10); > const VectorXf& ac(a); > VectorBlock<VectorXf> ab(a,0,3); > MatrixXf A(10,10); > const VectorBlock<VectorXf> abc(a,0,3); > > foo1(a); > //foo1(ac); // does not compile because ac is const > foo1(ab); > foo1(a.head(4)); > foo1(abc); > foo1(A.col(3)); > // foo1(A.row(3)); // does not compile because innerstride!=1 > foo3(A.row(3)); > foo4(A.row(3)); > //foo1(a+a); // does not compile for obvious reason > > foo2(A*A.col(1)); // evaluated into a temp > foo2(ac.head(5)); > foo2(ac); > foo2(a); > foo2(ab); > foo2(a.head(4)); > foo2(a+a); // evaluated into a temp > foo2(ca.imag()); // evaluated into a temp > > foo4(ac.head(5)); > foo4(a+a); > foo4(ca.imag()); > > std::cout << "\nmatrix cases:\n\n"; > > foo5(a); > foo5(a.head(3)); > foo5(A); > // foo5(A.transpose()); // does not compile > foo5(A.block(1,1,2,2)); > > foo6(a); > foo6(a.head(3)); > foo6(A.row(3)); // evaluated into a temp thouth it could be avoided by viewing it as a 1xn matrix > foo6(A+A); // evaluated into a temp > foo6(A); > foo6(A.transpose()); // evaluated into a temp because the storage orders do not match > foo6(A.block(1,1,2,2)); > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 481
:
280
|
282
| 283