35 #ifndef _BLAZE_MATH_ADAPTORS_DIAGONALMATRIX_DENSE_H_ 36 #define _BLAZE_MATH_ADAPTORS_DIAGONALMATRIX_DENSE_H_ 113 template<
typename MT
115 class DiagonalMatrix<MT,SO,true>
116 :
public DenseMatrix< DiagonalMatrix<MT,SO,true>, SO >
120 using OT = OppositeType_t<MT>;
121 using TT = TransposeType_t<MT>;
122 using ET = ElementType_t<MT>;
127 using This = DiagonalMatrix<MT,SO,true>;
128 using BaseType = DenseMatrix<This,SO>;
129 using ResultType = This;
130 using OppositeType = DiagonalMatrix<OT,!SO,true>;
131 using TransposeType = DiagonalMatrix<TT,!SO,true>;
132 using ElementType = ET;
133 using SIMDType = SIMDType_t<MT>;
134 using ReturnType = ReturnType_t<MT>;
135 using CompositeType =
const This&;
136 using Reference = DiagonalProxy<MT>;
137 using ConstReference = ConstReference_t<MT>;
138 using Pointer = Pointer_t<MT>;
139 using ConstPointer = ConstPointer_t<MT>;
140 using ConstIterator = ConstIterator_t<MT>;
146 template<
typename NewType >
149 using Other = DiagonalMatrix< typename MT::template Rebind<NewType>::Other >;
156 template<
size_t NewM
160 using Other = DiagonalMatrix< typename MT::template Resize<NewM,NewN>::Other >;
171 using IteratorCategory = std::random_access_iterator_tag;
172 using ValueType = ElementType_t<MT>;
173 using PointerType = DiagonalProxy<MT>;
174 using ReferenceType = DiagonalProxy<MT>;
175 using DifferenceType = ptrdiff_t;
178 using iterator_category = IteratorCategory;
179 using value_type = ValueType;
180 using pointer = PointerType;
181 using reference = ReferenceType;
182 using difference_type = DifferenceType;
188 inline Iterator() noexcept
202 inline Iterator( MT& matrix,
size_t row,
size_t column ) noexcept
215 inline Iterator&
operator+=(
size_t inc ) noexcept {
216 ( SO )?( row_ += inc ):( column_ += inc );
227 inline Iterator&
operator-=(
size_t dec ) noexcept {
228 ( SO )?( row_ -= dec ):( column_ -= dec );
238 inline Iterator& operator++() noexcept {
239 ( SO )?( ++row_ ):( ++column_ );
249 inline const Iterator operator++(
int ) noexcept {
250 const Iterator tmp( *
this );
261 inline Iterator& operator--() noexcept {
262 ( SO )?( --row_ ):( --column_ );
272 inline const Iterator operator--(
int ) noexcept {
273 const Iterator tmp( *
this );
285 return ReferenceType( *matrix_, row_, column_ );
294 inline PointerType operator->()
const {
295 return PointerType( *matrix_, row_, column_ );
309 inline SIMDType load()
const {
310 return (*matrix_).load(row_,column_);
324 inline SIMDType
loada()
const {
325 return (*matrix_).loada(row_,column_);
339 inline SIMDType
loadu()
const {
340 return (*matrix_).loadu(row_,column_);
349 inline operator ConstIterator()
const {
351 return matrix_->begin( column_ ) + row_;
353 return matrix_->begin( row_ ) + column_;
364 friend inline bool operator==(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
365 return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
376 friend inline bool operator==(
const Iterator& lhs,
const ConstIterator& rhs ) {
377 return ( ConstIterator( lhs ) == rhs );
388 friend inline bool operator==(
const ConstIterator& lhs,
const Iterator& rhs ) {
389 return ( lhs == ConstIterator( rhs ) );
400 friend inline bool operator!=(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
401 return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
412 friend inline bool operator!=(
const Iterator& lhs,
const ConstIterator& rhs ) {
413 return ( ConstIterator( lhs ) != rhs );
424 friend inline bool operator!=(
const ConstIterator& lhs,
const Iterator& rhs ) {
425 return ( lhs != ConstIterator( rhs ) );
436 friend inline bool operator<(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
437 return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
448 friend inline bool operator<(
const Iterator& lhs,
const ConstIterator& rhs ) {
449 return ( ConstIterator( lhs ) < rhs );
460 friend inline bool operator<(
const ConstIterator& lhs,
const Iterator& rhs ) {
461 return ( lhs < ConstIterator( rhs ) );
472 friend inline bool operator>(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
473 return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
484 friend inline bool operator>(
const Iterator& lhs,
const ConstIterator& rhs ) {
485 return ( ConstIterator( lhs ) > rhs );
496 friend inline bool operator>(
const ConstIterator& lhs,
const Iterator& rhs ) {
497 return ( lhs > ConstIterator( rhs ) );
508 friend inline bool operator<=(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
509 return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
520 friend inline bool operator<=(
const Iterator& lhs,
const ConstIterator& rhs ) {
521 return ( ConstIterator( lhs ) <= rhs );
532 friend inline bool operator<=(
const ConstIterator& lhs,
const Iterator& rhs ) {
533 return ( lhs <= ConstIterator( rhs ) );
544 friend inline bool operator>=(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
545 return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
556 friend inline bool operator>=(
const Iterator& lhs,
const ConstIterator& rhs ) {
557 return ( ConstIterator( lhs ) >= rhs );
568 friend inline bool operator>=(
const ConstIterator& lhs,
const Iterator& rhs ) {
569 return ( lhs >= ConstIterator( rhs ) );
579 inline DifferenceType
operator-(
const Iterator& rhs )
const noexcept {
580 return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
591 friend inline const Iterator
operator+(
const Iterator& it,
size_t inc ) noexcept {
593 return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
595 return Iterator( *it.matrix_, it.row_, it.column_ + inc );
606 friend inline const Iterator
operator+(
size_t inc,
const Iterator& it ) noexcept {
608 return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
610 return Iterator( *it.matrix_, it.row_, it.column_ + inc );
621 friend inline const Iterator
operator-(
const Iterator& it,
size_t dec ) noexcept {
623 return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
625 return Iterator( *it.matrix_, it.row_, it.column_ - dec );
640 static constexpr
bool simdEnabled = MT::simdEnabled;
643 static constexpr
bool smpAssignable = MT::smpAssignable;
649 explicit inline DiagonalMatrix();
650 template<
typename A1 >
explicit inline DiagonalMatrix(
const A1& a1 );
651 explicit inline DiagonalMatrix(
size_t n,
const ElementType& init );
653 inline DiagonalMatrix( initializer_list< initializer_list<ElementType> > list );
655 template<
typename Other >
656 explicit inline DiagonalMatrix(
size_t n,
const Other* array );
658 template<
typename Other,
size_t N >
659 explicit inline DiagonalMatrix(
const Other (&array)[N][N] );
661 explicit inline DiagonalMatrix( ElementType* ptr,
size_t n );
662 explicit inline DiagonalMatrix( ElementType* ptr,
size_t n,
size_t nn );
664 inline DiagonalMatrix(
const DiagonalMatrix& m );
665 inline DiagonalMatrix( DiagonalMatrix&& m ) noexcept;
672 ~DiagonalMatrix() =
default;
679 inline Reference operator()(
size_t i,
size_t j );
680 inline ConstReference operator()(
size_t i,
size_t j )
const;
681 inline Reference at(
size_t i,
size_t j );
682 inline ConstReference at(
size_t i,
size_t j )
const;
683 inline ConstPointer
data () const noexcept;
684 inline ConstPointer
data (
size_t i ) const noexcept;
685 inline Iterator
begin (
size_t i );
686 inline ConstIterator
begin (
size_t i ) const;
687 inline ConstIterator
cbegin(
size_t i ) const;
688 inline Iterator
end (
size_t i );
689 inline ConstIterator
end (
size_t i ) const;
690 inline ConstIterator
cend (
size_t i ) const;
697 inline DiagonalMatrix& operator=( const ElementType& rhs );
698 inline DiagonalMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
700 template< typename Other,
size_t N >
701 inline DiagonalMatrix& operator=( const Other (&array)[N][N] );
703 inline DiagonalMatrix& operator=( const DiagonalMatrix& rhs );
704 inline DiagonalMatrix& operator=( DiagonalMatrix&& rhs ) noexcept;
706 template< typename MT2,
bool SO2 >
707 inline auto operator=( const Matrix<MT2,SO2>& rhs )
710 template< typename MT2,
bool SO2 >
711 inline auto operator=( const Matrix<MT2,SO2>& rhs )
714 template< typename MT2,
bool SO2 >
715 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
718 template< typename MT2,
bool SO2 >
719 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
722 template< typename MT2,
bool SO2 >
723 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
726 template< typename MT2,
bool SO2 >
727 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
730 template< typename MT2,
bool SO2 >
731 inline auto operator%=( const Matrix<MT2,SO2>& rhs ) -> DiagonalMatrix&;
733 template< typename ST >
736 template< typename ST >
744 inline
size_t rows() const noexcept;
745 inline
size_t columns() const noexcept;
746 inline
size_t spacing() const noexcept;
747 inline
size_t capacity() const noexcept;
748 inline
size_t capacity(
size_t i ) const noexcept;
750 inline
size_t nonZeros(
size_t i ) const;
752 inline
void reset(
size_t i );
754 void resize (
size_t n,
bool preserve=true );
755 inline
void extend (
size_t n,
bool preserve=true );
756 inline
void reserve(
size_t elements );
758 inline
void swap( DiagonalMatrix& m ) noexcept;
765 template< typename Other > inline DiagonalMatrix& scale( const Other& scalar );
772 inline
bool isIntact() const noexcept;
779 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
780 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
782 inline
bool isAligned () const noexcept;
783 inline
bool canSMPAssign() const noexcept;
795 inline const MT construct(
size_t n ,
TrueType );
796 inline const MT construct( const ElementType& value,
FalseType );
798 template< typename MT2,
bool SO2, typename T >
799 inline const MT construct( const Matrix<MT2,SO2>& m, T );
811 template<
bool RF, typename MT2,
bool SO2,
bool DF2 >
812 friend
bool isDefault( const DiagonalMatrix<MT2,SO2,DF2>& m );
814 template< typename MT2,
bool SO2,
bool DF2 >
815 friend MT2& derestrict( DiagonalMatrix<MT2,SO2,DF2>& m );
852 template< typename MT
854 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix()
882 template<
typename MT
884 template<
typename A1 >
885 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix(
const A1& a1 )
886 : matrix_( construct( a1, typename IsResizable<MT>::Type() ) )
902 template<
typename MT
904 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix(
size_t n,
const ElementType& init )
905 : matrix_( n, n, ElementType() )
909 for(
size_t i=0UL; i<n; ++i )
943 template<
typename MT
945 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( initializer_list< initializer_list<ElementType> > list )
984 template<
typename MT
986 template<
typename Other >
987 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix(
size_t n,
const Other* array )
988 : matrix_( n, n, array )
1023 template<
typename MT
1025 template<
typename Other
1027 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix(
const Other (&array)[N][N] )
1072 template<
typename MT
1074 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( ElementType* ptr,
size_t n )
1075 : matrix_( ptr, n, n )
1121 template<
typename MT
1123 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( ElementType* ptr,
size_t n,
size_t nn )
1124 : matrix_( ptr, n, n, nn )
1142 template<
typename MT
1144 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix(
const DiagonalMatrix& m )
1145 : matrix_( m.matrix_ )
1160 template<
typename MT
1162 inline DiagonalMatrix<MT,SO,true>::DiagonalMatrix( DiagonalMatrix&& m ) noexcept
1163 : matrix_( std::move( m.matrix_ ) )
1196 template<
typename MT
1198 inline typename DiagonalMatrix<MT,SO,true>::Reference
1199 DiagonalMatrix<MT,SO,true>::operator()(
size_t i,
size_t j )
1204 return Reference( matrix_, i, j );
1226 template<
typename MT
1228 inline typename DiagonalMatrix<MT,SO,true>::ConstReference
1229 DiagonalMatrix<MT,SO,true>::operator()(
size_t i,
size_t j )
const 1234 return matrix_(i,j);
1257 template<
typename MT
1259 inline typename DiagonalMatrix<MT,SO,true>::Reference
1260 DiagonalMatrix<MT,SO,true>::at(
size_t i,
size_t j )
1268 return (*
this)(i,j);
1291 template<
typename MT
1293 inline typename DiagonalMatrix<MT,SO,true>::ConstReference
1294 DiagonalMatrix<MT,SO,true>::at(
size_t i,
size_t j )
const 1302 return (*
this)(i,j);
1321 template<
typename MT
1323 inline typename DiagonalMatrix<MT,SO,true>::ConstPointer
1326 return matrix_.data();
1341 template<
typename MT
1343 inline typename DiagonalMatrix<MT,SO,true>::ConstPointer
1346 return matrix_.data(i);
1364 template<
typename MT
1366 inline typename DiagonalMatrix<MT,SO,true>::Iterator
1370 return Iterator( matrix_, 0UL, i );
1372 return Iterator( matrix_, i, 0UL );
1390 template<
typename MT
1392 inline typename DiagonalMatrix<MT,SO,true>::ConstIterator
1395 return matrix_.begin(i);
1413 template<
typename MT
1415 inline typename DiagonalMatrix<MT,SO,true>::ConstIterator
1418 return matrix_.cbegin(i);
1436 template<
typename MT
1438 inline typename DiagonalMatrix<MT,SO,true>::Iterator
1442 return Iterator( matrix_,
rows(), i );
1444 return Iterator( matrix_, i,
columns() );
1462 template<
typename MT
1464 inline typename DiagonalMatrix<MT,SO,true>::ConstIterator
1467 return matrix_.end(i);
1485 template<
typename MT
1487 inline typename DiagonalMatrix<MT,SO,true>::ConstIterator
1490 return matrix_.cend(i);
1511 template<
typename MT
1513 inline DiagonalMatrix<MT,SO,true>&
1514 DiagonalMatrix<MT,SO,true>::operator=(
const ElementType& rhs )
1516 for(
size_t i=0UL; i<
rows(); ++i )
1550 template<
typename MT
1552 inline DiagonalMatrix<MT,SO,true>&
1553 DiagonalMatrix<MT,SO,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1555 const InitializerMatrix<ElementType> tmp( list, list.size() );
1596 template<
typename MT
1598 template<
typename Other
1600 inline DiagonalMatrix<MT,SO,true>&
1601 DiagonalMatrix<MT,SO,true>::operator=(
const Other (&array)[N][N] )
1609 matrix_ = std::move( tmp );
1630 template<
typename MT
1632 inline DiagonalMatrix<MT,SO,true>&
1633 DiagonalMatrix<MT,SO,true>::operator=(
const DiagonalMatrix& rhs )
1635 matrix_ = rhs.matrix_;
1653 template<
typename MT
1655 inline DiagonalMatrix<MT,SO,true>&
1656 DiagonalMatrix<MT,SO,true>::operator=( DiagonalMatrix&& rhs ) noexcept
1658 matrix_ = std::move( rhs.matrix_ );
1682 template<
typename MT
1684 template<
typename MT2
1686 inline auto DiagonalMatrix<MT,SO,true>::operator=(
const Matrix<MT2,SO2>& rhs )
1687 -> DisableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >
1689 if( !IsDiagonal_v<MT2> && !
isDiagonal( ~rhs ) ) {
1717 template<
typename MT
1719 template<
typename MT2
1721 inline auto DiagonalMatrix<MT,SO,true>::operator=(
const Matrix<MT2,SO2>& rhs )
1722 -> EnableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >
1724 if( !IsSquare_v<MT2> && !
isSquare( ~rhs ) ) {
1728 if( IsDiagonal_v<MT2> ) {
1738 matrix_ = std::move( tmp );
1763 template<
typename MT
1765 template<
typename MT2
1768 -> DisableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >
1770 if( !IsDiagonal_v<MT2> && !
isDiagonal( ~rhs ) ) {
1798 template<
typename MT
1800 template<
typename MT2
1803 -> EnableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >
1805 if( !IsSquare_v<MT2> && !
isSquare( ~rhs ) ) {
1809 if( IsDiagonal_v<MT2> ) {
1813 const ResultType_t<MT2> tmp( ~rhs );
1844 template<
typename MT
1846 template<
typename MT2
1849 -> DisableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >
1851 if( !IsDiagonal_v<MT2> && !
isDiagonal( ~rhs ) ) {
1879 template<
typename MT
1881 template<
typename MT2
1884 -> EnableIf_t< IsComputation_v<MT2>, DiagonalMatrix& >
1886 if( !IsSquare_v<MT2> && !
isSquare( ~rhs ) ) {
1890 if( IsDiagonal_v<MT2> ) {
1894 const ResultType_t<MT2> tmp( ~rhs );
1923 template<
typename MT
1925 template<
typename MT2
1927 inline auto DiagonalMatrix<MT,SO,true>::operator%=(
const Matrix<MT2,SO2>& rhs )
1930 if( !IsSquare_v<MT2> && !
isSquare( ~rhs ) ) {
1953 template<
typename MT
1955 template<
typename ST >
1957 -> EnableIf_t< IsNumeric_v<ST>, DiagonalMatrix& >
1975 template<
typename MT
1977 template<
typename ST >
1979 -> EnableIf_t< IsNumeric_v<ST>, DiagonalMatrix& >
2003 template<
typename MT
2007 return matrix_.rows();
2019 template<
typename MT
2023 return matrix_.columns();
2040 template<
typename MT
2044 return matrix_.spacing();
2056 template<
typename MT
2060 return matrix_.capacity();
2078 template<
typename MT
2082 return matrix_.capacity(i);
2094 template<
typename MT
2098 return matrix_.nonZeros();
2116 template<
typename MT
2120 return matrix_.nonZeros(i);
2132 template<
typename MT
2155 template<
typename MT
2177 template<
typename MT
2225 template<
typename MT
2235 const size_t oldsize( matrix_.rows() );
2237 matrix_.resize( n, n,
true );
2240 const size_t increment( n - oldsize );
2241 submatrix( matrix_, 0UL, oldsize, n, increment ).reset();
2242 submatrix( matrix_, oldsize, 0UL, increment, increment ).reset();
2262 template<
typename MT
2264 inline void DiagonalMatrix<MT,SO,true>::extend(
size_t n,
bool preserve )
2286 template<
typename MT
2288 inline void DiagonalMatrix<MT,SO,true>::reserve(
size_t elements )
2306 template<
typename MT
2310 matrix_.shrinkToFit();
2323 template<
typename MT
2329 swap( matrix_, m.matrix_ );
2361 template<
typename MT
2363 template<
typename Other >
2364 inline DiagonalMatrix<MT,SO,true>& DiagonalMatrix<MT,SO,true>::scale(
const Other& scalar )
2366 matrix_.scale( scalar );
2391 template<
typename MT
2422 template<
typename MT
2424 template<
typename Other >
2425 inline bool DiagonalMatrix<MT,SO,true>::canAlias(
const Other* alias )
const noexcept
2427 return matrix_.canAlias( alias );
2444 template<
typename MT
2446 template<
typename Other >
2447 inline bool DiagonalMatrix<MT,SO,true>::isAliased(
const Other* alias )
const noexcept
2449 return matrix_.isAliased( alias );
2465 template<
typename MT
2467 inline bool DiagonalMatrix<MT,SO,true>::isAligned() const noexcept
2469 return matrix_.isAligned();
2486 template<
typename MT
2488 inline bool DiagonalMatrix<MT,SO,true>::canSMPAssign() const noexcept
2490 return matrix_.canSMPAssign();
2512 template<
typename MT
2515 DiagonalMatrix<MT,SO,true>::load(
size_t i,
size_t j )
const noexcept
2517 return matrix_.load( i, j );
2539 template<
typename MT
2544 return matrix_.loada( i, j );
2566 template<
typename MT
2571 return matrix_.loadu( i, j );
2592 template<
typename MT
2594 inline const MT DiagonalMatrix<MT,SO,true>::construct(
size_t n,
TrueType )
2598 return MT( n, n, ElementType() );
2611 template<
typename MT
2613 inline const MT DiagonalMatrix<MT,SO,true>::construct(
const ElementType& init,
FalseType )
2620 for(
size_t i=0UL; i<tmp.rows(); ++i )
2640 template<
typename MT
2642 template<
typename MT2
2645 inline const MT DiagonalMatrix<MT,SO,true>::construct(
const Matrix<MT2,SO2>& m, T )
2649 if( !IsDiagonal_v<MT2> && !
isDiagonal( tmp ) ) {
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSFORMATION_TYPE(T)
Constraint on the data type.In case the given data type T is a transformation expression (i....
Definition: Transformation.h:81
Constraint on the data type.
Header file for the implementation of the Submatrix view.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type,...
Definition: Const.h:79
Header file for the UnderlyingNumeric type trait.
BoolConstant< false > FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: IntegralConstant.h:121
#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
Constraint on the data type.
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:432
constexpr ptrdiff_t Size_v
Auxiliary variable template for the Size type trait.The Size_v variable template provides a convenien...
Definition: Size.h:176
decltype(auto) decldiag(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as diagonal.
Definition: DMatDeclDiagExpr.h:975
Constraint on the data type.
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression,...
Definition: Assert.h:117
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
constexpr const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:750
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:170
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:178
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:63
Header file for the isZero shim.
Header file for the IsDiagonal type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i....
Definition: Computation.h:81
Header file for the implementation of the Band view.
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type,...
Definition: DenseMatrix.h:61
constexpr bool operator<(const NegativeAccuracy< A > &lhs, const T &rhs)
Less-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:332
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:76
Constraint on the data type.
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:799
Header file for the MAYBE_UNUSED function template.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type,...
Definition: Volatile.h:79
bool isDiagonal(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is diagonal.
Definition: DenseMatrix.h:2328
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: IntegralConstant.h:132
Header file for the extended initializer_list functionality.
Constraint on the data type.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:482
MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:416
Constraint on the data type.
Constraint on the data type.
size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:253
#define BLAZE_CONSTRAINT_MUST_BE_SQUARE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a square matrix type,...
Definition: Square.h:60
Header file for the IsSquare type trait.
Constraint on the data type.
Header file for the implementation of a matrix representation of an initializer list.
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
Header file for the DisableIf class template.
Header file for the DiagonalProxy class.
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
Header file for the If class template.
Header file for the IsFloatingPoint type trait.
decltype(auto) operator *(const DenseMatrix< MT1, false > &lhs, const DenseMatrix< MT2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:9091
Header file for the UnderlyingBuiltin type trait.
#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
#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.
constexpr bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:370
constexpr bool operator>=(const NegativeAccuracy< A > &, const T &rhs)
Greater-or-equal-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:446
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:370
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:253
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
Constraint on the data type.
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Constraints on the storage order of matrix types.
decltype(auto) elements(Vector< VT, TF > &vector, REAs... args)
Creating a view on a selection of elements of the given vector.
Definition: Elements.h:139
Header file for the exception macros of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type,...
Definition: Upper.h:81
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
MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:438
decltype(auto) diagonal(Matrix< MT, SO > &matrix, RDAs... args)
Creating a view on the diagonal of the given matrix.
Definition: Band.h:377
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:293
Header file for the EnableIf class template.
Header file for utility functions for dense matrices.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:615
constexpr bool IsComputation_v
Auxiliary variable template for the IsComputation type trait.The IsComputation_v variable template pr...
Definition: IsComputation.h:90
Header file for the IsNumeric type trait.
auto operator/=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Division assignment operator for the division of a dense matrix by a scalar value ( ).
Definition: DenseMatrix.h:558
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type,...
Definition: Symmetric.h:79
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type,...
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_RESIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is resizable, i.e. has a 'resize' member fu...
Definition: Resizable.h:81
#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,...
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:282
Constraint on the data type.
Constraint on the data type.
constexpr bool operator<=(const NegativeAccuracy< A > &, const T &rhs)
Less-or-equal-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:408
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VIEW_TYPE(T)
Constraint on the data type.In case the given data type T is a view type (i.e. a subvector,...
Definition: View.h:81
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
constexpr const DenseIterator< Type, AF > operator+(const DenseIterator< Type, AF > &it, ptrdiff_t inc) noexcept
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:718
Header file for the IsInvertible type trait.
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 implementation of the base template of the DiagonalMatrix.
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not resizable, i.e. does not have a 'res...
Definition: Resizable.h:61
Header file for the IsComputation type trait class.
Header file for the IsBuiltin type trait.
Header file for the IntegralConstant class template.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
Header file for the IsComplex type trait.
auto operator *=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:494
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type,...
Definition: Hermitian.h:79
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:951
Header file for the IsResizable type trait.
System settings for the inline keywords.
Header file for the Size type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
Header file for the clear shim.