35 #ifndef _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENONNUMERIC_H_
36 #define _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_DENSENONNUMERIC_H_
103 template<
typename MT
105 class SymmetricMatrix<MT,SO,true,false>
106 :
public DenseMatrix< SymmetricMatrix<MT,SO,true,false>, SO >
117 typedef SymmetricMatrix<MT,SO,true,false>
This;
119 typedef SymmetricMatrix<OT,!SO,true,false>
OppositeType;
126 typedef typename MT::Pointer Pointer;
127 typedef typename MT::ConstPointer ConstPointer;
133 template<
typename ET >
136 typedef SymmetricMatrix< typename MT::template Rebind<ET>::Other > Other;
143 template<
typename MatrixType >
149 typedef typename IfTrue< IsConst<MatrixType>::value
153 typedef std::random_access_iterator_tag IteratorCategory;
154 typedef RemoveReference<Reference> ValueType;
155 typedef ValueType* PointerType;
157 typedef ptrdiff_t DifferenceType;
160 typedef IteratorCategory iterator_category;
161 typedef ValueType value_type;
162 typedef PointerType pointer;
163 typedef ReferenceType reference;
164 typedef DifferenceType difference_type;
184 inline RowIterator( MatrixType& matrix,
size_t row,
size_t column )
198 template<
typename MatrixType2 >
199 inline RowIterator(
const RowIterator<MatrixType2>& it )
200 : matrix_( it.matrix_ )
202 , column_( it.column_ )
214 inline RowIterator& operator+=(
size_t inc ) {
226 inline RowIterator& operator-=(
size_t dec ) {
237 inline RowIterator& operator++() {
248 inline const RowIterator operator++(
int ) {
249 const RowIterator tmp( *
this );
260 inline RowIterator& operator--() {
271 inline const RowIterator operator--(
int ) {
272 const RowIterator tmp( *
this );
285 return (*matrix_)(row_,column_);
287 return (*matrix_)(column_,row_);
296 inline PointerType operator->()
const {
298 return &(*matrix_)(row_,column_);
300 return &(*matrix_)(column_,row_);
310 template<
typename MatrixType2 >
311 inline bool operator==(
const RowIterator<MatrixType2>& rhs )
const {
312 return ( column_ == rhs.column_ );
322 template<
typename MatrixType2 >
323 inline bool operator!=(
const RowIterator<MatrixType2>& rhs )
const {
324 return ( column_ != rhs.column_ );
334 template<
typename MatrixType2 >
335 inline bool operator<( const RowIterator<MatrixType2>& rhs )
const {
336 return ( column_ < rhs.column_ );
346 template<
typename MatrixType2 >
347 inline bool operator>(
const RowIterator<MatrixType2>& rhs )
const {
348 return ( column_ > rhs.column_ );
358 template<
typename MatrixType2 >
359 inline bool operator<=( const RowIterator<MatrixType2>& rhs )
const {
360 return ( column_ <= rhs.column_ );
370 template<
typename MatrixType2 >
371 inline bool operator>=(
const RowIterator<MatrixType2>& rhs )
const {
372 return ( column_ >= rhs.column_ );
382 inline DifferenceType
operator-(
const RowIterator& rhs )
const {
383 return ( column_ - rhs.column_ );
394 friend inline const RowIterator
operator+(
const RowIterator& it,
size_t inc ) {
395 return RowIterator( *it.matrix_, it.row_, it.column_ + inc );
406 friend inline const RowIterator
operator+(
size_t inc,
const RowIterator& it ) {
407 return RowIterator( *it.matrix_, it.row_, it.column_ + inc );
418 friend inline const RowIterator
operator-(
const RowIterator& it,
size_t dec ) {
419 return RowIterator( *it.matrix_, it.row_, it.column_ - dec );
431 template<
typename MatrixType2 >
friend class RowIterator;
439 template<
typename MatrixType >
445 typedef typename IfTrue< IsConst<MatrixType>::value
449 typedef std::random_access_iterator_tag IteratorCategory;
450 typedef RemoveReference<Reference> ValueType;
451 typedef ValueType* PointerType;
453 typedef ptrdiff_t DifferenceType;
456 typedef IteratorCategory iterator_category;
457 typedef ValueType value_type;
458 typedef PointerType pointer;
459 typedef ReferenceType reference;
460 typedef DifferenceType difference_type;
466 inline ColumnIterator()
480 inline ColumnIterator( MatrixType& matrix,
size_t row,
size_t column )
494 template<
typename MatrixType2 >
495 inline ColumnIterator(
const ColumnIterator<MatrixType2>& it )
496 : matrix_( it.matrix_ )
498 , column_( it.column_ )
510 inline ColumnIterator& operator+=(
size_t inc ) {
522 inline ColumnIterator& operator-=(
size_t dec ) {
533 inline ColumnIterator& operator++() {
544 inline const ColumnIterator operator++(
int ) {
545 const ColumnIterator tmp( *
this );
556 inline ColumnIterator& operator--() {
567 inline const ColumnIterator operator--(
int ) {
568 const ColumnIterator tmp( *
this );
581 return (*matrix_)( row_, column_ );
583 return (*matrix_)( column_, row_ );
592 inline PointerType operator->()
const {
594 return &(*matrix_)( row_, column_ );
596 return &(*matrix_)( column_, row_ );
606 template<
typename MatrixType2 >
607 inline bool operator==(
const ColumnIterator<MatrixType2>& rhs )
const {
608 return ( row_ == rhs.row_ );
618 template<
typename MatrixType2 >
619 inline bool operator!=(
const ColumnIterator<MatrixType2>& rhs )
const {
620 return ( row_ != rhs.row_ );
630 template<
typename MatrixType2 >
631 inline bool operator<( const ColumnIterator<MatrixType2>& rhs )
const {
632 return ( row_ < rhs.row_ );
642 template<
typename MatrixType2 >
643 inline bool operator>(
const ColumnIterator<MatrixType2>& rhs )
const {
644 return ( row_ > rhs.row_ );
654 template<
typename MatrixType2 >
655 inline bool operator<=( const ColumnIterator<MatrixType2>& rhs )
const {
656 return ( row_ <= rhs.row_ );
666 template<
typename MatrixType2 >
667 inline bool operator>=(
const ColumnIterator<MatrixType2>& rhs )
const {
668 return ( row_ >= rhs.row_ );
678 inline DifferenceType
operator-(
const ColumnIterator& rhs )
const {
679 return ( row_ - rhs.row_ );
690 friend inline const ColumnIterator
operator+(
const ColumnIterator& it,
size_t inc ) {
691 return ColumnIterator( *it.matrix_, it.row_ + inc, it.column_ );
702 friend inline const ColumnIterator
operator+(
size_t inc,
const ColumnIterator& it ) {
703 return ColumnIterator( *it.matrix_, it.row_ + inc, it.column_ );
714 friend inline const ColumnIterator
operator-(
const ColumnIterator& it,
size_t dec ) {
715 return ColumnIterator( *it.matrix_, it.row_ - dec, it.column_ );
727 template<
typename MatrixType2 >
friend class ColumnIterator;
734 typedef typename IfTrue< SO, ColumnIterator<MT>, RowIterator<MT> >::Type
Iterator;
737 typedef typename IfTrue< SO, ColumnIterator<const MT>, RowIterator<const MT> >::Type
ConstIterator;
742 enum { vectorizable = 0 };
745 enum { smpAssignable = 0 };
751 explicit inline SymmetricMatrix();
752 explicit inline SymmetricMatrix(
size_t n );
754 inline SymmetricMatrix(
const SymmetricMatrix& m );
755 template<
typename MT2 >
inline SymmetricMatrix(
const Matrix<MT2,SO>& m );
756 template<
typename MT2 >
inline SymmetricMatrix(
const Matrix<MT2,!SO>& m );
767 inline Reference operator()(
size_t i,
size_t j );
769 inline ConstPointer data ()
const;
770 inline ConstPointer data (
size_t i )
const;
783 inline SymmetricMatrix& operator=(
const SymmetricMatrix& rhs );
785 template<
typename MT2 >
786 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
787 operator=(
const Matrix<MT2,SO>& rhs );
789 template<
typename MT2 >
790 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
791 operator=(
const Matrix<MT2,SO>& rhs );
793 template<
typename MT2 >
794 inline SymmetricMatrix& operator=(
const Matrix<MT2,!SO>& rhs );
796 template<
typename MT2 >
797 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
798 operator+=(
const Matrix<MT2,SO>& rhs );
800 template<
typename MT2 >
801 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
802 operator+=(
const Matrix<MT2,SO>& rhs );
804 template<
typename MT2 >
805 inline SymmetricMatrix& operator+=(
const Matrix<MT2,!SO>& rhs );
807 template<
typename MT2 >
808 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
809 operator-=(
const Matrix<MT2,SO>& rhs );
811 template<
typename MT2 >
812 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
813 operator-=(
const Matrix<MT2,SO>& rhs );
815 template<
typename MT2 >
816 inline SymmetricMatrix& operator-=(
const Matrix<MT2,!SO>& rhs );
818 template<
typename MT2,
bool SO2 >
819 inline SymmetricMatrix& operator*=(
const Matrix<MT2,SO2>& rhs );
821 template<
typename Other >
822 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix >::Type&
823 operator*=( Other rhs );
825 template<
typename Other >
826 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix >::Type&
827 operator/=( Other rhs );
834 inline size_t rows()
const;
838 inline size_t capacity(
size_t i )
const;
840 inline size_t nonZeros(
size_t i )
const;
842 inline void reset(
size_t i );
844 void resize (
size_t n,
bool preserve=
true );
845 inline void extend (
size_t n,
bool preserve=
true );
846 inline void reserve(
size_t elements );
847 inline SymmetricMatrix& transpose();
848 template<
typename Other >
inline SymmetricMatrix& scale(
const Other& scalar );
849 inline void swap( SymmetricMatrix& m ) ;
857 inline bool isLowerOrUpper();
865 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
866 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
868 inline bool isAligned ()
const;
869 inline bool canSMPAssign()
const;
877 template<
typename MT2 >
inline void assign ( DenseMatrix <MT2,SO>& rhs );
878 template<
typename MT2 >
inline void assign (
const DenseMatrix <MT2,SO>& rhs );
879 template<
typename MT2 >
inline void assign (
const SparseMatrix<MT2,SO>& rhs );
880 template<
typename MT2 >
inline void addAssign(
const DenseMatrix <MT2,SO>& rhs );
881 template<
typename MT2 >
inline void addAssign(
const SparseMatrix<MT2,SO>& rhs );
882 template<
typename MT2 >
inline void subAssign(
const DenseMatrix <MT2,SO>& rhs );
883 template<
typename MT2 >
inline void subAssign(
const SparseMatrix<MT2,SO>& rhs );
895 template<
typename MT2,
bool SO2,
bool DF2,
bool NF2 >
896 friend bool isDefault(
const SymmetricMatrix<MT2,SO2,DF2,NF2>& m );
931 template<
typename MT
933 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix()
948 template<
typename MT
950 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix(
size_t n )
967 template<
typename MT
969 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix(
const SymmetricMatrix& m )
970 : matrix_( m.matrix_ )
989 template<
typename MT
991 template<
typename MT2 >
992 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix(
const Matrix<MT2,SO>& m )
997 typedef typename RemoveAdaptor<typename MT2::ResultType>::Type RT;
998 typedef typename If< IsComputation<MT2>, RT,
const MT2& >::Type Tmp;
1000 if( IsLower<MT2>::value || IsUpper<MT2>::value )
1001 throw std::invalid_argument(
"Invalid setup of symmetric matrix" );
1003 if( IsSymmetric<MT2>::value ) {
1011 throw std::invalid_argument(
"Invalid setup of symmetric matrix" );
1013 resize( matrix_, tmp.rows(), tmp.rows() );
1034 template<
typename MT
1036 template<
typename MT2 >
1037 inline SymmetricMatrix<MT,SO,true,false>::SymmetricMatrix(
const Matrix<MT2,!SO>& m )
1042 typedef typename RemoveAdaptor<typename MT2::ResultType>::Type RT;
1043 typedef typename If< IsComputation<MT2>, RT,
const MT2& >::Type Tmp;
1045 if( IsLower<MT2>::value || IsUpper<MT2>::value )
1046 throw std::invalid_argument(
"Invalid setup of symmetric matrix" );
1048 if( IsSymmetric<MT2>::value ) {
1056 throw std::invalid_argument(
"Invalid setup of symmetric matrix" );
1058 resize( matrix_, tmp.rows(), tmp.rows() );
1089 template<
typename MT
1092 SymmetricMatrix<MT,SO,true,false>::operator()(
size_t i,
size_t j )
1097 if( ( !SO && i > j ) || ( SO && i < j ) )
1098 return matrix_(i,j);
1100 return matrix_(j,i);
1118 template<
typename MT
1121 SymmetricMatrix<MT,SO,true,false>::operator()(
size_t i,
size_t j )
const
1126 if( ( !SO && i > j ) || ( SO && i < j ) )
1127 return matrix_(i,j);
1129 return matrix_(j,i);
1149 template<
typename MT
1151 inline typename SymmetricMatrix<MT,SO,true,false>::ConstPointer
1152 SymmetricMatrix<MT,SO,true,false>::data()
const
1154 return matrix_.data();
1171 template<
typename MT
1173 inline typename SymmetricMatrix<MT,SO,true,false>::ConstPointer
1174 SymmetricMatrix<MT,SO,true,false>::data(
size_t i )
const
1176 return matrix_.data(i);
1194 template<
typename MT
1200 return Iterator( matrix_, 0UL, i );
1202 return Iterator( matrix_, i, 0UL );
1220 template<
typename MT
1246 template<
typename MT
1272 template<
typename MT
1298 template<
typename MT
1324 template<
typename MT
1356 template<
typename MT
1358 inline SymmetricMatrix<MT,SO,true,false>&
1359 SymmetricMatrix<MT,SO,true,false>::operator=(
const SymmetricMatrix& rhs )
1363 if( &rhs ==
this )
return *
this;
1365 resize( matrix_, rhs.rows(), rhs.columns() );
1391 template<
typename MT
1393 template<
typename MT2 >
1394 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >::Type
1395 SymmetricMatrix<MT,SO,true,false>::operator=(
const Matrix<MT2,SO>& rhs )
1399 if( IsLower<MT2>::value || IsUpper<MT2>::value ||
1400 ( !IsSymmetric<MT2>::value && !
isSymmetric( ~rhs ) ) )
1401 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1403 if( (~rhs).isAliased(
this ) ) {
1404 SymmetricMatrix tmp( ~rhs );
1409 if( IsSparseMatrix<MT2>::value )
1437 template<
typename MT
1439 template<
typename MT2 >
1440 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >::Type
1441 SymmetricMatrix<MT,SO,true,false>::operator=(
const Matrix<MT2,SO>& rhs )
1445 typedef typename If< IsSymmetric<MT2>
1449 if( IsLower<MT2>::value || IsUpper<MT2>::value || !
isSquare( ~rhs ) )
1450 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1454 if( !IsSymmetric<Tmp>::value && !
isSymmetric( tmp ) )
1455 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1459 resize( matrix_, tmp.rows(), tmp.columns() );
1460 if( IsSparseMatrix<Tmp>::value )
1487 template<
typename MT
1489 template<
typename MT2 >
1490 inline SymmetricMatrix<MT,SO,true,false>&
1491 SymmetricMatrix<MT,SO,true,false>::operator=(
const Matrix<MT2,!SO>& rhs )
1493 return this->operator=(
trans( ~rhs ) );
1512 template<
typename MT
1514 template<
typename MT2 >
1515 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >::Type
1516 SymmetricMatrix<MT,SO,true,false>::operator+=(
const Matrix<MT2,SO>& rhs )
1518 if( IsLower<MT2>::value || IsUpper<MT2>::value ||
1519 ( !IsSymmetric<MT2>::value && !
isSymmetric( ~rhs ) ) )
1520 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1546 template<
typename MT
1548 template<
typename MT2 >
1549 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >::Type
1550 SymmetricMatrix<MT,SO,true,false>::operator+=(
const Matrix<MT2,SO>& rhs )
1552 typedef typename If< IsSymmetric<MT2>
1556 if( IsLower<MT2>::value || IsUpper<MT2>::value || !
isSquare( ~rhs ) )
1557 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1561 if( !IsSymmetric<Tmp>::value && !
isSymmetric( tmp ) )
1562 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1591 template<
typename MT
1593 template<
typename MT2 >
1594 inline SymmetricMatrix<MT,SO,true,false>&
1595 SymmetricMatrix<MT,SO,true,false>::operator+=(
const Matrix<MT2,!SO>& rhs )
1597 return this->operator+=(
trans( ~rhs ) );
1616 template<
typename MT
1618 template<
typename MT2 >
1619 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >::Type
1620 SymmetricMatrix<MT,SO,true,false>::operator-=(
const Matrix<MT2,SO>& rhs )
1622 if( IsLower<MT2>::value || IsUpper<MT2>::value ||
1623 ( !IsSymmetric<MT2>::value && !
isSymmetric( ~rhs ) ) )
1624 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1650 template<
typename MT
1652 template<
typename MT2 >
1653 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,true,false>& >::Type
1654 SymmetricMatrix<MT,SO,true,false>::operator-=(
const Matrix<MT2,SO>& rhs )
1656 typedef typename If< IsSymmetric<MT2>
1660 if( IsLower<MT2>::value || IsUpper<MT2>::value || !
isSquare( ~rhs ) )
1661 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1665 if( !IsSymmetric<Tmp>::value && !
isSymmetric( tmp ) )
1666 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1695 template<
typename MT
1697 template<
typename MT2 >
1698 inline SymmetricMatrix<MT,SO,true,false>&
1699 SymmetricMatrix<MT,SO,true,false>::operator-=(
const Matrix<MT2,!SO>& rhs )
1701 return this->operator-=(
trans( ~rhs ) );
1719 template<
typename MT
1721 template<
typename MT2
1723 inline SymmetricMatrix<MT,SO,true,false>&
1724 SymmetricMatrix<MT,SO,true,false>::operator*=(
const Matrix<MT2,SO2>& rhs )
1728 typedef typename MultTrait<MT,typename MT2::ResultType>::Type Tmp;
1732 if( matrix_.rows() != (~rhs).
columns() )
1733 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1735 Tmp tmp( (*
this) * ~rhs );
1738 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1740 resize( matrix_, tmp.rows(), tmp.columns() );
1760 template<
typename MT
1762 template<
typename Other >
1763 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix<MT,SO,true,false> >::Type&
1764 SymmetricMatrix<MT,SO,true,false>::operator*=( Other rhs )
1767 for(
size_t j=0UL; j<
columns(); ++j )
1768 for(
size_t i=0UL; i<=j; ++i )
1769 matrix_(i,j) *= rhs;
1772 for(
size_t i=0UL; i<
rows(); ++i )
1773 for(
size_t j=0UL; j<=i; ++j )
1774 matrix_(i,j) *= rhs;
1791 template<
typename MT
1793 template<
typename Other >
1794 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix<MT,SO,true,false> >::Type&
1795 SymmetricMatrix<MT,SO,true,false>::operator/=( Other rhs )
1800 for(
size_t j=0UL; j<
columns(); ++j )
1801 for(
size_t i=0UL; i<=j; ++i )
1802 matrix_(i,j) /= rhs;
1805 for(
size_t i=0UL; i<
rows(); ++i )
1806 for(
size_t j=0UL; j<=i; ++j )
1807 matrix_(i,j) /= rhs;
1830 template<
typename MT
1834 return matrix_.rows();
1846 template<
typename MT
1850 return matrix_.columns();
1868 template<
typename MT
1872 return matrix_.spacing();
1884 template<
typename MT
1888 return matrix_.capacity();
1905 template<
typename MT
1909 return matrix_.capacity(i);
1921 template<
typename MT
1925 size_t nonzeros( 0UL );
1929 for(
size_t j=0UL; j<
columns(); ++j ) {
1930 for(
size_t i=0UL; i<j; ++i ) {
1940 for(
size_t i=0UL; i<
rows(); ++i ) {
1941 for(
size_t j=0UL; j<i; ++j ) {
1968 template<
typename MT
1972 size_t nonzeros( 0UL );
1976 for(
size_t j=0UL; j<i; ++j ) {
1980 for(
size_t j=i; j<
rows(); ++j ) {
1987 for(
size_t j=0UL; j<i; ++j ) {
1991 for(
size_t j=i; j<
rows(); ++j ) {
2009 template<
typename MT
2016 for(
size_t j=0UL; j<
columns(); ++j )
2017 for(
size_t i=0UL; i<=j; ++i )
2018 clear( matrix_(i,j) );
2021 for(
size_t i=0UL; i<
rows(); ++i )
2022 for(
size_t j=0UL; j<=i; ++j )
2023 clear( matrix_(i,j) );
2070 template<
typename MT
2095 template<
typename MT
2123 template<
typename MT
2133 const size_t oldsize( matrix_.rows() );
2135 matrix_.resize( n, n,
true );
2138 const size_t increment( n - oldsize );
2139 submatrix( matrix_, 0UL, oldsize, oldsize, increment ).reset();
2140 submatrix( matrix_, oldsize, 0UL, increment, n ).reset();
2160 template<
typename MT
2162 inline void SymmetricMatrix<MT,SO,true,false>::extend(
size_t n,
bool preserve )
2184 template<
typename MT
2186 inline void SymmetricMatrix<MT,SO,true,false>::reserve(
size_t elements )
2188 matrix_.reserve( elements );
2200 template<
typename MT
2202 inline SymmetricMatrix<MT,SO,true,false>& SymmetricMatrix<MT,SO,true,false>::transpose()
2217 template<
typename MT
2219 template<
typename Other >
2220 inline SymmetricMatrix<MT,SO,true,false>&
2221 SymmetricMatrix<MT,SO,true,false>::scale(
const Other& scalar )
2224 for(
size_t j=0UL; j<
columns(); ++j )
2225 for(
size_t i=0UL; i<=j; ++i )
2226 matrix_(i,j) *= scalar;
2229 for(
size_t i=0UL; i<
rows(); ++i )
2230 for(
size_t j=0UL; j<=i; ++j )
2231 matrix_(i,j) *= scalar;
2248 template<
typename MT
2254 swap( matrix_, m.matrix_ );
2271 template<
typename MT
2273 inline bool SymmetricMatrix<MT,SO,true,false>::isLowerOrUpper()
2300 template<
typename MT
2302 template<
typename Other >
2303 inline bool SymmetricMatrix<MT,SO,true,false>::canAlias(
const Other* alias )
const
2305 return matrix_.canAlias( alias );
2322 template<
typename MT
2324 template<
typename Other >
2325 inline bool SymmetricMatrix<MT,SO,true,false>::isAliased(
const Other* alias )
const
2327 return matrix_.isAliased( alias );
2343 template<
typename MT
2345 inline bool SymmetricMatrix<MT,SO,true,false>::isAligned()
const
2347 return matrix_.isAligned();
2364 template<
typename MT
2366 inline bool SymmetricMatrix<MT,SO,true,false>::canSMPAssign()
const
2368 return matrix_.canSMPAssign();
2386 template<
typename MT
2388 template<
typename MT2 >
2395 for(
size_t j=0UL; j<
columns(); ++j )
2396 for(
size_t i=0UL; i<=j; ++i )
2397 move( matrix_(i,j), (~rhs)(i,j) );
2400 for(
size_t i=0UL; i<
rows(); ++i )
2401 for(
size_t j=0UL; j<=i; ++j )
2402 move( matrix_(i,j), (~rhs)(i,j) );
2421 template<
typename MT
2423 template<
typename MT2 >
2430 for(
size_t j=0UL; j<
columns(); ++j )
2431 for(
size_t i=0UL; i<=j; ++i )
2432 matrix_(i,j) = (~rhs)(i,j);
2435 for(
size_t i=0UL; i<
rows(); ++i )
2436 for(
size_t j=0UL; j<=i; ++j )
2437 matrix_(i,j) = (~rhs)(i,j);
2456 template<
typename MT
2458 template<
typename MT2 >
2467 for(
size_t j=0UL; j<
columns(); ++j ) {
2468 const ConstIterator last( (~rhs).upperBound(j,j) );
2469 for( ConstIterator element=(~rhs).
begin(j); element!=last; ++element )
2470 matrix_(element->index(),j) = element->value();
2474 for(
size_t i=0UL; i<
rows(); ++i ) {
2475 const ConstIterator last( (~rhs).upperBound(i,i) );
2476 for( ConstIterator element=(~rhs).
begin(i); element!=last; ++element )
2477 matrix_(i,element->index()) = element->value();
2497 template<
typename MT
2499 template<
typename MT2 >
2506 for(
size_t j=0UL; j<
columns(); ++j )
2507 for(
size_t i=0UL; i<=j; ++i )
2508 matrix_(i,j) += (~rhs)(i,j);
2511 for(
size_t i=0UL; i<
rows(); ++i )
2512 for(
size_t j=0UL; j<=i; ++j )
2513 matrix_(i,j) += (~rhs)(i,j);
2532 template<
typename MT
2534 template<
typename MT2 >
2543 for(
size_t j=0UL; j<
columns(); ++j ) {
2544 const ConstIterator last( (~rhs).upperBound(j,j) );
2545 for( ConstIterator element=(~rhs).
begin(j); element!=last; ++element )
2546 matrix_(element->index(),j) += element->value();
2550 for(
size_t i=0UL; i<
rows(); ++i ) {
2551 const ConstIterator last( (~rhs).upperBound(i,i) );
2552 for( ConstIterator element=(~rhs).
begin(i); element!=last; ++element )
2553 matrix_(i,element->index()) += element->value();
2573 template<
typename MT
2575 template<
typename MT2 >
2582 for(
size_t j=0UL; j<
columns(); ++j )
2583 for(
size_t i=0UL; i<=j; ++i )
2584 matrix_(i,j) -= (~rhs)(i,j);
2587 for(
size_t i=0UL; i<
rows(); ++i )
2588 for(
size_t j=0UL; j<=i; ++j )
2589 matrix_(i,j) -= (~rhs)(i,j);
2608 template<
typename MT
2610 template<
typename MT2 >
2619 for(
size_t j=0UL; j<
columns(); ++j ) {
2620 const ConstIterator last( (~rhs).upperBound(j,j) );
2621 for( ConstIterator element=(~rhs).
begin(j); element!=last; ++element )
2622 matrix_(element->index(),j) -= element->value();
2626 for(
size_t i=0UL; i<
rows(); ++i ) {
2627 const ConstIterator last( (~rhs).upperBound(i,i) );
2628 for( ConstIterator element=(~rhs).
begin(i); element!=last; ++element )
2629 matrix_(i,element->index()) -= element->value();
Header file for all restructuring submatrix functions.
#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:116
Constraint on the data type.
void swap(SymmetricMatrix< MT, SO, DF, NF > &a, SymmetricMatrix< MT, SO, DF, NF > &b)
Swapping the contents of two matrices.
Definition: SymmetricMatrix.h:195
#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 UNUSED_PARAMETER function template.
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:4838
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix)
Checks if the given matrix is a square matrix.
Definition: Matrix.h:902
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:237
void move(CompressedMatrix< Type, SO > &dst, CompressedMatrix< Type, SO > &src)
Moving the contents of one compressed matrix to another.
Definition: CompressedMatrix.h:4772
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:300
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:258
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:242
#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:79
Constraint on the data type.
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:731
Constraint on the data type.
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2478
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix)
Returns the maximum capacity of the matrix.
Definition: Matrix.h:348
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:316
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:4709
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename ColumnExprTrait< MT >::Type >::Type column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:103
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
bool operator>(const NegativeAccuracy< A > &lhs, const T &rhs)
Greater-than comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:366
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2472
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:442
#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:116
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:386
Constraint on the data type.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2474
bool isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:809
Constraint on the data type.
Header file for the IsSquare type trait.
Constraint on the data type.
Header file for the DenseSubmatrix class template.
bool isDefault(const CompressedMatrix< Type, SO > &m)
Returns whether the given compressed matrix is in default state.
Definition: CompressedMatrix.h:4736
Header file for the DisableIf class template.
Header file for the multiplication trait.
Header file for the IsSymmetric type trait.
Header file for the clear shim.
Header file for the If class template.
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: StorageOrder.h:161
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4754
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2482
#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:116
Header file for the DenseMatrix base class.
BLAZE_ALWAYS_INLINE void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:635
BLAZE_ALWAYS_INLINE void clear(const NonNumericProxy< MT > &proxy)
Clearing the represented element.
Definition: NonNumericProxy.h:854
Constraint on the data type.
const DenseIterator< Type > operator+(const DenseIterator< Type > &it, ptrdiff_t inc)
Addition between a DenseIterator and an integral value.
Definition: DenseIterator.h:556
Header file for the IsLower type trait.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2475
bool isUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an upper triangular matrix.
Definition: DenseMatrix.h:890
Constraints on the storage order of matrix types.
#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:118
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:195
#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:118
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:535
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2476
Header file for the RemoveAdaptor type trait.
Header file for all forward declarations for expression class templates.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2480
Header file for the EnableIf class template.
Header file for utility functions for dense matrices.
Header file for the IsNumeric type trait.
const bool spacing
Adding an additional spacing line between two log messages.This setting gives the opportunity to add ...
Definition: Logging.h:70
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename RowExprTrait< MT >::Type >::Type row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:103
#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:116
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: StorageOrder.h:81
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2477
Header file for run time assertion macros.
BLAZE_ALWAYS_INLINE void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:742
Constraint on the data type.
Constraint on the data type.
Header file for the implementation of the base template of the SymmetricMatrix.
const DenseIterator< Type > operator-(const DenseIterator< Type > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:585
#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:118
#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:116
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2481
Header file for the isDefault shim.
BLAZE_ALWAYS_INLINE bool isDefault(const NonNumericProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: NonNumericProxy.h:874
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE void reset(const NonNumericProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: NonNumericProxy.h:833
Header file for the RemoveReference type trait.
Header file for the move shim.
SubmatrixExprTrait< MT, unaligned >::Type 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:137
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE(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:79
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:932
Header file for the IsComputation type trait class.
#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:118
bool operator==(const NegativeAccuracy< A > &lhs, const T &rhs)
Equality comparison between a NegativeAccuracy object and a floating point value. ...
Definition: Accuracy.h:249
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2473
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
Header file for basic type definitions.
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2479
Header file for the IsUpper type trait.
#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:143
Header file for the IsResizable type trait.
#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 subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:849