Blaze 3.9
Sparse.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_ADAPTORS_STRICTLYLOWERMATRIX_SPARSE_H_
36#define _BLAZE_MATH_ADAPTORS_STRICTLYLOWERMATRIX_SPARSE_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <utility>
44#include <vector>
48#include <blaze/math/Aliases.h>
73#include <blaze/util/Assert.h>
78#include <blaze/util/EnableIf.h>
80#include <blaze/util/Types.h>
81
82
83namespace blaze {
84
85//=================================================================================================
86//
87// CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
88//
89//=================================================================================================
90
91//*************************************************************************************************
99template< typename MT // Type of the adapted sparse matrix
100 , bool SO > // Storage order of the adapted sparse matrix
101class StrictlyLowerMatrix<MT,SO,false>
102 : public SparseMatrix< StrictlyLowerMatrix<MT,SO,false>, SO >
103{
104 private:
105 //**Type definitions****************************************************************************
106 using OT = OppositeType_t<MT>;
107 using TT = TransposeType_t<MT>;
108 using ET = ElementType_t<MT>;
109 //**********************************************************************************************
110
111 public:
112 //**Type definitions****************************************************************************
113 using This = StrictlyLowerMatrix<MT,SO,false>;
114 using BaseType = SparseMatrix<This,SO>;
115 using ResultType = This;
116 using OppositeType = StrictlyLowerMatrix<OT,!SO,false>;
117 using TransposeType = StrictlyUpperMatrix<TT,!SO,false>;
118 using ElementType = ET;
119 using TagType = TagType_t<MT>;
120 using ReturnType = ReturnType_t<MT>;
121 using CompositeType = const This&;
122 using Reference = StrictlyLowerProxy<MT>;
123 using ConstReference = ConstReference_t<MT>;
124 using Iterator = Iterator_t<MT>;
125 using ConstIterator = ConstIterator_t<MT>;
126 //**********************************************************************************************
127
128 //**Rebind struct definition********************************************************************
131 template< typename NewType > // Data type of the other matrix
132 struct Rebind {
134 using Other = StrictlyLowerMatrix< typename MT::template Rebind<NewType>::Other >;
135 };
136 //**********************************************************************************************
137
138 //**Resize struct definition********************************************************************
141 template< size_t NewM // Number of rows of the other matrix
142 , size_t NewN > // Number of columns of the other matrix
143 struct Resize {
145 using Other = StrictlyLowerMatrix< typename MT::template Resize<NewM,NewN>::Other >;
146 };
147 //**********************************************************************************************
148
149 //**Compilation flags***************************************************************************
151 static constexpr bool smpAssignable = false;
152 //**********************************************************************************************
153
154 //**Constructors********************************************************************************
157 inline StrictlyLowerMatrix();
158 explicit inline StrictlyLowerMatrix( size_t n );
159 inline StrictlyLowerMatrix( size_t n, size_t nonzeros );
160 inline StrictlyLowerMatrix( size_t n, const std::vector<size_t>& nonzeros );
161 inline StrictlyLowerMatrix( initializer_list< initializer_list<ElementType> > list );
162
163 inline StrictlyLowerMatrix( const StrictlyLowerMatrix& m );
164 inline StrictlyLowerMatrix( StrictlyLowerMatrix&& m ) noexcept;
165
166 template< typename MT2, bool SO2 >
167 inline StrictlyLowerMatrix( const Matrix<MT2,SO2>& m );
169 //**********************************************************************************************
170
171 //**Destructor**********************************************************************************
174 ~StrictlyLowerMatrix() = default;
176 //**********************************************************************************************
177
178 //**Data access functions***********************************************************************
181 inline Reference operator()( size_t i, size_t j );
182 inline ConstReference operator()( size_t i, size_t j ) const;
183 inline Reference at( size_t i, size_t j );
184 inline ConstReference at( size_t i, size_t j ) const;
185 inline Iterator begin ( size_t i );
186 inline ConstIterator begin ( size_t i ) const;
187 inline ConstIterator cbegin( size_t i ) const;
188 inline Iterator end ( size_t i );
189 inline ConstIterator end ( size_t i ) const;
190 inline ConstIterator cend ( size_t i ) const;
192 //**********************************************************************************************
193
194 //**Assignment operators************************************************************************
197 inline StrictlyLowerMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
198
199 inline StrictlyLowerMatrix& operator=( const StrictlyLowerMatrix& rhs );
200 inline StrictlyLowerMatrix& operator=( StrictlyLowerMatrix&& rhs ) noexcept;
201
202 template< typename MT2, bool SO2 >
203 inline auto operator=( const Matrix<MT2,SO2>& rhs )
204 -> DisableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >;
205
206 template< typename MT2, bool SO2 >
207 inline auto operator=( const Matrix<MT2,SO2>& rhs )
208 -> EnableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >;
209
210 template< typename MT2, bool SO2 >
211 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
212 -> DisableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >;
213
214 template< typename MT2, bool SO2 >
215 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
216 -> EnableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >;
217
218 template< typename MT2, bool SO2 >
219 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
220 -> DisableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >;
221
222 template< typename MT2, bool SO2 >
223 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
224 -> EnableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >;
225
226 template< typename MT2, bool SO2 >
227 inline auto operator%=( const Matrix<MT2,SO2>& rhs ) -> StrictlyLowerMatrix&;
229 //**********************************************************************************************
230
231 //**Utility functions***************************************************************************
234 inline size_t rows() const noexcept;
235 inline size_t columns() const noexcept;
236 inline size_t capacity() const noexcept;
237 inline size_t capacity( size_t i ) const noexcept;
238 inline size_t nonZeros() const;
239 inline size_t nonZeros( size_t i ) const;
240 inline void reset();
241 inline void reset( size_t i );
242 inline void clear();
243 inline void resize ( size_t n, bool preserve=true );
244 inline void reserve( size_t nonzeros );
245 inline void reserve( size_t i, size_t nonzeros );
246 inline void trim();
247 inline void trim( size_t i );
248 inline void shrinkToFit();
249 inline void swap( StrictlyLowerMatrix& m ) noexcept;
250
251 static constexpr size_t maxNonZeros() noexcept;
252 static constexpr size_t maxNonZeros( size_t n ) noexcept;
254 //**********************************************************************************************
255
256 //**Insertion functions*************************************************************************
259 inline Iterator set ( size_t i, size_t j, const ElementType& value );
260 inline Iterator insert ( size_t i, size_t j, const ElementType& value );
261 inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
262 inline void finalize( size_t i );
264 //**********************************************************************************************
265
266 //**Erase functions*****************************************************************************
269 inline void erase( size_t i, size_t j );
270 inline Iterator erase( size_t i, Iterator pos );
271 inline Iterator erase( size_t i, Iterator first, Iterator last );
272
273 template< typename Pred >
274 inline void erase( Pred predicate );
275
276 template< typename Pred >
277 inline void erase( size_t i, Iterator first, Iterator last, Pred predicate );
279 //**********************************************************************************************
280
281 //**Lookup functions****************************************************************************
284 inline Iterator find ( size_t i, size_t j );
285 inline ConstIterator find ( size_t i, size_t j ) const;
286 inline Iterator lowerBound( size_t i, size_t j );
287 inline ConstIterator lowerBound( size_t i, size_t j ) const;
288 inline Iterator upperBound( size_t i, size_t j );
289 inline ConstIterator upperBound( size_t i, size_t j ) const;
291 //**********************************************************************************************
292
293 //**Numeric functions***************************************************************************
296 template< typename Other > inline StrictlyLowerMatrix& scale( const Other& scalar );
298 //**********************************************************************************************
299
300 //**Debugging functions*************************************************************************
303 inline bool isIntact() const noexcept;
305 //**********************************************************************************************
306
307 //**Expression template evaluation functions****************************************************
310 template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
311 template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
312
313 inline bool canSMPAssign() const noexcept;
315 //**********************************************************************************************
316
317 private:
318 //**Utility functions***************************************************************************
321 inline void resetUpper();
323 //**********************************************************************************************
324
325 //**Member variables****************************************************************************
328 MT matrix_;
330 //**********************************************************************************************
331
332 //**Friend declarations*************************************************************************
333 template< typename MT2, bool SO2, bool DF2 >
334 friend MT2& derestrict( StrictlyLowerMatrix<MT2,SO2,DF2>& m );
335 //**********************************************************************************************
336
337 //**Compile time checks*************************************************************************
352 BLAZE_STATIC_ASSERT( ( Size_v<MT,0UL> == Size_v<MT,1UL> ) );
353 //**********************************************************************************************
354};
356//*************************************************************************************************
357
358
359
360
361//=================================================================================================
362//
363// CONSTRUCTORS
364//
365//=================================================================================================
366
367//*************************************************************************************************
371template< typename MT // Type of the adapted sparse matrix
372 , bool SO > // Storage order of the adapted sparse matrix
373inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix()
374 : matrix_() // The adapted sparse matrix
375{
376 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
377}
379//*************************************************************************************************
380
381
382//*************************************************************************************************
390template< typename MT // Type of the adapted sparse matrix
391 , bool SO > // Storage order of the adapted sparse matrix
392inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n )
393 : matrix_( n, n ) // The adapted sparse matrix
394{
396
397 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
398}
400//*************************************************************************************************
401
402
403//*************************************************************************************************
413template< typename MT // Type of the adapted sparse matrix
414 , bool SO > // Storage order of the adapted sparse matrix
415inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n, size_t nonzeros )
416 : matrix_( n, n, max( nonzeros, n ) ) // The adapted sparse matrix
417{
419
420 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
421}
423//*************************************************************************************************
424
425
426//*************************************************************************************************
440template< typename MT // Type of the adapted sparse matrix
441 , bool SO > // Storage order of the adapted sparse matrix
442inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( size_t n, const std::vector<size_t>& nonzeros )
443 : matrix_( n, n, nonzeros ) // The adapted sparse matrix
444{
446
447 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
448}
450//*************************************************************************************************
451
452
453//*************************************************************************************************
477template< typename MT // Type of the adapted sparse matrix
478 , bool SO > // Storage order of the adapted sparse matrix
479inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( initializer_list< initializer_list<ElementType> > list )
480 : matrix_( list ) // The adapted sparse matrix
481{
482 if( !isStrictlyLower( matrix_ ) ) {
483 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly lower matrix" );
484 }
485
486 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
487}
489//*************************************************************************************************
490
491
492//*************************************************************************************************
498template< typename MT // Type of the adapted sparse matrix
499 , bool SO > // Storage order of the adapted sparse matrix
500inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( const StrictlyLowerMatrix& m )
501 : matrix_( m.matrix_ ) // The adapted sparse matrix
502{
503 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
504 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
505}
507//*************************************************************************************************
508
509
510//*************************************************************************************************
516template< typename MT // Type of the adapted sparse matrix
517 , bool SO > // Storage order of the adapted sparse matrix
518inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( StrictlyLowerMatrix&& m ) noexcept
519 : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
520{
521 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
522 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
523}
525//*************************************************************************************************
526
527
528//*************************************************************************************************
539template< typename MT // Type of the adapted sparse matrix
540 , bool SO > // Storage order of the adapted sparse matrix
541template< typename MT2 // Type of the foreign matrix
542 , bool SO2 > // Storage order of the foreign matrix
543inline StrictlyLowerMatrix<MT,SO,false>::StrictlyLowerMatrix( const Matrix<MT2,SO2>& m )
544 : matrix_( *m ) // The adapted sparse matrix
545{
546 if( IsUniTriangular_v<MT2> ||
547 ( !IsStrictlyLower_v<MT2> && !isStrictlyLower( matrix_ ) ) ) {
548 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly lower matrix" );
549 }
550
551 if( !IsStrictlyLower_v<MT2> )
552 resetUpper();
553
554 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
555 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
556}
558//*************************************************************************************************
559
560
561
562
563//=================================================================================================
564//
565// DATA ACCESS FUNCTIONS
566//
567//=================================================================================================
568
569//*************************************************************************************************
585template< typename MT // Type of the adapted sparse matrix
586 , bool SO > // Storage order of the adapted sparse matrix
587inline typename StrictlyLowerMatrix<MT,SO,false>::Reference
588 StrictlyLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j )
589{
590 BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
591 BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
592
593 return Reference( matrix_, i, j );
594}
596//*************************************************************************************************
597
598
599//*************************************************************************************************
615template< typename MT // Type of the adapted sparse matrix
616 , bool SO > // Storage order of the adapted sparse matrix
617inline typename StrictlyLowerMatrix<MT,SO,false>::ConstReference
618 StrictlyLowerMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
619{
620 BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
621 BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
622
623 return matrix_(i,j);
624}
626//*************************************************************************************************
627
628
629//*************************************************************************************************
646template< typename MT // Type of the adapted sparse matrix
647 , bool SO > // Storage order of the adapted sparse matrix
648inline typename StrictlyLowerMatrix<MT,SO,false>::Reference
649 StrictlyLowerMatrix<MT,SO,false>::at( size_t i, size_t j )
650{
651 if( i >= rows() ) {
652 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
653 }
654 if( j >= columns() ) {
655 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
656 }
657 return (*this)(i,j);
658}
660//*************************************************************************************************
661
662
663//*************************************************************************************************
680template< typename MT // Type of the adapted sparse matrix
681 , bool SO > // Storage order of the adapted sparse matrix
682inline typename StrictlyLowerMatrix<MT,SO,false>::ConstReference
683 StrictlyLowerMatrix<MT,SO,false>::at( size_t i, size_t j ) const
684{
685 if( i >= rows() ) {
686 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
687 }
688 if( j >= columns() ) {
689 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
690 }
691 return (*this)(i,j);
692}
694//*************************************************************************************************
695
696
697//*************************************************************************************************
709template< typename MT // Type of the adapted sparse matrix
710 , bool SO > // Storage order of the adapted sparse matrix
711inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
713{
714 return matrix_.begin(i);
715}
717//*************************************************************************************************
718
719
720//*************************************************************************************************
732template< typename MT // Type of the adapted sparse matrix
733 , bool SO > // Storage order of the adapted sparse matrix
734inline typename StrictlyLowerMatrix<MT,SO,false>::ConstIterator
736{
737 return matrix_.begin(i);
738}
740//*************************************************************************************************
741
742
743//*************************************************************************************************
755template< typename MT // Type of the adapted sparse matrix
756 , bool SO > // Storage order of the adapted sparse matrix
757inline typename StrictlyLowerMatrix<MT,SO,false>::ConstIterator
759{
760 return matrix_.cbegin(i);
761}
763//*************************************************************************************************
764
765
766//*************************************************************************************************
778template< typename MT // Type of the adapted sparse matrix
779 , bool SO > // Storage order of the adapted sparse matrix
780inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
782{
783 return matrix_.end(i);
784}
786//*************************************************************************************************
787
788
789//*************************************************************************************************
801template< typename MT // Type of the adapted sparse matrix
802 , bool SO > // Storage order of the adapted sparse matrix
803inline typename StrictlyLowerMatrix<MT,SO,false>::ConstIterator
805{
806 return matrix_.end(i);
807}
809//*************************************************************************************************
810
811
812//*************************************************************************************************
824template< typename MT // Type of the adapted sparse matrix
825 , bool SO > // Storage order of the adapted sparse matrix
826inline typename StrictlyLowerMatrix<MT,SO,false>::ConstIterator
828{
829 return matrix_.cend(i);
830}
832//*************************************************************************************************
833
834
835
836
837//=================================================================================================
838//
839// ASSIGNMENT OPERATORS
840//
841//=================================================================================================
842
843//*************************************************************************************************
868template< typename MT // Type of the adapted sparse matrix
869 , bool SO > // Storage order of the adapted sparse matrix
870inline StrictlyLowerMatrix<MT,SO,false>&
871 StrictlyLowerMatrix<MT,SO,false>::operator=( initializer_list< initializer_list<ElementType> > list )
872{
873 const InitializerMatrix<ElementType> tmp( list, list.size() );
874
875 if( !isStrictlyLower( tmp ) ) {
876 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
877 }
878
879 matrix_ = list;
880
881 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
882 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
883
884 return *this;
885}
887//*************************************************************************************************
888
889
890//*************************************************************************************************
900template< typename MT // Type of the adapted sparse matrix
901 , bool SO > // Storage order of the adapted sparse matrix
902inline StrictlyLowerMatrix<MT,SO,false>&
903 StrictlyLowerMatrix<MT,SO,false>::operator=( const StrictlyLowerMatrix& rhs )
904{
905 matrix_ = rhs.matrix_;
906
907 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
908 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
909
910 return *this;
911}
913//*************************************************************************************************
914
915
916//*************************************************************************************************
923template< typename MT // Type of the adapted sparse matrix
924 , bool SO > // Storage order of the adapted sparse matrix
925inline StrictlyLowerMatrix<MT,SO,false>&
926 StrictlyLowerMatrix<MT,SO,false>::operator=( StrictlyLowerMatrix&& rhs ) noexcept
927{
928 matrix_ = std::move( rhs.matrix_ );
929
930 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
931 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
932
933 return *this;
934}
936//*************************************************************************************************
937
938
939//*************************************************************************************************
952template< typename MT // Type of the adapted sparse matrix
953 , bool SO > // Storage order of the adapted sparse matrix
954template< typename MT2 // Type of the right-hand side matrix
955 , bool SO2 > // Storage order of the right-hand side matrix
956inline auto StrictlyLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
957 -> DisableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >
958{
959 if( IsUniTriangular_v<MT2> ||
960 ( !IsStrictlyLower_v<MT2> && !isStrictlyLower( *rhs ) ) ) {
961 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
962 }
963
964 matrix_ = decllow( *rhs );
965
966 if( !IsStrictlyLower_v<MT2> )
967 resetUpper();
968
969 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
970 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
971
972 return *this;
973}
975//*************************************************************************************************
976
977
978//*************************************************************************************************
991template< typename MT // Type of the adapted sparse matrix
992 , bool SO > // Storage order of the adapted sparse matrix
993template< typename MT2 // Type of the right-hand side matrix
994 , bool SO2 > // Storage order of the right-hand side matrix
995inline auto StrictlyLowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
996 -> EnableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >
997{
998 if( IsUniTriangular_v<MT2> || ( !IsSquare_v<MT2> && !isSquare( *rhs ) ) ) {
999 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1000 }
1001
1002 if( IsStrictlyLower_v<MT2> ) {
1003 matrix_ = *rhs;
1004 }
1005 else {
1006 MT tmp( *rhs );
1007
1008 if( !isStrictlyLower( tmp ) ) {
1009 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1010 }
1011
1012 matrix_ = std::move( tmp );
1013 }
1014
1015 if( !IsStrictlyLower_v<MT2> )
1016 resetUpper();
1017
1018 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1019 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1020
1021 return *this;
1022}
1024//*************************************************************************************************
1025
1026
1027//*************************************************************************************************
1040template< typename MT // Type of the adapted sparse matrix
1041 , bool SO > // Storage order of the adapted sparse matrix
1042template< typename MT2 // Type of the right-hand side matrix
1043 , bool SO2 > // Storage order of the right-hand side matrix
1044inline auto StrictlyLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1045 -> DisableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >
1046{
1047 if( IsUniTriangular_v<MT2> ||
1048 ( !IsStrictlyLower_v<MT2> && !isStrictlyLower( *rhs ) ) ) {
1049 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1050 }
1051
1052 matrix_ += decllow( *rhs );
1053
1054 if( !IsStrictlyLower_v<MT2> )
1055 resetUpper();
1056
1057 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1058 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1059
1060 return *this;
1061}
1063//*************************************************************************************************
1064
1065
1066//*************************************************************************************************
1079template< typename MT // Type of the adapted sparse matrix
1080 , bool SO > // Storage order of the adapted sparse matrix
1081template< typename MT2 // Type of the right-hand side matrix
1082 , bool SO2 > // Storage order of the right-hand side matrix
1083inline auto StrictlyLowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1084 -> EnableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >
1085{
1086 if( IsUniTriangular_v<MT2> || ( !IsSquare_v<MT2> && !isSquare( *rhs ) ) ) {
1087 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1088 }
1089
1090 if( IsStrictlyLower_v<MT2> ) {
1091 matrix_ += *rhs;
1092 }
1093 else {
1094 const ResultType_t<MT2> tmp( *rhs );
1095
1096 if( !isStrictlyLower( tmp ) ) {
1097 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1098 }
1099
1100 matrix_ += decllow( tmp );
1101 }
1102
1103 if( !IsStrictlyLower_v<MT2> )
1104 resetUpper();
1105
1106 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1107 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1108
1109 return *this;
1110}
1112//*************************************************************************************************
1113
1114
1115//*************************************************************************************************
1128template< typename MT // Type of the adapted sparse matrix
1129 , bool SO > // Storage order of the adapted sparse matrix
1130template< typename MT2 // Type of the right-hand side matrix
1131 , bool SO2 > // Storage order of the right-hand side matrix
1132inline auto StrictlyLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1133 -> DisableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >
1134{
1135 if( IsUniTriangular_v<MT2> ||
1136 ( !IsStrictlyLower_v<MT2> && !isStrictlyLower( *rhs ) ) ) {
1137 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1138 }
1139
1140 matrix_ -= decllow( *rhs );
1141
1142 if( !IsStrictlyLower_v<MT2> )
1143 resetUpper();
1144
1145 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1146 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1147
1148 return *this;
1149}
1151//*************************************************************************************************
1152
1153
1154//*************************************************************************************************
1167template< typename MT // Type of the adapted sparse matrix
1168 , bool SO > // Storage order of the adapted sparse matrix
1169template< typename MT2 // Type of the right-hand side matrix
1170 , bool SO2 > // Storage order of the right-hand side matrix
1171inline auto StrictlyLowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1172 -> EnableIf_t< IsComputation_v<MT2>, StrictlyLowerMatrix& >
1173{
1174 if( IsUniTriangular_v<MT2> || ( !IsSquare_v<MT2> && !isSquare( *rhs ) ) ) {
1175 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1176 }
1177
1178 if( IsStrictlyLower_v<MT2> ) {
1179 matrix_ -= *rhs;
1180 }
1181 else {
1182 const ResultType_t<MT2> tmp( *rhs );
1183
1184 if( !isStrictlyLower( tmp ) ) {
1185 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1186 }
1187
1188 matrix_ -= decllow( tmp );
1189 }
1190
1191 if( !IsStrictlyLower_v<MT2> )
1192 resetUpper();
1193
1194 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1195 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1196
1197 return *this;
1198}
1200//*************************************************************************************************
1201
1202
1203//*************************************************************************************************
1215template< typename MT // Type of the adapted sparse matrix
1216 , bool SO > // Storage order of the adapted sparse matrix
1217template< typename MT2 // Type of the right-hand side matrix
1218 , bool SO2 > // Storage order of the right-hand side matrix
1219inline auto StrictlyLowerMatrix<MT,SO,false>::operator%=( const Matrix<MT2,SO2>& rhs )
1220 -> StrictlyLowerMatrix&
1221{
1222 if( !IsSquare_v<MT2> && !isSquare( *rhs ) ) {
1223 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly lower matrix" );
1224 }
1225
1226 matrix_ %= *rhs;
1227
1228 if( !IsStrictlyLower_v<MT2> )
1229 resetUpper();
1230
1231 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1232 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1233
1234 return *this;
1235}
1237//*************************************************************************************************
1238
1239
1240
1241
1242//=================================================================================================
1243//
1244// UTILITY FUNCTIONS
1245//
1246//=================================================================================================
1247
1248//*************************************************************************************************
1254template< typename MT // Type of the adapted sparse matrix
1255 , bool SO > // Storage order of the adapted sparse matrix
1256inline size_t StrictlyLowerMatrix<MT,SO,false>::rows() const noexcept
1257{
1258 return matrix_.rows();
1259}
1261//*************************************************************************************************
1262
1263
1264//*************************************************************************************************
1270template< typename MT // Type of the adapted sparse matrix
1271 , bool SO > // Storage order of the adapted sparse matrix
1272inline size_t StrictlyLowerMatrix<MT,SO,false>::columns() const noexcept
1273{
1274 return matrix_.columns();
1275}
1277//*************************************************************************************************
1278
1279
1280//*************************************************************************************************
1286template< typename MT // Type of the adapted sparse matrix
1287 , bool SO > // Storage order of the adapted sparse matrix
1288inline size_t StrictlyLowerMatrix<MT,SO,false>::capacity() const noexcept
1289{
1290 return matrix_.capacity();
1291}
1293//*************************************************************************************************
1294
1295
1296//*************************************************************************************************
1308template< typename MT // Type of the adapted sparse matrix
1309 , bool SO > // Storage order of the adapted sparse matrix
1310inline size_t StrictlyLowerMatrix<MT,SO,false>::capacity( size_t i ) const noexcept
1311{
1312 return matrix_.capacity(i);
1313}
1315//*************************************************************************************************
1316
1317
1318//*************************************************************************************************
1324template< typename MT // Type of the adapted sparse matrix
1325 , bool SO > // Storage order of the adapted sparse matrix
1327{
1328 return matrix_.nonZeros();
1329}
1331//*************************************************************************************************
1332
1333
1334//*************************************************************************************************
1346template< typename MT // Type of the adapted sparse matrix
1347 , bool SO > // Storage order of the adapted sparse matrix
1348inline size_t StrictlyLowerMatrix<MT,SO,false>::nonZeros( size_t i ) const
1349{
1350 return matrix_.nonZeros(i);
1351}
1353//*************************************************************************************************
1354
1355
1356//*************************************************************************************************
1362template< typename MT // Type of the adapted sparse matrix
1363 , bool SO > // Storage order of the adapted sparse matrix
1365{
1366 using blaze::erase;
1367
1368 if( SO ) {
1369 for( size_t j=0UL; j<columns(); ++j ) {
1370 erase( matrix_, j, matrix_.lowerBound(j+1UL,j), matrix_.end(j) );
1371 }
1372 }
1373 else {
1374 for( size_t i=1UL; i<rows(); ++i ) {
1375 erase( matrix_, i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1376 }
1377 }
1378}
1380//*************************************************************************************************
1381
1382
1383//*************************************************************************************************
1396template< typename MT // Type of the adapted sparse matrix
1397 , bool SO > // Storage order of the adapted sparse matrix
1398inline void StrictlyLowerMatrix<MT,SO,false>::reset( size_t i )
1399{
1400 using blaze::erase;
1401
1402 if( SO ) {
1403 erase( matrix_, i, matrix_.lowerBound(i+1UL,i), matrix_.end(i) );
1404 }
1405 else {
1406 erase( matrix_, i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1407 }
1408}
1410//*************************************************************************************************
1411
1412
1413//*************************************************************************************************
1421template< typename MT // Type of the adapted sparse matrix
1422 , bool SO > // Storage order of the adapted sparse matrix
1424{
1425 matrix_.clear();
1426
1427 BLAZE_INTERNAL_ASSERT( matrix_.rows() == 0UL, "Invalid number of rows" );
1428 BLAZE_INTERNAL_ASSERT( matrix_.columns() == 0UL, "Invalid number of columns" );
1429}
1431//*************************************************************************************************
1432
1433
1434//*************************************************************************************************
1449template< typename MT // Type of the adapted sparse matrix
1450 , bool SO > // Storage order of the adapted sparse matrix
1451void StrictlyLowerMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1452{
1454
1455 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly lower matrix detected" );
1456
1457 matrix_.resize( n, n, preserve );
1458}
1460//*************************************************************************************************
1461
1462
1463//*************************************************************************************************
1474template< typename MT // Type of the adapted sparse matrix
1475 , bool SO > // Storage order of the adapted sparse matrix
1476inline void StrictlyLowerMatrix<MT,SO,false>::reserve( size_t nonzeros )
1477{
1478 matrix_.reserve( nonzeros );
1479}
1481//*************************************************************************************************
1482
1483
1484//*************************************************************************************************
1499template< typename MT // Type of the adapted sparse matrix
1500 , bool SO > // Storage order of the adapted sparse matrix
1501inline void StrictlyLowerMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1502{
1503 matrix_.reserve( i, nonzeros );
1504}
1506//*************************************************************************************************
1507
1508
1509//*************************************************************************************************
1520template< typename MT // Type of the adapted sparse matrix
1521 , bool SO > // Storage order of the adapted sparse matrix
1522inline void StrictlyLowerMatrix<MT,SO,false>::trim()
1523{
1524 matrix_.trim();
1525}
1527//*************************************************************************************************
1528
1529
1530//*************************************************************************************************
1542template< typename MT // Type of the adapted sparse matrix
1543 , bool SO > // Storage order of the adapted sparse matrix
1544inline void StrictlyLowerMatrix<MT,SO,false>::trim( size_t i )
1545{
1546 matrix_.trim( i );
1547}
1549//*************************************************************************************************
1550
1551
1552//*************************************************************************************************
1562template< typename MT // Type of the adapted sparse matrix
1563 , bool SO > // Storage order of the adapted sparse matrix
1565{
1566 matrix_.shrinkToFit();
1567}
1569//*************************************************************************************************
1570
1571
1572//*************************************************************************************************
1579template< typename MT // Type of the adapted sparse matrix
1580 , bool SO > // Storage order of the adapted sparse matrix
1581inline void StrictlyLowerMatrix<MT,SO,false>::swap( StrictlyLowerMatrix& m ) noexcept
1582{
1583 using std::swap;
1584
1585 swap( matrix_, m.matrix_ );
1586}
1588//*************************************************************************************************
1589
1590
1591//*************************************************************************************************
1603template< typename MT // Type of the adapted dense matrix
1604 , bool SO > // Storage order of the adapted dense matrix
1605constexpr size_t StrictlyLowerMatrix<MT,SO,false>::maxNonZeros() noexcept
1606{
1608
1609 return maxNonZeros( Size_v<MT,0UL> );
1610}
1612//*************************************************************************************************
1613
1614
1615//*************************************************************************************************
1625template< typename MT // Type of the adapted dense matrix
1626 , bool SO > // Storage order of the adapted dense matrix
1627constexpr size_t StrictlyLowerMatrix<MT,SO,false>::maxNonZeros( size_t n ) noexcept
1628{
1629 return ( ( n - 1UL ) * n ) / 2UL;
1630}
1632//*************************************************************************************************
1633
1634
1635//*************************************************************************************************
1641template< typename MT // Type of the adapted dense matrix
1642 , bool SO > // Storage order of the adapted dense matrix
1643inline void StrictlyLowerMatrix<MT,SO,false>::resetUpper()
1644{
1645 using blaze::erase;
1646
1647 if( SO ) {
1648 for( size_t j=1UL; j<columns(); ++j )
1649 erase( matrix_, j, matrix_.begin( j ), matrix_.lowerBound( j, j ) );
1650 }
1651 else {
1652 for( size_t i=0UL; i<rows(); ++i )
1653 erase( matrix_, i, matrix_.upperBound( i, i ), matrix_.end( i ) );
1654 }
1655}
1657//*************************************************************************************************
1658
1659
1660
1661
1662//=================================================================================================
1663//
1664// INSERTION FUNCTIONS
1665//
1666//=================================================================================================
1667
1668//*************************************************************************************************
1684template< typename MT // Type of the adapted sparse matrix
1685 , bool SO > // Storage order of the adapted sparse matrix
1686inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
1687 StrictlyLowerMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1688{
1689 if( i <= j ) {
1690 BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1691 }
1692
1693 return matrix_.set( i, j, value );
1694}
1696//*************************************************************************************************
1697
1698
1699//*************************************************************************************************
1716template< typename MT // Type of the adapted sparse matrix
1717 , bool SO > // Storage order of the adapted sparse matrix
1718inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
1719 StrictlyLowerMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1720{
1721 if( i <= j ) {
1722 BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1723 }
1724
1725 return matrix_.insert( i, j, value );
1726}
1728//*************************************************************************************************
1729
1730
1731//*************************************************************************************************
1781template< typename MT // Type of the adapted sparse matrix
1782 , bool SO > // Storage order of the adapted sparse matrix
1783inline void StrictlyLowerMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1784{
1785 if( i <= j ) {
1786 BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or upper matrix element" );
1787 }
1788
1789 matrix_.append( i, j, value, check );
1790}
1792//*************************************************************************************************
1793
1794
1795//*************************************************************************************************
1809template< typename MT // Type of the adapted sparse matrix
1810 , bool SO > // Storage order of the adapted sparse matrix
1811inline void StrictlyLowerMatrix<MT,SO,false>::finalize( size_t i )
1812{
1813 matrix_.finalize( i );
1814}
1816//*************************************************************************************************
1817
1818
1819
1820
1821//=================================================================================================
1822//
1823// ERASE FUNCTIONS
1824//
1825//=================================================================================================
1826
1827//*************************************************************************************************
1837template< typename MT // Type of the adapted sparse matrix
1838 , bool SO > // Storage order of the adapted sparse matrix
1839inline void StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, size_t j )
1840{
1841 using blaze::erase;
1842
1843 erase( matrix_, i, j );
1844}
1846//*************************************************************************************************
1847
1848
1849//*************************************************************************************************
1861template< typename MT // Type of the adapted sparse matrix
1862 , bool SO > // Storage order of the adapted sparse matrix
1863inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
1864 StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1865{
1866 using blaze::erase;
1867
1868 return erase( matrix_, i, pos );
1869}
1871//*************************************************************************************************
1872
1873
1874//*************************************************************************************************
1888template< typename MT // Type of the adapted sparse matrix
1889 , bool SO > // Storage order of the adapted sparse matrix
1890inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
1891 StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1892{
1893 using blaze::erase;
1894
1895 return erase( matrix_, i, first, last );
1896}
1898//*************************************************************************************************
1899
1900
1901//*************************************************************************************************
1923template< typename MT // Type of the adapted sparse matrix
1924 , bool SO > // Storage order of the adapted sparse matrix
1925template< typename Pred > // Type of the unary predicate
1926inline void StrictlyLowerMatrix<MT,SO,false>::erase( Pred predicate )
1927{
1928 using blaze::erase;
1929
1930 erase( matrix_, predicate );
1931
1932 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1933}
1935//*************************************************************************************************
1936
1937
1938//*************************************************************************************************
1966template< typename MT // Type of the adapted sparse matrix
1967 , bool SO > // Storage order of the adapted sparse matrix
1968template< typename Pred > // Type of the unary predicate
1969inline void StrictlyLowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last, Pred predicate )
1970{
1971 using blaze::erase;
1972
1973 erase( matrix_, i, first, last, predicate );
1974
1975 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1976}
1978//*************************************************************************************************
1979
1980
1981
1982
1983//=================================================================================================
1984//
1985// LOOKUP FUNCTIONS
1986//
1987//=================================================================================================
1988
1989//*************************************************************************************************
2005template< typename MT // Type of the adapted sparse matrix
2006 , bool SO > // Storage order of the adapted sparse matrix
2007inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
2008 StrictlyLowerMatrix<MT,SO,false>::find( size_t i, size_t j )
2009{
2010 return matrix_.find( i, j );
2011}
2013//*************************************************************************************************
2014
2015
2016//*************************************************************************************************
2032template< typename MT // Type of the adapted sparse matrix
2033 , bool SO > // Storage order of the adapted sparse matrix
2034inline typename StrictlyLowerMatrix<MT,SO,false>::ConstIterator
2035 StrictlyLowerMatrix<MT,SO,false>::find( size_t i, size_t j ) const
2036{
2037 return matrix_.find( i, j );
2038}
2040//*************************************************************************************************
2041
2042
2043//*************************************************************************************************
2059template< typename MT // Type of the adapted sparse matrix
2060 , bool SO > // Storage order of the adapted sparse matrix
2061inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
2063{
2064 return matrix_.lowerBound( i, j );
2065}
2067//*************************************************************************************************
2068
2069
2070//*************************************************************************************************
2086template< typename MT // Type of the adapted sparse matrix
2087 , bool SO > // Storage order of the adapted sparse matrix
2088inline typename StrictlyLowerMatrix<MT,SO,false>::ConstIterator
2089 StrictlyLowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
2090{
2091 return matrix_.lowerBound( i, j );
2092}
2094//*************************************************************************************************
2095
2096
2097//*************************************************************************************************
2113template< typename MT // Type of the adapted sparse matrix
2114 , bool SO > // Storage order of the adapted sparse matrix
2115inline typename StrictlyLowerMatrix<MT,SO,false>::Iterator
2117{
2118 return matrix_.upperBound( i, j );
2119}
2121//*************************************************************************************************
2122
2123
2124//*************************************************************************************************
2140template< typename MT // Type of the adapted sparse matrix
2141 , bool SO > // Storage order of the adapted sparse matrix
2142inline typename StrictlyLowerMatrix<MT,SO,false>::ConstIterator
2143 StrictlyLowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
2144{
2145 return matrix_.upperBound( i, j );
2146}
2148//*************************************************************************************************
2149
2150
2151
2152
2153//=================================================================================================
2154//
2155// NUMERIC FUNCTIONS
2156//
2157//=================================================================================================
2158
2159//*************************************************************************************************
2177template< typename MT // Type of the adapted sparse matrix
2178 , bool SO > // Storage order of the adapted sparse matrix
2179template< typename Other > // Data type of the scalar value
2180inline StrictlyLowerMatrix<MT,SO,false>&
2181 StrictlyLowerMatrix<MT,SO,false>::scale( const Other& scalar )
2182{
2183 matrix_.scale( scalar );
2184 return *this;
2185}
2187//*************************************************************************************************
2188
2189
2190
2191
2192//=================================================================================================
2193//
2194// DEBUGGING FUNCTIONS
2195//
2196//=================================================================================================
2197
2198//*************************************************************************************************
2208template< typename MT // Type of the adapted sparse matrix
2209 , bool SO > // Storage order of the adapted sparse matrix
2210inline bool StrictlyLowerMatrix<MT,SO,false>::isIntact() const noexcept
2211{
2212 using blaze::isIntact;
2213
2214 return ( isIntact( matrix_ ) && isStrictlyLower( matrix_ ) );
2215}
2217//*************************************************************************************************
2218
2219
2220
2221
2222//=================================================================================================
2223//
2224// EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2225//
2226//=================================================================================================
2227
2228//*************************************************************************************************
2239template< typename MT // Type of the adapted sparse matrix
2240 , bool SO > // Storage order of the adapted sparse matrix
2241template< typename Other > // Data type of the foreign expression
2242inline bool StrictlyLowerMatrix<MT,SO,false>::canAlias( const Other* alias ) const noexcept
2243{
2244 return matrix_.canAlias( alias );
2245}
2247//*************************************************************************************************
2248
2249
2250//*************************************************************************************************
2261template< typename MT // Type of the adapted sparse matrix
2262 , bool SO > // Storage order of the adapted sparse matrix
2263template< typename Other > // Data type of the foreign expression
2264inline bool StrictlyLowerMatrix<MT,SO,false>::isAliased( const Other* alias ) const noexcept
2265{
2266 return matrix_.isAliased( alias );
2267}
2269//*************************************************************************************************
2270
2271
2272//*************************************************************************************************
2283template< typename MT // Type of the adapted sparse matrix
2284 , bool SO > // Storage order of the adapted sparse matrix
2285inline bool StrictlyLowerMatrix<MT,SO,false>::canSMPAssign() const noexcept
2286{
2287 return matrix_.canSMPAssign();
2288}
2290//*************************************************************************************************
2291
2292} // namespace blaze
2293
2294#endif
Header file for auxiliary alias declarations.
Header file for run time assertion macros.
Constraint on the data type.
Header file for the EnableIf class template.
Constraint on the data type.
Header file for the IsComputation type trait class.
Header file for the isDefault shim.
Header file for the IsSquare type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsUniTriangular type trait.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Compile time assertion.
Constraint on the data type.
Header file for the StrictlyLowerProxy class.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the implementation of the base template of the StrictlyLowerMatrix.
Initializer list type of the Blaze library.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Header file for the implementation of a matrix representation of an initializer list.
Header file for the SparseMatrix base class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.
Definition: Volatile.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.
Definition: Pointer.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.
Definition: Const.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.
Definition: Reference.h:79
bool isStrictlyLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly lower triangular matrix.
Definition: DenseMatrix.h:2096
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1375
auto operator+=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Addition assignment operator for the addition of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:386
decltype(auto) decllow(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as lower.
Definition: DMatDeclLowExpr.h:1004
auto operator-=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Subtraction assignment operator for the subtraction of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:448
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:207
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:225
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VIEW_TYPE(T)
Constraint on the data type.
Definition: View.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Hermitian.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Upper.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.
Definition: Computation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_STATIC_TYPE(T)
Constraint on the data type.
Definition: Static.h:61
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: SparseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Lower.h:81
#define BLAZE_CONSTRAINT_MUST_BE_RESIZABLE_TYPE(T)
Constraint on the data type.
Definition: Resizable.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_TRANSFORMATION_TYPE(T)
Constraint on the data type.
Definition: Transformation.h:81
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.
Definition: StorageOrder.h:63
constexpr ptrdiff_t Size_v
Auxiliary variable template for the Size type trait.
Definition: Size.h:176
constexpr void clear(Matrix< MT, SO > &matrix)
Clearing the given matrix.
Definition: Matrix.h:960
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:628
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:644
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:730
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:562
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:692
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition: Matrix.h:806
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:660
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:1108
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:584
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:518
void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:1169
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:1383
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition: Assert.h:117
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition: Set.h:75
MT::Iterator upperBound(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Returns an iterator to the first index greater than the given index.
Definition: SparseMatrix.h:244
MT::Iterator lowerBound(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Returns an iterator to the first index not less than the given index.
Definition: SparseMatrix.h:194
MT::Iterator find(SparseMatrix< MT, SO > &sm, size_t i, size_t j)
Searches for a specific matrix element.
Definition: SparseMatrix.h:144
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.
Definition: StaticAssert.h:112
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
Header file for the exception macros of the math module.
Header file for the extended initializer_list functionality.
Header file for all adaptor forward declarations.
Constraints on the storage order of matrix types.
Header file for the Size type trait.
Header file for the SparseElement base class.
Header file for utility functions for sparse matrices.
Header file for basic type definitions.
Header file for the generic max algorithm.