aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2007-12-31 13:29:51 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2007-12-31 13:29:51 +0000
commit42f6590bb26d77bfa67f57c64ff9cc6d38e23f58 (patch)
tree9bbda84078dc76c5b978a91a5a6295b3e883b849 /Eigen/src
parent86220784b6df06c13292c308a2254381d7b7630b (diff)
cleanup: remove copy contructors when the compiler is able to generate a satisfactory
default copy constructor; remove useless static_cast's; some misc cleanup.
Diffstat (limited to 'Eigen/src')
-rw-r--r--Eigen/src/Core/Block.h4
-rw-r--r--Eigen/src/Core/Cast.h7
-rw-r--r--Eigen/src/Core/Column.h7
-rw-r--r--Eigen/src/Core/Conjugate.h5
-rw-r--r--Eigen/src/Core/DiagonalCoeffs.h2
-rw-r--r--Eigen/src/Core/Difference.h3
-rw-r--r--Eigen/src/Core/DynBlock.h5
-rw-r--r--Eigen/src/Core/Map.h20
-rw-r--r--Eigen/src/Core/MatrixRef.h1
-rw-r--r--Eigen/src/Core/Minor.h3
-rw-r--r--Eigen/src/Core/Ones.h16
-rw-r--r--Eigen/src/Core/Opposite.h5
-rw-r--r--Eigen/src/Core/Product.h3
-rw-r--r--Eigen/src/Core/Random.h16
-rw-r--r--Eigen/src/Core/Row.h3
-rw-r--r--Eigen/src/Core/ScalarMultiple.h3
-rw-r--r--Eigen/src/Core/Sum.h2
-rw-r--r--Eigen/src/Core/Transpose.h3
-rw-r--r--Eigen/src/Core/Zero.h16
19 files changed, 48 insertions, 76 deletions
diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h
index eb80fc790..8456b2b78 100644
--- a/Eigen/src/Core/Block.h
+++ b/Eigen/src/Core/Block.h
@@ -64,10 +64,6 @@ template<typename MatrixType, int BlockRows, int BlockCols> class Block
&& startCol >= 0 && BlockCols >= 1 && startCol + BlockCols <= matrix.cols());
}
- Block(const Block& other)
- : m_matrix(other.m_matrix),
- m_startRow(other.m_startRow), m_startCol(other.m_startCol) {}
-
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block)
private:
diff --git a/Eigen/src/Core/Cast.h b/Eigen/src/Core/Cast.h
index 36886200b..513a070a9 100644
--- a/Eigen/src/Core/Cast.h
+++ b/Eigen/src/Core/Cast.h
@@ -56,9 +56,6 @@ template<typename NewScalar, typename MatrixType> class Cast : NoOperatorEquals,
Cast(const MatRef& matrix) : m_matrix(matrix) {}
- Cast(const Cast& other)
- : m_matrix(other.m_matrix) {}
-
private:
static const int _RowsAtCompileTime = MatrixType::RowsAtCompileTime,
_ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@@ -78,7 +75,7 @@ template<typename NewScalar, typename MatrixType> class Cast : NoOperatorEquals,
/** \returns an expression of *this with the \a Scalar type casted to
* \a NewScalar.
*
- * \param NewScalar the type we are casting the scalars to
+ * The template parameter \a NewScalar is the type we are casting the scalars to.
*
* Example: \include MatrixBase_cast.cpp
* Output: \verbinclude MatrixBase_cast.out
@@ -90,7 +87,7 @@ template<typename NewScalar>
const Cast<NewScalar, Derived>
MatrixBase<Scalar, Derived>::cast() const
{
- return Cast<NewScalar, Derived>(static_cast<const Derived*>(this)->ref());
+ return Cast<NewScalar, Derived>(ref());
}
#endif // EIGEN_CAST_H
diff --git a/Eigen/src/Core/Column.h b/Eigen/src/Core/Column.h
index e0da29638..30d8ae684 100644
--- a/Eigen/src/Core/Column.h
+++ b/Eigen/src/Core/Column.h
@@ -60,9 +60,6 @@ template<typename MatrixType> class Column
assert(col >= 0 && col < matrix.cols());
}
- Column(const Column& other)
- : m_matrix(other.m_matrix), m_col(other.m_col) {}
-
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Column)
private:
@@ -89,8 +86,8 @@ template<typename MatrixType> class Column
/** \returns an expression of the \a i-th column of *this. Note that the numbering starts at 0.
*
- * Example: \include MatrixBase_column.cpp
- * Output: \verbinclude MatrixBase_column.out
+ * Example: \include MatrixBase_col.cpp
+ * Output: \verbinclude MatrixBase_col.out
*
* \sa row(), class Column */
template<typename Scalar, typename Derived>
diff --git a/Eigen/src/Core/Conjugate.h b/Eigen/src/Core/Conjugate.h
index 3fbe29402..00797c2ff 100644
--- a/Eigen/src/Core/Conjugate.h
+++ b/Eigen/src/Core/Conjugate.h
@@ -48,9 +48,6 @@ template<typename MatrixType> class Conjugate : NoOperatorEquals,
Conjugate(const MatRef& matrix) : m_matrix(matrix) {}
- Conjugate(const Conjugate& other)
- : m_matrix(other.m_matrix) {}
-
private:
static const int _RowsAtCompileTime = MatrixType::RowsAtCompileTime,
_ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@@ -75,7 +72,7 @@ template<typename Scalar, typename Derived>
const Conjugate<Derived>
MatrixBase<Scalar, Derived>::conjugate() const
{
- return Conjugate<Derived>(static_cast<const Derived*>(this)->ref());
+ return Conjugate<Derived>(ref());
}
/** \returns an expression of the adjoint (i.e. conjugate transpose) of *this.
diff --git a/Eigen/src/Core/DiagonalCoeffs.h b/Eigen/src/Core/DiagonalCoeffs.h
index 1c5353df0..1b9920cdd 100644
--- a/Eigen/src/Core/DiagonalCoeffs.h
+++ b/Eigen/src/Core/DiagonalCoeffs.h
@@ -48,8 +48,6 @@ template<typename MatrixType> class DiagonalCoeffs
DiagonalCoeffs(const MatRef& matrix) : m_matrix(matrix) {}
- DiagonalCoeffs(const DiagonalCoeffs& other) : m_matrix(other.m_matrix) {}
-
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(DiagonalCoeffs)
private:
diff --git a/Eigen/src/Core/Difference.h b/Eigen/src/Core/Difference.h
index 815f5b2fb..7ed3bae4d 100644
--- a/Eigen/src/Core/Difference.h
+++ b/Eigen/src/Core/Difference.h
@@ -41,9 +41,6 @@ template<typename Lhs, typename Rhs> class Difference : NoOperatorEquals,
assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
}
- Difference(const Difference& other)
- : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {}
-
private:
static const int _RowsAtCompileTime = Lhs::RowsAtCompileTime,
_ColsAtCompileTime = Rhs::ColsAtCompileTime;
diff --git a/Eigen/src/Core/DynBlock.h b/Eigen/src/Core/DynBlock.h
index c06a33b07..b46bed0eb 100644
--- a/Eigen/src/Core/DynBlock.h
+++ b/Eigen/src/Core/DynBlock.h
@@ -64,11 +64,6 @@ template<typename MatrixType> class DynBlock
&& startCol >= 0 && blockCols >= 1 && startCol + blockCols <= matrix.cols());
}
- DynBlock(const DynBlock& other)
- : m_matrix(other.m_matrix),
- m_startRow(other.m_startRow), m_startCol(other.m_startCol),
- m_blockRows(other.m_blockRows), m_blockCols(other.m_blockCols) {}
-
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(DynBlock)
private:
diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h
index 2fcda3e3d..4558d329d 100644
--- a/Eigen/src/Core/Map.h
+++ b/Eigen/src/Core/Map.h
@@ -32,14 +32,7 @@ template<typename MatrixType> class Map
public:
typedef typename MatrixType::Scalar Scalar;
friend class MatrixBase<Scalar, Map<MatrixType> >;
-
- Map(const Scalar* data, int rows, int cols) : m_data(data), m_rows(rows), m_cols(cols)
- {
- assert(rows > 0 && cols > 0);
- }
-
- EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map)
-
+
private:
static const int _RowsAtCompileTime = MatrixType::RowsAtCompileTime,
_ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@@ -65,6 +58,17 @@ template<typename MatrixType> class Map
else // RowDominant
return const_cast<Scalar*>(m_data)[col + row * m_cols];
}
+
+ public:
+ Map(const Scalar* data, int rows, int cols) : m_data(data), m_rows(rows), m_cols(cols)
+ {
+ assert(rows > 0
+ && (_RowsAtCompileTime == Dynamic || _RowsAtCompileTime == rows)
+ && cols > 0
+ && (_ColsAtCompileTime == Dynamic || _ColsAtCompileTime == cols));
+ }
+
+ EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map)
protected:
const Scalar* m_data;
diff --git a/Eigen/src/Core/MatrixRef.h b/Eigen/src/Core/MatrixRef.h
index ffdac9d8b..835782b32 100644
--- a/Eigen/src/Core/MatrixRef.h
+++ b/Eigen/src/Core/MatrixRef.h
@@ -34,7 +34,6 @@ template<typename MatrixType> class MatrixRef
friend class MatrixBase<Scalar, MatrixRef>;
MatrixRef(const MatrixType& matrix) : m_matrix(matrix) {}
- MatrixRef(const MatrixRef& other) : m_matrix(other.m_matrix) {}
~MatrixRef() {}
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixRef)
diff --git a/Eigen/src/Core/Minor.h b/Eigen/src/Core/Minor.h
index ab2e76963..b4fedebe0 100644
--- a/Eigen/src/Core/Minor.h
+++ b/Eigen/src/Core/Minor.h
@@ -54,9 +54,6 @@ template<typename MatrixType> class Minor
&& col >= 0 && col < matrix.cols());
}
- Minor(const Minor& other)
- : m_matrix(other.m_matrix), m_row(other.m_row), m_col(other.m_col) {}
-
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Minor)
private:
diff --git a/Eigen/src/Core/Ones.h b/Eigen/src/Core/Ones.h
index 36fbe58b0..4aedb7f0f 100644
--- a/Eigen/src/Core/Ones.h
+++ b/Eigen/src/Core/Ones.h
@@ -32,12 +32,7 @@ template<typename MatrixType> class Ones : NoOperatorEquals,
public:
typedef typename MatrixType::Scalar Scalar;
friend class MatrixBase<Scalar, Ones<MatrixType> >;
-
- Ones(int rows, int cols) : m_rows(rows), m_cols(cols)
- {
- assert(rows > 0 && cols > 0);
- }
-
+
private:
static const int _RowsAtCompileTime = MatrixType::RowsAtCompileTime,
_ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@@ -50,6 +45,15 @@ template<typename MatrixType> class Ones : NoOperatorEquals,
{
return static_cast<Scalar>(1);
}
+
+ public:
+ Ones(int rows, int cols) : m_rows(rows), m_cols(cols)
+ {
+ assert(rows > 0
+ && (_RowsAtCompileTime == Dynamic || _RowsAtCompileTime == rows)
+ && cols > 0
+ && (_ColsAtCompileTime == Dynamic || _ColsAtCompileTime == cols));
+ }
protected:
int m_rows, m_cols;
diff --git a/Eigen/src/Core/Opposite.h b/Eigen/src/Core/Opposite.h
index 21be7f614..110b63cf2 100644
--- a/Eigen/src/Core/Opposite.h
+++ b/Eigen/src/Core/Opposite.h
@@ -36,9 +36,6 @@ template<typename MatrixType> class Opposite : NoOperatorEquals,
Opposite(const MatRef& matrix) : m_matrix(matrix) {}
- Opposite(const Opposite& other)
- : m_matrix(other.m_matrix) {}
-
private:
static const int _RowsAtCompileTime = MatrixType::RowsAtCompileTime,
_ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@@ -60,7 +57,7 @@ template<typename Scalar, typename Derived>
const Opposite<Derived>
MatrixBase<Scalar, Derived>::operator-() const
{
- return Opposite<Derived>(static_cast<const Derived*>(this)->ref());
+ return Opposite<Derived>(ref());
}
#endif // EIGEN_OPPOSITE_H
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h
index 4a89e3a99..db261491e 100644
--- a/Eigen/src/Core/Product.h
+++ b/Eigen/src/Core/Product.h
@@ -75,9 +75,6 @@ template<typename Lhs, typename Rhs> class Product : NoOperatorEquals,
assert(lhs.cols() == rhs.rows());
}
- Product(const Product& other)
- : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {}
-
private:
static const int _RowsAtCompileTime = Lhs::RowsAtCompileTime,
_ColsAtCompileTime = Rhs::ColsAtCompileTime;
diff --git a/Eigen/src/Core/Random.h b/Eigen/src/Core/Random.h
index a8c00c858..6e672709c 100644
--- a/Eigen/src/Core/Random.h
+++ b/Eigen/src/Core/Random.h
@@ -32,12 +32,7 @@ template<typename MatrixType> class Random : NoOperatorEquals,
public:
typedef typename MatrixType::Scalar Scalar;
friend class MatrixBase<Scalar, Random<MatrixType> >;
-
- Random(int rows, int cols) : m_rows(rows), m_cols(cols)
- {
- assert(rows > 0 && cols > 0);
- }
-
+
private:
static const int _RowsAtCompileTime = MatrixType::RowsAtCompileTime,
_ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@@ -50,6 +45,15 @@ template<typename MatrixType> class Random : NoOperatorEquals,
{
return random<Scalar>();
}
+
+ public:
+ Random(int rows, int cols) : m_rows(rows), m_cols(cols)
+ {
+ assert(rows > 0
+ && (_RowsAtCompileTime == Dynamic || _RowsAtCompileTime == rows)
+ && cols > 0
+ && (_ColsAtCompileTime == Dynamic || _ColsAtCompileTime == cols));
+ }
protected:
int m_rows, m_cols;
diff --git a/Eigen/src/Core/Row.h b/Eigen/src/Core/Row.h
index 34c6fe3b0..4387b2e6c 100644
--- a/Eigen/src/Core/Row.h
+++ b/Eigen/src/Core/Row.h
@@ -60,9 +60,6 @@ template<typename MatrixType> class Row
assert(row >= 0 && row < matrix.rows());
}
- Row(const Row& other)
- : m_matrix(other.m_matrix), m_row(other.m_row) {}
-
template<typename OtherDerived>
Row& operator=(const MatrixBase<Scalar, OtherDerived>& other)
{
diff --git a/Eigen/src/Core/ScalarMultiple.h b/Eigen/src/Core/ScalarMultiple.h
index bcaabb383..29c566977 100644
--- a/Eigen/src/Core/ScalarMultiple.h
+++ b/Eigen/src/Core/ScalarMultiple.h
@@ -37,9 +37,6 @@ template<typename FactorType, typename MatrixType> class ScalarMultiple : NoOper
ScalarMultiple(const MatRef& matrix, FactorType factor)
: m_matrix(matrix), m_factor(factor) {}
- ScalarMultiple(const ScalarMultiple& other)
- : m_matrix(other.m_matrix), m_factor(other.m_factor) {}
-
private:
static const int _RowsAtCompileTime = MatrixType::RowsAtCompileTime,
_ColsAtCompileTime = MatrixType::ColsAtCompileTime;
diff --git a/Eigen/src/Core/Sum.h b/Eigen/src/Core/Sum.h
index 6385ced2c..51dc66bfa 100644
--- a/Eigen/src/Core/Sum.h
+++ b/Eigen/src/Core/Sum.h
@@ -41,8 +41,6 @@ template<typename Lhs, typename Rhs> class Sum : NoOperatorEquals,
assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
}
- Sum(const Sum& other) : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {}
-
private:
static const int _RowsAtCompileTime = Lhs::RowsAtCompileTime,
_ColsAtCompileTime = Rhs::ColsAtCompileTime;
diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h
index fb79ea3cd..777e86143 100644
--- a/Eigen/src/Core/Transpose.h
+++ b/Eigen/src/Core/Transpose.h
@@ -48,9 +48,6 @@ template<typename MatrixType> class Transpose
Transpose(const MatRef& matrix) : m_matrix(matrix) {}
- Transpose(const Transpose& other)
- : m_matrix(other.m_matrix) {}
-
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Transpose)
private:
diff --git a/Eigen/src/Core/Zero.h b/Eigen/src/Core/Zero.h
index 2d3ec264e..aad2f382d 100644
--- a/Eigen/src/Core/Zero.h
+++ b/Eigen/src/Core/Zero.h
@@ -32,12 +32,7 @@ template<typename MatrixType> class Zero : NoOperatorEquals,
public:
typedef typename MatrixType::Scalar Scalar;
friend class MatrixBase<Scalar, Zero<MatrixType> >;
-
- Zero(int rows, int cols) : m_rows(rows), m_cols(cols)
- {
- assert(rows > 0 && cols > 0);
- }
-
+
private:
static const int _RowsAtCompileTime = MatrixType::RowsAtCompileTime,
_ColsAtCompileTime = MatrixType::ColsAtCompileTime;
@@ -51,6 +46,15 @@ template<typename MatrixType> class Zero : NoOperatorEquals,
return static_cast<Scalar>(0);
}
+ public:
+ Zero(int rows, int cols) : m_rows(rows), m_cols(cols)
+ {
+ assert(rows > 0
+ && (_RowsAtCompileTime == Dynamic || _RowsAtCompileTime == rows)
+ && cols > 0
+ && (_ColsAtCompileTime == Dynamic || _ColsAtCompileTime == cols));
+ }
+
protected:
int m_rows, m_cols;
};