-merge patch from Gael Guennebaud adding NumTraits for long long

and long double.
-define scalar-multiple operators only for the current Scalar type;
 thanks to Gael for expaining how to make the compiler understand
 when automatic casting is needed.
-take ScalarMultiple take only 1 template param, again.
 We lose some flexibility especially when dealing with complex numbers,
 but we gain a lot of extensibility to new scalar types.
This commit is contained in:
Benoit Jacob
2008-02-29 13:20:44 +00:00
parent aa8e2bcbde
commit b3268a6e2f
6 changed files with 89 additions and 91 deletions

View File

@@ -215,7 +215,7 @@ template<typename Scalar, typename Derived> class MatrixBase
Scalar dot(const OtherDerived& other) const;
RealScalar norm2() const;
RealScalar norm() const;
const ScalarMultiple<RealScalar, Derived> normalized() const;
const ScalarMultiple<Derived> normalized() const;
template<typename OtherDerived>
bool isOrtho(const OtherDerived& other, RealScalar prec = precision<Scalar>()) const;
bool isOrtho(RealScalar prec = precision<Scalar>()) const;
@@ -269,17 +269,16 @@ template<typename Scalar, typename Derived> class MatrixBase
template<typename OtherDerived>
Derived& operator*=(const MatrixBase<Scalar, OtherDerived>& other);
Derived& operator*=(const int& other);
Derived& operator*=(const float& other);
Derived& operator*=(const double& other);
Derived& operator*=(const std::complex<float>& other);
Derived& operator*=(const std::complex<double>& other);
Derived& operator/=(const int& other);
Derived& operator/=(const float& other);
Derived& operator/=(const double& other);
Derived& operator/=(const std::complex<float>& other);
Derived& operator/=(const std::complex<double>& other);
Derived& operator*=(const Scalar& other);
Derived& operator/=(const Scalar& other);
const ScalarMultiple<Derived> operator*(const Scalar& scalar) const;
const ScalarMultiple<Derived> operator/(const Scalar& scalar) const;
friend
const ScalarMultiple<Derived> operator*(const Scalar& scalar,
const MatrixBase& matrix)
{ return matrix*scalar; }
Scalar coeff(int row, int col) const;
Scalar operator()(int row, int col) const;