diff options
author | Gael Guennebaud <g.gael@free.fr> | 2014-07-02 09:35:37 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2014-07-02 09:35:37 +0200 |
commit | 61b88d2feb8f23d1ba122f2c9a73abb183ebb25d (patch) | |
tree | da8fbb7e88c6668bbf4b63e2c988697d95f9f2de /Eigen/src/Core/Matrix.h | |
parent | 8f4cdbbc8f9b2214b906412701722a150cba3460 (diff) | |
parent | bf334b8ae51725754f525c2ffcfbd83ffc55ff2e (diff) |
merge with default branch
Diffstat (limited to 'Eigen/src/Core/Matrix.h')
-rw-r--r-- | Eigen/src/Core/Matrix.h | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index cd4913525..eb70c1129 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -237,24 +237,17 @@ class Matrix } #endif - /** \brief Constructs a vector or row-vector with given dimension. \only_for_vectors - * - * Note that this is only useful for dynamic-size vectors. For fixed-size vectors, - * it is redundant to pass the dimension here, so it makes more sense to use the default - * constructor Matrix() instead. - */ + #ifndef EIGEN_PARSED_BY_DOXYGEN + + // This constructor is for both 1x1 matrices and dynamic vectors + template<typename T> EIGEN_DEVICE_FUNC - EIGEN_STRONG_INLINE explicit Matrix(Index dim) - : Base(dim, RowsAtCompileTime == 1 ? 1 : dim, ColsAtCompileTime == 1 ? 1 : dim) + EIGEN_STRONG_INLINE explicit Matrix(const T& x) { Base::_check_template_params(); - EIGEN_STATIC_ASSERT_VECTOR_ONLY(Matrix) - eigen_assert(dim >= 0); - eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim); - EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + Base::template _init1<T>(x); } - #ifndef EIGEN_PARSED_BY_DOXYGEN template<typename T0, typename T1> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(const T0& x, const T1& y) @@ -263,6 +256,19 @@ class Matrix Base::template _init2<T0,T1>(x, y); } #else + /** \brief Constructs a fixed-sized matrix initialized with coefficients starting at \a data */ + EIGEN_DEVICE_FUNC + explicit Matrix(const Scalar *data); + + /** \brief Constructs a vector or row-vector with given dimension. \only_for_vectors + * + * Note that this is only useful for dynamic-size vectors. For fixed-size vectors, + * it is redundant to pass the dimension here, so it makes more sense to use the default + * constructor Matrix() instead. + */ + EIGEN_STRONG_INLINE explicit Matrix(Index dim); + /** \brief Constructs an initialized 1x1 matrix with the given coefficient */ + Matrix(const Scalar& x); /** \brief Constructs an uninitialized matrix with \a rows rows and \a cols columns. * * This is useful for dynamic-size matrices. For fixed-size matrices, @@ -296,8 +302,6 @@ class Matrix m_storage.data()[3] = w; } - EIGEN_DEVICE_FUNC - explicit Matrix(const Scalar *data); /** \brief Constructor copying the value of the expression \a other */ template<typename OtherDerived> @@ -367,13 +371,6 @@ class Matrix EIGEN_DEVICE_FUNC Matrix& operator=(const RotationBase<OtherDerived,ColsAtCompileTime>& r); - #ifdef EIGEN2_SUPPORT - template<typename OtherDerived> - explicit Matrix(const eigen2_RotationBase<OtherDerived,ColsAtCompileTime>& r); - template<typename OtherDerived> - Matrix& operator=(const eigen2_RotationBase<OtherDerived,ColsAtCompileTime>& r); - #endif - // allow to extend Matrix outside Eigen #ifdef EIGEN_MATRIX_PLUGIN #include EIGEN_MATRIX_PLUGIN |