diff options
Diffstat (limited to 'Eigen/src')
-rw-r--r-- | Eigen/src/Core/Eval.h | 1 | ||||
-rw-r--r-- | Eigen/src/Core/Matrix.h | 21 | ||||
-rw-r--r-- | Eigen/src/Core/MatrixStorage.h | 16 |
3 files changed, 14 insertions, 24 deletions
diff --git a/Eigen/src/Core/Eval.h b/Eigen/src/Core/Eval.h index 7fa661c48..efa68a7cb 100644 --- a/Eigen/src/Core/Eval.h +++ b/Eigen/src/Core/Eval.h @@ -56,6 +56,7 @@ template<typename Expression> class Eval : NoOperatorEquals, typedef Expression Base; friend class MatrixBase<Scalar, Expression>; + Eval() : MatrixType() {} Eval(const Expression& expression) : MatrixType(expression) {} }; diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index 25ef36182..a829a2f8f 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -42,9 +42,9 @@ * All matrix and vector types are just typedefs to specializations of this class template. * * These typedefs are as follows: - * \li \c %Matrix##Size##Type for square matrices - * \li \c Vector##Size##Type for vectors (matrices with one column) - * \li \c RowVector##Size##Type for row-vectors (matrices with one row) + * \li \c %Matrix\#\#Size\#\#Type for square matrices + * \li \c Vector\#\#Size\#\#Type for vectors (matrices with one column) + * \li \c RowVector\#\#Size\#\#Type for row-vectors (matrices with one row) * * where \c Size can be * \li \c 2 for fixed size 2 @@ -57,7 +57,7 @@ * \li \c f for type \c float * \li \c d for type \c double * \li \c cf for type \c std::complex<float> - * \li \c cd for type \c std::complex<float> + * \li \c cd for type \c std::complex<double> * * Examples: * \li \c Matrix2d is a typedef for \c Matrix<double,2,2> @@ -163,14 +163,13 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, _Storage static Map<Matrix> map(Scalar* array, int size); static Map<Matrix> map(Scalar* array); - /** Default constructor, does nothing. Only for fixed-size matrices. - * For dynamic-size matrices and vectors, this constructor is forbidden (guarded by - * an assertion) because it would leave the matrix without an allocated data buffer. + /** Default constructor. + * + * For fixed-size matrices, does nothing. + * + * For dynamic-size matrices, dynamic dimensions are set to 1. */ - explicit Matrix() : Storage() - { - assert(RowsAtCompileTime > 0 && ColsAtCompileTime > 0); - } + explicit Matrix() : Storage() {} /** Constructs a vector or row-vector with given dimension. \only_for_vectors * diff --git a/Eigen/src/Core/MatrixStorage.h b/Eigen/src/Core/MatrixStorage.h index ebeaf4922..db4feb195 100644 --- a/Eigen/src/Core/MatrixStorage.h +++ b/Eigen/src/Core/MatrixStorage.h @@ -80,7 +80,7 @@ class MatrixStorage<Scalar, Dynamic, ColsAtCompileTime> { return ColsAtCompileTime; } public: - MatrixStorage(int dim) : m_rows(dim) + MatrixStorage(int dim = 1) : m_rows(dim) { m_data = new Scalar[m_rows * ColsAtCompileTime]; } @@ -92,9 +92,6 @@ class MatrixStorage<Scalar, Dynamic, ColsAtCompileTime> ~MatrixStorage() { delete[] m_data; } - - private: - MatrixStorage(); }; template<typename Scalar, int RowsAtCompileTime> @@ -123,7 +120,7 @@ class MatrixStorage<Scalar, RowsAtCompileTime, Dynamic> { return m_cols; } public: - MatrixStorage(int dim) : m_cols(dim) + MatrixStorage(int dim = 1) : m_cols(dim) { m_data = new Scalar[m_cols * RowsAtCompileTime]; } @@ -135,9 +132,6 @@ class MatrixStorage<Scalar, RowsAtCompileTime, Dynamic> ~MatrixStorage() { delete[] m_data; } - - private: - MatrixStorage(); }; template<typename Scalar> @@ -167,17 +161,13 @@ class MatrixStorage<Scalar, Dynamic, Dynamic> public: - MatrixStorage(int rows, int cols) : m_rows(rows), m_cols(cols) + MatrixStorage(int rows = 1, int cols = 1) : m_rows(rows), m_cols(cols) { m_data = new Scalar[m_rows * m_cols]; } ~MatrixStorage() { delete[] m_data; } - - private: - MatrixStorage(); - MatrixStorage(int dim); }; #endif // EIGEN_MATRIXSTORAGE_H |