doc + quick bug fix in Matrix ctor

This commit is contained in:
Gael Guennebaud 2008-08-28 00:33:58 +00:00
parent f7de12de69
commit 70266b4d05
7 changed files with 30 additions and 15 deletions

View File

@ -25,6 +25,7 @@ namespace Eigen {
*/ */
#include "src/Core/util/Memory.h" #include "src/Core/util/Memory.h"
#include "src/Core/NumTraits.h" #include "src/Core/NumTraits.h"
#include "src/Core/MathFunctions.h" #include "src/Core/MathFunctions.h"
#include "src/Core/GenericPacketMath.h" #include "src/Core/GenericPacketMath.h"

View File

@ -335,7 +335,8 @@ class Matrix
inline Matrix(const MatrixBase<OtherDerived>& other) inline Matrix(const MatrixBase<OtherDerived>& other)
: m_storage(other.rows() * other.cols(), other.rows(), other.cols()) : m_storage(other.rows() * other.cols(), other.rows(), other.cols())
{ {
Base::lazyAssign(other.derived()); ei_assign_selector<Matrix,OtherDerived,false>::run(*this, other.derived());
//Base::operator=(other.derived());
} }
/** Copy constructor */ /** Copy constructor */
inline Matrix(const Matrix& other) inline Matrix(const Matrix& other)

View File

@ -81,6 +81,8 @@ template<typename Scalar> struct ei_scalar_min_op;
template<typename Scalar> struct ei_scalar_max_op; template<typename Scalar> struct ei_scalar_max_op;
template<typename Scalar> struct ei_scalar_random_op; template<typename Scalar> struct ei_scalar_random_op;
template<typename Scalar> struct ei_scalar_add_op; template<typename Scalar> struct ei_scalar_add_op;
template<typename Scalar> struct ei_scalar_constant_op;
template<typename Scalar> struct ei_scalar_identity_op;
struct IOFormat; struct IOFormat;

View File

@ -121,5 +121,4 @@
|| int(TYPE0::ColsAtCompileTime)==int(TYPE1::ColsAtCompileTime))),\ || int(TYPE0::ColsAtCompileTime)==int(TYPE1::ColsAtCompileTime))),\
you_mixed_matrices_of_different_sizes) you_mixed_matrices_of_different_sizes)
#endif // EIGEN_STATIC_ASSERT_H #endif // EIGEN_STATIC_ASSERT_H

View File

@ -161,8 +161,7 @@ public:
{ return m_angle += other.m_angle; } { return m_angle += other.m_angle; }
/** Applies the rotation to a 2D vector */ /** Applies the rotation to a 2D vector */
template<typename Derived> Vector2 operator* (const Vector2& vec) const
Vector2 operator* (const MatrixBase<Derived>& vec) const
{ return toRotationMatrix() * vec; } { return toRotationMatrix() * vec; }
template<typename Derived> template<typename Derived>

View File

