Blaze 3.9
Sparse.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_ADAPTORS_LOWERMATRIX_SPARSE_H_
36#define _BLAZE_MATH_ADAPTORS_LOWERMATRIX_SPARSE_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <utility>
44#include <vector>
48#include <blaze/math/Aliases.h>
70#include <blaze/util/Assert.h>
75#include <blaze/util/EnableIf.h>
77#include <blaze/util/Types.h>
78
79
80namespace blaze {
81
82//=================================================================================================
83//
84// CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
85//
86//=================================================================================================
87
88//*************************************************************************************************
96template< typename MT // Type of the adapted sparse matrix
97 , bool SO > // Storage order of the adapted sparse matrix
98class LowerMatrix<MT,SO,false>
99 : public SparseMatrix< LowerMatrix<MT,SO,false>, SO >
100{
101 private:
102 //**Type definitions****************************************************************************
103 using OT = OppositeType_t<MT>;
104 using TT = TransposeType_t<MT>;
105 using ET = ElementType_t<MT>;
106 //**********************************************************************************************
107
108 public:
109 //**Type definitions****************************************************************************
110 using This = LowerMatrix<MT,SO,false>;
111 using BaseType = SparseMatrix<This,SO>;
112 using ResultType = This;
113 using OppositeType = LowerMatrix<OT,!SO,false>;
114 using TransposeType = UpperMatrix<TT,!SO,false>;
115 using ElementType = ET;
116 using TagType = TagType_t<MT>;
117 using ReturnType = ReturnType_t<MT>;
118 using CompositeType = const This&;
119 using Reference = LowerProxy<MT>;
120 using ConstReference = ConstReference_t<MT>;
121 using Iterator = Iterator_t<MT>;
122 using ConstIterator = ConstIterator_t<MT>;
123 //**********************************************************************************************
124
125 //**Rebind struct definition********************************************************************
128 template< typename NewType > // Data type of the other matrix
129 struct Rebind {
131 using Other = LowerMatrix< typename MT::template Rebind<NewType>::Other >;
132 };
133 //**********************************************************************************************
134
135 //**Resize struct definition********************************************************************
138 template< size_t NewM // Number of rows of the other matrix
139 , size_t NewN > // Number of columns of the other matrix
140 struct Resize {
142 using Other = LowerMatrix< typename MT::template Resize<NewM,NewN>::Other >;
143 };
144 //**********************************************************************************************
145
146 //**Compilation flags***************************************************************************
148 static constexpr bool smpAssignable = false;
149 //**********************************************************************************************
150
151 //**Constructors********************************************************************************
154 inline LowerMatrix();
155 explicit inline LowerMatrix( size_t n );
156 inline LowerMatrix( size_t n, size_t nonzeros );
157 inline LowerMatrix( size_t n, const std::vector<size_t>& nonzeros );
158 inline LowerMatrix( initializer_list< initializer_list<ElementType> > list );
159
160 inline LowerMatrix( const LowerMatrix& m );
161 inline LowerMatrix( LowerMatrix&& m ) noexcept;
162
163 template< typename MT2, bool SO2 >
164 inline LowerMatrix( const Matrix<MT2,SO2>& m );
166 //**********************************************************************************************
167
168 //**Destructor**********************************************************************************
171 ~LowerMatrix() = default;
173 //**********************************************************************************************
174
175 //**Data access functions***********************************************************************
178 inline Reference operator()( size_t i, size_t j );
179 inline ConstReference operator()( size_t i, size_t j ) const;
180 inline Reference at( size_t i, size_t j );
181 inline ConstReference at( size_t i, size_t j ) const;
182 inline Iterator begin ( size_t i );
183 inline ConstIterator begin ( size_t i ) const;
184 inline ConstIterator cbegin( size_t i ) const;
185 inline Iterator end ( size_t i );
186 inline ConstIterator end ( size_t i ) const;
187 inline ConstIterator cend ( size_t i ) const;
189 //**********************************************************************************************
190
191 //**Assignment operators************************************************************************
194 inline LowerMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
195
196 inline LowerMatrix& operator=( const LowerMatrix& rhs );
197 inline LowerMatrix& operator=( LowerMatrix&& rhs ) noexcept;
198
199 template< typename MT2, bool SO2 >
200 inline auto operator=( const Matrix<MT2,SO2>& rhs )
201 -> DisableIf_t< IsComputation_v<MT2>, LowerMatrix& >;
202
203 template< typename MT2, bool SO2 >
204 inline auto operator=( const Matrix<MT2,SO2>& rhs )
205 -> EnableIf_t< IsComputation_v<MT2>, LowerMatrix& >;
206
207 template< typename MT2, bool SO2 >
208 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
209 -> DisableIf_t< IsComputation_v<MT2>, LowerMatrix& >;
210
211 template< typename MT2, bool SO2 >
212 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
213 -> EnableIf_t< IsComputation_v<MT2>, LowerMatrix& >;
214
215 template< typename MT2, bool SO2 >
216 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
217 -> DisableIf_t< IsComputation_v<MT2>, LowerMatrix& >;
218
219 template< typename MT2, bool SO2 >
220 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
221 -> EnableIf_t< IsComputation_v<MT2>, LowerMatrix& >;
222
223 template< typename MT2, bool SO2 >
224 inline auto operator%=( const Matrix<MT2,SO2>& rhs ) -> LowerMatrix&;
226 //**********************************************************************************************
227
228 //**Utility functions***************************************************************************
231 inline size_t rows() const noexcept;
232 inline size_t columns() const noexcept;
233 inline size_t capacity() const noexcept;
234 inline size_t capacity( size_t i ) const noexcept;
235 inline size_t nonZeros() const;
236 inline size_t nonZeros( size_t i ) const;
237 inline void reset();
238 inline void reset( size_t i );
239 inline void clear();
240 inline void resize ( size_t n, bool preserve=true );
241 inline void reserve( size_t nonzeros );
242 inline void reserve( size_t i, size_t nonzeros );
243 inline void trim();
244 inline void trim( size_t i );
245 inline void shrinkToFit();
246 inline void swap( LowerMatrix& m ) noexcept;
247
248 static constexpr size_t maxNonZeros() noexcept;
249 static constexpr size_t maxNonZeros( size_t n ) noexcept;
251 //**********************************************************************************************
252
253 //**Insertion functions*************************************************************************
256 inline Iterator set ( size_t i, size_t j, const ElementType& value );
257 inline Iterator insert ( size_t i, size_t j, const ElementType& value );
258 inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
259 inline void finalize( size_t i );
261 //**********************************************************************************************
262
263 //**Erase functions*****************************************************************************
266 inline void erase( size_t i, size_t j );
267 inline Iterator erase( size_t i, Iterator pos );
268 inline Iterator erase( size_t i, Iterator first, Iterator last );
269
270 template< typename Pred >
271 inline void erase( Pred predicate );
272
273 template< typename Pred >
274 inline void erase( size_t i, Iterator first, Iterator last, Pred predicate );
276 //**********************************************************************************************
277
278 //**Lookup functions****************************************************************************
281 inline Iterator find ( size_t i, size_t j );
282 inline ConstIterator find ( size_t i, size_t j ) const;
283 inline Iterator lowerBound( size_t i, size_t j );
284 inline ConstIterator lowerBound( size_t i, size_t j ) const;
285 inline Iterator upperBound( size_t i, size_t j );
286 inline ConstIterator upperBound( size_t i, size_t j ) const;
288 //**********************************************************************************************
289
290 //**Numeric functions***************************************************************************
293 template< typename Other > inline LowerMatrix& scale( const Other& scalar );
295 //**********************************************************************************************
296
297 //**Debugging functions*************************************************************************
300 inline bool isIntact() const noexcept;
302 //**********************************************************************************************
303
304 //**Expression template evaluation functions****************************************************
307 template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
308 template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
309
310 inline bool canSMPAssign() const noexcept;
312 //**********************************************************************************************
313
314 private:
315 //**Utility functions***************************************************************************
318 inline void resetUpper();
320 //**********************************************************************************************
321
322 //**Member variables****************************************************************************
325 MT matrix_;
327 //**********************************************************************************************
328
329 //**Friend declarations*************************************************************************
330 template< typename MT2, bool SO2, bool DF2 >
331 friend MT2& derestrict( LowerMatrix<MT2,SO2,DF2>& m );
332 //**********************************************************************************************
333
334 //**Compile time checks*************************************************************************
349 BLAZE_STATIC_ASSERT( ( Size_v<MT,0UL> == Size_v<MT,1UL> ) );
350 //**********************************************************************************************
351};
353//*************************************************************************************************
354
355
356
357
358//=================================================================================================
359//
360// CONSTRUCTORS
361//
362//=================================================================================================
363
364//*************************************************************************************************
368template< typename MT // Type of the adapted sparse matrix
369 , bool SO > // Storage order of the adapted sparse matrix
370inline LowerMatrix<MT,SO,false>::LowerMatrix()
371 : matrix_() // The adapted sparse matrix
372{
373 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
374}
376//*************************************************************************************************
377
378
379//*************************************************************************************************
387template< typename MT // Type of the adapted sparse matrix
388 , bool SO > // Storage order of the adapted sparse matrix
389inline LowerMatrix<MT,SO,false>::LowerMatrix( size_t n )
390 : matrix_( n, n ) // The adapted sparse matrix
391{
393
394 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
395}
397//*************************************************************************************************
398
399
400//*************************************************************************************************
409template< typename MT // Type of the adapted sparse matrix
410 , bool SO > // Storage order of the adapted sparse matrix
411inline LowerMatrix<MT,SO,false>::LowerMatrix( size_t n, size_t nonzeros )
412 : matrix_( n, n, nonzeros ) // The adapted sparse matrix
413{
415
416 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
417}
419//*************************************************************************************************
420
421
422//*************************************************************************************************
433template< typename MT // Type of the adapted sparse matrix
434 , bool SO > // Storage order of the adapted sparse matrix
435inline LowerMatrix<MT,SO,false>::LowerMatrix( size_t n, const std::vector<size_t>& nonzeros )
436 : matrix_( n, n, nonzeros ) // The adapted sparse matrix
437{
439
440 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
441}
443//*************************************************************************************************
444
445
446//*************************************************************************************************
470template< typename MT // Type of the adapted sparse matrix
471 , bool SO > // Storage order of the adapted sparse matrix
472inline LowerMatrix<MT,SO,false>::LowerMatrix( initializer_list< initializer_list<ElementType> > list )
473 : matrix_( list ) // The adapted sparse matrix
474{
475 if( !isLower( matrix_ ) ) {
476 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of lower matrix" );
477 }
478
479 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
480}
482//*************************************************************************************************
483
484
485//*************************************************************************************************
491template< typename MT // Type of the adapted sparse matrix
492 , bool SO > // Storage order of the adapted sparse matrix
493inline LowerMatrix<MT,SO,false>::LowerMatrix( const LowerMatrix& m )
494 : matrix_( m.matrix_ ) // The adapted sparse matrix
495{
496 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
497 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
498}
500//*************************************************************************************************
501
502
503//*************************************************************************************************
509template< typename MT // Type of the adapted sparse matrix
510 , bool SO > // Storage order of the adapted sparse matrix
511inline LowerMatrix<MT,SO,false>::LowerMatrix( LowerMatrix&& m ) noexcept
512 : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
513{
514 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
515 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
516}
518//*************************************************************************************************
519
520
521//*************************************************************************************************
531template< typename MT // Type of the adapted sparse matrix
532 , bool SO > // Storage order of the adapted sparse matrix
533template< typename MT2 // Type of the foreign matrix
534 , bool SO2 > // Storage order of the foreign matrix
535inline LowerMatrix<MT,SO,false>::LowerMatrix( const Matrix<MT2,SO2>& m )
536 : matrix_( *m ) // The adapted sparse matrix
537{
538 if( !IsLower_v<MT2> && !isLower( matrix_ ) ) {
539 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of lower matrix" );
540 }
541
542 if( !IsLower_v<MT2> )
543 resetUpper();
544
545 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
546 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
547}
549//*************************************************************************************************
550
551
552
553
554//=================================================================================================
555//
556// DATA ACCESS FUNCTIONS
557//
558//=================================================================================================
559
560//*************************************************************************************************
576template< typename MT // Type of the adapted sparse matrix
577 , bool SO > // Storage order of the adapted sparse matrix
578inline typename LowerMatrix<MT,SO,false>::Reference
579 LowerMatrix<MT,SO,false>::operator()( size_t i, size_t j )
580{
581 BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
582 BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
583
584 return Reference( matrix_, i, j );
585}
587//*************************************************************************************************
588
589
590//*************************************************************************************************
606template< typename MT // Type of the adapted sparse matrix
607 , bool SO > // Storage order of the adapted sparse matrix
608inline typename LowerMatrix<MT,SO,false>::ConstReference
609 LowerMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
610{
611 BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
612 BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
613
614 return matrix_(i,j);
615}
617//*************************************************************************************************
618
619
620//*************************************************************************************************
637template< typename MT // Type of the adapted sparse matrix
638 , bool SO > // Storage order of the adapted sparse matrix
639inline typename LowerMatrix<MT,SO,false>::Reference
640 LowerMatrix<MT,SO,false>::at( size_t i, size_t j )
641{
642 if( i >= rows() ) {
643 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
644 }
645 if( j >= columns() ) {
646 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
647 }
648 return (*this)(i,j);
649}
651//*************************************************************************************************
652
653
654//*************************************************************************************************
671template< typename MT // Type of the adapted sparse matrix
672 , bool SO > // Storage order of the adapted sparse matrix
673inline typename LowerMatrix<MT,SO,false>::ConstReference
674 LowerMatrix<MT,SO,false>::at( size_t i, size_t j ) const
675{
676 if( i >= rows() ) {
677 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
678 }
679 if( j >= columns() ) {
680 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
681 }
682 return (*this)(i,j);
683}
685//*************************************************************************************************
686
687
688//*************************************************************************************************
700template< typename MT // Type of the adapted sparse matrix
701 , bool SO > // Storage order of the adapted sparse matrix
702inline typename LowerMatrix<MT,SO,false>::Iterator
704{
705 return matrix_.begin(i);
706}
708//*************************************************************************************************
709
710
711//*************************************************************************************************
723template< typename MT // Type of the adapted sparse matrix
724 , bool SO > // Storage order of the adapted sparse matrix
725inline typename LowerMatrix<MT,SO,false>::ConstIterator
726 LowerMatrix<MT,SO,false>::begin( size_t i ) const
727{
728 return matrix_.begin(i);
729}
731//*************************************************************************************************
732
733
734//*************************************************************************************************
746template< typename MT // Type of the adapted sparse matrix
747 , bool SO > // Storage order of the adapted sparse matrix
748inline typename LowerMatrix<MT,SO,false>::ConstIterator
749 LowerMatrix<MT,SO,false>::cbegin( size_t i ) const
750{
751 return matrix_.cbegin(i);
752}
754//*************************************************************************************************
755
756
757//*************************************************************************************************
769template< typename MT // Type of the adapted sparse matrix
770 , bool SO > // Storage order of the adapted sparse matrix
771inline typename LowerMatrix<MT,SO,false>::Iterator
773{
774 return matrix_.end(i);
775}
777//*************************************************************************************************
778
779
780//*************************************************************************************************
792template< typename MT // Type of the adapted sparse matrix
793 , bool SO > // Storage order of the adapted sparse matrix
794inline typename LowerMatrix<MT,SO,false>::ConstIterator
795 LowerMatrix<MT,SO,false>::end( size_t i ) const
796{
797 return matrix_.end(i);
798}
800//*************************************************************************************************
801
802
803//*************************************************************************************************
815template< typename MT // Type of the adapted sparse matrix
816 , bool SO > // Storage order of the adapted sparse matrix
817inline typename LowerMatrix<MT,SO,false>::ConstIterator
818 LowerMatrix<MT,SO,false>::cend( size_t i ) const
819{
820 return matrix_.cend(i);
821}
823//*************************************************************************************************
824
825
826
827
828//=================================================================================================
829//
830// ASSIGNMENT OPERATORS
831//
832//=================================================================================================
833
834//*************************************************************************************************
859template< typename MT // Type of the adapted sparse matrix
860 , bool SO > // Storage order of the adapted sparse matrix
861inline LowerMatrix<MT,SO,false>&
862 LowerMatrix<MT,SO,false>::operator=( initializer_list< initializer_list<ElementType> > list )
863{
864 const InitializerMatrix<ElementType> tmp( list, list.size() );
865
866 if( !isLower( tmp ) ) {
867 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
868 }
869
870 matrix_ = list;
871
872 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
873 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
874
875 return *this;
876}
878//*************************************************************************************************
879
880
881//*************************************************************************************************
891template< typename MT // Type of the adapted sparse matrix
892 , bool SO > // Storage order of the adapted sparse matrix
893inline LowerMatrix<MT,SO,false>&
894 LowerMatrix<MT,SO,false>::operator=( const LowerMatrix& rhs )
895{
896 matrix_ = rhs.matrix_;
897
898 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
899 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
900
901 return *this;
902}
904//*************************************************************************************************
905
906
907//*************************************************************************************************
914template< typename MT // Type of the adapted sparse matrix
915 , bool SO > // Storage order of the adapted sparse matrix
916inline LowerMatrix<MT,SO,false>&
917 LowerMatrix<MT,SO,false>::operator=( LowerMatrix&& rhs ) noexcept
918{
919 matrix_ = std::move( rhs.matrix_ );
920
921 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
922 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
923
924 return *this;
925}
927//*************************************************************************************************
928
929
930//*************************************************************************************************
943template< typename MT // Type of the adapted sparse matrix
944 , bool SO > // Storage order of the adapted sparse matrix
945template< typename MT2 // Type of the right-hand side matrix
946 , bool SO2 > // Storage order of the right-hand side matrix
947inline auto LowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
948 -> DisableIf_t< IsComputation_v<MT2>, LowerMatrix& >
949{
950 if( !IsLower_v<MT2> && !isLower( *rhs ) ) {
951 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
952 }
953
954 matrix_ = decllow( *rhs );
955
956 if( !IsLower_v<MT2> )
957 resetUpper();
958
959 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
960 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
961
962 return *this;
963}
965//*************************************************************************************************
966
967
968//*************************************************************************************************
981template< typename MT // Type of the adapted sparse matrix
982 , bool SO > // Storage order of the adapted sparse matrix
983template< typename MT2 // Type of the right-hand side matrix
984 , bool SO2 > // Storage order of the right-hand side matrix
985inline auto LowerMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
986 -> EnableIf_t< IsComputation_v<MT2>, LowerMatrix& >
987{
988 if( !IsSquare_v<MT2> && !isSquare( *rhs ) ) {
989 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
990 }
991
992 if( IsLower_v<MT2> ) {
993 matrix_ = *rhs;
994 }
995 else {
996 MT tmp( *rhs );
997
998 if( !isLower( tmp ) ) {
999 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1000 }
1001
1002 matrix_ = std::move( tmp );
1003 }
1004
1005 if( !IsLower_v<MT2> )
1006 resetUpper();
1007
1008 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1009 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1010
1011 return *this;
1012}
1014//*************************************************************************************************
1015
1016
1017//*************************************************************************************************
1030template< typename MT // Type of the adapted sparse matrix
1031 , bool SO > // Storage order of the adapted sparse matrix
1032template< typename MT2 // Type of the right-hand side matrix
1033 , bool SO2 > // Storage order of the right-hand side matrix
1034inline auto LowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1035 -> DisableIf_t< IsComputation_v<MT2>, LowerMatrix& >
1036{
1037 if( !IsLower_v<MT2> && !isLower( *rhs ) ) {
1038 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1039 }
1040
1041 matrix_ += decllow( *rhs );
1042
1043 if( !IsLower_v<MT2> )
1044 resetUpper();
1045
1046 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1047 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1048
1049 return *this;
1050}
1052//*************************************************************************************************
1053
1054
1055//*************************************************************************************************
1068template< typename MT // Type of the adapted sparse matrix
1069 , bool SO > // Storage order of the adapted sparse matrix
1070template< typename MT2 // Type of the right-hand side matrix
1071 , bool SO2 > // Storage order of the right-hand side matrix
1072inline auto LowerMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1073 -> EnableIf_t< IsComputation_v<MT2>, LowerMatrix& >
1074{
1075 if( !IsSquare_v<MT2> && !isSquare( *rhs ) ) {
1076 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1077 }
1078
1079 if( IsLower_v<MT2> ) {
1080 matrix_ += *rhs;
1081 }
1082 else {
1083 const ResultType_t<MT2> tmp( *rhs );
1084
1085 if( !isLower( tmp ) ) {
1086 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1087 }
1088
1089 matrix_ += decllow( tmp );
1090 }
1091
1092 if( !IsLower_v<MT2> )
1093 resetUpper();
1094
1095 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1096 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1097
1098 return *this;
1099}
1101//*************************************************************************************************
1102
1103
1104//*************************************************************************************************
1117template< typename MT // Type of the adapted sparse matrix
1118 , bool SO > // Storage order of the adapted sparse matrix
1119template< typename MT2 // Type of the right-hand side matrix
1120 , bool SO2 > // Storage order of the right-hand side matrix
1121inline auto LowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1122 -> DisableIf_t< IsComputation_v<MT2>, LowerMatrix& >
1123{
1124 if( !IsLower_v<MT2> && !isLower( *rhs ) ) {
1125 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1126 }
1127
1128 matrix_ -= decllow( *rhs );
1129
1130 if( !IsLower_v<MT2> )
1131 resetUpper();
1132
1133 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1134 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1135
1136 return *this;
1137}
1139//*************************************************************************************************
1140
1141
1142//*************************************************************************************************
1155template< typename MT // Type of the adapted sparse matrix
1156 , bool SO > // Storage order of the adapted sparse matrix
1157template< typename MT2 // Type of the right-hand side matrix
1158 , bool SO2 > // Storage order of the right-hand side matrix
1159inline auto LowerMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1160 -> EnableIf_t< IsComputation_v<MT2>, LowerMatrix& >
1161{
1162 if( !IsSquare_v<MT2> && !isSquare( *rhs ) ) {
1163 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1164 }
1165
1166 if( IsLower_v<MT2> ) {
1167 matrix_ -= *rhs;
1168 }
1169 else {
1170 const ResultType_t<MT2> tmp( *rhs );
1171
1172 if( !isLower( tmp ) ) {
1173 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1174 }
1175
1176 matrix_ -= decllow( tmp );
1177 }
1178
1179 if( !IsLower_v<MT2> )
1180 resetUpper();
1181
1182 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1183 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1184
1185 return *this;
1186}
1188//*************************************************************************************************
1189
1190
1191//*************************************************************************************************
1202template< typename MT // Type of the adapted sparse matrix
1203 , bool SO > // Storage order of the adapted sparse matrix
1204template< typename MT2 // Type of the right-hand side matrix
1205 , bool SO2 > // Storage order of the right-hand side matrix
1206inline auto LowerMatrix<MT,SO,false>::operator%=( const Matrix<MT2,SO2>& rhs )
1207 -> LowerMatrix&
1208{
1209 if( !IsSquare_v<MT2> && !isSquare( *rhs ) ) {
1210 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to lower matrix" );
1211 }
1212
1213 matrix_ %= *rhs;
1214
1215 if( !IsLower_v<MT2> )
1216 resetUpper();
1217
1218 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1219 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1220
1221 return *this;
1222}
1224//*************************************************************************************************
1225
1226
1227
1228
1229//=================================================================================================
1230//
1231// UTILITY FUNCTIONS
1232//
1233//=================================================================================================
1234
1235//*************************************************************************************************
1241template< typename MT // Type of the adapted sparse matrix
1242 , bool SO > // Storage order of the adapted sparse matrix
1243inline size_t LowerMatrix<MT,SO,false>::rows() const noexcept
1244{
1245 return matrix_.rows();
1246}
1248//*************************************************************************************************
1249
1250
1251//*************************************************************************************************
1257template< typename MT // Type of the adapted sparse matrix
1258 , bool SO > // Storage order of the adapted sparse matrix
1259inline size_t LowerMatrix<MT,SO,false>::columns() const noexcept
1260{
1261 return matrix_.columns();
1262}
1264//*************************************************************************************************
1265
1266
1267//*************************************************************************************************
1273template< typename MT // Type of the adapted sparse matrix
1274 , bool SO > // Storage order of the adapted sparse matrix
1275inline size_t LowerMatrix<MT,SO,false>::capacity() const noexcept
1276{
1277 return matrix_.capacity();
1278}
1280//*************************************************************************************************
1281
1282
1283//*************************************************************************************************
1295template< typename MT // Type of the adapted sparse matrix
1296 , bool SO > // Storage order of the adapted sparse matrix
1297inline size_t LowerMatrix<MT,SO,false>::capacity( size_t i ) const noexcept
1298{
1299 return matrix_.capacity(i);
1300}
1302//*************************************************************************************************
1303
1304
1305//*************************************************************************************************
1311template< typename MT // Type of the adapted sparse matrix
1312 , bool SO > // Storage order of the adapted sparse matrix
1313inline size_t LowerMatrix<MT,SO,false>::nonZeros() const
1314{
1315 return matrix_.nonZeros();
1316}
1318//*************************************************************************************************
1319
1320
1321//*************************************************************************************************
1333template< typename MT // Type of the adapted sparse matrix
1334 , bool SO > // Storage order of the adapted sparse matrix
1335inline size_t LowerMatrix<MT,SO,false>::nonZeros( size_t i ) const
1336{
1337 return matrix_.nonZeros(i);
1338}
1340//*************************************************************************************************
1341
1342
1343//*************************************************************************************************
1349template< typename MT // Type of the adapted sparse matrix
1350 , bool SO > // Storage order of the adapted sparse matrix
1352{
1353 matrix_.reset();
1354}
1356//*************************************************************************************************
1357
1358
1359//*************************************************************************************************
1372template< typename MT // Type of the adapted sparse matrix
1373 , bool SO > // Storage order of the adapted sparse matrix
1374inline void LowerMatrix<MT,SO,false>::reset( size_t i )
1375{
1376 matrix_.reset( i );
1377}
1379//*************************************************************************************************
1380
1381
1382//*************************************************************************************************
1390template< typename MT // Type of the adapted sparse matrix
1391 , bool SO > // Storage order of the adapted sparse matrix
1393{
1394 matrix_.clear();
1395
1396 BLAZE_INTERNAL_ASSERT( matrix_.rows() == 0UL, "Invalid number of rows" );
1397 BLAZE_INTERNAL_ASSERT( matrix_.columns() == 0UL, "Invalid number of columns" );
1398}
1400//*************************************************************************************************
1401
1402
1403//*************************************************************************************************
1418template< typename MT // Type of the adapted sparse matrix
1419 , bool SO > // Storage order of the adapted sparse matrix
1420void LowerMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1421{
1423
1424 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square lower matrix detected" );
1425
1426 matrix_.resize( n, n, preserve );
1427}
1429//*************************************************************************************************
1430
1431
1432//*************************************************************************************************
1443template< typename MT // Type of the adapted sparse matrix
1444 , bool SO > // Storage order of the adapted sparse matrix
1445inline void LowerMatrix<MT,SO,false>::reserve( size_t nonzeros )
1446{
1447 matrix_.reserve( nonzeros );
1448}
1450//*************************************************************************************************
1451
1452
1453//*************************************************************************************************
1467template< typename MT // Type of the adapted sparse matrix
1468 , bool SO > // Storage order of the adapted sparse matrix
1469inline void LowerMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1470{
1471 matrix_.reserve( i, nonzeros );
1472}
1474//*************************************************************************************************
1475
1476
1477//*************************************************************************************************
1488template< typename MT // Type of the adapted sparse matrix
1489 , bool SO > // Storage order of the adapted sparse matrix
1490inline void LowerMatrix<MT,SO,false>::trim()
1491{
1492 matrix_.trim();
1493}
1495//*************************************************************************************************
1496
1497
1498//*************************************************************************************************
1510template< typename MT // Type of the adapted sparse matrix
1511 , bool SO > // Storage order of the adapted sparse matrix
1512inline void LowerMatrix<MT,SO,false>::trim( size_t i )
1513{
1514 matrix_.trim( i );
1515}
1517//*************************************************************************************************
1518
1519
1520//*************************************************************************************************
1530template< typename MT // Type of the adapted sparse matrix
1531 , bool SO > // Storage order of the adapted sparse matrix
1533{
1534 matrix_.shrinkToFit();
1535}
1537//*************************************************************************************************
1538
1539
1540//*************************************************************************************************
1547template< typename MT // Type of the adapted sparse matrix
1548 , bool SO > // Storage order of the adapted sparse matrix
1549inline void LowerMatrix<MT,SO,false>::swap( LowerMatrix& m ) noexcept
1550{
1551 using std::swap;
1552
1553 swap( matrix_, m.matrix_ );
1554}
1556//*************************************************************************************************
1557
1558
1559//*************************************************************************************************
1570template< typename MT // Type of the adapted dense matrix
1571 , bool SO > // Storage order of the adapted dense matrix
1572constexpr size_t LowerMatrix<MT,SO,false>::maxNonZeros() noexcept
1573{
1575
1576 return maxNonZeros( Size_v<MT,0UL> );
1577}
1579//*************************************************************************************************
1580
1581
1582//*************************************************************************************************
1592template< typename MT // Type of the adapted dense matrix
1593 , bool SO > // Storage order of the adapted dense matrix
1594constexpr size_t LowerMatrix<MT,SO,false>::maxNonZeros( size_t n ) noexcept
1595{
1596 return ( ( n + 1UL ) * n ) / 2UL;
1597}
1599//*************************************************************************************************
1600
1601
1602//*************************************************************************************************
1608template< typename MT // Type of the adapted dense matrix
1609 , bool SO > // Storage order of the adapted dense matrix
1610inline void LowerMatrix<MT,SO,false>::resetUpper()
1611{
1612 using blaze::erase;
1613
1614 if( SO ) {
1615 for( size_t j=1UL; j<columns(); ++j )
1616 erase( matrix_, j, matrix_.begin( j ), matrix_.lowerBound( j, j ) );
1617 }
1618 else {
1619 for( size_t i=0UL; i<rows(); ++i )
1620 erase( matrix_, i, matrix_.upperBound( i, i ), matrix_.end( i ) );
1621 }
1622}
1624//*************************************************************************************************
1625
1626
1627
1628
1629//=================================================================================================
1630//
1631// INSERTION FUNCTIONS
1632//
1633//=================================================================================================
1634
1635//*************************************************************************************************
1651template< typename MT // Type of the adapted sparse matrix
1652 , bool SO > // Storage order of the adapted sparse matrix
1653inline typename LowerMatrix<MT,SO,false>::Iterator
1654 LowerMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1655{
1656 if( i < j ) {
1657 BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to upper matrix element" );
1658 }
1659
1660 return matrix_.set( i, j, value );
1661}
1663//*************************************************************************************************
1664
1665
1666//*************************************************************************************************
1683template< typename MT // Type of the adapted sparse matrix
1684 , bool SO > // Storage order of the adapted sparse matrix
1685inline typename LowerMatrix<MT,SO,false>::Iterator
1686 LowerMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1687{
1688 if( i < j ) {
1689 BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to upper matrix element" );
1690 }
1691
1692 return matrix_.insert( i, j, value );
1693}
1695//*************************************************************************************************
1696
1697
1698//*************************************************************************************************
1748template< typename MT // Type of the adapted sparse matrix
1749 , bool SO > // Storage order of the adapted sparse matrix
1750inline void LowerMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1751{
1752 if( i < j ) {
1753 BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to upper matrix element" );
1754 }
1755
1756 matrix_.append( i, j, value, check );
1757}
1759//*************************************************************************************************
1760
1761
1762//*************************************************************************************************
1776template< typename MT // Type of the adapted sparse matrix
1777 , bool SO > // Storage order of the adapted sparse matrix
1778inline void LowerMatrix<MT,SO,false>::finalize( size_t i )
1779{
1780 matrix_.finalize( i );
1781}
1783//*************************************************************************************************
1784
1785
1786
1787
1788//=================================================================================================
1789//
1790// ERASE FUNCTIONS
1791//
1792//=================================================================================================
1793
1794//*************************************************************************************************
1804template< typename MT // Type of the adapted sparse matrix
1805 , bool SO > // Storage order of the adapted sparse matrix
1806inline void LowerMatrix<MT,SO,false>::erase( size_t i, size_t j )
1807{
1808 using blaze::erase;
1809
1810 erase( matrix_, i, j );
1811}
1813//*************************************************************************************************
1814
1815
1816//*************************************************************************************************
1828template< typename MT // Type of the adapted sparse matrix
1829 , bool SO > // Storage order of the adapted sparse matrix
1830inline typename LowerMatrix<MT,SO,false>::Iterator
1831 LowerMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1832{
1833 using blaze::erase;
1834
1835 return erase( matrix_, i, pos );
1836}
1838//*************************************************************************************************
1839
1840
1841//*************************************************************************************************
1854template< typename MT // Type of the adapted sparse matrix
1855 , bool SO > // Storage order of the adapted sparse matrix
1856inline typename LowerMatrix<MT,SO,false>::Iterator
1857 LowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1858{
1859 using blaze::erase;
1860
1861 return erase( matrix_, i, first, last );
1862}
1864//*************************************************************************************************
1865
1866
1867//*************************************************************************************************
1889template< typename MT // Type of the adapted sparse matrix
1890 , bool SO > // Storage order of the adapted sparse matrix
1891template< typename Pred > // Type of the unary predicate
1892inline void LowerMatrix<MT,SO,false>::erase( Pred predicate )
1893{
1894 using blaze::erase;
1895
1896 erase( matrix_, predicate );
1897
1898 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1899}
1901//*************************************************************************************************
1902
1903
1904//*************************************************************************************************
1932template< typename MT // Type of the adapted sparse matrix
1933 , bool SO > // Storage order of the adapted sparse matrix
1934template< typename Pred > // Type of the unary predicate
1935inline void LowerMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last, Pred predicate )
1936{
1937 using blaze::erase;
1938
1939 erase( matrix_, i, first, last, predicate );
1940
1941 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1942}
1944//*************************************************************************************************
1945
1946
1947
1948
1949//=================================================================================================
1950//
1951// LOOKUP FUNCTIONS
1952//
1953//=================================================================================================
1954
1955//*************************************************************************************************
1971template< typename MT // Type of the adapted sparse matrix
1972 , bool SO > // Storage order of the adapted sparse matrix
1973inline typename LowerMatrix<MT,SO,false>::Iterator
1974 LowerMatrix<MT,SO,false>::find( size_t i, size_t j )
1975{
1976 return matrix_.find( i, j );
1977}
1979//*************************************************************************************************
1980
1981
1982//*************************************************************************************************
1998template< typename MT // Type of the adapted sparse matrix
1999 , bool SO > // Storage order of the adapted sparse matrix
2000inline typename LowerMatrix<MT,SO,false>::ConstIterator
2001 LowerMatrix<MT,SO,false>::find( size_t i, size_t j ) const
2002{
2003 return matrix_.find( i, j );
2004}
2006//*************************************************************************************************
2007
2008
2009//*************************************************************************************************
2025template< typename MT // Type of the adapted sparse matrix
2026 , bool SO > // Storage order of the adapted sparse matrix
2027inline typename LowerMatrix<MT,SO,false>::Iterator
2028 LowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j )
2029{
2030 return matrix_.lowerBound( i, j );
2031}
2033//*************************************************************************************************
2034
2035
2036//*************************************************************************************************
2052template< typename MT // Type of the adapted sparse matrix
2053 , bool SO > // Storage order of the adapted sparse matrix
2054inline typename LowerMatrix<MT,SO,false>::ConstIterator
2055 LowerMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
2056{
2057 return matrix_.lowerBound( i, j );
2058}
2060//*************************************************************************************************
2061
2062
2063//*************************************************************************************************
2079template< typename MT // Type of the adapted sparse matrix
2080 , bool SO > // Storage order of the adapted sparse matrix
2081inline typename LowerMatrix<MT,SO,false>::Iterator
2082 LowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j )
2083{
2084 return matrix_.upperBound( i, j );
2085}
2087//*************************************************************************************************
2088
2089
2090//*************************************************************************************************
2106template< typename MT // Type of the adapted sparse matrix
2107 , bool SO > // Storage order of the adapted sparse matrix
2108inline typename LowerMatrix<MT,SO,false>::ConstIterator
2109 LowerMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
2110{
2111 return matrix_.upperBound( i, j );
2112}
2114//*************************************************************************************************
2115
2116
2117
2118
2119//=================================================================================================
2120//
2121// NUMERIC FUNCTIONS
2122//
2123//=================================================================================================
2124
2125//*************************************************************************************************
2143template< typename MT // Type of the adapted sparse matrix
2144 , bool SO > // Storage order of the adapted sparse matrix
2145template< typename Other > // Data type of the scalar value
2146inline LowerMatrix<MT,SO,false>&
2147 LowerMatrix<MT,SO,false>::scale( const Other& scalar )
2148{
2149 matrix_.scale( scalar );
2150 return *this;
2151}
2153//*************************************************************************************************
2154
2155
2156
2157
2158//=================================================================================================
2159//
2160// DEBUGGING FUNCTIONS
2161//
2162//=================================================================================================
2163
2164//*************************************************************************************************
2174template< typename MT // Type of the adapted sparse matrix
2175 , bool SO > // Storage order of the adapted sparse matrix
2176inline bool LowerMatrix<MT,SO,false>::isIntact() const noexcept
2177{
2178 using blaze::isIntact;
2179
2180 return ( isIntact( matrix_ ) && isLower( matrix_ ) );
2181}
2183//*************************************************************************************************
2184
2185
2186
2187
2188//=================================================================================================
2189//
2190// EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2191//
2192//=================================================================================================
2193
2194//*************************************************************************************************
2205template< typename MT // Type of the adapted sparse matrix
2206 , bool SO > // Storage order of the adapted sparse matrix
2207template< typename Other > // Data type of the foreign expression
2208inline bool LowerMatrix<MT,SO,false>::canAlias( const Other* alias ) const noexcept
2209{
2210 return matrix_.canAlias( alias );
2211}
2213//*************************************************************************************************
2214
2215
2216//*************************************************************************************************
2227template< typename MT // Type of the adapted sparse matrix
2228 , bool SO > // Storage order of the adapted sparse matrix
2229template< typename Other > // Data type of the foreign expression
2230inline bool LowerMatrix<MT,SO,false>::isAliased( const Other* alias ) const noexcept
2231{
2232 return matrix_.isAliased( alias );
2233}
2235//*************************************************************************************************
2236
2237
2238//*************************************************************************************************
2249template< typename MT // Type of the adapted sparse matrix
2250 , bool SO > // Storage order of the adapted sparse matrix
2251inline bool LowerMatrix<MT,SO,false>::canSMPAssign() const noexcept
2252{
2253 return matrix_.canSMPAssign();
2254}
2256//*************************************************************************************************
2257
2258} // namespace blaze
2259
2260#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 IsLower type trait.
Header file for the IsSquare type trait.
Header file for the LowerProxy class.
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.
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 LowerMatrix.
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 isLower(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a lower triangular matrix.
Definition: DenseMatrix.h:1921
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 utility functions for sparse matrices.
Header file for basic type definitions.