@@ -13,8 +13,8 @@ template<typename T, unsigned int Nrows, unsigned Ncols> class Matrix;
1313template <typename T, unsigned int Nrows, unsigned Ncols>
1414struct MatrixTraits < Matrix<T, Nrows, Ncols> >
1515{
16- using Scalar = T;
17- using Size = unsigned int ;
16+ using Scalar = T;
17+ using Size = unsigned int ;
1818
1919 static constexpr bool hasReadRandomAccess = true ;
2020 static constexpr bool hasWriteRandomAccess = true ;
@@ -45,19 +45,19 @@ class Matrix : public MatrixBase< Matrix<T, Nrows, Ncols> >
4545
4646 Matrix (const RealScalar& value = RealScalar(0 )) requires (isScalarComplex) { for (Size i=0 ; i!=size; ++i) { m_data[i] = value; } }
4747 Matrix (std::initializer_list< std::initializer_list<RealScalar> > values) requires (isScalarComplex);
48- Matrix (std::initializer_list<RealScalar> values) requires (isScalarComplex and isVector) : m_data (values) { }
48+ Matrix (std::initializer_list<RealScalar> values) requires (isScalarComplex and isVector) { std::copy ( std::cbegin (values), std::cend (values), std::begin (m_data)); }
4949
5050 Matrix (const Scalar& value = Scalar(0 )) { m_data.fill (value); }
5151 Matrix (std::initializer_list< std::initializer_list<Scalar> > values);
5252 Matrix (std::initializer_list<Scalar> values) requires (isVector) { std::copy (std::cbegin (values), std::cend (values), std::begin (m_data)); }
5353
5454 Matrix (const Matrix& other) : m_data(other.m_data) {}
5555
56- template <class Expr > Matrix (const MatrixBase<Expr>& expr) requires(IsConstructibleFrom<Expr>::value) { expr.assignTo (BIC ::fixed<bool , false >, Scalar (1 ), *this ); }
56+ template <class Expr > Matrix (const MatrixBase<Expr>& expr) requires(IsConstructibleFrom<Expr>::value) { expr.assignTo (BIC ::fixed<bool , false >, BIC ::fixed<RealScalar, RealScalar (1 )> , *this ); }
5757
58- template <class Expr > Matrix& operator = (const MatrixBase<Expr>& expr) requires (IsConstructibleFrom<Expr>::value) { expr.assignTo (BIC ::fixed<bool , true >, Scalar (1 ), *this ); return *this ; }
59- template <class Expr > Matrix& operator +=(const MatrixBase<Expr>& expr) requires (IsConstructibleFrom<Expr>::value) { expr.increment (BIC ::fixed<bool , true >, Scalar (1 ), *this ); return *this ; }
60- template <class Expr > Matrix& operator -=(const MatrixBase<Expr>& expr) requires (IsConstructibleFrom<Expr>::value) { expr.decrement (BIC ::fixed<bool , true >, Scalar (1 ), *this ); return *this ; }
58+ template <class Expr > Matrix& operator = (const MatrixBase<Expr>& expr) requires (IsConstructibleFrom<Expr>::value) { expr.assignTo (BIC ::fixed<bool , true >, BIC ::fixed<RealScalar, RealScalar (1 )> , *this ); return *this ; }
59+ template <class Expr > Matrix& operator +=(const MatrixBase<Expr>& expr) requires (IsConstructibleFrom<Expr>::value) { expr.increment (BIC ::fixed<bool , true >, BIC ::fixed<RealScalar, RealScalar (1 )> , *this ); return *this ; }
60+ template <class Expr > Matrix& operator -=(const MatrixBase<Expr>& expr) requires (IsConstructibleFrom<Expr>::value) { expr.decrement (BIC ::fixed<bool , true >, BIC ::fixed<RealScalar, RealScalar (1 )> , *this ); return *this ; }
6161
6262 Matrix& operator *=(const RealScalar& alpha) requires (isScalarComplex) { for (Size i=0 ; i!=size; ++i) { m_data[i] *= alpha; } return *this ; }
6363 Matrix& operator /=(const RealScalar& alpha) requires (isScalarComplex) { for (Size i=0 ; i!=size; ++i) { m_data[i] /= alpha; } return *this ; }
@@ -76,10 +76,10 @@ class Matrix : public MatrixBase< Matrix<T, Nrows, Ncols> >
7676 template <class Dst > bool isAliasedToImpl (const MatrixBase<Dst>& dst) const requires( CanBeAlisaedTo<Dst>::value) { return std::addressof (dst.derived ()) == this ; }
7777 template <class Dst > constexpr bool isAliasedToImpl (const MatrixBase<Dst>& ) const requires(not CanBeAlisaedTo<Dst>::value) { return false ; }
7878
79- static Matrix zero () { return Matrix (Scalar (0 )); }
80- static Matrix ones () { return Matrix (Scalar (1 )); }
79+ static Matrix zero () { return Matrix (RealScalar (0 )); }
80+ static Matrix ones () { return Matrix (RealScalar (1 )); }
8181
82- static Matrix random (const RealScalar& lb, const RealScalar& ub);
82+ static Matrix random (const RealScalar& lb = RealScalar(- 1 ) , const RealScalar& ub = RealScalar( 1 ) );
8383private:
8484 std::array<Scalar, size> m_data;
8585};
0 commit comments