35 #ifndef _BLAZE_MATH_DENSE_UNIFORMMATRIX_H_ 36 #define _BLAZE_MATH_DENSE_UNIFORMMATRIX_H_ 180 template<
typename Type
181 ,
bool SO = defaultStorageOrder >
183 :
public DenseMatrix< UniformMatrix<Type,SO>, SO >
209 template<
typename NewType >
218 template<
size_t NewM
244 explicit inline constexpr
UniformMatrix(
size_t m,
size_t n );
245 explicit inline constexpr
UniformMatrix(
size_t m,
size_t n, const Type& init );
247 template< typename MT,
bool SO2 >
266 inline constexpr
ConstReference operator()(
size_t i,
size_t j ) const noexcept;
280 inline constexpr
UniformMatrix& operator=( const Type& rhs );
285 template< typename MT,
bool SO2 > inline
UniformMatrix& operator= ( const
Matrix<MT,SO2>& rhs );
286 template< typename MT,
bool SO2 > inline
UniformMatrix& operator+=( const
Matrix<MT,SO2>& rhs );
287 template< typename MT,
bool SO2 > inline
UniformMatrix& operator-=( const
Matrix<MT,SO2>& rhs );
288 template< typename MT,
bool SO2 > inline
UniformMatrix& operator%=( const
Matrix<MT,SO2>& rhs );
289 template< typename MT,
bool SO2 > inline
UniformMatrix& operator*=( const
Matrix<MT,SO2>& rhs );
291 template< typename ST >
294 template< typename ST >
302 inline constexpr
size_t rows() const noexcept;
303 inline constexpr
size_t columns() const noexcept;
304 inline constexpr
size_t spacing() const noexcept;
305 inline constexpr
size_t capacity() const noexcept;
306 inline constexpr
size_t capacity(
size_t i ) const noexcept;
308 inline
size_t nonZeros(
size_t i ) const;
309 inline constexpr
void reset();
310 inline constexpr
void clear();
311 constexpr
void resize (
size_t m,
size_t n,
bool preserve=true );
312 inline constexpr
void extend (
size_t m,
size_t n,
bool preserve=true );
323 template< typename Other > inline
UniformMatrix& scale( const Other& scalar );
337 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
338 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
382 template< typename Type
398 template<
typename Type
417 template<
typename Type
436 template<
typename Type
438 template<
typename MT
445 if( !IsUniform_v<MT> && !
isUniform( ~m ) ) {
449 if(
m_ > 0UL &&
n_ > 0UL ) {
474 template<
typename Type
500 template<
typename Type
529 template<
typename Type
547 template<
typename Type
573 template<
typename Type
599 template<
typename Type
625 template<
typename Type
651 template<
typename Type
680 template<
typename Type
700 template<
typename Type
702 template<
typename MT
706 using TT = decltype(
trans( *
this ) );
707 using CT = decltype(
ctrans( *
this ) );
709 if( !IsUniform_v<MT> && !
isUniform( ~rhs ) ) {
713 if( IsSame_v<MT,TT> && (~rhs).isAliased(
this ) ) {
716 else if( IsSame_v<MT,CT> && (~rhs).isAliased(
this ) ) {
723 if( (~rhs).rows() > 0UL && (~rhs).
columns() > 0UL ) {
724 value_ = (~rhs)(0UL,0UL);
743 template<
typename Type
745 template<
typename MT
753 if( !IsUniform_v<MT> && !
isUniform( ~rhs ) ) {
757 if(
m_ > 0UL &&
n_ > 0UL ) {
758 value_ += (~rhs)(0UL,0UL);
776 template<
typename Type
778 template<
typename MT
786 if( !IsUniform_v<MT> && !
isUniform( ~rhs ) ) {
790 if(
m_ > 0UL &&
n_ > 0UL ) {
791 value_ -= (~rhs)(0UL,0UL);
809 template<
typename Type
811 template<
typename MT
819 if( !IsUniform_v<MT> && !
isUniform( ~rhs ) ) {
823 if(
m_ > 0UL &&
n_ > 0UL ) {
824 value_ *= (~rhs)(0UL,0UL);
842 template<
typename Type
844 template<
typename MT
848 if( (~rhs).
rows() !=
n_ ) {
852 if( !IsUniform_v<MT> && !
isUniform( ~rhs ) ) {
858 if(
m_ > 0UL &&
n_ > 0UL ) {
859 value_ = ( value_ * (~rhs)(0UL,0UL) ) * Type( (~rhs).rows() );
874 template<
typename Type
876 template<
typename ST >
896 template<
typename Type
898 template<
typename ST >
924 template<
typename Type
938 template<
typename Type
957 template<
typename Type
971 template<
typename Type
991 template<
typename Type
1008 template<
typename Type
1031 template<
typename Type
1040 const size_t tmp( SO ?
m_ :
n_ );
1054 template<
typename Type
1072 template<
typename Type
1096 template<
typename Type
1120 template<
typename Type
1135 template<
typename Type
1143 swap( value_, m.value_ );
1161 template<
typename Type
1179 template<
typename Type
1210 template<
typename Type
1212 template<
typename Other >
1215 if(
m_ > 0UL &&
n_ > 0UL ) {
1242 template<
typename Type
1244 template<
typename Other >
1247 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1262 template<
typename Type
1264 template<
typename Other >
1267 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
1281 template<
typename Type
1300 template<
typename Type
1304 return (
rows() *
columns() >= SMP_DMATASSIGN_THRESHOLD );
1324 template<
typename Type
1329 return loada( i, j );
1349 template<
typename Type
1363 return set( value_ );
1383 template<
typename Type
1397 return set( value_ );
1417 template<
typename Type,
bool SO >
1420 template<
typename Type,
bool SO >
1423 template<
bool RF,
typename Type,
bool SO >
1426 template<
typename Type,
bool SO >
1429 template<
typename Type,
bool SO >
1442 template<
typename Type
1458 template<
typename Type
1497 return ( m.rows() == 0UL && m.columns() == 0UL );
1520 template<
typename Type
1539 template<
typename Type
1558 template<
typename Type,
bool SO >
1559 struct IsUniform< UniformMatrix<Type,SO> >
1576 template<
typename Type,
bool SO >
1577 struct IsAligned< UniformMatrix<Type,SO> >
1594 template<
typename Type,
bool SO >
1595 struct IsResizable< UniformMatrix<Type,SO> >
1612 template<
typename T1,
typename T2 >
1613 struct AddTraitEval1< T1, T2
1616 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1617 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1619 using ET1 = ElementType_t<T1>;
1620 using ET2 = ElementType_t<T2>;
1622 static constexpr
bool SO1 = StorageOrder_v<T1>;
1623 static constexpr
bool SO2 = StorageOrder_v<T2>;
1625 static constexpr
bool SO = ( IsDenseMatrix_v<T1> && IsDenseMatrix_v<T2>
1626 ? ( IsSymmetric_v<T1> ^ IsSymmetric_v<T2>
1627 ? ( IsSymmetric_v<T1>
1635 using Type = UniformMatrix< AddTrait_t<ET1,ET2>, SO >;
1651 template<
typename T1,
typename T2 >
1652 struct SubTraitEval1< T1, T2
1655 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1656 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1658 using ET1 = ElementType_t<T1>;
1659 using ET2 = ElementType_t<T2>;
1661 static constexpr
bool SO1 = StorageOrder_v<T1>;
1662 static constexpr
bool SO2 = StorageOrder_v<T2>;
1664 static constexpr
bool SO = ( IsDenseMatrix_v<T1> && IsDenseMatrix_v<T2>
1665 ? ( IsSymmetric_v<T1> ^ IsSymmetric_v<T2>
1666 ? ( IsSymmetric_v<T1>
1674 using Type = UniformMatrix< SubTrait_t<ET1,ET2>, SO >;
1690 template<
typename T1,
typename T2 >
1691 struct SchurTraitEval1< T1, T2
1694 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1695 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1697 using ET1 = ElementType_t<T1>;
1698 using ET2 = ElementType_t<T2>;
1700 static constexpr
bool SO1 = StorageOrder_v<T1>;
1701 static constexpr
bool SO2 = StorageOrder_v<T2>;
1703 static constexpr
bool SO = ( IsSymmetric_v<T1> ^ IsSymmetric_v<T2>
1704 ? ( IsSymmetric_v<T1>
1709 using Type = UniformMatrix< MultTrait_t<ET1,ET2>, SO >;
1725 template<
typename T1,
typename T2 >
1726 struct MultTraitEval1< T1, T2
1732 using ET1 = ElementType_t<T1>;
1734 using Type = UniformMatrix< MultTrait_t<ET1,T2>, StorageOrder_v<T1> >;
1737 template<
typename T1,
typename T2 >
1738 struct MultTraitEval1< T1, T2
1744 using ET2 = ElementType_t<T2>;
1746 using Type = UniformMatrix< MultTrait_t<T1,ET2>, StorageOrder_v<T2> >;
1749 template<
typename T1,
typename T2 >
1750 struct MultTraitEval1< T1, T2
1752 IsRowVector_v<T2> &&
1753 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1754 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1756 using ET1 = ElementType_t<T1>;
1757 using ET2 = ElementType_t<T2>;
1759 using Type = UniformMatrix< MultTrait_t<ET1,ET2>,
false >;
1762 template<
typename T1,
typename T2 >
1763 struct MultTraitEval1< T1, T2
1766 ( IsUniform_v<T1> && IsUniform_v<T2> ) &&
1767 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1769 using ET1 = ElementType_t<T1>;
1770 using ET2 = ElementType_t<T2>;
1772 using Type = UniformMatrix< MultTrait_t<ET1,ET2>, StorageOrder_v<T1> >;
1788 template<
typename T1,
typename T2 >
1789 struct DivTraitEval1< T1, T2
1792 IsUniform_v<T1> && !IsZero_v<T1> > >
1794 using ET1 = ElementType_t<T1>;
1796 using Type = UniformMatrix< DivTrait_t<ET1,T2>, StorageOrder_v<T1> >;
1812 template<
typename T,
typename OP >
1813 struct UnaryMapTraitEval1< T, OP
1815 YieldsUniform_v<OP,T> &&
1816 !YieldsZero_v<OP,T> > >
1818 using ET = ElementType_t<T>;
1820 using Type = UniformMatrix< MapTrait_t<ET,OP>, StorageOrder_v<T> >;
1828 template<
typename T1,
typename T2,
typename OP >
1829 struct BinaryMapTraitEval1< T1, T2, OP
1832 YieldsUniform_v<OP,T1,T2> &&
1833 !YieldsZero_v<OP,T1,T2> > >
1835 using ET1 = ElementType_t<T1>;
1836 using ET2 = ElementType_t<T2>;
1838 static constexpr
bool SO1 = StorageOrder_v<T1>;
1839 static constexpr
bool SO2 = StorageOrder_v<T2>;
1841 static constexpr
bool SO = ( IsDenseMatrix_v<T1> && IsDenseMatrix_v<T2>
1842 ? ( IsSymmetric_v<T1> ^ IsSymmetric_v<T2>
1843 ? ( IsSymmetric_v<T1>
1851 using Type = UniformMatrix< MapTrait_t<ET1,ET2,OP>, SO >;
1867 template<
typename T
1869 struct ExpandTraitEval1< T, E
1871 IsUniform_v<T> && !IsZero_v<T> > >
1875 using Type = UniformMatrix< ElementType_t<T>, TF >;
1891 template<
typename T1,
bool SO,
typename T2 >
1892 struct HighType< UniformMatrix<T1,SO>, UniformMatrix<T2,SO> >
1894 using Type = UniformMatrix< typename HighType<T1,T2>::Type, SO >;
1910 template<
typename T1,
bool SO,
typename T2 >
1911 struct LowType< UniformMatrix<T1,SO>, UniformMatrix<T2,SO> >
1913 using Type = UniformMatrix< typename LowType<T1,T2>::Type, SO >;
1929 template<
typename MT,
size_t I,
size_t J,
size_t M,
size_t N >
1930 struct SubmatrixTraitEval1< MT, I, J, M, N
1933 using Type = UniformMatrix< RemoveConst_t< ElementType_t<MT> >, StorageOrder_v<MT> >;
1949 template<
typename MT,
size_t M >
1950 struct RowsTraitEval1< MT, M
1953 using Type = UniformMatrix< RemoveConst_t< ElementType_t<MT> >,
false >;
1969 template<
typename MT,
size_t N >
1970 struct ColumnsTraitEval1< MT, N
1973 using Type = UniformMatrix< RemoveConst_t< ElementType_t<MT> >,
true >;
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Header file for the Schur product trait.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the alignment flag values.
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
Header file for basic type definitions.
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:139
Header file for the YieldsZero type trait.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
size_t m_
The current number of rows of the compressed matrix.
Definition: CompressedMatrix.h:3289
Header file for the IsRowVector type trait.
typename SIMDTrait< T >::Type SIMDTrait_t
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_t alias declaration provid...
Definition: SIMDTrait.h:315
void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:851
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
Header file for the reset shim.
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
constexpr bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:80
Constraint on the data type.
Header file for the IsMatrix type trait.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
constexpr bool columnMajor
Storage order flag for column-major matrices.
Definition: StorageOrder.h:99
Header file for the LowType type trait.
Header file for the multiplication trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1364
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5907
Header file for all forward declarations of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Header file for the IsSMPAssignable type trait.
Header file for the expand trait.
constexpr bool IsColumnVector_v
Auxiliary variable template for the IsColumnVector type trait.The IsColumnVector_v variable template ...
Definition: IsColumnVector.h:143
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the DenseMatrix base class.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
Header file for all SIMD functionality.
Constraint on the data type.
Header file for the IsAligned type trait.
constexpr bool IsVector_v
Auxiliary variable template for the IsVector type trait.The IsVector_v variable template provides a c...
Definition: IsVector.h:140
Header file for the default storage order for all vectors of the Blaze library.
#define BLAZE_CONSTRAINT_MUST_BE_VECTORIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a vectorizable data type...
Definition: Vectorizable.h:61
Header file for the exception macros of the math module.
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
bool isUniform(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a uniform matrix.
Definition: DenseMatrix.h:849
Header file for the IsVector type trait.
Header file for the IsDenseMatrix type trait.
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:611
Header file for the IsVectorizable type trait.
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
Header file for the RemoveConst type trait.
BLAZE_ALWAYS_INLINE void conjugate(T &a) noexcept(IsNumeric_v< T >)
In-place conjugation of the given value/object.
Definition: Conjugate.h:120
Header file for run time assertion macros.
Header file for the addition trait.
Header file for the division trait.
Header file for the submatrix trait.
Constraint on the data type.
Header file for the columns trait.
Header file for the IsZero type trait.
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:295
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:281
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:109
Constraint on the data type.
constexpr bool IsDenseMatrix_v
Auxiliary variable template for the IsDenseMatrix type trait.The IsDenseMatrix_v variable template pr...
Definition: IsDenseMatrix.h:139
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:79
Header file for the rows trait.
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
size_t n_
The current number of columns of the compressed matrix.
Definition: CompressedMatrix.h:3290
constexpr bool IsUniform_v
Auxiliary variable template for the IsUniform type trait.The IsUniform_v variable template provides a...
Definition: IsUniform.h:163
Header file for the StorageOrder type trait.
Header file for the map trait.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
Header file for the IsColumnVector type trait.
Header file for the IsResizable type trait.
System settings for the inline keywords.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the HighType type trait.
Header file for the TrueType type/value trait base class.
Header file for the clear shim.
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:825