Discussion:
[eigen] alignment issues, conversion between aligned / unaligned data, unaligned Eigen::Rotation2D
bubnikv
2018-08-20 13:14:40 UTC
Permalink
Hello.

We are developing a 3D printing software https://github.com/prusa3d/slic3r
(fork of http://slic3r.org/)

We are now trying to replace the homebrew point classes with the Eigen
fixed size types. As the code base is quite large, we want to avoid
alignment issues by declaring fixed vector types with the Eigen::DontAlign
attribute. So far so good, with the exception of Eigen::Rotation2D, which
is not templated with the alignment attribute, so it cannot be used against
the fixed size matrices with Eigen::DontAlign. Is there any reason for
that? Would you guys please extend the class with the alignment template
attribute?

We are thinking of using https://github.com/libigl/libigl for some
operations on triangle meshes, where the vectorized operations may or may
not be beneficial. We may just disable alignment / vectorization for the
whole application. We are not sure about the performance penalty, but
looking at the evaluation of Eigen 2 from 2008
http://eigen.tuxfamily.org/index.php?title=Benchmark-August2008
the loss may be significant.

We may then think about converting between the aligned / non aligned
values. Does Eigen support any conversion between aligned / unaligned
types? I know about the .cast<>() operator, but it does not allow me to
change the alignment attribute.

Thanks for your time,
Vojtech
Christoph Hertzberg
2018-08-20 13:37:04 UTC
Permalink
Post by bubnikv
Hello.
We are developing a 3D printing software https://github.com/prusa3d/slic3r
(fork of http://slic3r.org/)
We are now trying to replace the homebrew point classes with the Eigen
fixed size types. As the code base is quite large, we want to avoid
alignment issues by declaring fixed vector types with the Eigen::DontAlign
attribute. So far so good, with the exception of Eigen::Rotation2D, which
is not templated with the alignment attribute, so it cannot be used against
the fixed size matrices with Eigen::DontAlign. Is there any reason for
that? Would you guys please extend the class with the alignment template
attribute?
Rotation2D stores just a single Scalar (the angle), so there is no
need/possibility to align it.
Alternatively, you could store a 2D rotation as a 2x2 matrix, or as a
complex number (neither of them inherits from RotationBase, though).
Post by bubnikv
We are thinking of using https://github.com/libigl/libigl for some
operations on triangle meshes, where the vectorized operations may or may
not be beneficial. We may just disable alignment / vectorization for the
whole application. We are not sure about the performance penalty, but
looking at the evaluation of Eigen 2 from 2008
http://eigen.tuxfamily.org/index.php?title=Benchmark-August2008
the loss may be significant.
On modern CPUs the difference between aligned and not-aligned is far
less or even non-existing (except for effects like crossing
cache-lines). And with Eigen 3.3 it is possible to use vectorization on
unaligned data (enabled by default):
http://eigen.tuxfamily.org/bz/show_bug.cgi?id=256#c10

So make meaningful benchmarks on the CPU you want to target to decide if
you need to invest time into that.
Post by bubnikv
We may then think about converting between the aligned / non aligned
values. Does Eigen support any conversion between aligned / unaligned
types? I know about the .cast<>() operator, but it does not allow me to
change the alignment attribute.
You can simply copy in either direction, or you can mix aligned and
non-aligned data inside expressions. No need to cast here.



Christoph
Post by bubnikv
Thanks for your time,
Vojtech
--
Dr.-Ing. Christoph Hertzberg

Besuchsadresse der Nebengeschäftsstelle:
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany

Postadresse der Hauptgeschäftsstelle Standort Bremen:
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 1
28359 Bremen, Germany

Tel.: +49 421 178 45-4021
Zentrale: +49 421 178 45-0
E-Mail: ***@dfki.de

Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.: DE 148646973
Steuernummer: 19/672/50006
-----------------------------------------------------------------------
bubnikv
2018-08-20 16:32:43 UTC
Permalink
Hello Christoph.

Thanks for your help.

Just for reference, I am using Visual Studio 2013 compiler, 64bit platform,
and Eigen 3.3.5.
You can simply copy in either direction.
Thanks, that certainly helped.
or you can mix aligned and non-aligned data inside expressions
I just tried some expressions and the test confirms your statement. I
suppose I must have mixed up some wrong dimensions errors with alignment
issues.
Rotation2D stores just a single Scalar (the angle), so there is no
need/possibility to align it.

The issue I have with Rotation2D is the following:

Eigen::Matrix<double, 2, 1, Eigen::DontAlign> v, w;
Eigen::Rotation2Dd rot(3.);
// Following fails to compile:
v = rot * w;
// Explicit temporary helps:
v = rot * Eigen::Matrix<double, 2, 1>(w);

So thanks for the hint about I understand that there is always a way to
rotate the vector. I am just pointing out, that as a user of a finely
polished library, I would expect the Rotation2D to just work with both
aligned and non-aligned types.

Gruesse nach Bremen,
Vojtech


On Mon, Aug 20, 2018 at 3:37 PM, Christoph Hertzberg <
Post by bubnikv
Hello.
We are developing a 3D printing software https://github.com/prusa3d/sli
c3r
(fork of http://slic3r.org/)
We are now trying to replace the homebrew point classes with the Eigen
fixed size types. As the code base is quite large, we want to avoid
alignment issues by declaring fixed vector types with the Eigen::DontAlign
attribute. So far so good, with the exception of Eigen::Rotation2D, which
is not templated with the alignment attribute, so it cannot be used against
the fixed size matrices with Eigen::DontAlign. Is there any reason for
that? Would you guys please extend the class with the alignment template
attribute?
Rotation2D stores just a single Scalar (the angle), so there is no
need/possibility to align it.
Alternatively, you could store a 2D rotation as a 2x2 matrix, or as a
complex number (neither of them inherits from RotationBase, though).
We are thinking of using https://github.com/libigl/libigl for some
Post by bubnikv
operations on triangle meshes, where the vectorized operations may or may
not be beneficial. We may just disable alignment / vectorization for the
whole application. We are not sure about the performance penalty, but
looking at the evaluation of Eigen 2 from 2008
http://eigen.tuxfamily.org/index.php?title=Benchmark-August2008
the loss may be significant.
On modern CPUs the difference between aligned and not-aligned is far less
or even non-existing (except for effects like crossing cache-lines). And
with Eigen 3.3 it is possible to use vectorization on unaligned data
http://eigen.tuxfamily.org/bz/show_bug.cgi?id=256#c10
So make meaningful benchmarks on the CPU you want to target to decide if
you need to invest time into that.
We may then think about converting between the aligned / non aligned
Post by bubnikv
values. Does Eigen support any conversion between aligned / unaligned
types? I know about the .cast<>() operator, but it does not allow me to
change the alignment attribute.
You can simply copy in either direction, or you can mix aligned and
non-aligned data inside expressions. No need to cast here.
Christoph
Post by bubnikv
Thanks for your time,
Vojtech
--
Dr.-Ing. Christoph Hertzberg
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 1
28359 Bremen, Germany
Tel.: +49 421 178 45-4021
Zentrale: +49 421 178 45-0
Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.: DE 148646973
Steuernummer: 19/672/50006
-----------------------------------------------------------------------
Christoph Hertzberg
2018-08-20 17:52:29 UTC
Permalink
Post by bubnikv
[...]
Just for reference, I am using Visual Studio 2013 compiler, 64bit platform,
and Eigen 3.3.5.
[...]
Eigen::Matrix<double, 2, 1, Eigen::DontAlign> v, w;
Eigen::Rotation2Dd rot(3.);
v = rot * w;
v = rot * Eigen::Matrix<double, 2, 1>(w);
This should work (testing with Eigen 3.3.4 and MSVC2015):
https://godbolt.org/z/EFv5ok

Maybe something else causes an error or it is a defect in MSVC2013.
Could you post the compile error you get (and a complete minimal source
you tried to compile + compilation flags)?
Maybe we find a workaround for that.


Christoph
Post by bubnikv
So thanks for the hint about I understand that there is always a way to
rotate the vector. I am just pointing out, that as a user of a finely
polished library, I would expect the Rotation2D to just work with both
aligned and non-aligned types.
Gruesse nach Bremen,
Vojtech
On Mon, Aug 20, 2018 at 3:37 PM, Christoph Hertzberg <
Post by Christoph Hertzberg
Post by bubnikv
Hello.
We are developing a 3D printing software https://github.com/prusa3d/sli
c3r
(fork of http://slic3r.org/)
We are now trying to replace the homebrew point classes with the Eigen
fixed size types. As the code base is quite large, we want to avoid
alignment issues by declaring fixed vector types with the Eigen::DontAlign
attribute. So far so good, with the exception of Eigen::Rotation2D, which
is not templated with the alignment attribute, so it cannot be used against
the fixed size matrices with Eigen::DontAlign. Is there any reason for
that? Would you guys please extend the class with the alignment template
attribute?
Rotation2D stores just a single Scalar (the angle), so there is no
need/possibility to align it.
Alternatively, you could store a 2D rotation as a 2x2 matrix, or as a
complex number (neither of them inherits from RotationBase, though).
We are thinking of using https://github.com/libigl/libigl for some
Post by bubnikv
operations on triangle meshes, where the vectorized operations may or may
not be beneficial. We may just disable alignment / vectorization for the
whole application. We are not sure about the performance penalty, but
looking at the evaluation of Eigen 2 from 2008
http://eigen.tuxfamily.org/index.php?title=Benchmark-August2008
the loss may be significant.
On modern CPUs the difference between aligned and not-aligned is far less
or even non-existing (except for effects like crossing cache-lines). And
with Eigen 3.3 it is possible to use vectorization on unaligned data
http://eigen.tuxfamily.org/bz/show_bug.cgi?id=256#c10
So make meaningful benchmarks on the CPU you want to target to decide if
you need to invest time into that.
We may then think about converting between the aligned / non aligned
Post by bubnikv
values. Does Eigen support any conversion between aligned / unaligned
types? I know about the .cast<>() operator, but it does not allow me to
change the alignment attribute.
You can simply copy in either direction, or you can mix aligned and
non-aligned data inside expressions. No need to cast here.
Christoph
Post by bubnikv
Thanks for your time,
Vojtech
--
Dr.-Ing. Christoph Hertzberg
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 1
28359 Bremen, Germany
Tel.: +49 421 178 45-4021
Zentrale: +49 421 178 45-0
Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.: DE 148646973
Steuernummer: 19/672/50006
-----------------------------------------------------------------------
--
Dr.-Ing. Christoph Hertzberg

Besuchsadresse der Nebengeschäftsstelle:
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany

Postadresse der Hauptgeschäftsstelle Standort Bremen:
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 1
28359 Bremen, Germany

Tel.: +49 421 178 45-4021
Zentrale: +49 421 178 45-0
E-Mail: ***@dfki.de

Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.: DE 148646973
Steuernummer: 19/672/50006
-----------------------------------------------------------------------
bubnikv
2018-08-21 07:46:35 UTC
Permalink
This is the minimal example, compiler output follows. Removing the
DontAlign flag solves the compilation issue. Thanks for looking into this.



#include <Eigen/Geometry>

void main()
{
typedef Eigen::Matrix<double, 2, 1, Eigen::DontAlign> Vec2d;
Vec2d v, w;
v = Eigen::Rotation2Dd(3.) * w;
}
cl Rotation2D_fail.cpp -I xs\src\eigen
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

Rotation2D_fail.cpp
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xlocale(337)
: warning C4530: C++ exception handler used, but unwind semantics are not
enabled. Specify /EHsc
Rotation2D_fail.cpp(7) : error C2666: 'Eigen::Rotation2D<double>::operator
*' : 2 overloads have similar conversions

d:\src-perl\slic3r-eigenize\xs\src\eigen\eigen\src/Geometry/Rotation2D.h(109):
could be 'Eigen::Matrix<double,2,1,0,2,1>
Eigen::Rotation2D<double>::operator *(const Eigen::Matrix<double,2,1,0,2,1>
&) const'

d:\src-perl\slic3r-eigenize\xs\src\eigen\eigen\src/Geometry/Rotation2D.h(101):
or 'Eigen::Rotation2D<double> Eigen::Rotation2D<double>::operator
*(const Eigen::Rotation2D<double> &) const'

d:\src-perl\slic3r-eigenize\xs\src\eigen\eigen\src/Geometry/RotationBase.h(56):
or 'Eigen::Transform<double,2,1,0>
Eigen::RotationBase<Eigen::Rotation2D<double>,2>::operator *(const
Eigen::Translation<double,2> &) const'

d:\src-perl\slic3r-eigenize\xs\src\eigen\eigen\src/Geometry/RotationBase.h(60):
or 'Eigen::Matrix<double,2,2,0,2,2>
Eigen::RotationBase<Eigen::Rotation2D<double>,2>::operator *(const
Eigen::UniformScaling<double> &) const'

d:\src-perl\slic3r-eigenize\xs\src\eigen\eigen\src/Geometry/RotationBase.h(80):
or 'Eigen::Transform<float,3,2,0>
Eigen::RotationBase<Derived,3>::operator *(const
Eigen::DiagonalMatrix<float,3,3> &,const Derived &)' [found using
argument-dependent lookup]
with
[
Derived=Eigen::Quaternion<float,0>
]

d:\src-perl\slic3r-eigenize\xs\src\eigen\eigen\src/Geometry/RotationBase.h(80):
or 'Eigen::Transform<double,3,2,0>
Eigen::RotationBase<Derived,3>::operator *(const
Eigen::DiagonalMatrix<double,3,3> &,const Derived &)' [found using
argument-dependent lookup]
with
[
Derived=Eigen::Quaternion<double,0>
]

d:\src-perl\slic3r-eigenize\xs\src\eigen\eigen\src/Geometry/RotationBase.h(80):
or 'Eigen::Transform<double,2,2,0>
Eigen::RotationBase<Eigen::Rotation2D<double>,2>::operator *(const
Eigen::DiagonalMatrix<double,2,2> &,const Derived &)' [found using
argument-dependent lookup]
with
[
Derived=Eigen::Rotation2D<double>
]

d:\src-perl\slic3r-eigenize\xs\src\eigen\eigen\src/Geometry/RotationBase.h(71):
or 'Eigen::Matrix<double,2,1,0,2,1>
Eigen::RotationBase<Eigen::Rotation2D<double>,2>::operator *<Derived>(const
Eigen::EigenBase<Derived> &) const'
with
[
Derived=Eigen::Matrix<double,2,1,2,2,1>
]
while trying to match the argument list
'(Eigen::Rotation2D<double>, Vec2d)'




On Mon, Aug 20, 2018 at 7:52 PM, Christoph Hertzberg <
Post by bubnikv
[...]
Just for reference, I am using Visual Studio 2013 compiler, 64bit platform,
and Eigen 3.3.5.
[...]
Eigen::Matrix<double, 2, 1, Eigen::DontAlign> v, w;
Eigen::Rotation2Dd rot(3.);
v = rot * w;
v = rot * Eigen::Matrix<double, 2, 1>(w);
https://godbolt.org/z/EFv5ok
Maybe something else causes an error or it is a defect in MSVC2013. Could
you post the compile error you get (and a complete minimal source you tried
to compile + compilation flags)?
Maybe we find a workaround for that.
Christoph
Post by bubnikv
So thanks for the hint about I understand that there is always a way to
rotate the vector. I am just pointing out, that as a user of a finely
polished library, I would expect the Rotation2D to just work with both
aligned and non-aligned types.
Gruesse nach Bremen,
Vojtech
On Mon, Aug 20, 2018 at 3:37 PM, Christoph Hertzberg <
Post by bubnikv
Hello.
Post by bubnikv
We are developing a 3D printing software https://github.com/prusa3d/sli
c3r
(fork of http://slic3r.org/)
We are now trying to replace the homebrew point classes with the Eigen
fixed size types. As the code base is quite large, we want to avoid
alignment issues by declaring fixed vector types with the
Eigen::DontAlign
attribute. So far so good, with the exception of Eigen::Rotation2D, which
is not templated with the alignment attribute, so it cannot be used against
the fixed size matrices with Eigen::DontAlign. Is there any reason for
that? Would you guys please extend the class with the alignment template
attribute?
Rotation2D stores just a single Scalar (the angle), so there is no
need/possibility to align it.
Alternatively, you could store a 2D rotation as a 2x2 matrix, or as a
complex number (neither of them inherits from RotationBase, though).
We are thinking of using https://github.com/libigl/libigl for some
Post by bubnikv
operations on triangle meshes, where the vectorized operations may or may
not be beneficial. We may just disable alignment / vectorization for the
whole application. We are not sure about the performance penalty, but
looking at the evaluation of Eigen 2 from 2008
http://eigen.tuxfamily.org/index.php?title=Benchmark-August2008
the loss may be significant.
On modern CPUs the difference between aligned and not-aligned is far less
or even non-existing (except for effects like crossing cache-lines). And
with Eigen 3.3 it is possible to use vectorization on unaligned data
http://eigen.tuxfamily.org/bz/show_bug.cgi?id=256#c10
So make meaningful benchmarks on the CPU you want to target to decide if
you need to invest time into that.
We may then think about converting between the aligned / non aligned
Post by bubnikv
values. Does Eigen support any conversion between aligned / unaligned
types? I know about the .cast<>() operator, but it does not allow me to
change the alignment attribute.
You can simply copy in either direction, or you can mix aligned and
non-aligned data inside expressions. No need to cast here.
Christoph
Thanks for your time,
Post by bubnikv
Vojtech
--
Dr.-Ing. Christoph Hertzberg
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 1
28359 Bremen, Germany
Tel.: +49 421 178 45-4021
Zentrale: +49 421 178 45-0
Weitere Informationen: http://www.dfki.de/robotik
------------------------------------------------------------
-----------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.: DE 148646973
Steuernummer: 19/672/50006
------------------------------------------------------------
-----------
--
Dr.-Ing. Christoph Hertzberg
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 1
28359 Bremen, Germany
Tel.: +49 421 178 45-4021
Zentrale: +49 421 178 45-0
Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.: DE 148646973
Steuernummer: 19/672/50006
-----------------------------------------------------------------------
Christoph Hertzberg
2018-08-21 08:51:44 UTC
Permalink
I can't reproduce with gcc or clang on either 3.3.4, 3.3.5, or 3.3 (tip).
Godbolt-link (last mail) showed that MSVC2015+Eigen3.3.4 works fine as
well.
To rule out an Eigen regression, could you try Eigen versions 3.3.4, as
well as 3.3.5 (and others, if you like)?

I guess upgrading MSVC is not an (easy) option for you?
But we should find a workaround nevertheless, since we claim to support
MSVC2012 and newer ...


Christoph
Post by bubnikv
This is the minimal example, compiler output follows. Removing the
DontAlign flag solves the compilation issue. Thanks for looking into this.
#include <Eigen/Geometry>
void main()
{
typedef Eigen::Matrix<double, 2, 1, Eigen::DontAlign> Vec2d;
Vec2d v, w;
v = Eigen::Rotation2Dd(3.) * w;
}
cl Rotation2D_fail.cpp -I xs\src\eigen
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
Rotation2D_fail.cpp
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xlocale(337)
: warning C4530: C++ exception handler used, but unwind semantics are not
enabled. Specify /EHsc
Rotation2D_fail.cpp(7) : error C2666: 'Eigen::Rotation2D<double>::operator
*' : 2 overloads have similar conversions
could be 'Eigen::Matrix<double,2,1,0,2,1>
Eigen::Rotation2D<double>::operator *(const Eigen::Matrix<double,2,1,0,2,1>
&) const'
or 'Eigen::Rotation2D<double> Eigen::Rotation2D<double>::operator
*(const Eigen::Rotation2D<double> &) const'
or 'Eigen::Transform<double,2,1,0>
Eigen::RotationBase<Eigen::Rotation2D<double>,2>::operator *(const
Eigen::Translation<double,2> &) const'
or 'Eigen::Matrix<double,2,2,0,2,2>
Eigen::RotationBase<Eigen::Rotation2D<double>,2>::operator *(const
Eigen::UniformScaling<double> &) const'
or 'Eigen::Transform<float,3,2,0>
Eigen::RotationBase<Derived,3>::operator *(const
Eigen::DiagonalMatrix<float,3,3> &,const Derived &)' [found using
argument-dependent lookup]
with
[
Derived=Eigen::Quaternion<float,0>
]
or 'Eigen::Transform<double,3,2,0>
Eigen::RotationBase<Derived,3>::operator *(const
Eigen::DiagonalMatrix<double,3,3> &,const Derived &)' [found using
argument-dependent lookup]
with
[
Derived=Eigen::Quaternion<double,0>
]
or 'Eigen::Transform<double,2,2,0>
Eigen::RotationBase<Eigen::Rotation2D<double>,2>::operator *(const
Eigen::DiagonalMatrix<double,2,2> &,const Derived &)' [found using
argument-dependent lookup]
with
[
Derived=Eigen::Rotation2D<double>
]
or 'Eigen::Matrix<double,2,1,0,2,1>
Eigen::RotationBase<Eigen::Rotation2D<double>,2>::operator *<Derived>(const
Eigen::EigenBase<Derived> &) const'
with
[
Derived=Eigen::Matrix<double,2,1,2,2,1>
]
while trying to match the argument list
'(Eigen::Rotation2D<double>, Vec2d)'
On Mon, Aug 20, 2018 at 7:52 PM, Christoph Hertzberg <
Post by bubnikv
[...]
Just for reference, I am using Visual Studio 2013 compiler, 64bit platform,
and Eigen 3.3.5.
[...]
Eigen::Matrix<double, 2, 1, Eigen::DontAlign> v, w;
Eigen::Rotation2Dd rot(3.);
v = rot * w;
v = rot * Eigen::Matrix<double, 2, 1>(w);
https://godbolt.org/z/EFv5ok
Maybe something else causes an error or it is a defect in MSVC2013. Could
you post the compile error you get (and a complete minimal source you tried
to compile + compilation flags)?
Maybe we find a workaround for that.
Christoph
Post by bubnikv
So thanks for the hint about I understand that there is always a way to
rotate the vector. I am just pointing out, that as a user of a finely
polished library, I would expect the Rotation2D to just work with both
aligned and non-aligned types.
Gruesse nach Bremen,
Vojtech
On Mon, Aug 20, 2018 at 3:37 PM, Christoph Hertzberg <
Post by bubnikv
Hello.
Post by bubnikv
We are developing a 3D printing software https://github.com/prusa3d/sli
c3r
(fork of http://slic3r.org/)
We are now trying to replace the homebrew point classes with the Eigen
fixed size types. As the code base is quite large, we want to avoid
alignment issues by declaring fixed vector types with the
Eigen::DontAlign
attribute. So far so good, with the exception of Eigen::Rotation2D, which
is not templated with the alignment attribute, so it cannot be used against
the fixed size matrices with Eigen::DontAlign. Is there any reason for
that? Would you guys please extend the class with the alignment template
attribute?
Rotation2D stores just a single Scalar (the angle), so there is no
need/possibility to align it.
Alternatively, you could store a 2D rotation as a 2x2 matrix, or as a
complex number (neither of them inherits from RotationBase, though).
We are thinking of using https://github.com/libigl/libigl for some
Post by bubnikv
operations on triangle meshes, where the vectorized operations may or may
not be beneficial. We may just disable alignment / vectorization for the
whole application. We are not sure about the performance penalty, but
looking at the evaluation of Eigen 2 from 2008
http://eigen.tuxfamily.org/index.php?title=Benchmark-August2008
the loss may be significant.
On modern CPUs the difference between aligned and not-aligned is far less
or even non-existing (except for effects like crossing cache-lines). And
with Eigen 3.3 it is possible to use vectorization on unaligned data
http://eigen.tuxfamily.org/bz/show_bug.cgi?id=256#c10
So make meaningful benchmarks on the CPU you want to target to decide if
you need to invest time into that.
We may then think about converting between the aligned / non aligned
Post by bubnikv
values. Does Eigen support any conversion between aligned / unaligned
types? I know about the .cast<>() operator, but it does not allow me to
change the alignment attribute.
You can simply copy in either direction, or you can mix aligned and
non-aligned data inside expressions. No need to cast here.
Christoph
Thanks for your time,
Post by bubnikv
Vojtech
--
Dr.-Ing. Christoph Hertzberg
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 1
28359 Bremen, Germany
Tel.: +49 421 178 45-4021
Zentrale: +49 421 178 45-0
Weitere Informationen: http://www.dfki.de/robotik
------------------------------------------------------------
-----------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.: DE 148646973
Steuernummer: 19/672/50006
------------------------------------------------------------
-----------
--
Dr.-Ing. Christoph Hertzberg
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 1
28359 Bremen, Germany
Tel.: +49 421 178 45-4021
Zentrale: +49 421 178 45-0
Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.: DE 148646973
Steuernummer: 19/672/50006
-----------------------------------------------------------------------
--
Dr.-Ing. Christoph Hertzberg

Besuchsadresse der Nebengeschäftsstelle:
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany

Postadresse der Hauptgeschäftsstelle Standort Bremen:
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 1
28359 Bremen, Germany

Tel.: +49 421 178 45-4021
Zentrale: +49 421 178 45-0
E-Mail: ***@dfki.de

Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.: DE 148646973
Steuernummer: 19/672/50006
-----------------------------------------------------------------------
Loading...