@ -187,8 +187,8 @@ MatrixXi mat2x2 = Map<MatrixXi>(data,2,2);
\subsection TutorialCommaInit CommaInitializer \subsection TutorialCommaInit Comma initializer
Eigen also offer a comma initializer syntax which allows you to set all the coefficients of a matrix to specific values: Eigen also offer a \link MatrixBase::operator<<(const Scalar &) comma initializer syntax \endlink which allows you to set all the coefficients of a matrix to specific values:
<table class="tutorial_code"><tr><td> <table class="tutorial_code"><tr><td>
\include Tutorial_commainit_01.cpp \include Tutorial_commainit_01.cpp
</td> </td>
@ -206,7 +206,8 @@ output:
\verbinclude Tutorial_commainit_02.out \verbinclude Tutorial_commainit_02.out
</td></tr></table> </td></tr></table>
<span class="note">\b Side \b note: here .finished() is used to get the actual matrix object once the comma initialization <span class="note">\b Side \b note: here \link CommaInitializer::finished() .finished() \endlink
is used to get the actual matrix object once the comma initialization
of our temporary submatrix is done. Note that despite the appearant complexity of such an expression of our temporary submatrix is done. Note that despite the appearant complexity of such an expression
Eigen's comma initializer usually yields to very optimized code without any overhead.</span> Eigen's comma initializer usually yields to very optimized code without any overhead.</span>
@ -263,7 +264,7 @@ most common coefficient wise operators:
<table class="noborder"> <table class="noborder">
<tr><td> <tr><td>
<table class="tutorial_code" style="margin-right:10pt"> <table class="tutorial_code" style="margin-right:10pt">
<tr><td>Coefficient wise product</td> <tr><td>Coefficient wise \link Cwise::operator*() product \endlink</td>
<td>\code mat3 = mat1.cwise() * mat2; \endcode <td>\code mat3 = mat1.cwise() * mat2; \endcode
</td></tr> </td></tr>
<tr><td> <tr><td>
@ -274,11 +275,11 @@ mat3.cwise() -= scalar;
\endcode \endcode
</td></tr> </td></tr>
<tr><td> <tr><td>
Coefficient wise division</td><td>\code Coefficient wise \link Cwise::operator/() division \endlink</td><td>\code
mat3 = mat1.cwise() / mat2; \endcode mat3 = mat1.cwise() / mat2; \endcode
</td></tr> </td></tr>
<tr><td> <tr><td>
Coefficient wise reciprocal</td><td>\code Coefficient wise \link Cwise::inverse() reciprocal \endlink</td><td>\code
mat3 = mat1.cwise().inverse(); \endcode mat3 = mat1.cwise().inverse(); \endcode
</td></tr> </td></tr>
<tr><td> <tr><td>
@ -293,13 +294,17 @@ etc.
</td> </td>
<td><table class="tutorial_code"> <td><table class="tutorial_code">
<tr><td> <tr><td>
Trigo:\n sin, cos, tan</td><td>\code \b Trigo: \n
\link Cwise::sin sin \endlink, \link Cwise::cos cos \endlink,
\link Cwise::tan tan \endlink</td><td>\code
mat3 = mat1.cwise().sin(); mat3 = mat1.cwise().sin();
etc. etc.
\endcode \endcode
</td></tr> </td></tr>
<tr><td> <tr><td>
Power:\n pow, square, cube,\n sqrt, exp, log</td><td>\code \b Power: \n \link Cwise::pow() pow \endlink, \link Cwise::square square \endlink,
\link Cwise::cube cube \endlink, \n \link Cwise::sqrt sqrt \endlink,
\link Cwise::exp exp \endlink, \link Cwise::log log \endlink </td><td>\code
mat3 = mat1.cwise().square(); mat3 = mat1.cwise().square();
mat3 = mat1.cwise().pow(5); mat3 = mat1.cwise().pow(5);
mat3 = mat1.cwise().log(); mat3 = mat1.cwise().log();
@ -307,7 +312,9 @@ etc.
\endcode \endcode
</td></tr> </td></tr>
<tr><td> <tr><td>
min, max, absolute value</td><td>\code \link Cwise::min min \endlink, \link Cwise::max max \endlink, \n
absolute value (\link Cwise::abs() abs \endlink, \link Cwise::abs2() abs2 \endlink
</td><td>\code
mat3 = mat1.cwise().min(mat2); mat3 = mat1.cwise().min(mat2);
mat3 = mat1.cwise().max(mat2); mat3 = mat1.cwise().max(mat2);
mat3 = mat1.cwise().abs(mat2); mat3 = mat1.cwise().abs(mat2);
@ -428,6 +435,13 @@ mat3 = mat1.conjugate().transpose() * mat2;
\endcode \endcode
</td></tr> </td></tr>
<tr><td> <tr><td>
returns a \link MatrixBase::normalized() normalized \endlink vector \n
\link MatrixBase::normalize() normalize \endlink a vector
</td><td>\code
vec3 = vec1.normalized();
vec1.normalize();\endcode
</td></tr>
<tr><td>
\link MatrixBase::asDiagonal() make a diagonal matrix \endlink from a vector \n \link MatrixBase::asDiagonal() make a diagonal matrix \endlink from a vector \n
\b Note: this product is automatically optimized !</td><td>\code \b Note: this product is automatically optimized !</td><td>\code
mat3 = mat1 * vec2.asDiagonal();\endcode mat3 = mat1 * vec2.asDiagonal();\endcode

View File

@ -452,12 +452,11 @@ A.top:hover, A.logo:hover {
background-color: transparent;font-weight : bolder; background-color: transparent;font-weight : bolder;
} }
SPAN.note { SPAN.note {
font-size: 7pt; font-size: 8.5pt;
} }
DIV.navigation { DIV.navigation {
min-height : 64px; min-height : 64px;
/* background : url("Eigen_Silly_Professor_64x64.png") no-repeat left; */
padding-left : 80px; padding-left : 80px;
padding-top : 5px; padding-top : 5px;
} }