35 #ifndef _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_SPARSENONNUMERIC_H_
36 #define _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_SPARSENONNUMERIC_H_
105 template<
typename MT
107 class SymmetricMatrix<MT,SO,false,false>
108 :
public SparseMatrix< SymmetricMatrix<MT,SO,false,false>, SO >
117 typedef typename MT::template Rebind< SharedValue<ET> >::Other MatrixType;
122 typedef SymmetricMatrix<MT,SO,false,false>
This;
124 typedef SymmetricMatrix<OT,!SO,false,false>
OppositeType;
129 typedef NonNumericProxy<MatrixType>
Reference;
136 template<
typename ET >
139 typedef SymmetricMatrix< typename MT::template Rebind<ET>::Other > Other;
146 template<
typename IteratorType >
147 class SharedElement :
private SparseElement
151 typedef ET ValueType;
152 typedef size_t IndexType;
155 typedef SharedElement* Pointer;
156 typedef const SharedElement* ConstPointer;
164 inline SharedElement( IteratorType pos )
175 template<
typename T >
inline SharedElement& operator=(
const T& v ) {
187 template<
typename T >
inline SharedElement& operator+=(
const T& v ) {
199 template<
typename T >
inline SharedElement& operator-=(
const T& v ) {
211 template<
typename T >
inline SharedElement& operator*=(
const T& v ) {
223 template<
typename T >
inline SharedElement& operator/=(
const T& v ) {
234 inline Pointer operator->() {
244 inline ConstPointer operator->()
const {
254 inline Reference value() {
255 return *pos_->value();
264 inline ConstReference value()
const {
265 return *pos_->value();
274 inline IndexType index()
const {
275 return pos_->index();
289 template<
typename SparseElementType
290 ,
typename IteratorType >
295 typedef std::forward_iterator_tag IteratorCategory;
296 typedef SparseElementType ValueType;
297 typedef SparseElementType PointerType;
298 typedef SparseElementType ReferenceType;
299 typedef ptrdiff_t DifferenceType;
302 typedef IteratorCategory iterator_category;
303 typedef ValueType value_type;
304 typedef PointerType pointer;
305 typedef ReferenceType reference;
306 typedef DifferenceType difference_type;
312 inline SharedIterator()
322 inline SharedIterator( IteratorType pos )
332 template<
typename SparseElementType2,
typename IteratorType2 >
333 inline SharedIterator(
const SharedIterator<SparseElementType2,IteratorType2>& it )
343 inline SharedIterator& operator++() {
354 inline const SharedIterator operator++(
int ) {
355 const SharedIterator tmp( *
this );
367 return ReferenceType( pos_ );
376 inline PointerType operator->()
const {
377 return PointerType( pos_ );
387 inline bool operator==(
const SharedIterator& rhs )
const {
388 return pos_ == rhs.pos_;
398 inline bool operator!=(
const SharedIterator& rhs )
const {
399 return !( *
this == rhs );
409 inline DifferenceType
operator-(
const SharedIterator& rhs )
const {
410 return pos_ - rhs.pos_;
419 inline IteratorType base()
const {
430 template<
typename SparseElementType2,
typename IteratorType2 >
friend class SharedIterator;
437 typedef SharedIterator< SharedElement< typename MatrixType::Iterator >
442 typedef SharedIterator< const SharedElement< typename MatrixType::ConstIterator >
449 enum { smpAssignable = 0 };
455 explicit inline SymmetricMatrix();
456 explicit inline SymmetricMatrix(
size_t n );
457 explicit inline SymmetricMatrix(
size_t n,
size_t nonzeros );
458 explicit inline SymmetricMatrix(
size_t n,
const std::vector<size_t>& nonzeros );
460 inline SymmetricMatrix(
const SymmetricMatrix& m );
461 template<
typename MT2 >
inline SymmetricMatrix(
const Matrix<MT2,SO>& m );
462 template<
typename MT2 >
inline SymmetricMatrix(
const Matrix<MT2,!SO>& m );
473 inline Reference operator()(
size_t i,
size_t j );
474 inline ConstReference operator()(
size_t i,
size_t j )
const;
475 inline Reference at(
size_t i,
size_t j );
476 inline ConstReference at(
size_t i,
size_t j )
const;
477 inline Iterator
begin (
size_t i );
478 inline ConstIterator
begin (
size_t i )
const;
479 inline ConstIterator
cbegin(
size_t i )
const;
480 inline Iterator
end (
size_t i );
481 inline ConstIterator
end (
size_t i )
const;
482 inline ConstIterator
cend (
size_t i )
const;
489 inline SymmetricMatrix& operator=(
const SymmetricMatrix& rhs );
491 template<
typename MT2 >
492 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
493 operator=(
const Matrix<MT2,SO>& rhs );
495 template<
typename MT2 >
496 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
497 operator=(
const Matrix<MT2,SO>& rhs );
499 template<
typename MT2 >
500 inline SymmetricMatrix& operator=(
const Matrix<MT2,!SO>& rhs );
502 template<
typename MT2 >
503 inline SymmetricMatrix& operator+=(
const Matrix<MT2,SO>& rhs );
505 template<
typename MT2 >
506 inline SymmetricMatrix& operator+=(
const Matrix<MT2,!SO>& rhs );
508 template<
typename MT2 >
509 inline SymmetricMatrix& operator-=(
const Matrix<MT2,SO>& rhs );
511 template<
typename MT2 >
512 inline SymmetricMatrix& operator-=(
const Matrix<MT2,!SO>& rhs );
514 template<
typename MT2,
bool SO2 >
515 inline SymmetricMatrix& operator*=(
const Matrix<MT2,SO2>& rhs );
517 template<
typename Other >
518 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix >::Type&
519 operator*=( Other rhs );
521 template<
typename Other >
522 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix >::Type&
523 operator/=( Other rhs );
530 inline size_t rows()
const;
533 inline size_t capacity(
size_t i )
const;
535 inline size_t nonZeros(
size_t i )
const;
537 inline void reset(
size_t i );
539 inline Iterator
set(
size_t i,
size_t j,
const ElementType& value );
540 inline Iterator insert(
size_t i,
size_t j,
const ElementType& value );
541 inline void erase(
size_t i,
size_t j );
542 inline Iterator erase(
size_t i, Iterator pos );
543 inline Iterator erase(
size_t i, Iterator first, Iterator last );
544 inline void resize (
size_t n,
bool preserve=
true );
545 inline void reserve(
size_t nonzeros );
546 inline void reserve(
size_t i,
size_t nonzeros );
548 inline void trim(
size_t i );
551 template<
typename Other >
inline SymmetricMatrix& scale(
const Other& scalar );
552 template<
typename Other >
inline SymmetricMatrix& scaleDiagonal( Other scale );
553 inline void swap( SymmetricMatrix& m ) ;
560 inline Iterator find (
size_t i,
size_t j );
561 inline ConstIterator find (
size_t i,
size_t j )
const;
562 inline Iterator lowerBound(
size_t i,
size_t j );
563 inline ConstIterator lowerBound(
size_t i,
size_t j )
const;
564 inline Iterator upperBound(
size_t i,
size_t j );
565 inline ConstIterator upperBound(
size_t i,
size_t j )
const;
572 inline void append (
size_t i,
size_t j,
const ElementType& value,
bool check=
false );
573 inline void finalize(
size_t i );
587 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
588 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
590 inline bool canSMPAssign()
const;
598 template<
typename MT2 >
void assign( DenseMatrix<MT2,SO>& rhs );
599 template<
typename MT2 >
void assign(
const DenseMatrix<MT2,SO>& rhs );
600 template<
typename MT2 >
void assign( SparseMatrix<MT2,SO>& rhs );
601 template<
typename MT2 >
void assign(
const SparseMatrix<MT2,SO>& rhs );
613 template<
typename MT2,
bool SO2,
bool DF2,
bool NF2 >
614 friend bool isDefault(
const SymmetricMatrix<MT2,SO2,DF2,NF2>& m );
650 template<
typename MT
652 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix()
669 template<
typename MT
671 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix(
size_t n )
691 template<
typename MT
693 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix(
size_t n,
size_t nonzeros )
694 : matrix_( n, n, nonzeros )
715 template<
typename MT
717 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix(
size_t n,
const std::vector<size_t>& nonzeros )
718 : matrix_( n, n, nonzeros )
734 template<
typename MT
736 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix(
const SymmetricMatrix& m )
741 resize( matrix_, m.rows(), m.columns() );
761 template<
typename MT
763 template<
typename MT2 >
764 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix(
const Matrix<MT2,SO>& m )
769 typedef typename RemoveAdaptor<typename MT2::ResultType>::Type RT;
770 typedef typename If< IsComputation<MT2>, RT,
const MT2& >::Type Tmp;
774 if( !IsSymmetric<MT2>::value && !
isSymmetric( tmp ) ) {
778 resize( matrix_, tmp.rows(), tmp.columns() );
798 template<
typename MT
800 template<
typename MT2 >
801 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix(
const Matrix<MT2,!SO>& m )
806 typedef typename RemoveAdaptor<typename MT2::ResultType>::Type RT;
807 typedef typename If< IsComputation<MT2>, RT,
const MT2& >::Type Tmp;
811 if( !IsSymmetric<MT2>::value && !
isSymmetric( tmp ) ) {
815 resize( matrix_, tmp.rows(), tmp.columns() );
816 assign(
trans( tmp ) );
848 template<
typename MT
851 SymmetricMatrix<MT,SO,false,false>::operator()(
size_t i,
size_t j )
877 template<
typename MT
880 SymmetricMatrix<MT,SO,false,false>::operator()(
size_t i,
size_t j )
const
885 return *matrix_(i,j);
907 template<
typename MT
910 SymmetricMatrix<MT,SO,false,false>::at(
size_t i,
size_t j )
940 template<
typename MT
943 SymmetricMatrix<MT,SO,false,false>::at(
size_t i,
size_t j )
const
969 template<
typename MT
974 return Iterator( matrix_.begin(i) );
992 template<
typename MT
1015 template<
typename MT
1038 template<
typename MT
1061 template<
typename MT
1084 template<
typename MT
1113 template<
typename MT
1115 inline SymmetricMatrix<MT,SO,false,false>&
1116 SymmetricMatrix<MT,SO,false,false>::operator=(
const SymmetricMatrix& rhs )
1120 if( &rhs ==
this )
return *
this;
1122 resize( matrix_, rhs.rows(), rhs.columns() );
1149 template<
typename MT
1151 template<
typename MT2 >
1152 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,false,false>& >::Type
1153 SymmetricMatrix<MT,SO,false,false>::operator=(
const Matrix<MT2,SO>& rhs )
1157 if( !IsSymmetric<MT2>::value && !
isSymmetric( ~rhs ) ) {
1161 if( (~rhs).canAlias(
this ) ) {
1162 SymmetricMatrix tmp( ~rhs );
1194 template<
typename MT
1196 template<
typename MT2 >
1197 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,false,false>& >::Type
1198 SymmetricMatrix<MT,SO,false,false>::operator=(
const Matrix<MT2,SO>& rhs )
1202 if( !IsSquare<MT2>::value && !
isSquare( ~rhs ) ) {
1208 if( !IsSymmetric<MT2>::value && !
isSymmetric( tmp ) ) {
1212 resize( matrix_, tmp.rows(), tmp.columns() );
1239 template<
typename MT
1241 template<
typename MT2 >
1242 inline SymmetricMatrix<MT,SO,false,false>&
1243 SymmetricMatrix<MT,SO,false,false>::operator=(
const Matrix<MT2,!SO>& rhs )
1245 return this->operator=(
trans( ~rhs ) );
1264 template<
typename MT
1266 template<
typename MT2 >
1267 inline SymmetricMatrix<MT,SO,false,false>&
1268 SymmetricMatrix<MT,SO,false,false>::operator+=(
const Matrix<MT2,SO>& rhs )
1272 typedef typename AddTrait<MT,typename MT2::ResultType>::Type Tmp;
1274 if( !IsSquare<MT2>::value && !
isSquare( ~rhs ) ) {
1278 Tmp tmp( (*
this) + ~rhs );
1280 if( !IsSymmetric<Tmp>::value && !
isSymmetric( tmp ) ) {
1284 resize( matrix_, tmp.rows(), tmp.columns() );
1311 template<
typename MT
1313 template<
typename MT2 >
1314 inline SymmetricMatrix<MT,SO,false,false>&
1315 SymmetricMatrix<MT,SO,false,false>::operator+=(
const Matrix<MT2,!SO>& rhs )
1317 return this->operator+=(
trans( ~rhs ) );
1336 template<
typename MT
1338 template<
typename MT2 >
1339 inline SymmetricMatrix<MT,SO,false,false>&
1340 SymmetricMatrix<MT,SO,false,false>::operator-=(
const Matrix<MT2,SO>& rhs )
1344 typedef typename SubTrait<MT,typename MT2::ResultType>::Type Tmp;
1346 if( !IsSquare<MT2>::value && !
isSquare( ~rhs ) ) {
1350 Tmp tmp( (*
this) - ~rhs );
1352 if( !IsSymmetric<Tmp>::value && !
isSymmetric( tmp ) ) {
1356 resize( matrix_, tmp.rows(), tmp.columns() );
1383 template<
typename MT
1385 template<
typename MT2 >
1386 inline SymmetricMatrix<MT,SO,false,false>&
1387 SymmetricMatrix<MT,SO,false,false>::operator-=(
const Matrix<MT2,!SO>& rhs )
1389 return this->operator-=(
trans( ~rhs ) );
1407 template<
typename MT
1409 template<
typename MT2
1411 inline SymmetricMatrix<MT,SO,false,false>&
1412 SymmetricMatrix<MT,SO,false,false>::operator*=(
const Matrix<MT2,SO2>& rhs )
1416 typedef typename MultTrait<MT,typename MT2::ResultType>::Type Tmp;
1418 if( matrix_.rows() != (~rhs).
columns() ) {
1422 Tmp tmp( (*
this) * ~rhs );
1424 if( !IsSymmetric<Tmp>::value && !
isSymmetric( tmp ) ) {
1428 resize( matrix_, tmp.rows(), tmp.columns() );
1449 template<
typename MT
1451 template<
typename Other >
1452 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix<MT,SO,false,false> >::Type&
1453 SymmetricMatrix<MT,SO,false,false>::operator*=( Other rhs )
1455 for(
size_t i=0UL; i<
rows(); ++i ) {
1458 *element->value() *= rhs;
1475 template<
typename MT
1477 template<
typename Other >
1478 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix<MT,SO,false,false> >::Type&
1479 SymmetricMatrix<MT,SO,false,false>::operator/=( Other rhs )
1483 for(
size_t i=0UL; i<
rows(); ++i ) {
1486 *element->value() /= rhs;
1509 template<
typename MT
1513 return matrix_.rows();
1525 template<
typename MT
1529 return matrix_.columns();
1541 template<
typename MT
1545 return matrix_.capacity();
1562 template<
typename MT
1566 return matrix_.capacity(i);
1578 template<
typename MT
1582 return matrix_.nonZeros();
1600 template<
typename MT
1604 return matrix_.nonZeros(i);
1616 template<
typename MT
1666 template<
typename MT
1672 const size_t j( it->index() );
1680 matrix_.erase( j, pos );
1685 matrix_.erase( j, pos );
1703 template<
typename MT
1729 template<
typename MT
1734 SharedValue<ET> shared( value );
1737 matrix_.set( j, i, shared );
1739 return Iterator( matrix_.set( i, j, shared ) );
1760 template<
typename MT
1763 SymmetricMatrix<MT,SO,false,false>::insert(
size_t i,
size_t j,
const ElementType& value )
1765 SharedValue<ET> shared( value );
1768 matrix_.insert( j, i, shared );
1770 return Iterator( matrix_.insert( i, j, shared ) );
1786 template<
typename MT
1788 inline void SymmetricMatrix<MT,SO,false,false>::erase(
size_t i,
size_t j )
1790 matrix_.erase( i, j );
1792 matrix_.erase( j, i );
1810 template<
typename MT
1813 SymmetricMatrix<MT,SO,false,false>::erase(
size_t i,
Iterator pos )
1815 if( pos ==
end( i ) )
1818 const size_t j( pos->index() );
1821 return Iterator( matrix_.erase( i, pos.base() ) );
1825 matrix_.erase( j, matrix_.find( i, j ) );
1826 return Iterator( matrix_.erase( i, pos.base() ) );
1830 matrix_.erase( j, matrix_.find( j, i ) );
1831 return Iterator( matrix_.erase( i, pos.base() ) );
1852 template<
typename MT
1855 SymmetricMatrix<MT,SO,false,false>::erase(
size_t i,
Iterator first,
Iterator last )
1857 for(
Iterator it=first; it!=last; ++it )
1859 const size_t j( it->index() );
1866 matrix_.erase( i, j );
1870 matrix_.erase( j, i );
1874 return Iterator( matrix_.erase( i, first.base(), last.base() ) );
1895 template<
typename MT
1905 matrix_.resize( n, n,
true );
1922 template<
typename MT
1924 inline void SymmetricMatrix<MT,SO,false,false>::reserve(
size_t nonzeros )
1926 matrix_.reserve( nonzeros );
1946 template<
typename MT
1948 inline void SymmetricMatrix<MT,SO,false,false>::reserve(
size_t i,
size_t nonzeros )
1950 matrix_.reserve( i, nonzeros );
1967 template<
typename MT
1969 inline void SymmetricMatrix<MT,SO,false,false>::trim()
1989 template<
typename MT
1991 inline void SymmetricMatrix<MT,SO,false,false>::trim(
size_t i )
2005 template<
typename MT
2021 template<
typename MT
2025 for(
size_t i=0UL; i<
rows(); ++i ) {
2044 template<
typename MT
2046 template<
typename Other >
2047 inline SymmetricMatrix<MT,SO,false,false>&
2048 SymmetricMatrix<MT,SO,false,false>::scale(
const Other& scalar )
2050 for(
size_t i=0UL; i<
rows(); ++i ) {
2053 ( *element->value() ).scale( scalar );
2069 template<
typename MT
2071 template<
typename Other >
2072 inline SymmetricMatrix<MT,SO,false,false>&
2073 SymmetricMatrix<MT,SO,false,false>::scaleDiagonal( Other scalar )
2075 matrix_.scaleDiagonal( scalar );
2090 template<
typename MT
2096 swap( matrix_, m.matrix_ );
2126 template<
typename MT
2129 SymmetricMatrix<MT,SO,false,false>::find(
size_t i,
size_t j )
2131 return Iterator( matrix_.find( i, j ) );
2153 template<
typename MT
2156 SymmetricMatrix<MT,SO,false,false>::find(
size_t i,
size_t j )
const
2180 template<
typename MT
2183 SymmetricMatrix<MT,SO,false,false>::lowerBound(
size_t i,
size_t j )
2185 return Iterator( matrix_.lowerBound( i, j ) );
2207 template<
typename MT
2210 SymmetricMatrix<MT,SO,false,false>::lowerBound(
size_t i,
size_t j )
const
2234 template<
typename MT
2237 SymmetricMatrix<MT,SO,false,false>::upperBound(
size_t i,
size_t j )
2239 return Iterator( matrix_.upperBound( i, j ) );
2261 template<
typename MT
2264 SymmetricMatrix<MT,SO,false,false>::upperBound(
size_t i,
size_t j )
const
2335 template<
typename MT
2337 inline void SymmetricMatrix<MT,SO,false,false>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
2339 SharedValue<ET> shared( value );
2341 matrix_.append( i, j, shared, check );
2342 if( i != j && ( !check || !
isDefault( value ) ) )
2343 matrix_.insert( j, i, shared );
2363 template<
typename MT
2365 inline void SymmetricMatrix<MT,SO,false,false>::finalize(
size_t i )
2391 template<
typename MT
2422 template<
typename MT
2424 template<
typename Other >
2425 inline bool SymmetricMatrix<MT,SO,false,false>::canAlias(
const Other* alias )
const
2427 return matrix_.canAlias( alias );
2444 template<
typename MT
2446 template<
typename Other >
2447 inline bool SymmetricMatrix<MT,SO,false,false>::isAliased(
const Other* alias )
const
2449 return matrix_.isAliased( alias );
2466 template<
typename MT
2468 inline bool SymmetricMatrix<MT,SO,false,false>::canSMPAssign()
const
2470 return matrix_.canSMPAssign();
2488 template<
typename MT
2490 template<
typename MT2 >
2491 void SymmetricMatrix<MT,SO,false,false>::assign( DenseMatrix<MT2,SO>& rhs )
2498 std::vector<size_t> nonzeros(
rows(), 0UL );
2501 for(
size_t i=0UL; i<
rows(); ++i ) {
2506 matrix_.reserve(
sum );
2507 for(
size_t i=0UL; i<
rows(); ++i ) {
2508 matrix_.reserve( i, nonzeros[i] );
2511 for(
size_t i=0UL; i<
rows(); ++i ) {
2512 for(
size_t j=i; j<
columns(); ++j ) {
2514 SharedValue<ET> shared;
2515 move( *shared, (~rhs)(i,j) );
2516 matrix_.append( i, j, shared,
false );
2518 matrix_.append( j, i, shared,
false );
2539 template<
typename MT
2541 template<
typename MT2 >
2542 void SymmetricMatrix<MT,SO,false,false>::assign(
const DenseMatrix<MT2,SO>& rhs )
2549 std::vector<size_t> nonzeros(
rows(), 0UL );
2552 for(
size_t i=0UL; i<
rows(); ++i ) {
2557 matrix_.reserve(
sum );
2558 for(
size_t i=0UL; i<
rows(); ++i ) {
2559 matrix_.reserve( i, nonzeros[i] );
2562 for(
size_t i=0UL; i<
rows(); ++i ) {
2563 for(
size_t j=i; j<
columns(); ++j ) {
2565 const SharedValue<ET> shared( (~rhs)(i,j) );
2566 matrix_.append( i, j, shared,
false );
2568 matrix_.append( j, i, shared,
false );
2589 template<
typename MT
2591 template<
typename MT2 >
2592 void SymmetricMatrix<MT,SO,false,false>::assign( SparseMatrix<MT2,SO>& rhs )
2599 std::vector<size_t> nonzeros(
rows(), 0UL );
2602 for(
size_t i=0UL; i<
rows(); ++i ) {
2607 matrix_.reserve(
sum );
2608 for(
size_t i=0UL; i<
rows(); ++i ) {
2609 matrix_.reserve( i, nonzeros[i] );
2612 for(
size_t i=0UL; i<
rows(); ++i ) {
2613 for(
typename MT2::Iterator it=(~rhs).lowerBound(i,i); it!=(~rhs).
end(i); ++it ) {
2615 SharedValue<ET> shared;
2616 move( *shared, it->value() );
2617 matrix_.append( i, it->index(), shared, false );
2618 if( i != it->index() )
2619 matrix_.append( it->index(), i, shared, false );
2640 template<
typename MT
2642 template<
typename MT2 >
2643 void SymmetricMatrix<MT,SO,false,false>::assign(
const SparseMatrix<MT2,SO>& rhs )
2650 std::vector<size_t> nonzeros(
rows(), 0UL );
2653 for(
size_t i=0UL; i<
rows(); ++i ) {
2658 matrix_.reserve(
sum );
2659 for(
size_t i=0UL; i<
rows(); ++i ) {
2660 matrix_.reserve( i, nonzeros[i] );
2663 for(
size_t i=0UL; i<
rows(); ++i ) {
2666 const SharedValue<ET> shared( it->value() );
2667 matrix_.append( i, it->index(), shared, false );
2668 if( i != it->index() )
2669 matrix_.append( it->index(), i, shared, false );
#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
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exceptionThis macro encapsulates the default way of...
Definition: Exception.h:187
Constraint on the data type.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, simd_int16_t >::Type set(T value)
Sets all values in the vector to the given 2-byte integral value.
Definition: Set.h:73
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, 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.
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:7820
Header file for the subtraction trait.
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix)
Checks if the given matrix is a square matrix.
Definition: Matrix.h:603
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:229
void move(CompressedMatrix< Type, SO > &dst, CompressedMatrix< Type, SO > &src)
Moving the contents of one compressed matrix to another.
Definition: CompressedMatrix.h:5016
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:292
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:250
#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:81
#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:118
Constraint on the data type.
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:697
Constraint on the data type.
Header file for the SharedValue class.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix)
Returns the maximum capacity of the matrix.
Definition: Matrix.h:340
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:308
void clear(CompressedMatrix< Type, SO > &m)
Clearing the given compressed matrix.
Definition: CompressedMatrix.h:4926
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:584
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2582
#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:378
Constraint on the data type.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2584
Header file for the implementation of the base template of the SymmetricMatrix.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
Constraint on the data type.
Constraint on the data type.
Header file for the SparseMatrix base class.
Header file for utility functions for sparse matrices.
Header file for the IsSquare type trait.
Constraint on the data type.
bool isDefault(const CompressedMatrix< Type, SO > &m)
Returns whether the given compressed matrix is in default state.
Definition: CompressedMatrix.h:4953
Header file for the multiplication trait.
Header file for the IsSymmetric type trait.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the If class template.
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4998
bool isIntact(const CompressedMatrix< Type, SO > &m)
Returns whether the invariants of the given compressed matrix are intact.
Definition: CompressedMatrix.h:4980
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
#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
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
Header file for the Columns type trait.
BLAZE_ALWAYS_INLINE void conjugate(T &a)
In-place conjugation of the given value/object.
Definition: Conjugate.h:120
Constraint on the data type.
const DenseIterator< Type, AF > operator-(const DenseIterator< Type, AF > &it, ptrdiff_t inc)
Subtraction between a DenseIterator and an integral value.
Definition: DenseIterator.h:642
Header file for the SparseElement base class.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2585
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:187
#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:532
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Header file for the RemoveAdaptor type trait.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2590
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:527
Header file for the NonNumericProxy class.
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:116
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Header file for run time assertion macros.
Header file for the addition trait.
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: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:2591
Header file for the isDefault shim.
Constraint on the data type.
Constraint on the data type.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b)
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:256
BLAZE_ALWAYS_INLINE int16_t sum(const simd_int16_t &a)
Returns the sum of all elements in the 16-bit integral intrinsic vector.
Definition: Reduction.h:63
Header file for the move shim.
#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:944
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:2583
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:324
bool operator!=(const NegativeAccuracy< A > &lhs, const T &rhs)
Inequality comparison between a NegativeAccuracy object and a floating point value.
Definition: Accuracy.h:289
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:237
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2589
#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:116
Header file for exception macros.
#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
#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
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:79
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:558