35 #ifndef _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENONNUMERIC_H_ 36 #define _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENONNUMERIC_H_ 105 template<
typename MT
107 class SymmetricMatrix<MT,SO,true,false>
108 :
public DenseMatrix< SymmetricMatrix<MT,SO,true,false>, SO >
112 using OT = OppositeType_<MT>;
113 using TT = TransposeType_<MT>;
114 using ET = ElementType_<MT>;
119 using This = SymmetricMatrix<MT,SO,true,false>;
120 using BaseType = DenseMatrix<This,SO>;
122 using OppositeType = SymmetricMatrix<OT,!SO,true,false>;
129 using Pointer = Pointer_<MT>;
130 using ConstPointer = ConstPointer_<MT>;
136 template<
typename NewType >
139 using Other = SymmetricMatrix< typename MT::template Rebind<NewType>::Other >;
146 template<
size_t NewM
150 using Other = SymmetricMatrix< typename MT::template Resize<NewM,NewN>::Other >;
157 template<
typename MatrixType >
163 using Reference = If_< IsConst<MatrixType>
164 , ConstReference_<MatrixType>
165 , Reference_<MatrixType> >;
167 using IteratorCategory = std::random_access_iterator_tag;
168 using ValueType = RemoveReference_<Reference>;
169 using PointerType = ValueType*;
171 using DifferenceType = ptrdiff_t;
174 using iterator_category = IteratorCategory;
175 using value_type = ValueType;
176 using pointer = PointerType;
177 using reference = ReferenceType;
178 using difference_type = DifferenceType;
184 inline MatrixIterator() noexcept
198 inline MatrixIterator( MatrixType& matrix,
size_t row,
size_t column ) noexcept
210 template<
typename MatrixType2 >
211 inline MatrixIterator(
const MatrixIterator<MatrixType2>& it ) noexcept
212 : matrix_( it.matrix_ )
214 , column_( it.column_ )
224 inline MatrixIterator&
operator+=(
size_t inc ) noexcept {
225 ( SO )?( row_ += inc ):( column_ += inc );
236 inline MatrixIterator&
operator-=(
size_t dec ) noexcept {
237 ( SO )?( row_ -= dec ):( column_ -= dec );
247 inline MatrixIterator& operator++() noexcept {
248 ( SO )?( ++row_ ):( ++column_ );
258 inline const MatrixIterator operator++(
int ) noexcept {
259 const MatrixIterator tmp( *
this );
270 inline MatrixIterator& operator--() noexcept {
271 ( SO )?( --row_ ):( --column_ );
281 inline const MatrixIterator operator--(
int ) noexcept {
282 const MatrixIterator tmp( *
this );
294 if( ( SO && row_ < column_ ) || ( !SO && row_ > column_ ) )
295 return (*matrix_)(row_,column_);
297 return (*matrix_)(column_,row_);
306 inline PointerType operator->()
const {
307 if( ( SO && row_ < column_ ) || ( !SO && row_ > column_ ) )
308 return &(*matrix_)(row_,column_);
310 return &(*matrix_)(column_,row_);
320 template<
typename MatrixType2 >
321 inline bool operator==(
const MatrixIterator<MatrixType2>& rhs )
const noexcept {
322 return ( SO )?( row_ == rhs.row_ ):( column_ == rhs.column_ );
332 template<
typename MatrixType2 >
333 inline bool operator!=(
const MatrixIterator<MatrixType2>& rhs )
const noexcept {
334 return ( SO )?( row_ != rhs.row_ ):( column_ != rhs.column_ );
344 template<
typename MatrixType2 >
345 inline bool operator<( const MatrixIterator<MatrixType2>& rhs )
const noexcept {
346 return ( SO )?( row_ < rhs.row_ ):( column_ < rhs.column_ );
347 return ( column_ < rhs.column_ );
357 template<
typename MatrixType2 >
358 inline bool operator>(
const MatrixIterator<MatrixType2>& rhs )
const noexcept {
359 return ( SO )?( row_ > rhs.row_ ):( column_ > rhs.column_ );
360 return ( column_ > rhs.column_ );
370 template<
typename MatrixType2 >
371 inline bool operator<=( const MatrixIterator<MatrixType2>& rhs )
const noexcept {
372 return ( SO )?( row_ <= rhs.row_ ):( column_ <= rhs.column_ );
382 template<
typename MatrixType2 >
383 inline bool operator>=(
const MatrixIterator<MatrixType2>& rhs )
const noexcept {
384 return ( SO )?( row_ >= rhs.row_ ):( column_ >= rhs.column_ );
394 inline DifferenceType
operator-(
const MatrixIterator& rhs )
const noexcept {
395 return ( SO )?( row_ - rhs.row_ ):( column_ - rhs.column_ );
406 friend inline const MatrixIterator
operator+(
const MatrixIterator& it,
size_t inc ) noexcept {
408 return MatrixIterator( *it.matrix_, it.row_ + inc, it.column_ );
410 return MatrixIterator( *it.matrix_, it.row_, it.column_ + inc );
421 friend inline const MatrixIterator
operator+(
size_t inc,
const MatrixIterator& it ) noexcept {
423 return MatrixIterator( *it.matrix_, it.row_ + inc, it.column_ );
425 return MatrixIterator( *it.matrix_, it.row_, it.column_ + inc );
436 friend inline const MatrixIterator
operator-(
const MatrixIterator& it,
size_t dec ) noexcept {
438 return MatrixIterator( *it.matrix_, it.row_ - dec, it.column_ );
440 return MatrixIterator( *it.matrix_, it.row_, it.column_ - dec );
452 template<
typename MatrixType2 >
friend class MatrixIterator;
458 using Iterator = MatrixIterator<MT>;
464 enum :
bool { simdEnabled =
false };
467 enum :
bool { smpAssignable = MT::smpAssignable && !IsSMPAssignable<ET>::value };
473 explicit inline SymmetricMatrix();
474 explicit inline SymmetricMatrix(
size_t n );
476 explicit inline SymmetricMatrix(
ElementType* ptr,
size_t n );
477 explicit inline SymmetricMatrix(
ElementType* ptr,
size_t n,
size_t nn );
479 inline SymmetricMatrix(
const SymmetricMatrix& m );
480 inline SymmetricMatrix( SymmetricMatrix&& m ) noexcept;
482 template<
typename MT2 >
inline SymmetricMatrix(
const Matrix<MT2,SO>& m );
483 template<
typename MT2 >
inline SymmetricMatrix(
const Matrix<MT2,!SO>& m );
494 inline Reference operator()(
size_t i,
size_t j );
496 inline Reference at(
size_t i,
size_t j );
498 inline ConstPointer data () const noexcept;
499 inline ConstPointer data (
size_t i ) const noexcept;
512 inline SymmetricMatrix& operator=( const SymmetricMatrix& rhs );
513 inline SymmetricMatrix& operator=( SymmetricMatrix&& rhs ) noexcept;
515 template< typename MT2 >
516 inline
DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator=( const Matrix<MT2,SO>& rhs );
518 template< typename MT2 >
519 inline
EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator=( const Matrix<MT2,SO>& rhs );
521 template< typename MT2 >
522 inline SymmetricMatrix& operator=( const Matrix<MT2,!SO>& rhs );
524 template< typename MT2 >
525 inline
DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator+=( const Matrix<MT2,SO>& rhs );
527 template< typename MT2 >
528 inline
EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator+=( const Matrix<MT2,SO>& rhs );
530 template< typename MT2 >
531 inline SymmetricMatrix& operator+=( const Matrix<MT2,!SO>& rhs );
533 template< typename MT2 >
534 inline
DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator-=( const Matrix<MT2,SO>& rhs );
536 template< typename MT2 >
537 inline
EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator-=( const Matrix<MT2,SO>& rhs );
539 template< typename MT2 >
540 inline SymmetricMatrix& operator-=( const Matrix<MT2,!SO>& rhs );
542 template< typename MT2 >
543 inline
DisableIf_< IsComputation<MT2>, SymmetricMatrix& > operator%=( const Matrix<MT2,SO>& rhs );
545 template< typename MT2 >
546 inline
EnableIf_< IsComputation<MT2>, SymmetricMatrix& > operator%=( const Matrix<MT2,SO>& rhs );
548 template< typename MT2 >
549 inline SymmetricMatrix& operator%=( const Matrix<MT2,!SO>& rhs );
551 template< typename MT2,
bool SO2 >
552 inline SymmetricMatrix& operator*=( const Matrix<MT2,SO2>& rhs );
554 template< typename Other >
555 inline
EnableIf_< IsNumeric<Other>, SymmetricMatrix >& operator*=( Other rhs );
557 template< typename Other >
558 inline
EnableIf_< IsNumeric<Other>, SymmetricMatrix >& operator/=( Other rhs );
565 inline
size_t rows() const noexcept;
566 inline
size_t columns() const noexcept;
567 inline
size_t spacing() const noexcept;
568 inline
size_t capacity() const noexcept;
569 inline
size_t capacity(
size_t i ) const noexcept;
571 inline
size_t nonZeros(
size_t i ) const;
573 inline
void reset(
size_t i );
575 void resize (
size_t n,
bool preserve=true );
576 inline
void extend (
size_t n,
bool preserve=true );
577 inline
void reserve(
size_t elements );
579 inline
void swap( SymmetricMatrix& m ) noexcept;
589 template< typename Other > inline SymmetricMatrix& scale( const Other& scalar );
596 inline
bool isIntact() const noexcept;
603 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
604 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
606 inline
bool isAligned () const noexcept;
607 inline
bool canSMPAssign() const noexcept;
615 template< typename MT2 > inline
void assign ( DenseMatrix <MT2,SO>& rhs );
616 template< typename MT2 > inline
void assign ( const DenseMatrix <MT2,SO>& rhs );
617 template< typename MT2 > inline
void assign ( const SparseMatrix<MT2,SO>& rhs );
618 template< typename MT2 > inline
void addAssign ( const DenseMatrix <MT2,SO>& rhs );
619 template< typename MT2 > inline
void addAssign ( const SparseMatrix<MT2,SO>& rhs );
620 template< typename MT2 > inline
void subAssign ( const DenseMatrix <MT2,SO>& rhs );
621 template< typename MT2 > inline
void subAssign ( const SparseMatrix<MT2,SO>& rhs );
622 template< typename MT2 > inline
void schurAssign( const DenseMatrix <MT2,SO>& rhs );
623 template< typename MT2 > inline
void schurAssign( const SparseMatrix<MT2,SO>& rhs );
635 template<
bool RF, typename MT2,
bool SO2,
bool DF2,
bool NF2 >
636 friend
bool isDefault( const SymmetricMatrix<MT2,SO2,DF2,NF2>& m );
672 template< typename MT
674 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix()
689 template<
typename MT
691 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix(
size_t n )
736 template<
typename MT
738 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix( ElementType* ptr,
size_t n )
739 : matrix_( ptr, n, n )
787 template<
typename MT
789 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix( ElementType* ptr,
size_t n,
size_t nn )
790 : matrix_( ptr, n, n, nn )
808 template<
typename MT
810 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix(
const SymmetricMatrix& m )
811 : matrix_( m.matrix_ )
826 template<
typename MT
828 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix( SymmetricMatrix&& m ) noexcept
829 : matrix_( std::move( m.matrix_ ) )
848 template<
typename MT
850 template<
typename MT2 >
851 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix(
const Matrix<MT2,SO>& m )
856 using RT = RemoveAdaptor_<ResultType_<MT2> >;
857 using Tmp = If_< IsComputation<MT2>, RT,
const MT2& >;
859 if( IsSymmetric<MT2>::value ) {
870 resize( matrix_, tmp.rows(), tmp.rows() );
891 template<
typename MT
893 template<
typename MT2 >
894 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix(
const Matrix<MT2,!SO>& m )
899 using RT = RemoveAdaptor_< ResultType_<MT2> >;
900 using Tmp = If_< IsComputation<MT2>, RT,
const MT2& >;
902 if( IsSymmetric<MT2>::value ) {
904 assign(
trans( ~m ) );
913 resize( matrix_, tmp.rows(), tmp.rows() );
914 assign(
trans( tmp ) );
947 template<
typename MT
950 SymmetricMatrix<MT,SO,true,false>::operator()(
size_t i,
size_t j )
955 if( ( !SO && i > j ) || ( SO && i < j ) )
979 template<
typename MT
982 SymmetricMatrix<MT,SO,true,false>::operator()(
size_t i,
size_t j )
const 987 if( ( !SO && i > j ) || ( SO && i < j ) )
1012 template<
typename MT
1015 SymmetricMatrix<MT,SO,true,false>::at(
size_t i,
size_t j )
1023 return (*
this)(i,j);
1045 template<
typename MT
1048 SymmetricMatrix<MT,SO,true,false>::at(
size_t i,
size_t j )
const 1056 return (*
this)(i,j);
1076 template<
typename MT
1078 inline typename SymmetricMatrix<MT,SO,true,false>::ConstPointer
1079 SymmetricMatrix<MT,SO,true,false>::data() const noexcept
1081 return matrix_.data();
1098 template<
typename MT
1100 inline typename SymmetricMatrix<MT,SO,true,false>::ConstPointer
1101 SymmetricMatrix<MT,SO,true,false>::data(
size_t i )
const noexcept
1103 return matrix_.data(i);
1121 template<
typename MT
1127 return Iterator( matrix_, 0UL, i );
1129 return Iterator( matrix_, i, 0UL );
1147 template<
typename MT
1173 template<
typename MT
1199 template<
typename MT
1225 template<
typename MT
1251 template<
typename MT
1283 template<
typename MT
1285 inline SymmetricMatrix<MT,SO,true,false>&
1286 SymmetricMatrix<MT,SO,true,false>::operator=(
const SymmetricMatrix& rhs )
1290 if( &rhs ==
this )
return *
this;
1292 resize( matrix_, rhs.rows(), rhs.columns() );
1311 template<
typename MT
1313 inline SymmetricMatrix<MT,SO,true,false>&
1314 SymmetricMatrix<MT,SO,true,false>::operator=( SymmetricMatrix&& rhs ) noexcept
1316 matrix_ = std::move( rhs.matrix_ );
1341 template<
typename MT
1343 template<
typename MT2 >
1344 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >
1345 SymmetricMatrix<MT,SO,true,false>::operator=(
const Matrix<MT2,SO>& rhs )
1349 if( !IsSymmetric<MT2>::value && !
isSymmetric( ~rhs ) ) {
1353 if( (~rhs).isAliased(
this ) ) {
1354 SymmetricMatrix tmp( ~rhs );
1359 if( IsSparseMatrix<MT2>::value )
1387 template<
typename MT
1389 template<
typename MT2 >
1390 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >
1391 SymmetricMatrix<MT,SO,true,false>::operator=(
const Matrix<MT2,SO>& rhs )
1395 using Tmp = If_< IsSymmetric<MT2>, CompositeType_<MT2>, ResultType_<MT2> >;
1397 if( !IsSquare<MT2>::value && !
isSquare( ~rhs ) ) {
1403 if( !IsSymmetric<Tmp>::value && !
isSymmetric( tmp ) ) {
1409 resize( matrix_, tmp.rows(), tmp.columns() );
1410 if( IsSparseMatrix<Tmp>::value )
1437 template<
typename MT
1439 template<
typename MT2 >
1440 inline SymmetricMatrix<MT,SO,true,false>&
1441 SymmetricMatrix<MT,SO,true,false>::operator=(
const Matrix<MT2,!SO>& rhs )
1443 return this->operator=(
trans( ~rhs ) );
1462 template<
typename MT
1464 template<
typename MT2 >
1465 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >
1468 if( !IsSymmetric<MT2>::value && !
isSymmetric( ~rhs ) ) {
1496 template<
typename MT
1498 template<
typename MT2 >
1499 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >
1502 using Tmp = If_< IsSymmetric<MT2>, CompositeType_<MT2>, ResultType_<MT2> >;
1504 if( !IsSquare<MT2>::value && !
isSquare( ~rhs ) ) {
1510 if( !IsSymmetric<Tmp>::value && !
isSymmetric( tmp ) ) {
1541 template<
typename MT
1543 template<
typename MT2 >
1544 inline SymmetricMatrix<MT,SO,true,false>&
1566 template<
typename MT
1568 template<
typename MT2 >
1569 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >
1572 if( !IsSymmetric<MT2>::value && !
isSymmetric( ~rhs ) ) {
1600 template<
typename MT
1602 template<
typename MT2 >
1603 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >
1606 using Tmp = If_< IsSymmetric<MT2>, CompositeType_<MT2>, ResultType_<MT2> >;
1608 if( !IsSquare<MT2>::value && !
isSquare( ~rhs ) ) {
1614 if( !IsSymmetric<Tmp>::value && !
isSymmetric( tmp ) ) {
1645 template<
typename MT
1647 template<
typename MT2 >
1648 inline SymmetricMatrix<MT,SO,true,false>&
1671 template<
typename MT
1673 template<
typename MT2 >
1674 inline DisableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >
1675 SymmetricMatrix<MT,SO,true,false>::operator%=(
const Matrix<MT2,SO>& rhs )
1677 if( !IsSymmetric<MT2>::value && !
isSymmetric( ~rhs ) ) {
1681 schurAssign( ~rhs );
1706 template<
typename MT
1708 template<
typename MT2 >
1709 inline EnableIf_< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >
1710 SymmetricMatrix<MT,SO,true,false>::operator%=(
const Matrix<MT2,SO>& rhs )
1712 using Tmp = If_< IsSymmetric<MT2>, CompositeType_<MT2>, ResultType_<MT2> >;
1714 if( !IsSquare<MT2>::value && !
isSquare( ~rhs ) ) {
1720 if( !IsSymmetric<Tmp>::value && !
isSymmetric( tmp ) ) {
1751 template<
typename MT
1753 template<
typename MT2 >
1754 inline SymmetricMatrix<MT,SO,true,false>&
1755 SymmetricMatrix<MT,SO,true,false>::operator%=(
const Matrix<MT2,!SO>& rhs )
1757 return this->operator%=(
trans( ~rhs ) );
1775 template<
typename MT
1777 template<
typename MT2
1779 inline SymmetricMatrix<MT,SO,true,false>&
1784 using Tmp = MultTrait_< MT, ResultType_<MT2> >;
1788 if( matrix_.rows() != (~rhs).
columns() ) {
1792 Tmp tmp( (*
this) * ~rhs );
1798 resize( matrix_, tmp.rows(), tmp.columns() );
1818 template<
typename MT
1820 template<
typename Other >
1821 inline EnableIf_< IsNumeric<Other>, SymmetricMatrix<MT,SO,true,false> >&
1825 for(
size_t j=0UL; j<
columns(); ++j )
1826 for(
size_t i=0UL; i<=j; ++i )
1827 matrix_(i,j) *= rhs;
1830 for(
size_t i=0UL; i<
rows(); ++i )
1831 for(
size_t j=0UL; j<=i; ++j )
1832 matrix_(i,j) *= rhs;
1849 template<
typename MT
1851 template<
typename Other >
1852 inline EnableIf_< IsNumeric<Other>, SymmetricMatrix<MT,SO,true,false> >&
1858 for(
size_t j=0UL; j<
columns(); ++j )
1859 for(
size_t i=0UL; i<=j; ++i )
1860 matrix_(i,j) /= rhs;
1863 for(
size_t i=0UL; i<
rows(); ++i )
1864 for(
size_t j=0UL; j<=i; ++j )
1865 matrix_(i,j) /= rhs;
1888 template<
typename MT
1892 return matrix_.rows();
1904 template<
typename MT
1908 return matrix_.columns();
1926 template<
typename MT
1930 return matrix_.spacing();
1942 template<
typename MT
1946 return matrix_.capacity();
1963 template<
typename MT
1967 return matrix_.capacity(i);
1979 template<
typename MT
1983 size_t nonzeros( 0UL );
1987 for(
size_t j=0UL; j<
columns(); ++j ) {
1988 for(
size_t i=0UL; i<j; ++i ) {
1998 for(
size_t i=0UL; i<
rows(); ++i ) {
1999 for(
size_t j=0UL; j<i; ++j ) {
2026 template<
typename MT
2030 size_t nonzeros( 0UL );
2034 for(
size_t j=0UL; j<i; ++j ) {
2038 for(
size_t j=i; j<
rows(); ++j ) {
2045 for(
size_t j=0UL; j<i; ++j ) {
2049 for(
size_t j=i; j<
rows(); ++j ) {
2067 template<
typename MT
2074 for(
size_t j=0UL; j<
columns(); ++j )
2075 for(
size_t i=0UL; i<=j; ++i )
2076 clear( matrix_(i,j) );
2079 for(
size_t i=0UL; i<
rows(); ++i )
2080 for(
size_t j=0UL; j<=i; ++j )
2081 clear( matrix_(i,j) );
2128 template<
typename MT
2153 template<
typename MT
2181 template<
typename MT
2191 const size_t oldsize( matrix_.rows() );
2193 matrix_.resize( n, n,
true );
2196 const size_t increment( n - oldsize );
2197 submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2198 submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2218 template<
typename MT
2220 inline void SymmetricMatrix<MT,SO,true,false>::extend(
size_t n,
bool preserve )
2242 template<
typename MT
2244 inline void SymmetricMatrix<MT,SO,true,false>::reserve(
size_t elements )
2246 matrix_.reserve( elements );
2262 template<
typename MT
2266 matrix_.shrinkToFit();
2279 template<
typename MT
2285 swap( matrix_, m.matrix_ );
2305 template<
typename MT
2321 template<
typename MT
2326 for(
size_t j=0UL; j<
columns(); ++j )
2327 for(
size_t i=0UL; i<=j; ++i )
2331 for(
size_t i=0UL; i<
rows(); ++i )
2332 for(
size_t j=0UL; j<=i; ++j )
2360 template<
typename MT
2362 template<
typename Other >
2363 inline SymmetricMatrix<MT,SO,true,false>&
2364 SymmetricMatrix<MT,SO,true,false>::scale(
const Other& scalar )
2367 for(
size_t j=0UL; j<
columns(); ++j )
2368 for(
size_t i=0UL; i<=j; ++i )
2369 matrix_(i,j) *= scalar;
2372 for(
size_t i=0UL; i<
rows(); ++i )
2373 for(
size_t j=0UL; j<=i; ++j )
2374 matrix_(i,j) *= scalar;
2401 template<
typename MT
2408 ( IsCustom<MT>::value || ( SO ?
isUpper( matrix_ ) :
isLower( matrix_ ) ) );
2433 template<
typename MT
2435 template<
typename Other >
2436 inline bool SymmetricMatrix<MT,SO,true,false>::canAlias(
const Other* alias )
const noexcept
2438 return matrix_.canAlias( alias );
2455 template<
typename MT
2457 template<
typename Other >
2458 inline bool SymmetricMatrix<MT,SO,true,false>::isAliased(
const Other* alias )
const noexcept
2460 return matrix_.isAliased( alias );
2476 template<
typename MT
2478 inline bool SymmetricMatrix<MT,SO,true,false>::isAligned() const noexcept
2480 return matrix_.isAligned();
2497 template<
typename MT
2499 inline bool SymmetricMatrix<MT,SO,true,false>::canSMPAssign() const noexcept
2501 return matrix_.canSMPAssign();
2519 template<
typename MT
2521 template<
typename MT2 >
2522 inline void SymmetricMatrix<MT,SO,true,false>::assign( DenseMatrix<MT2,SO>& rhs )
2528 for(
size_t j=0UL; j<
columns(); ++j )
2529 for(
size_t i=0UL; i<=j; ++i )
2530 matrix_(i,j) = std::move( (~rhs)(i,j) );
2533 for(
size_t i=0UL; i<
rows(); ++i )
2534 for(
size_t j=0UL; j<=i; ++j )
2535 matrix_(i,j) = std::move( (~rhs)(i,j) );
2554 template<
typename MT
2556 template<
typename MT2 >
2557 inline void SymmetricMatrix<MT,SO,true,false>::assign(
const DenseMatrix<MT2,SO>& rhs )
2563 for(
size_t j=0UL; j<
columns(); ++j )
2564 for(
size_t i=0UL; i<=j; ++i )
2565 matrix_(i,j) = (~rhs)(i,j);
2568 for(
size_t i=0UL; i<
rows(); ++i )
2569 for(
size_t j=0UL; j<=i; ++j )
2570 matrix_(i,j) = (~rhs)(i,j);
2589 template<
typename MT
2591 template<
typename MT2 >
2592 inline void SymmetricMatrix<MT,SO,true,false>::assign(
const SparseMatrix<MT2,SO>& rhs )
2600 for(
size_t j=0UL; j<
columns(); ++j ) {
2603 matrix_(element->index(),j) = element->value();
2607 for(
size_t i=0UL; i<
rows(); ++i ) {
2610 matrix_(i,element->index()) = element->value();
2630 template<
typename MT
2632 template<
typename MT2 >
2633 inline void SymmetricMatrix<MT,SO,true,false>::addAssign(
const DenseMatrix<MT2,SO>& rhs )
2639 for(
size_t j=0UL; j<
columns(); ++j )
2640 for(
size_t i=0UL; i<=j; ++i )
2641 matrix_(i,j) += (~rhs)(i,j);
2644 for(
size_t i=0UL; i<
rows(); ++i )
2645 for(
size_t j=0UL; j<=i; ++j )
2646 matrix_(i,j) += (~rhs)(i,j);
2665 template<
typename MT
2667 template<
typename MT2 >
2668 inline void SymmetricMatrix<MT,SO,true,false>::addAssign(
const SparseMatrix<MT2,SO>& rhs )
2676 for(
size_t j=0UL; j<
columns(); ++j ) {
2679 matrix_(element->index(),j) += element->value();
2683 for(
size_t i=0UL; i<
rows(); ++i ) {
2686 matrix_(i,element->index()) += element->value();
2706 template<
typename MT
2708 template<
typename MT2 >
2709 inline void SymmetricMatrix<MT,SO,true,false>::subAssign(
const DenseMatrix<MT2,SO>& rhs )
2715 for(
size_t j=0UL; j<
columns(); ++j )
2716 for(
size_t i=0UL; i<=j; ++i )
2717 matrix_(i,j) -= (~rhs)(i,j);
2720 for(
size_t i=0UL; i<
rows(); ++i )
2721 for(
size_t j=0UL; j<=i; ++j )
2722 matrix_(i,j) -= (~rhs)(i,j);
2741 template<
typename MT
2743 template<
typename MT2 >
2744 inline void SymmetricMatrix<MT,SO,true,false>::subAssign(
const SparseMatrix<MT2,SO>& rhs )
2752 for(
size_t j=0UL; j<
columns(); ++j ) {
2755 matrix_(element->index(),j) -= element->value();
2759 for(
size_t i=0UL; i<
rows(); ++i ) {
2762 matrix_(i,element->index()) -= element->value();
2782 template<
typename MT
2784 template<
typename MT2 >
2785 inline void SymmetricMatrix<MT,SO,true,false>::schurAssign(
const DenseMatrix<MT2,SO>& rhs )
2791 for(
size_t j=0UL; j<
columns(); ++j )
2792 for(
size_t i=0UL; i<=j; ++i )
2793 matrix_(i,j) *= (~rhs)(i,j);
2796 for(
size_t i=0UL; i<
rows(); ++i )
2797 for(
size_t j=0UL; j<=i; ++j )
2798 matrix_(i,j) *= (~rhs)(i,j);
2817 template<
typename MT
2819 template<
typename MT2 >
2820 inline void SymmetricMatrix<MT,SO,true,false>::schurAssign(
const SparseMatrix<MT2,SO>& rhs )
2828 for(
size_t j=0UL; j<
columns(); ++j )
2834 for( ; i<element->index(); ++i )
2835 reset( matrix_(i,j) );
2836 matrix_(i,j) *= element->value();
2840 for( ; i<
rows(); ++i ) {
2841 reset( matrix_(i,j) );
2846 for(
size_t i=0UL; i<
rows(); ++i )
2852 for( ; j<element->index(); ++j )
2853 reset( matrix_(i,j) );
2854 matrix_(i,j) *= element->value();
2859 reset( matrix_(i,j) );
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, 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.
Constraint on the data type.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:3079
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:1073
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:1328
#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 Rows type trait.
Header file for the UNUSED_PARAMETER function template.
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:356
Header file for basic type definitions.
Header file for the IsSparseMatrix type trait.
#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
#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
BLAZE_ALWAYS_INLINE T1 & operator/=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Division assignment operator for the division of two SIMD packs.
Definition: BasicTypes.h:1411
Constraint on the data type.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3078
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:198
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3076
Constraint on the data type.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:560
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:699
BLAZE_ALWAYS_INLINE void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:609
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:5845
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:3080
Submatrix< MT, AF > submatrix(Matrix< MT, SO > &matrix, size_t row, size_t column, size_t m, size_t n)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:352
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:661
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:3085
#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
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:394
Column< MT > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:124
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:731
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3086
BLAZE_ALWAYS_INLINE T1 & operator*=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Multiplication assignment operator for the multiplication of two SIMD packs.
Definition: BasicTypes.h:1393
Constraint on the data type.
BLAZE_ALWAYS_INLINE 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:308
BLAZE_ALWAYS_INLINE 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:242
Header file for the implementation of the base template of the SymmetricMatrix.
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:110
Header file for the IsSquare type trait.
Row< MT > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:124
Constraint on the data type.
Header file for the DisableIf class template.
Header file for the IsCustom type trait.
Header file for the multiplication trait.
Header file for the IsSymmetric type trait.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:3084
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5924
Header file for the If class template.
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:5907
SparseMatrix< This, true > BaseType
Base type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:3077
#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.
Type ElementType
Type of the compressed matrix elements.
Definition: CompressedMatrix.h:3081
#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.
Header file for the Columns type trait.
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:367
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:443
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3087
constexpr bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:250
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:340
Constraints on the storage order of matrix types.
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
#define BLAZE_CONSTRAINT_MUST_NOT_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is a numeric (integral or floating point) d...
Definition: Numeric.h:81
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:548
BLAZE_ALWAYS_INLINE 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:264
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:8893
Header file for the RemoveAdaptor type trait.
constexpr bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:290
Header file for all forward declarations for expression class templates.
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:580
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
#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, a compilation error is created.
Definition: Symmetric.h:79
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
Header file for run time assertion macros.
Constraint on the data type.
Constraint on the data type.
#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_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:270
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE void conjugate(T &a) noexcept(IsNumeric< T >::value)
In-place conjugation of the given value/object.
Definition: Conjugate.h:120
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:700
Header file for the RemoveReference type trait.
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:324
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3082
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:790
#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.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:3083
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:81
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:252
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:600
#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, a compilation error is created.
Definition: Hermitian.h:79
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
#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
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:742
#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
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:635