35 #ifndef _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_SPARSENONNUMERIC_H_
36 #define _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_SPARSENONNUMERIC_H_
102 template<
typename MT
104 class SymmetricMatrix<MT,SO,false,false>
105 :
public SparseMatrix< SymmetricMatrix<MT,SO,false,false>, SO >
114 typedef typename MT::template Rebind< SharedValue<ET> >::Other MatrixType;
119 typedef SymmetricMatrix<MT,SO,false,false>
This;
121 typedef SymmetricMatrix<OT,!SO,false,false>
OppositeType;
126 typedef NonNumericProxy<MatrixType>
Reference;
133 template<
typename ET >
136 typedef SymmetricMatrix< typename MT::template Rebind<ET>::Other > Other;
143 template<
typename IteratorType >
144 class SharedElement :
private SparseElement
148 typedef ET ValueType;
149 typedef size_t IndexType;
152 typedef SharedElement* Pointer;
153 typedef const SharedElement* ConstPointer;
161 inline SharedElement( IteratorType pos )
172 template<
typename T >
inline SharedElement& operator=(
const T& v ) {
184 template<
typename T >
inline SharedElement& operator+=(
const T& v ) {
196 template<
typename T >
inline SharedElement& operator-=(
const T& v ) {
208 template<
typename T >
inline SharedElement& operator*=(
const T& v ) {
220 template<
typename T >
inline SharedElement& operator/=(
const T& v ) {
231 inline Pointer operator->() {
241 inline ConstPointer operator->()
const {
251 inline Reference value() {
252 return *pos_->value();
261 inline ConstReference value()
const {
262 return *pos_->value();
271 inline IndexType index()
const {
272 return pos_->index();
286 template<
typename SparseElementType
287 ,
typename IteratorType >
292 typedef std::forward_iterator_tag IteratorCategory;
293 typedef SparseElementType ValueType;
294 typedef SparseElementType PointerType;
295 typedef SparseElementType ReferenceType;
296 typedef ptrdiff_t DifferenceType;
299 typedef IteratorCategory iterator_category;
300 typedef ValueType value_type;
301 typedef PointerType pointer;
302 typedef ReferenceType reference;
303 typedef DifferenceType difference_type;
309 inline SharedIterator()
319 inline SharedIterator( IteratorType pos )
329 template<
typename SparseElementType2,
typename IteratorType2 >
330 inline SharedIterator(
const SharedIterator<SparseElementType2,IteratorType2>& it )
340 inline SharedIterator& operator++() {
351 inline const SharedIterator operator++(
int ) {
352 const SharedIterator tmp( *
this );
364 return ReferenceType( pos_ );
373 inline PointerType operator->()
const {
374 return PointerType( pos_ );
384 inline bool operator==(
const SharedIterator& rhs )
const {
385 return pos_ == rhs.pos_;
395 inline bool operator!=(
const SharedIterator& rhs )
const {
396 return !( *
this == rhs );
406 inline DifferenceType
operator-(
const SharedIterator& rhs )
const {
407 return pos_ - rhs.pos_;
416 inline IteratorType base()
const {
427 template<
typename SparseElementType2,
typename IteratorType2 >
friend class SharedIterator;
434 typedef SharedIterator< SharedElement< typename MatrixType::Iterator >
439 typedef SharedIterator< const SharedElement< typename MatrixType::ConstIterator >
446 enum { smpAssignable = 0 };
452 explicit inline SymmetricMatrix();
453 explicit inline SymmetricMatrix(
size_t n );
454 explicit inline SymmetricMatrix(
size_t n,
size_t nonzeros );
455 explicit inline SymmetricMatrix(
size_t n,
const std::vector<size_t>& nonzeros );
457 inline SymmetricMatrix(
const SymmetricMatrix& m );
458 template<
typename MT2 >
inline SymmetricMatrix(
const Matrix<MT2,SO>& m );
459 template<
typename MT2 >
inline SymmetricMatrix(
const Matrix<MT2,!SO>& m );
470 inline Reference operator()(
size_t i,
size_t j );
471 inline ConstReference operator()(
size_t i,
size_t j )
const;
472 inline Iterator
begin (
size_t i );
473 inline ConstIterator
begin (
size_t i )
const;
474 inline ConstIterator
cbegin(
size_t i )
const;
475 inline Iterator
end (
size_t i );
476 inline ConstIterator
end (
size_t i )
const;
477 inline ConstIterator
cend (
size_t i )
const;
484 inline SymmetricMatrix& operator=(
const SymmetricMatrix& rhs );
486 template<
typename MT2 >
487 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
488 operator=(
const Matrix<MT2,SO>& rhs );
490 template<
typename MT2 >
491 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix& >::Type
492 operator=(
const Matrix<MT2,SO>& rhs );
494 template<
typename MT2 >
495 inline SymmetricMatrix& operator=(
const Matrix<MT2,!SO>& rhs );
497 template<
typename MT2 >
498 inline SymmetricMatrix& operator+=(
const Matrix<MT2,SO>& rhs );
500 template<
typename MT2 >
501 inline SymmetricMatrix& operator+=(
const Matrix<MT2,!SO>& rhs );
503 template<
typename MT2 >
504 inline SymmetricMatrix& operator-=(
const Matrix<MT2,SO>& rhs );
506 template<
typename MT2 >
507 inline SymmetricMatrix& operator-=(
const Matrix<MT2,!SO>& rhs );
509 template<
typename MT2,
bool SO2 >
510 inline SymmetricMatrix& operator*=(
const Matrix<MT2,SO2>& rhs );
512 template<
typename Other >
513 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix >::Type&
514 operator*=( Other rhs );
516 template<
typename Other >
517 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix >::Type&
518 operator/=( Other rhs );
525 inline size_t rows()
const;
528 inline size_t capacity(
size_t i )
const;
530 inline size_t nonZeros(
size_t i )
const;
532 inline void reset(
size_t i );
534 inline Iterator
set(
size_t i,
size_t j,
const ElementType& value );
535 inline Iterator insert(
size_t i,
size_t j,
const ElementType& value );
536 inline void erase(
size_t i,
size_t j );
537 inline Iterator erase(
size_t i, Iterator pos );
538 inline Iterator erase(
size_t i, Iterator first, Iterator last );
539 inline void resize (
size_t n,
bool preserve=
true );
540 inline void reserve(
size_t nonzeros );
541 inline void reserve(
size_t i,
size_t nonzeros );
543 inline void trim(
size_t i );
544 inline SymmetricMatrix& transpose();
545 template<
typename Other >
inline SymmetricMatrix& scale(
const Other& scalar );
546 template<
typename Other >
inline SymmetricMatrix& scaleDiagonal( Other scale );
547 inline void swap( SymmetricMatrix& m ) ;
554 inline Iterator find (
size_t i,
size_t j );
555 inline ConstIterator find (
size_t i,
size_t j )
const;
556 inline Iterator lowerBound(
size_t i,
size_t j );
557 inline ConstIterator lowerBound(
size_t i,
size_t j )
const;
558 inline Iterator upperBound(
size_t i,
size_t j );
559 inline ConstIterator upperBound(
size_t i,
size_t j )
const;
566 inline void append (
size_t i,
size_t j,
const ElementType& value,
bool check=
false );
567 inline void finalize(
size_t i );
575 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
576 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
578 inline bool canSMPAssign()
const;
586 template<
typename MT2 >
void assign( DenseMatrix<MT2,SO>& rhs );
587 template<
typename MT2 >
void assign(
const DenseMatrix<MT2,SO>& rhs );
588 template<
typename MT2 >
void assign( SparseMatrix<MT2,SO>& rhs );
589 template<
typename MT2 >
void assign(
const SparseMatrix<MT2,SO>& rhs );
601 template<
typename MT2,
bool SO2,
bool DF2,
bool NF2 >
602 friend bool isDefault(
const SymmetricMatrix<MT2,SO2,DF2,NF2>& m );
637 template<
typename MT
639 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix()
656 template<
typename MT
658 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix(
size_t n )
678 template<
typename MT
680 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix(
size_t n,
size_t nonzeros )
681 : matrix_( n, n, nonzeros )
702 template<
typename MT
704 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix(
size_t n,
const std::vector<size_t>& nonzeros )
705 : matrix_( n, n, nonzeros )
721 template<
typename MT
723 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix(
const SymmetricMatrix& m )
728 resize( matrix_, m.rows(), m.columns() );
747 template<
typename MT
749 template<
typename MT2 >
750 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix(
const Matrix<MT2,SO>& m )
755 typedef typename RemoveAdaptor<typename MT2::ResultType>::Type RT;
756 typedef typename If< IsComputation<MT2>, RT,
const MT2& >::Type Tmp;
760 if( !IsSymmetric<MT2>::value && !
isSymmetric( tmp ) )
761 throw std::invalid_argument(
"Invalid setup of symmetric matrix" );
763 resize( matrix_, tmp.rows(), tmp.columns() );
782 template<
typename MT
784 template<
typename MT2 >
785 inline SymmetricMatrix<MT,SO,false,false>::SymmetricMatrix(
const Matrix<MT2,!SO>& m )
790 typedef typename RemoveAdaptor<typename MT2::ResultType>::Type RT;
791 typedef typename If< IsComputation<MT2>, RT,
const MT2& >::Type Tmp;
795 if( !IsSymmetric<MT2>::value && !
isSymmetric( tmp ) )
796 throw std::invalid_argument(
"Invalid setup of symmetric matrix" );
798 resize( matrix_, tmp.rows(), tmp.columns() );
827 template<
typename MT
830 SymmetricMatrix<MT,SO,false,false>::operator()(
size_t i,
size_t j )
853 template<
typename MT
856 SymmetricMatrix<MT,SO,false,false>::operator()(
size_t i,
size_t j )
const
861 return *matrix_(i,j);
879 template<
typename MT
884 return Iterator( matrix_.begin(i) );
902 template<
typename MT
925 template<
typename MT
948 template<
typename MT
971 template<
typename MT
994 template<
typename MT
1023 template<
typename MT
1025 inline SymmetricMatrix<MT,SO,false,false>&
1026 SymmetricMatrix<MT,SO,false,false>::operator=(
const SymmetricMatrix& rhs )
1030 if( &rhs ==
this )
return *
this;
1032 resize( matrix_, rhs.rows(), rhs.columns() );
1058 template<
typename MT
1060 template<
typename MT2 >
1061 inline typename DisableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,false,false>& >::Type
1062 SymmetricMatrix<MT,SO,false,false>::operator=(
const Matrix<MT2,SO>& rhs )
1066 if( !IsSymmetric<MT2>::value && !
isSymmetric( ~rhs ) )
1067 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1069 if( (~rhs).canAlias(
this ) ) {
1070 SymmetricMatrix tmp( ~rhs );
1101 template<
typename MT
1103 template<
typename MT2 >
1104 inline typename EnableIf< IsComputation<MT2>, SymmetricMatrix<MT,SO,false,false>& >::Type
1105 SymmetricMatrix<MT,SO,false,false>::operator=(
const Matrix<MT2,SO>& rhs )
1109 if( !IsSquare<MT2>::value && !
isSquare( ~rhs ) )
1110 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1114 if( !IsSymmetric<MT2>::value && !
isSymmetric( tmp ) )
1115 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1117 resize( matrix_, tmp.rows(), tmp.columns() );
1143 template<
typename MT
1145 template<
typename MT2 >
1146 inline SymmetricMatrix<MT,SO,false,false>&
1147 SymmetricMatrix<MT,SO,false,false>::operator=(
const Matrix<MT2,!SO>& rhs )
1149 return this->operator=(
trans( ~rhs ) );
1168 template<
typename MT
1170 template<
typename MT2 >
1171 inline SymmetricMatrix<MT,SO,false,false>&
1172 SymmetricMatrix<MT,SO,false,false>::operator+=(
const Matrix<MT2,SO>& rhs )
1176 typedef typename AddTrait<MT,typename MT2::ResultType>::Type Tmp;
1178 if( !IsSquare<MT2>::value && !
isSquare( ~rhs ) )
1179 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1181 Tmp tmp( (*
this) + ~rhs );
1183 if( !IsSymmetric<Tmp>::value && !
isSymmetric( tmp ) )
1184 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1186 resize( matrix_, tmp.rows(), tmp.columns() );
1212 template<
typename MT
1214 template<
typename MT2 >
1215 inline SymmetricMatrix<MT,SO,false,false>&
1216 SymmetricMatrix<MT,SO,false,false>::operator+=(
const Matrix<MT2,!SO>& rhs )
1218 return this->operator+=(
trans( ~rhs ) );
1237 template<
typename MT
1239 template<
typename MT2 >
1240 inline SymmetricMatrix<MT,SO,false,false>&
1241 SymmetricMatrix<MT,SO,false,false>::operator-=(
const Matrix<MT2,SO>& rhs )
1245 typedef typename SubTrait<MT,typename MT2::ResultType>::Type Tmp;
1247 if( !IsSquare<MT2>::value && !
isSquare( ~rhs ) )
1248 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1250 Tmp tmp( (*
this) - ~rhs );
1252 if( !IsSymmetric<Tmp>::value && !
isSymmetric( tmp ) )
1253 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1255 resize( matrix_, tmp.rows(), tmp.columns() );
1281 template<
typename MT
1283 template<
typename MT2 >
1284 inline SymmetricMatrix<MT,SO,false,false>&
1285 SymmetricMatrix<MT,SO,false,false>::operator-=(
const Matrix<MT2,!SO>& rhs )
1287 return this->operator-=(
trans( ~rhs ) );
1305 template<
typename MT
1307 template<
typename MT2
1309 inline SymmetricMatrix<MT,SO,false,false>&
1310 SymmetricMatrix<MT,SO,false,false>::operator*=(
const Matrix<MT2,SO2>& rhs )
1314 typedef typename MultTrait<MT,typename MT2::ResultType>::Type Tmp;
1316 if( matrix_.rows() != (~rhs).
columns() )
1317 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1319 Tmp tmp( (*
this) * ~rhs );
1321 if( !IsSymmetric<Tmp>::value && !
isSymmetric( tmp ) )
1322 throw std::invalid_argument(
"Invalid assignment to symmetric matrix" );
1324 resize( matrix_, tmp.rows(), tmp.columns() );
1344 template<
typename MT
1346 template<
typename Other >
1347 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix<MT,SO,false,false> >::Type&
1348 SymmetricMatrix<MT,SO,false,false>::operator*=( Other rhs )
1350 for(
size_t i=0UL; i<
rows(); ++i ) {
1353 *element->value() *= rhs;
1370 template<
typename MT
1372 template<
typename Other >
1373 inline typename EnableIf< IsNumeric<Other>, SymmetricMatrix<MT,SO,false,false> >::Type&
1374 SymmetricMatrix<MT,SO,false,false>::operator/=( Other rhs )
1378 for(
size_t i=0UL; i<
rows(); ++i ) {
1381 *element->value() /= rhs;
1404 template<
typename MT
1408 return matrix_.rows();
1420 template<
typename MT
1424 return matrix_.columns();
1436 template<
typename MT
1440 return matrix_.capacity();
1457 template<
typename MT
1461 return matrix_.capacity(i);
1473 template<
typename MT
1477 return matrix_.nonZeros();
1495 template<
typename MT
1499 return matrix_.nonZeros(i);
1511 template<
typename MT
1561 template<
typename MT
1567 const size_t j( it->index() );
1575 matrix_.erase( j, pos );
1580 matrix_.erase( j, pos );
1598 template<
typename MT
1624 template<
typename MT
1629 SharedValue<ET> shared( value );
1632 matrix_.set( j, i, shared );
1634 return Iterator( matrix_.set( i, j, shared ) );
1655 template<
typename MT
1658 SymmetricMatrix<MT,SO,false,false>::insert(
size_t i,
size_t j,
const ElementType& value )
1660 SharedValue<ET> shared( value );
1663 matrix_.insert( j, i, shared );
1665 return Iterator( matrix_.insert( i, j, shared ) );
1681 template<
typename MT
1683 inline void SymmetricMatrix<MT,SO,false,false>::erase(
size_t i,
size_t j )
1685 matrix_.erase( i, j );
1687 matrix_.erase( j, i );
1705 template<
typename MT
1708 SymmetricMatrix<MT,SO,false,false>::erase(
size_t i,
Iterator pos )
1710 if( pos ==
end( i ) )
1713 const size_t j( pos->index() );
1716 return Iterator( matrix_.erase( i, pos.base() ) );
1720 matrix_.erase( j, matrix_.find( i, j ) );
1721 return Iterator( matrix_.erase( i, pos.base() ) );
1725 matrix_.erase( j, matrix_.find( j, i ) );
1726 return Iterator( matrix_.erase( i, pos.base() ) );
1747 template<
typename MT
1750 SymmetricMatrix<MT,SO,false,false>::erase(
size_t i,
Iterator first,
Iterator last )
1752 for(
Iterator it=first; it!=last; ++it )
1754 const size_t j( it->index() );
1761 matrix_.erase( i, j );
1765 matrix_.erase( j, i );
1769 return Iterator( matrix_.erase( i, first.base(), last.base() ) );
1790 template<
typename MT
1800 matrix_.resize( n, n,
true );
1817 template<
typename MT
1819 inline void SymmetricMatrix<MT,SO,false,false>::reserve(
size_t nonzeros )
1821 matrix_.reserve( nonzeros );
1841 template<
typename MT
1843 inline void SymmetricMatrix<MT,SO,false,false>::reserve(
size_t i,
size_t nonzeros )
1845 matrix_.reserve( i, nonzeros );
1862 template<
typename MT
1864 inline void SymmetricMatrix<MT,SO,false,false>::trim()
1884 template<
typename MT
1886 inline void SymmetricMatrix<MT,SO,false,false>::trim(
size_t i )
1900 template<
typename MT
1902 inline SymmetricMatrix<MT,SO,false,false>& SymmetricMatrix<MT,SO,false,false>::transpose()
1917 template<
typename MT
1919 template<
typename Other >
1920 inline SymmetricMatrix<MT,SO,false,false>&
1921 SymmetricMatrix<MT,SO,false,false>::scale(
const Other& scalar )
1923 for(
size_t i=0UL; i<
rows(); ++i ) {
1926 ( *element->value() ).scale( scalar );
1942 template<
typename MT
1944 template<
typename Other >
1945 inline SymmetricMatrix<MT,SO,false,false>&
1946 SymmetricMatrix<MT,SO,false,false>::scaleDiagonal( Other scalar )
1948 matrix_.scaleDiagonal( scalar );
1963 template<
typename MT
1969 swap( matrix_, m.matrix_ );
1999 template<
typename MT
2002 SymmetricMatrix<MT,SO,false,false>::find(
size_t i,
size_t j )
2004 return Iterator( matrix_.find( i, j ) );
2026 template<
typename MT
2029 SymmetricMatrix<MT,SO,false,false>::find(
size_t i,
size_t j )
const
2053 template<
typename MT
2056 SymmetricMatrix<MT,SO,false,false>::lowerBound(
size_t i,
size_t j )
2058 return Iterator( matrix_.lowerBound( i, j ) );
2080 template<
typename MT
2083 SymmetricMatrix<MT,SO,false,false>::lowerBound(
size_t i,
size_t j )
const
2107 template<
typename MT
2110 SymmetricMatrix<MT,SO,false,false>::upperBound(
size_t i,
size_t j )
2112 return Iterator( matrix_.upperBound( i, j ) );
2134 template<
typename MT
2137 SymmetricMatrix<MT,SO,false,false>::upperBound(
size_t i,
size_t j )
const
2208 template<
typename MT
2210 inline void SymmetricMatrix<MT,SO,false,false>::append(
size_t i,
size_t j,
const ElementType& value,
bool check )
2212 SharedValue<ET> shared( value );
2214 matrix_.append( i, j, shared, check );
2215 if( i != j && ( !check || !
isDefault( value ) ) )
2216 matrix_.insert( j, i, shared );
2236 template<
typename MT
2238 inline void SymmetricMatrix<MT,SO,false,false>::finalize(
size_t i )
2265 template<
typename MT
2267 template<
typename Other >
2268 inline bool SymmetricMatrix<MT,SO,false,false>::canAlias(
const Other* alias )
const
2270 return matrix_.canAlias( alias );
2287 template<
typename MT
2289 template<
typename Other >
2290 inline bool SymmetricMatrix<MT,SO,false,false>::isAliased(
const Other* alias )
const
2292 return matrix_.isAliased( alias );
2309 template<
typename MT
2311 inline bool SymmetricMatrix<MT,SO,false,false>::canSMPAssign()
const
2313 return matrix_.canSMPAssign();
2331 template<
typename MT
2333 template<
typename MT2 >
2341 std::vector<size_t> nonzeros(
rows(), 0UL );
2344 for(
size_t i=0UL; i<
rows(); ++i ) {
2349 matrix_.reserve(
sum );
2350 for(
size_t i=0UL; i<
rows(); ++i ) {
2351 matrix_.reserve( i, nonzeros[i] );
2354 for(
size_t i=0UL; i<
rows(); ++i ) {
2355 for(
size_t j=i; j<
columns(); ++j ) {
2357 SharedValue<ET> shared;
2358 move( *shared, (~rhs)(i,j) );
2359 matrix_.append( i, j, shared,
false );
2361 matrix_.append( j, i, shared,
false );
2382 template<
typename MT
2384 template<
typename MT2 >
2392 std::vector<size_t> nonzeros(
rows(), 0UL );
2395 for(
size_t i=0UL; i<
rows(); ++i ) {
2400 matrix_.reserve(
sum );
2401 for(
size_t i=0UL; i<
rows(); ++i ) {
2402 matrix_.reserve( i, nonzeros[i] );
2405 for(
size_t i=0UL; i<
rows(); ++i ) {
2406 for(
size_t j=i; j<
columns(); ++j ) {
2408 const SharedValue<ET> shared( (~rhs)(i,j) );
2409 matrix_.append( i, j, shared,
false );
2411 matrix_.append( j, i, shared,
false );
2432 template<
typename MT
2434 template<
typename MT2 >
2442 std::vector<size_t> nonzeros(
rows(), 0UL );
2445 for(
size_t i=0UL; i<
rows(); ++i ) {
2450 matrix_.reserve(
sum );
2451 for(
size_t i=0UL; i<
rows(); ++i ) {
2452 matrix_.reserve( i, nonzeros[i] );
2455 for(
size_t i=0UL; i<
rows(); ++i ) {
2456 for(
typename MT2::Iterator it=(~rhs).lowerBound(i,i); it!=(~rhs).
end(i); ++it ) {
2458 SharedValue<ET> shared;
2459 move( *shared, it->value() );
2460 matrix_.append( i, it->index(), shared, false );
2461 if( i != it->index() )
2462 matrix_.append( it->index(), i, shared, false );
2483 template<
typename MT
2485 template<
typename MT2 >
2493 std::vector<size_t> nonzeros(
rows(), 0UL );
2496 for(
size_t i=0UL; i<
rows(); ++i ) {
2501 matrix_.reserve(
sum );
2502 for(
size_t i=0UL; i<
rows(); ++i ) {
2503 matrix_.reserve( i, nonzeros[i] );
2506 for(
size_t i=0UL; i<
rows(); ++i ) {
2509 const SharedValue<ET> shared( it->value() );
2510 matrix_.append( i, it->index(), shared, false );
2511 if( i != it->index() )
2512 matrix_.append( it->index(), i, shared, false );
BLAZE_ALWAYS_INLINE int16_t sum(const sse_int16_t &a)
Returns the sum of all elements in the 16-bit integral intrinsic vector.
Definition: Reduction.h:63
#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.
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 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:8247
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: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:4825
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
#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_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:692
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:821
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2507
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:4762
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
CompressedMatrix< Type, true > This
Type of this CompressedMatrix instance.
Definition: CompressedMatrix.h:2501
#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:2503
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:861
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:4789
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:4807
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
#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
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
Constraint on the data type.
Header file for the SparseElement base class.
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2504
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:2505
Header file for the RemoveAdaptor type trait.
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2509
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:841
Header file for the NonNumericProxy class.
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:2506
Header file for run time assertion macros.
Header file for the addition trait.
Constraint on the data type.
Constraint on the data type.
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:2510
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:200
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type set(T value)
Sets all values in the vector to the given 2-byte integral value.
Definition: Set.h:73
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:937
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:2502
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
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2508
#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
#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