35 #ifndef _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENUMERIC_H_ 36 #define _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENUMERIC_H_ 111 template<
typename MT
113 class SymmetricMatrix<MT,SO,true,true>
114 :
public DenseMatrix< SymmetricMatrix<MT,SO,true,true>, SO >
118 using OT = OppositeType_t<MT>;
119 using TT = TransposeType_t<MT>;
120 using ET = ElementType_t<MT>;
125 using This = SymmetricMatrix<MT,SO,true,true>;
126 using BaseType = DenseMatrix<This,SO>;
127 using ResultType = This;
128 using OppositeType = SymmetricMatrix<OT,!SO,true,true>;
129 using TransposeType = SymmetricMatrix<TT,!SO,true,true>;
130 using ElementType = ET;
131 using SIMDType = SIMDType_t<MT>;
132 using ReturnType = ReturnType_t<MT>;
133 using CompositeType =
const This&;
134 using Reference = NumericProxy<MT>;
135 using ConstReference = ConstReference_t<MT>;
136 using Pointer = Pointer_t<MT>;
137 using ConstPointer = ConstPointer_t<MT>;
138 using ConstIterator = ConstIterator_t<MT>;
144 template<
typename NewType >
147 using Other = SymmetricMatrix< typename MT::template Rebind<NewType>::Other >;
154 template<
size_t NewM
158 using Other = SymmetricMatrix< typename MT::template Resize<NewM,NewN>::Other >;
169 using IteratorCategory = std::random_access_iterator_tag;
170 using ValueType = ElementType_t<MT>;
171 using PointerType = NumericProxy<MT>;
172 using ReferenceType = NumericProxy<MT>;
173 using DifferenceType = ptrdiff_t;
176 using iterator_category = IteratorCategory;
177 using value_type = ValueType;
178 using pointer = PointerType;
179 using reference = ReferenceType;
180 using difference_type = DifferenceType;
186 inline Iterator() noexcept
200 inline Iterator( MT& matrix,
size_t row,
size_t column ) noexcept
213 inline Iterator&
operator+=(
size_t inc ) noexcept {
214 ( SO )?( row_ += inc ):( column_ += inc );
225 inline Iterator&
operator-=(
size_t dec ) noexcept {
226 ( SO )?( row_ -= dec ):( column_ -= dec );
236 inline Iterator& operator++() noexcept {
237 ( SO )?( ++row_ ):( ++column_ );
247 inline const Iterator operator++(
int ) noexcept {
248 const Iterator tmp( *
this );
259 inline Iterator& operator--() noexcept {
260 ( SO )?( --row_ ):( --column_ );
270 inline const Iterator operator--(
int ) noexcept {
271 const Iterator tmp( *
this );
283 return ReferenceType( *matrix_, row_, column_ );
292 inline PointerType operator->()
const {
293 return PointerType( *matrix_, row_, column_ );
307 inline SIMDType load()
const {
308 return (*matrix_).load(row_,column_);
322 inline SIMDType
loada()
const {
323 return (*matrix_).loada(row_,column_);
337 inline SIMDType
loadu()
const {
338 return (*matrix_).loadu(row_,column_);
353 inline void store(
const SIMDType& value )
const {
354 (*matrix_).store( row_, column_, value );
370 inline void storea(
const SIMDType& value )
const {
371 (*matrix_).storea( row_, column_, value );
387 inline void storeu(
const SIMDType& value )
const {
388 (*matrix_).storeu( row_, column_, value );
404 inline void stream(
const SIMDType& value )
const {
405 (*matrix_).stream( row_, column_, value );
415 inline operator ConstIterator()
const {
417 return matrix_->begin( column_ ) + row_;
419 return matrix_->begin( row_ ) + column_;
430 friend inline bool operator==(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
431 return ( SO )?( lhs.row_ == rhs.row_ ):( lhs.column_ == rhs.column_ );
442 friend inline bool operator==(
const Iterator& lhs,
const ConstIterator& rhs ) {
443 return ( ConstIterator( lhs ) == rhs );
454 friend inline bool operator==(
const ConstIterator& lhs,
const Iterator& rhs ) {
455 return ( lhs == ConstIterator( rhs ) );
466 friend inline bool operator!=(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
467 return ( SO )?( lhs.row_ != rhs.row_ ):( lhs.column_ != rhs.column_ );
478 friend inline bool operator!=(
const Iterator& lhs,
const ConstIterator& rhs ) {
479 return ( ConstIterator( lhs ) != rhs );
490 friend inline bool operator!=(
const ConstIterator& lhs,
const Iterator& rhs ) {
491 return ( lhs != ConstIterator( rhs ) );
502 friend inline bool operator<(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
503 return ( SO )?( lhs.row_ < rhs.row_ ):( lhs.column_ < rhs.column_ );
514 friend inline bool operator<(
const Iterator& lhs,
const ConstIterator& rhs ) {
515 return ( ConstIterator( lhs ) < rhs );
526 friend inline bool operator<(
const ConstIterator& lhs,
const Iterator& rhs ) {
527 return ( lhs < ConstIterator( rhs ) );
538 friend inline bool operator>(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
539 return ( SO )?( lhs.row_ > rhs.row_ ):( lhs.column_ > rhs.column_ );
550 friend inline bool operator>(
const Iterator& lhs,
const ConstIterator& rhs ) {
551 return ( ConstIterator( lhs ) > rhs );
562 friend inline bool operator>(
const ConstIterator& lhs,
const Iterator& rhs ) {
563 return ( lhs > ConstIterator( rhs ) );
574 friend inline bool operator<=(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
575 return ( SO )?( lhs.row_ <= rhs.row_ ):( lhs.column_ <= rhs.column_ );
586 friend inline bool operator<=(
const Iterator& lhs,
const ConstIterator& rhs ) {
587 return ( ConstIterator( lhs ) <= rhs );
598 friend inline bool operator<=(
const ConstIterator& lhs,
const Iterator& rhs ) {
599 return ( lhs <= ConstIterator( rhs ) );
610 friend inline bool operator>=(
const Iterator& lhs,
const Iterator& rhs ) noexcept {
611 return ( SO )?( lhs.row_ >= rhs.row_ ):( lhs.column_ >= rhs.column_ );
622 friend inline bool operator>=(
const Iterator& lhs,
const ConstIterator& rhs ) {
623 return ( ConstIterator( lhs ) >= rhs );
634 friend inline bool operator>=(
const ConstIterator& lhs,
const Iterator& rhs ) {
635 return ( lhs >= ConstIterator( rhs ) );
645 inline DifferenceType
operator-(
const Iterator& rhs )
const noexcept {
646 return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
657 friend inline const Iterator
operator+(
const Iterator& it,
size_t inc ) noexcept {
659 return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
661 return Iterator( *it.matrix_, it.row_, it.column_ + inc );
672 friend inline const Iterator
operator+(
size_t inc,
const Iterator& it ) noexcept {
674 return Iterator( *it.matrix_, it.row_ + inc, it.column_ );
676 return Iterator( *it.matrix_, it.row_, it.column_ + inc );
687 friend inline const Iterator
operator-(
const Iterator& it,
size_t dec ) noexcept {
689 return Iterator( *it.matrix_, it.row_ - dec, it.column_ );
691 return Iterator( *it.matrix_, it.row_, it.column_ - dec );
703 const size_t kend(
min( row_+SIMDSIZE, (*matrix_).rows() ) );
704 for(
size_t k=row_; k<kend; ++k )
705 (*matrix_)(column_,k) = (*matrix_)(k,column_);
708 const size_t kend(
min( column_+SIMDSIZE, (*matrix_).columns() ) );
709 for(
size_t k=column_; k<kend; ++k )
710 (*matrix_)(k,row_) = (*matrix_)(row_,k);
725 static constexpr
bool simdEnabled = MT::simdEnabled;
728 static constexpr
bool smpAssignable = MT::smpAssignable;
734 explicit inline SymmetricMatrix();
735 explicit inline SymmetricMatrix(
size_t n );
736 inline SymmetricMatrix( initializer_list< initializer_list<ElementType> > list );
738 template<
typename Other >
739 explicit inline SymmetricMatrix(
size_t n,
const Other* array );
741 template<
typename Other,
size_t N >
742 explicit inline SymmetricMatrix(
const Other (&array)[N][N] );
744 explicit inline SymmetricMatrix( ElementType* ptr,
size_t n );
745 explicit inline SymmetricMatrix( ElementType* ptr,
size_t n,
size_t nn );
747 inline SymmetricMatrix(
const SymmetricMatrix& m );
748 inline SymmetricMatrix( SymmetricMatrix&& m ) noexcept;
750 template<
typename MT2 >
inline SymmetricMatrix(
const Matrix<MT2,SO>& m );
751 template<
typename MT2 >
inline SymmetricMatrix(
const Matrix<MT2,!SO>& m );
758 ~SymmetricMatrix() =
default;
765 inline Reference operator()(
size_t i,
size_t j );
766 inline ConstReference operator()(
size_t i,
size_t j )
const;
767 inline Reference at(
size_t i,
size_t j );
768 inline ConstReference at(
size_t i,
size_t j )
const;
769 inline ConstPointer
data () const noexcept;
770 inline ConstPointer
data (
size_t i ) const noexcept;
771 inline Iterator
begin (
size_t i );
772 inline ConstIterator
begin (
size_t i ) const;
773 inline ConstIterator
cbegin(
size_t i ) const;
774 inline Iterator
end (
size_t i );
775 inline ConstIterator
end (
size_t i ) const;
776 inline ConstIterator
cend (
size_t i ) const;
783 inline SymmetricMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
785 template< typename Other,
size_t N >
786 inline SymmetricMatrix& operator=( const Other (&array)[N][N] );
788 inline SymmetricMatrix& operator=( const SymmetricMatrix& rhs );
789 inline SymmetricMatrix& operator=( SymmetricMatrix&& rhs ) noexcept;
791 template< typename MT2 >
792 inline auto operator=( const Matrix<MT2,SO>& rhs )
795 template< typename MT2 >
796 inline auto operator=( const Matrix<MT2,SO>& rhs )
799 template< typename MT2 >
800 inline auto operator=( const Matrix<MT2,!SO>& rhs ) -> SymmetricMatrix&;
802 template< typename MT2 >
803 inline auto operator+=( const Matrix<MT2,SO>& rhs )
806 template< typename MT2 >
807 inline auto operator+=( const Matrix<MT2,SO>& rhs )
810 template< typename MT2 >
811 inline auto operator+=( const Matrix<MT2,!SO>& rhs ) -> SymmetricMatrix&;
813 template< typename MT2 >
814 inline auto operator-=( const Matrix<MT2,SO>& rhs )
817 template< typename MT2 >
818 inline auto operator-=( const Matrix<MT2,SO>& rhs )
821 template< typename MT2 >
822 inline auto operator-=( const Matrix<MT2,!SO>& rhs ) -> SymmetricMatrix&;
824 template< typename MT2 >
825 inline auto operator%=( const Matrix<MT2,SO>& rhs )
828 template< typename MT2 >
829 inline auto operator%=( const Matrix<MT2,SO>& rhs )
832 template< typename MT2 >
833 inline auto operator%=( const Matrix<MT2,!SO>& rhs )
836 template< typename ST >
839 template< typename ST >
847 inline
size_t rows() const noexcept;
848 inline
size_t columns() const noexcept;
849 inline
size_t spacing() const noexcept;
850 inline
size_t capacity() const noexcept;
851 inline
size_t capacity(
size_t i ) const noexcept;
853 inline
size_t nonZeros(
size_t i ) const;
855 inline
void reset(
size_t i );
857 void resize (
size_t n,
bool preserve=true );
858 inline
void extend (
size_t n,
bool preserve=true );
859 inline
void reserve(
size_t elements );
861 inline
void swap( SymmetricMatrix& m ) noexcept;
871 template< typename Other > inline SymmetricMatrix& scale( const Other& scalar );
878 inline
bool isIntact() const noexcept;
885 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
886 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
888 inline
bool isAligned () const noexcept;
889 inline
bool canSMPAssign() const noexcept;
895 inline
void store (
size_t i,
size_t j, const SIMDType& value ) noexcept;
896 inline
void storea(
size_t i,
size_t j, const SIMDType& value ) noexcept;
897 inline
void storeu(
size_t i,
size_t j, const SIMDType& value ) noexcept;
898 inline
void stream(
size_t i,
size_t j, const SIMDType& value ) noexcept;
905 static constexpr
size_t SIMDSIZE = SIMDTrait<ET>::
size;
916 template<
bool RF, typename MT2,
bool SO2,
bool DF2,
bool NF2 >
917 friend
bool isDefault( const SymmetricMatrix<MT2,SO2,DF2,NF2>& m );
920 friend
void invert( SymmetricMatrix<MT2,SO2,true,true>& m );
958 template< typename MT
960 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix()
976 template<
typename MT
978 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix(
size_t n )
979 : matrix_( n, n, ElementType() )
1014 template<
typename MT
1016 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( initializer_list< initializer_list<ElementType> > list )
1055 template<
typename MT
1057 template<
typename Other >
1058 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix(
size_t n,
const Other* array )
1059 : matrix_( n, n, array )
1094 template<
typename MT
1096 template<
typename Other
1098 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix(
const Other (&array)[N][N] )
1143 template<
typename MT
1145 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr,
size_t n )
1146 : matrix_( ptr, n, n )
1192 template<
typename MT
1194 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( ElementType* ptr,
size_t n,
size_t nn )
1195 : matrix_( ptr, n, n, nn )
1213 template<
typename MT
1215 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix(
const SymmetricMatrix& m )
1216 : matrix_( m.matrix_ )
1231 template<
typename MT
1233 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix( SymmetricMatrix&& m ) noexcept
1234 : matrix_( std::move( m.matrix_ ) )
1253 template<
typename MT
1255 template<
typename MT2 >
1256 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix(
const Matrix<MT2,SO>& m )
1259 if( !IsSymmetric_v<MT2> && !
isSymmetric( matrix_ ) ) {
1280 template<
typename MT
1282 template<
typename MT2 >
1283 inline SymmetricMatrix<MT,SO,true,true>::SymmetricMatrix(
const Matrix<MT2,!SO>& m )
1284 : matrix_(
trans( ~m ) )
1286 if( !IsSymmetric_v<MT2> && !
isSymmetric( matrix_ ) ) {
1320 template<
typename MT
1322 inline typename SymmetricMatrix<MT,SO,true,true>::Reference
1323 SymmetricMatrix<MT,SO,true,true>::operator()(
size_t i,
size_t j )
1328 return Reference( matrix_, i, j );
1349 template<
typename MT
1351 inline typename SymmetricMatrix<MT,SO,true,true>::ConstReference
1352 SymmetricMatrix<MT,SO,true,true>::operator()(
size_t i,
size_t j )
const 1357 return matrix_(i,j);
1379 template<
typename MT
1381 inline typename SymmetricMatrix<MT,SO,true,true>::Reference
1382 SymmetricMatrix<MT,SO,true,true>::at(
size_t i,
size_t j )
1390 return (*
this)(i,j);
1412 template<
typename MT
1414 inline typename SymmetricMatrix<MT,SO,true,true>::ConstReference
1415 SymmetricMatrix<MT,SO,true,true>::at(
size_t i,
size_t j )
const 1423 return (*
this)(i,j);
1443 template<
typename MT
1445 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
1448 return matrix_.data();
1465 template<
typename MT
1467 inline typename SymmetricMatrix<MT,SO,true,true>::ConstPointer
1470 return matrix_.data(i);
1488 template<
typename MT
1490 inline typename SymmetricMatrix<MT,SO,true,true>::Iterator
1494 return Iterator( matrix_, 0UL, i );
1496 return Iterator( matrix_, i, 0UL );
1514 template<
typename MT
1516 inline typename SymmetricMatrix<MT,SO,true,true>::ConstIterator
1519 return matrix_.begin(i);
1537 template<
typename MT
1539 inline typename SymmetricMatrix<MT,SO,true,true>::ConstIterator
1542 return matrix_.cbegin(i);
1560 template<
typename MT
1562 inline typename SymmetricMatrix<MT,SO,true,true>::Iterator
1566 return Iterator( matrix_,
rows(), i );
1568 return Iterator( matrix_, i,
columns() );
1586 template<
typename MT
1588 inline typename SymmetricMatrix<MT,SO,true,true>::ConstIterator
1591 return matrix_.end(i);
1609 template<
typename MT
1611 inline typename SymmetricMatrix<MT,SO,true,true>::ConstIterator
1614 return matrix_.cend(i);
1653 template<
typename MT
1655 inline SymmetricMatrix<MT,SO,true,true>&
1656 SymmetricMatrix<MT,SO,true,true>::operator=( initializer_list< initializer_list<ElementType> > list )
1658 const InitializerMatrix<ElementType> tmp( list, list.size() );
1699 template<
typename MT
1701 template<
typename Other
1703 inline SymmetricMatrix<MT,SO,true,true>&
1704 SymmetricMatrix<MT,SO,true,true>::operator=(
const Other (&array)[N][N] )
1712 matrix_ = std::move( tmp );
1733 template<
typename MT
1735 inline SymmetricMatrix<MT,SO,true,true>&
1736 SymmetricMatrix<MT,SO,true,true>::operator=(
const SymmetricMatrix& rhs )
1738 matrix_ = rhs.matrix_;
1756 template<
typename MT
1758 inline SymmetricMatrix<MT,SO,true,true>&
1759 SymmetricMatrix<MT,SO,true,true>::operator=( SymmetricMatrix&& rhs ) noexcept
1761 matrix_ = std::move( rhs.matrix_ );
1785 template<
typename MT
1787 template<
typename MT2 >
1788 inline auto SymmetricMatrix<MT,SO,true,true>::operator=(
const Matrix<MT2,SO>& rhs )
1789 -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
1791 if( !IsSymmetric_v<MT2> && !
isSymmetric( ~rhs ) ) {
1819 template<
typename MT
1821 template<
typename MT2 >
1822 inline auto SymmetricMatrix<MT,SO,true,true>::operator=(
const Matrix<MT2,SO>& rhs )
1823 -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
1825 if( !IsSquare_v<MT2> && !
isSquare( ~rhs ) ) {
1829 if( IsSymmetric_v<MT2> ) {
1839 matrix_ = std::move( tmp );
1864 template<
typename MT
1866 template<
typename MT2 >
1867 inline auto SymmetricMatrix<MT,SO,true,true>::operator=(
const Matrix<MT2,!SO>& rhs )
1870 return this->operator=(
trans( ~rhs ) );
1889 template<
typename MT
1891 template<
typename MT2 >
1893 -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
1895 if( !IsSymmetric_v<MT2> && !
isSymmetric( ~rhs ) ) {
1923 template<
typename MT
1925 template<
typename MT2 >
1927 -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
1929 if( !IsSquare_v<MT2> && !
isSquare( ~rhs ) ) {
1933 if( IsSymmetric_v<MT2> ) {
1937 const ResultType_t<MT2> tmp( ~rhs );
1969 template<
typename MT
1971 template<
typename MT2 >
1994 template<
typename MT
1996 template<
typename MT2 >
1998 -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
2000 if( !IsSymmetric_v<MT2> && !
isSymmetric( ~rhs ) ) {
2028 template<
typename MT
2030 template<
typename MT2 >
2032 -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
2034 if( !IsSquare_v<MT2> && !
isSquare( ~rhs ) ) {
2038 if( IsSymmetric_v<MT2> ) {
2042 const ResultType_t<MT2> tmp( ~rhs );
2074 template<
typename MT
2076 template<
typename MT2 >
2100 template<
typename MT
2102 template<
typename MT2 >
2103 inline auto SymmetricMatrix<MT,SO,true,true>::operator%=(
const Matrix<MT2,SO>& rhs )
2104 -> DisableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
2106 if( !IsSymmetric_v<MT2> && !
isSymmetric( ~rhs ) ) {
2135 template<
typename MT
2137 template<
typename MT2 >
2138 inline auto SymmetricMatrix<MT,SO,true,true>::operator%=(
const Matrix<MT2,SO>& rhs )
2139 -> EnableIf_t< IsComputation_v<MT2>, SymmetricMatrix& >
2141 if( !IsSquare_v<MT2> && !
isSquare( ~rhs ) ) {
2145 if( IsSymmetric_v<MT2> ) {
2149 const ResultType_t<MT2> tmp( ~rhs );
2181 template<
typename MT
2183 template<
typename MT2 >
2184 inline auto SymmetricMatrix<MT,SO,true,true>::operator%=(
const Matrix<MT2,!SO>& rhs )
2187 return this->operator%=(
trans( ~rhs ) );
2201 template<
typename MT
2203 template<
typename ST >
2205 -> EnableIf_t< IsNumeric_v<ST>, SymmetricMatrix& >
2221 template<
typename MT
2223 template<
typename ST >
2225 -> EnableIf_t< IsNumeric_v<ST>, SymmetricMatrix& >
2250 template<
typename MT
2254 return matrix_.rows();
2266 template<
typename MT
2270 return matrix_.columns();
2288 template<
typename MT
2292 return matrix_.spacing();
2304 template<
typename MT
2308 return matrix_.capacity();
2325 template<
typename MT
2329 return matrix_.capacity(i);
2341 template<
typename MT
2345 return matrix_.nonZeros();
2363 template<
typename MT
2367 return matrix_.nonZeros(i);
2379 template<
typename MT
2425 template<
typename MT
2448 template<
typename MT
2495 template<
typename MT
2505 const size_t oldsize( matrix_.rows() );
2507 matrix_.resize( n, n,
true );
2510 const size_t increment( n - oldsize );
2511 submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2512 submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2532 template<
typename MT
2534 inline void SymmetricMatrix<MT,SO,true,true>::extend(
size_t n,
bool preserve )
2555 template<
typename MT
2557 inline void SymmetricMatrix<MT,SO,true,true>::reserve(
size_t elements )
2575 template<
typename MT
2579 matrix_.shrinkToFit();
2592 template<
typename MT
2598 swap( matrix_, m.matrix_ );
2618 template<
typename MT
2634 template<
typename MT
2638 if( !IsBuiltin_v<ElementType> )
2665 template<
typename MT
2667 template<
typename Other >
2668 inline SymmetricMatrix<MT,SO,true,true>&
2669 SymmetricMatrix<MT,SO,true,true>::scale(
const Other& scalar )
2671 matrix_.scale( scalar );
2696 template<
typename MT
2727 template<
typename MT
2729 template<
typename Other >
2730 inline bool SymmetricMatrix<MT,SO,true,true>::canAlias(
const Other* alias )
const noexcept
2732 return matrix_.canAlias( alias );
2749 template<
typename MT
2751 template<
typename Other >
2752 inline bool SymmetricMatrix<MT,SO,true,true>::isAliased(
const Other* alias )
const noexcept
2754 return matrix_.isAliased( alias );
2770 template<
typename MT
2772 inline bool SymmetricMatrix<MT,SO,true,true>::isAligned() const noexcept
2774 return matrix_.isAligned();
2791 template<
typename MT
2793 inline bool SymmetricMatrix<MT,SO,true,true>::canSMPAssign() const noexcept
2795 return matrix_.canSMPAssign();
2817 template<
typename MT
2820 SymmetricMatrix<MT,SO,true,true>::load(
size_t i,
size_t j )
const noexcept
2822 return matrix_.load( i, j );
2844 template<
typename MT
2849 return matrix_.loada( i, j );
2871 template<
typename MT
2876 return matrix_.loadu( i, j );
2899 template<
typename MT
2902 SymmetricMatrix<MT,SO,true,true>::store(
size_t i,
size_t j,
const SIMDType& value ) noexcept
2904 matrix_.store( i, j, value );
2907 const size_t kend(
min( i+SIMDSIZE,
rows() ) );
2908 for(
size_t k=i; k<kend; ++k )
2909 matrix_(j,k) = matrix_(k,j);
2912 const size_t kend(
min( j+SIMDSIZE,
columns() ) );
2913 for(
size_t k=j; k<kend; ++k )
2914 matrix_(k,i) = matrix_(i,k);
2938 template<
typename MT
2943 matrix_.storea( i, j, value );
2946 const size_t kend(
min( i+SIMDSIZE,
rows() ) );
2947 for(
size_t k=i; k<kend; ++k )
2948 matrix_(j,k) = matrix_(k,j);
2951 const size_t kend(
min( j+SIMDSIZE,
columns() ) );
2952 for(
size_t k=j; k<kend; ++k )
2953 matrix_(k,i) = matrix_(i,k);
2977 template<
typename MT
2982 matrix_.storeu( i, j, value );
2985 const size_t kend(
min( i+SIMDSIZE,
rows() ) );
2986 for(
size_t k=i; k<kend; ++k )
2987 matrix_(j,k) = matrix_(k,j);
2990 const size_t kend(
min( j+SIMDSIZE,
columns() ) );
2991 for(
size_t k=j; k<kend; ++k )
2992 matrix_(k,i) = matrix_(i,k);
3016 template<
typename MT
3021 matrix_.stream( i, j, value );
3024 const size_t kend(
min( i+SIMDSIZE,
rows() ) );
3025 for(
size_t k=i; k<kend; ++k )
3026 matrix_(j,k) = matrix_(k,j);
3029 const size_t kend(
min( j+SIMDSIZE,
columns() ) );
3030 for(
size_t k=j; k<kend; ++k )
3031 matrix_(k,i) = matrix_(i,k);
#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
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
#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
Headerfile for the generic min algorithm.
Header file for the blaze::checked and blaze::unchecked instances.
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
Constraint on the data type.
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.
#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
#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.
Header file for the dense matrix inversion flags.
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
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:851
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
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:75
Header file for the extended initializer_list functionality.
Constraint on the data type.
Header file for the NumericProxy class.
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
Header file for the implementation of the base template of the SymmetricMatrix.
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
Header file for the IsSquare type trait.
bool isZero(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 0.
Definition: DiagonalProxy.h:677
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
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:779
Header file for the DisableIf class template.
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
Header file for the If class template.
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
#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
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1162
#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
Header file for all SIMD functionality.
Constraint on the data type.
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:78
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
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 implementation of the Column view.
Header file for the conjugate shim.
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
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.
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_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:61
#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
Header file for all forward declarations for expression class templates.
#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
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:282
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
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
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:1328
#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
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
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:74
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
#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.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
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
System settings for the inline keywords.
Header file for the Size type trait.
InversionFlag
Inversion flag.The InversionFlag type enumeration represents the different types of matrix inversion ...
Definition: InversionFlag.h:101
#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 implementation of the Row view.
Header file for the clear shim.
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:825