Blaze 3.9
Sparse.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_ADAPTORS_STRICTLYUPPERMATRIX_SPARSE_H_
36#define _BLAZE_MATH_ADAPTORS_STRICTLYUPPERMATRIX_SPARSE_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <utility>
44#include <vector>
48#include <blaze/math/Aliases.h>
72#include <blaze/util/Assert.h>
77#include <blaze/util/EnableIf.h>
79#include <blaze/util/Types.h>
80
81
82namespace blaze {
83
84//=================================================================================================
85//
86// CLASS TEMPLATE SPECIALIZATION FOR SPARSE MATRICES
87//
88//=================================================================================================
89
90//*************************************************************************************************
98template< typename MT // Type of the adapted sparse matrix
99 , bool SO > // Storage order of the adapted sparse matrix
100class StrictlyUpperMatrix<MT,SO,false>
101 : public SparseMatrix< StrictlyUpperMatrix<MT,SO,false>, SO >
102{
103 private:
104 //**Type definitions****************************************************************************
105 using OT = OppositeType_t<MT>;
106 using TT = TransposeType_t<MT>;
107 using ET = ElementType_t<MT>;
108 //**********************************************************************************************
109
110 public:
111 //**Type definitions****************************************************************************
112 using This = StrictlyUpperMatrix<MT,SO,false>;
113 using BaseType = SparseMatrix<This,SO>;
114 using ResultType = This;
115 using OppositeType = StrictlyUpperMatrix<OT,!SO,false>;
116 using TransposeType = StrictlyLowerMatrix<TT,!SO,false>;
117 using ElementType = ET;
118 using TagType = TagType_t<MT>;
119 using ReturnType = ReturnType_t<MT>;
120 using CompositeType = const This&;
121 using Reference = StrictlyUpperProxy<MT>;
122 using ConstReference = ConstReference_t<MT>;
123 using Iterator = Iterator_t<MT>;
124 using ConstIterator = ConstIterator_t<MT>;
125 //**********************************************************************************************
126
127 //**Rebind struct definition********************************************************************
130 template< typename NewType > // Data type of the other matrix
131 struct Rebind {
133 using Other = StrictlyUpperMatrix< typename MT::template Rebind<NewType>::Other >;
134 };
135 //**********************************************************************************************
136
137 //**Resize struct definition********************************************************************
140 template< size_t NewM // Number of rows of the other matrix
141 , size_t NewN > // Number of columns of the other matrix
142 struct Resize {
144 using Other = StrictlyUpperMatrix< typename MT::template Resize<NewM,NewN>::Other >;
145 };
146 //**********************************************************************************************
147
148 //**Compilation flags***************************************************************************
150 static constexpr bool smpAssignable = false;
151 //**********************************************************************************************
152
153 //**Constructors********************************************************************************
156 inline StrictlyUpperMatrix();
157 explicit inline StrictlyUpperMatrix( size_t n );
158 inline StrictlyUpperMatrix( size_t n, size_t nonzeros );
159 inline StrictlyUpperMatrix( size_t n, const std::vector<size_t>& nonzeros );
160 inline StrictlyUpperMatrix( initializer_list< initializer_list<ElementType> > list );
161
162 inline StrictlyUpperMatrix( const StrictlyUpperMatrix& m );
163 inline StrictlyUpperMatrix( StrictlyUpperMatrix&& m ) noexcept;
164
165 template< typename MT2, bool SO2 >
166 inline StrictlyUpperMatrix( const Matrix<MT2,SO2>& m );
168 //**********************************************************************************************
169
170 //**Destructor**********************************************************************************
173 ~StrictlyUpperMatrix() = default;
175 //**********************************************************************************************
176
177 //**Data access functions***********************************************************************
180 inline Reference operator()( size_t i, size_t j );
181 inline ConstReference operator()( size_t i, size_t j ) const;
182 inline Reference at( size_t i, size_t j );
183 inline ConstReference at( size_t i, size_t j ) const;
184 inline Iterator begin ( size_t i );
185 inline ConstIterator begin ( size_t i ) const;
186 inline ConstIterator cbegin( size_t i ) const;
187 inline Iterator end ( size_t i );
188 inline ConstIterator end ( size_t i ) const;
189 inline ConstIterator cend ( size_t i ) const;
191 //**********************************************************************************************
192
193 //**Assignment operators************************************************************************
196 inline StrictlyUpperMatrix& operator=( initializer_list< initializer_list<ElementType> > list );
197
198 inline StrictlyUpperMatrix& operator=( const StrictlyUpperMatrix& rhs );
199 inline StrictlyUpperMatrix& operator=( StrictlyUpperMatrix&& rhs ) noexcept;
200
201 template< typename MT2, bool SO2 >
202 inline auto operator=( const Matrix<MT2,SO2>& rhs )
203 -> DisableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >;
204
205 template< typename MT2, bool SO2 >
206 inline auto operator=( const Matrix<MT2,SO2>& rhs )
207 -> EnableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >;
208
209 template< typename MT2, bool SO2 >
210 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
211 -> DisableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >;
212
213 template< typename MT2, bool SO2 >
214 inline auto operator+=( const Matrix<MT2,SO2>& rhs )
215 -> EnableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >;
216
217 template< typename MT2, bool SO2 >
218 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
219 -> DisableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >;
220
221 template< typename MT2, bool SO2 >
222 inline auto operator-=( const Matrix<MT2,SO2>& rhs )
223 -> EnableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >;
224
225 template< typename MT2, bool SO2 >
226 inline auto operator%=( const Matrix<MT2,SO2>& rhs ) -> StrictlyUpperMatrix&;
228 //**********************************************************************************************
229
230 //**Utility functions***************************************************************************
233 inline size_t rows() const noexcept;
234 inline size_t columns() const noexcept;
235 inline size_t capacity() const noexcept;
236 inline size_t capacity( size_t i ) const noexcept;
237 inline size_t nonZeros() const;
238 inline size_t nonZeros( size_t i ) const;
239 inline void reset();
240 inline void reset( size_t i );
241 inline void clear();
242 inline void resize ( size_t n, bool preserve=true );
243 inline void reserve( size_t nonzeros );
244 inline void reserve( size_t i, size_t nonzeros );
245 inline void trim();
246 inline void trim( size_t i );
247 inline void shrinkToFit();
248 inline void swap( StrictlyUpperMatrix& m ) noexcept;
249
250 static constexpr size_t maxNonZeros() noexcept;
251 static constexpr size_t maxNonZeros( size_t n ) noexcept;
253 //**********************************************************************************************
254
255 //**Insertion functions*************************************************************************
258 inline Iterator set ( size_t i, size_t j, const ElementType& value );
259 inline Iterator insert ( size_t i, size_t j, const ElementType& value );
260 inline void append ( size_t i, size_t j, const ElementType& value, bool check=false );
261 inline void finalize( size_t i );
263 //**********************************************************************************************
264
265 //**Erase functions*****************************************************************************
268 inline void erase( size_t i, size_t j );
269 inline Iterator erase( size_t i, Iterator pos );
270 inline Iterator erase( size_t i, Iterator first, Iterator last );
271
272 template< typename Pred >
273 inline void erase( Pred predicate );
274
275 template< typename Pred >
276 inline void erase( size_t i, Iterator first, Iterator last, Pred predicate );
278 //**********************************************************************************************
279
280 //**Lookup functions****************************************************************************
283 inline Iterator find ( size_t i, size_t j );
284 inline ConstIterator find ( size_t i, size_t j ) const;
285 inline Iterator lowerBound( size_t i, size_t j );
286 inline ConstIterator lowerBound( size_t i, size_t j ) const;
287 inline Iterator upperBound( size_t i, size_t j );
288 inline ConstIterator upperBound( size_t i, size_t j ) const;
290 //**********************************************************************************************
291
292 //**Numeric functions***************************************************************************
295 template< typename Other > inline StrictlyUpperMatrix& scale( const Other& scalar );
297 //**********************************************************************************************
298
299 //**Debugging functions*************************************************************************
302 inline bool isIntact() const noexcept;
304 //**********************************************************************************************
305
306 //**Expression template evaluation functions****************************************************
309 template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
310 template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
311
312 inline bool canSMPAssign() const noexcept;
314 //**********************************************************************************************
315
316 private:
317 //**Utility functions***************************************************************************
320 inline void resetLower();
322 //**********************************************************************************************
323
324 //**Member variables****************************************************************************
327 MT matrix_;
329 //**********************************************************************************************
330
331 //**Friend declarations*************************************************************************
332 template< typename MT2, bool SO2, bool DF2 >
333 friend MT2& derestrict( StrictlyUpperMatrix<MT2,SO2,DF2>& m );
334 //**********************************************************************************************
335
336 //**Compile time checks*************************************************************************
351 BLAZE_STATIC_ASSERT( ( Size_v<MT,0UL> == Size_v<MT,1UL> ) );
352 //**********************************************************************************************
353};
355//*************************************************************************************************
356
357
358
359
360//=================================================================================================
361//
362// CONSTRUCTORS
363//
364//=================================================================================================
365
366//*************************************************************************************************
370template< typename MT // Type of the adapted sparse matrix
371 , bool SO > // Storage order of the adapted sparse matrix
372inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix()
373 : matrix_() // The adapted sparse matrix
374{
375 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
376}
378//*************************************************************************************************
379
380
381//*************************************************************************************************
389template< typename MT // Type of the adapted sparse matrix
390 , bool SO > // Storage order of the adapted sparse matrix
391inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( size_t n )
392 : matrix_( n, n ) // The adapted sparse matrix
393{
395
396 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
397}
399//*************************************************************************************************
400
401
402//*************************************************************************************************
412template< typename MT // Type of the adapted sparse matrix
413 , bool SO > // Storage order of the adapted sparse matrix
414inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( size_t n, size_t nonzeros )
415 : matrix_( n, n, max( nonzeros, n ) ) // The adapted sparse matrix
416{
418
419 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
420}
422//*************************************************************************************************
423
424
425//*************************************************************************************************
439template< typename MT // Type of the adapted sparse matrix
440 , bool SO > // Storage order of the adapted sparse matrix
441inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( size_t n, const std::vector<size_t>& nonzeros )
442 : matrix_( n, n, nonzeros ) // The adapted sparse matrix
443{
445
446 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
447}
449//*************************************************************************************************
450
451
452//*************************************************************************************************
476template< typename MT // Type of the adapted sparse matrix
477 , bool SO > // Storage order of the adapted sparse matrix
478inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( initializer_list< initializer_list<ElementType> > list )
479 : matrix_( list ) // The adapted sparse matrix
480{
481 if( !isStrictlyUpper( matrix_ ) ) {
482 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly upper matrix" );
483 }
484
485 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
486}
488//*************************************************************************************************
489
490
491//*************************************************************************************************
497template< typename MT // Type of the adapted sparse matrix
498 , bool SO > // Storage order of the adapted sparse matrix
499inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( const StrictlyUpperMatrix& m )
500 : matrix_( m.matrix_ ) // The adapted sparse matrix
501{
502 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
503 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
504}
506//*************************************************************************************************
507
508
509//*************************************************************************************************
515template< typename MT // Type of the adapted sparse matrix
516 , bool SO > // Storage order of the adapted sparse matrix
517inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( StrictlyUpperMatrix&& m ) noexcept
518 : matrix_( std::move( m.matrix_ ) ) // The adapted sparse matrix
519{
520 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
521 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
522}
524//*************************************************************************************************
525
526
527//*************************************************************************************************
538template< typename MT // Type of the adapted sparse matrix
539 , bool SO > // Storage order of the adapted sparse matrix
540template< typename MT2 // Type of the foreign matrix
541 , bool SO2 > // Storage order of the foreign matrix
542inline StrictlyUpperMatrix<MT,SO,false>::StrictlyUpperMatrix( const Matrix<MT2,SO2>& m )
543 : matrix_( *m ) // The adapted sparse matrix
544{
545 if( IsUniTriangular_v<MT2> ||
546 ( !IsStrictlyUpper_v<MT2> && !isStrictlyUpper( matrix_ ) ) ) {
547 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of strictly upper matrix" );
548 }
549
550 if( !IsStrictlyUpper_v<MT2> )
551 resetLower();
552
553 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
554 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
555}
557//*************************************************************************************************
558
559
560
561
562//=================================================================================================
563//
564// DATA ACCESS FUNCTIONS
565//
566//=================================================================================================
567
568//*************************************************************************************************
584template< typename MT // Type of the adapted sparse matrix
585 , bool SO > // Storage order of the adapted sparse matrix
586inline typename StrictlyUpperMatrix<MT,SO,false>::Reference
587 StrictlyUpperMatrix<MT,SO,false>::operator()( size_t i, size_t j )
588{
589 BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
590 BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
591
592 return Reference( matrix_, i, j );
593}
595//*************************************************************************************************
596
597
598//*************************************************************************************************
614template< typename MT // Type of the adapted sparse matrix
615 , bool SO > // Storage order of the adapted sparse matrix
616inline typename StrictlyUpperMatrix<MT,SO,false>::ConstReference
617 StrictlyUpperMatrix<MT,SO,false>::operator()( size_t i, size_t j ) const
618{
619 BLAZE_USER_ASSERT( i<rows() , "Invalid row access index" );
620 BLAZE_USER_ASSERT( j<columns(), "Invalid column access index" );
621
622 return matrix_(i,j);
623}
625//*************************************************************************************************
626
627
628//*************************************************************************************************
645template< typename MT // Type of the adapted sparse matrix
646 , bool SO > // Storage order of the adapted sparse matrix
647inline typename StrictlyUpperMatrix<MT,SO,false>::Reference
648 StrictlyUpperMatrix<MT,SO,false>::at( size_t i, size_t j )
649{
650 if( i >= rows() ) {
651 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
652 }
653 if( j >= columns() ) {
654 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
655 }
656 return (*this)(i,j);
657}
659//*************************************************************************************************
660
661
662//*************************************************************************************************
679template< typename MT // Type of the adapted sparse matrix
680 , bool SO > // Storage order of the adapted sparse matrix
681inline typename StrictlyUpperMatrix<MT,SO,false>::ConstReference
682 StrictlyUpperMatrix<MT,SO,false>::at( size_t i, size_t j ) const
683{
684 if( i >= rows() ) {
685 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
686 }
687 if( j >= columns() ) {
688 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
689 }
690 return (*this)(i,j);
691}
693//*************************************************************************************************
694
695
696//*************************************************************************************************
708template< typename MT // Type of the adapted sparse matrix
709 , bool SO > // Storage order of the adapted sparse matrix
710inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
712{
713 return matrix_.begin(i);
714}
716//*************************************************************************************************
717
718
719//*************************************************************************************************
731template< typename MT // Type of the adapted sparse matrix
732 , bool SO > // Storage order of the adapted sparse matrix
733inline typename StrictlyUpperMatrix<MT,SO,false>::ConstIterator
735{
736 return matrix_.begin(i);
737}
739//*************************************************************************************************
740
741
742//*************************************************************************************************
754template< typename MT // Type of the adapted sparse matrix
755 , bool SO > // Storage order of the adapted sparse matrix
756inline typename StrictlyUpperMatrix<MT,SO,false>::ConstIterator
758{
759 return matrix_.cbegin(i);
760}
762//*************************************************************************************************
763
764
765//*************************************************************************************************
777template< typename MT // Type of the adapted sparse matrix
778 , bool SO > // Storage order of the adapted sparse matrix
779inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
781{
782 return matrix_.end(i);
783}
785//*************************************************************************************************
786
787
788//*************************************************************************************************
800template< typename MT // Type of the adapted sparse matrix
801 , bool SO > // Storage order of the adapted sparse matrix
802inline typename StrictlyUpperMatrix<MT,SO,false>::ConstIterator
804{
805 return matrix_.end(i);
806}
808//*************************************************************************************************
809
810
811//*************************************************************************************************
823template< typename MT // Type of the adapted sparse matrix
824 , bool SO > // Storage order of the adapted sparse matrix
825inline typename StrictlyUpperMatrix<MT,SO,false>::ConstIterator
827{
828 return matrix_.cend(i);
829}
831//*************************************************************************************************
832
833
834
835
836//=================================================================================================
837//
838// ASSIGNMENT OPERATORS
839//
840//=================================================================================================
841
842//*************************************************************************************************
867template< typename MT // Type of the adapted sparse matrix
868 , bool SO > // Storage order of the adapted sparse matrix
869inline StrictlyUpperMatrix<MT,SO,false>&
870 StrictlyUpperMatrix<MT,SO,false>::operator=( initializer_list< initializer_list<ElementType> > list )
871{
872 const InitializerMatrix<ElementType> tmp( list, list.size() );
873
874 if( !isStrictlyUpper( tmp ) ) {
875 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
876 }
877
878 matrix_ = list;
879
880 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
881 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
882
883 return *this;
884}
886//*************************************************************************************************
887
888
889//*************************************************************************************************
899template< typename MT // Type of the adapted sparse matrix
900 , bool SO > // Storage order of the adapted sparse matrix
901inline StrictlyUpperMatrix<MT,SO,false>&
902 StrictlyUpperMatrix<MT,SO,false>::operator=( const StrictlyUpperMatrix& rhs )
903{
904 matrix_ = rhs.matrix_;
905
906 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
907 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
908
909 return *this;
910}
912//*************************************************************************************************
913
914
915//*************************************************************************************************
922template< typename MT // Type of the adapted sparse matrix
923 , bool SO > // Storage order of the adapted sparse matrix
924inline StrictlyUpperMatrix<MT,SO,false>&
925 StrictlyUpperMatrix<MT,SO,false>::operator=( StrictlyUpperMatrix&& rhs ) noexcept
926{
927 matrix_ = std::move( rhs.matrix_ );
928
929 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
930 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
931
932 return *this;
933}
935//*************************************************************************************************
936
937
938//*************************************************************************************************
951template< typename MT // Type of the adapted sparse matrix
952 , bool SO > // Storage order of the adapted sparse matrix
953template< typename MT2 // Type of the right-hand side matrix
954 , bool SO2 > // Storage order of the right-hand side matrix
955inline auto StrictlyUpperMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
956 -> DisableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >
957{
958 if( IsUniTriangular_v<MT2> ||
959 ( !IsStrictlyUpper_v<MT2> && !isStrictlyUpper( *rhs ) ) ) {
960 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
961 }
962
963 matrix_ = declupp( *rhs );
964
965 if( !IsStrictlyUpper_v<MT2> )
966 resetLower();
967
968 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
969 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
970
971 return *this;
972}
974//*************************************************************************************************
975
976
977//*************************************************************************************************
990template< typename MT // Type of the adapted sparse matrix
991 , bool SO > // Storage order of the adapted sparse matrix
992template< typename MT2 // Type of the right-hand side matrix
993 , bool SO2 > // Storage order of the right-hand side matrix
994inline auto StrictlyUpperMatrix<MT,SO,false>::operator=( const Matrix<MT2,SO2>& rhs )
995 -> EnableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >
996{
997 if( IsUniTriangular_v<MT2> || ( !IsSquare_v<MT2> && !isSquare( *rhs ) ) ) {
998 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
999 }
1000
1001 if( IsStrictlyUpper_v<MT2> ) {
1002 matrix_ = *rhs;
1003 }
1004 else {
1005 MT tmp( *rhs );
1006
1007 if( !isStrictlyUpper( tmp ) ) {
1008 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1009 }
1010
1011 matrix_ = std::move( tmp );
1012 }
1013
1014 if( !IsStrictlyUpper_v<MT2> )
1015 resetLower();
1016
1017 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1018 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1019
1020 return *this;
1021}
1023//*************************************************************************************************
1024
1025
1026//*************************************************************************************************
1039template< typename MT // Type of the adapted sparse matrix
1040 , bool SO > // Storage order of the adapted sparse matrix
1041template< typename MT2 // Type of the right-hand side matrix
1042 , bool SO2 > // Storage order of the right-hand side matrix
1043inline auto StrictlyUpperMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1044 -> DisableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >
1045{
1046 if( IsUniTriangular_v<MT2> ||
1047 ( !IsStrictlyUpper_v<MT2> && !isStrictlyUpper( *rhs ) ) ) {
1048 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1049 }
1050
1051 matrix_ += declupp( *rhs );
1052
1053 if( !IsStrictlyUpper_v<MT2> )
1054 resetLower();
1055
1056 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1057 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1058
1059 return *this;
1060}
1062//*************************************************************************************************
1063
1064
1065//*************************************************************************************************
1078template< typename MT // Type of the adapted sparse matrix
1079 , bool SO > // Storage order of the adapted sparse matrix
1080template< typename MT2 // Type of the right-hand side matrix
1081 , bool SO2 > // Storage order of the right-hand side matrix
1082inline auto StrictlyUpperMatrix<MT,SO,false>::operator+=( const Matrix<MT2,SO2>& rhs )
1083 -> EnableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >
1084{
1085 if( IsUniTriangular_v<MT2> || ( IsSquare_v<MT2> && !isSquare( *rhs ) ) ) {
1086 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1087 }
1088
1089 if( IsStrictlyUpper_v<MT2> ) {
1090 matrix_ += *rhs;
1091 }
1092 else {
1093 const ResultType_t<MT2> tmp( *rhs );
1094
1095 if( !isStrictlyUpper( tmp ) ) {
1096 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1097 }
1098
1099 matrix_ += declupp( tmp );
1100 }
1101
1102 if( !IsStrictlyUpper_v<MT2> )
1103 resetLower();
1104
1105 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1106 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1107
1108 return *this;
1109}
1111//*************************************************************************************************
1112
1113
1114//*************************************************************************************************
1127template< typename MT // Type of the adapted sparse matrix
1128 , bool SO > // Storage order of the adapted sparse matrix
1129template< typename MT2 // Type of the right-hand side matrix
1130 , bool SO2 > // Storage order of the right-hand side matrix
1131inline auto StrictlyUpperMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1132 -> DisableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >
1133{
1134 if( IsUniTriangular_v<MT2> ||
1135 ( !IsStrictlyUpper_v<MT2> && !isStrictlyUpper( *rhs ) ) ) {
1136 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1137 }
1138
1139 matrix_ -= declupp( *rhs );
1140
1141 if( !IsStrictlyUpper_v<MT2> )
1142 resetLower();
1143
1144 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1145 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1146
1147 return *this;
1148}
1150//*************************************************************************************************
1151
1152
1153//*************************************************************************************************
1166template< typename MT // Type of the adapted sparse matrix
1167 , bool SO > // Storage order of the adapted sparse matrix
1168template< typename MT2 // Type of the right-hand side matrix
1169 , bool SO2 > // Storage order of the right-hand side matrix
1170inline auto StrictlyUpperMatrix<MT,SO,false>::operator-=( const Matrix<MT2,SO2>& rhs )
1171 -> EnableIf_t< IsComputation_v<MT2>, StrictlyUpperMatrix& >
1172{
1173 if( IsUniTriangular_v<MT2> || ( !IsSquare_v<MT2> && !isSquare( *rhs ) ) ) {
1174 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1175 }
1176
1177 if( IsStrictlyUpper_v<MT2> ) {
1178 matrix_ -= *rhs;
1179 }
1180 else {
1181 const ResultType_t<MT2> tmp( *rhs );
1182
1183 if( !isStrictlyUpper( tmp ) ) {
1184 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1185 }
1186
1187 matrix_ -= declupp( tmp );
1188 }
1189
1190 if( !IsStrictlyUpper_v<MT2> )
1191 resetLower();
1192
1193 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1194 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1195
1196 return *this;
1197}
1199//*************************************************************************************************
1200
1201
1202//*************************************************************************************************
1213template< typename MT // Type of the adapted sparse matrix
1214 , bool SO > // Storage order of the adapted sparse matrix
1215template< typename MT2 // Type of the right-hand side matrix
1216 , bool SO2 > // Storage order of the right-hand side matrix
1217inline auto StrictlyUpperMatrix<MT,SO,false>::operator%=( const Matrix<MT2,SO2>& rhs )
1218 -> StrictlyUpperMatrix&
1219{
1220 if( !IsSquare_v<MT2> && !isSquare( *rhs ) ) {
1221 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to strictly upper matrix" );
1222 }
1223
1224 matrix_ %= *rhs;
1225
1226 if( !IsStrictlyUpper_v<MT2> )
1227 resetLower();
1228
1229 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1230 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1231
1232 return *this;
1233}
1235//*************************************************************************************************
1236
1237
1238
1239
1240//=================================================================================================
1241//
1242// UTILITY FUNCTIONS
1243//
1244//=================================================================================================
1245
1246//*************************************************************************************************
1252template< typename MT // Type of the adapted sparse matrix
1253 , bool SO > // Storage order of the adapted sparse matrix
1254inline size_t StrictlyUpperMatrix<MT,SO,false>::rows() const noexcept
1255{
1256 return matrix_.rows();
1257}
1259//*************************************************************************************************
1260
1261
1262//*************************************************************************************************
1268template< typename MT // Type of the adapted sparse matrix
1269 , bool SO > // Storage order of the adapted sparse matrix
1270inline size_t StrictlyUpperMatrix<MT,SO,false>::columns() const noexcept
1271{
1272 return matrix_.columns();
1273}
1275//*************************************************************************************************
1276
1277
1278//*************************************************************************************************
1284template< typename MT // Type of the adapted sparse matrix
1285 , bool SO > // Storage order of the adapted sparse matrix
1286inline size_t StrictlyUpperMatrix<MT,SO,false>::capacity() const noexcept
1287{
1288 return matrix_.capacity();
1289}
1291//*************************************************************************************************
1292
1293
1294//*************************************************************************************************
1306template< typename MT // Type of the adapted sparse matrix
1307 , bool SO > // Storage order of the adapted sparse matrix
1308inline size_t StrictlyUpperMatrix<MT,SO,false>::capacity( size_t i ) const noexcept
1309{
1310 return matrix_.capacity(i);
1311}
1313//*************************************************************************************************
1314
1315
1316//*************************************************************************************************
1322template< typename MT // Type of the adapted sparse matrix
1323 , bool SO > // Storage order of the adapted sparse matrix
1325{
1326 return matrix_.nonZeros();
1327}
1329//*************************************************************************************************
1330
1331
1332//*************************************************************************************************
1344template< typename MT // Type of the adapted sparse matrix
1345 , bool SO > // Storage order of the adapted sparse matrix
1346inline size_t StrictlyUpperMatrix<MT,SO,false>::nonZeros( size_t i ) const
1347{
1348 return matrix_.nonZeros(i);
1349}
1351//*************************************************************************************************
1352
1353
1354//*************************************************************************************************
1360template< typename MT // Type of the adapted sparse matrix
1361 , bool SO > // Storage order of the adapted sparse matrix
1363{
1364 using blaze::erase;
1365
1366 if( SO ) {
1367 for( size_t j=1UL; j<columns(); ++j ) {
1368 erase( matrix_, j, matrix_.begin(j), matrix_.lowerBound(j,j) );
1369 }
1370 }
1371 else {
1372 for( size_t i=0UL; i<rows(); ++i ) {
1373 erase( matrix_, i, matrix_.lowerBound(i,i+1UL), matrix_.end(i) );
1374 }
1375 }
1376}
1378//*************************************************************************************************
1379
1380
1381//*************************************************************************************************
1394template< typename MT // Type of the adapted sparse matrix
1395 , bool SO > // Storage order of the adapted sparse matrix
1396inline void StrictlyUpperMatrix<MT,SO,false>::reset( size_t i )
1397{
1398 using blaze::erase;
1399
1400 if( SO ) {
1401 erase( matrix_, i, matrix_.begin(i), matrix_.lowerBound(i,i) );
1402 }
1403 else {
1404 erase( matrix_, i, matrix_.lowerBound(i,i+1UL), matrix_.end(i) );
1405 }
1406}
1408//*************************************************************************************************
1409
1410
1411//*************************************************************************************************
1419template< typename MT // Type of the adapted sparse matrix
1420 , bool SO > // Storage order of the adapted sparse matrix
1422{
1423 matrix_.clear();
1424
1425 BLAZE_INTERNAL_ASSERT( matrix_.rows() == 0UL, "Invalid number of rows" );
1426 BLAZE_INTERNAL_ASSERT( matrix_.columns() == 0UL, "Invalid number of columns" );
1427}
1429//*************************************************************************************************
1430
1431
1432//*************************************************************************************************
1447template< typename MT // Type of the adapted sparse matrix
1448 , bool SO > // Storage order of the adapted sparse matrix
1449void StrictlyUpperMatrix<MT,SO,false>::resize( size_t n, bool preserve )
1450{
1452
1453 BLAZE_INTERNAL_ASSERT( isSquare( matrix_ ), "Non-square strictly upper matrix detected" );
1454
1455 matrix_.resize( n, n, preserve );
1456}
1458//*************************************************************************************************
1459
1460
1461//*************************************************************************************************
1472template< typename MT // Type of the adapted sparse matrix
1473 , bool SO > // Storage order of the adapted sparse matrix
1474inline void StrictlyUpperMatrix<MT,SO,false>::reserve( size_t nonzeros )
1475{
1476 matrix_.reserve( nonzeros );
1477}
1479//*************************************************************************************************
1480
1481
1482//*************************************************************************************************
1497template< typename MT // Type of the adapted sparse matrix
1498 , bool SO > // Storage order of the adapted sparse matrix
1499inline void StrictlyUpperMatrix<MT,SO,false>::reserve( size_t i, size_t nonzeros )
1500{
1501 matrix_.reserve( i, nonzeros );
1502}
1504//*************************************************************************************************
1505
1506
1507//*************************************************************************************************
1518template< typename MT // Type of the adapted sparse matrix
1519 , bool SO > // Storage order of the adapted sparse matrix
1520inline void StrictlyUpperMatrix<MT,SO,false>::trim()
1521{
1522 matrix_.trim();
1523}
1525//*************************************************************************************************
1526
1527
1528//*************************************************************************************************
1540template< typename MT // Type of the adapted sparse matrix
1541 , bool SO > // Storage order of the adapted sparse matrix
1542inline void StrictlyUpperMatrix<MT,SO,false>::trim( size_t i )
1543{
1544 matrix_.trim( i );
1545}
1547//*************************************************************************************************
1548
1549
1550//*************************************************************************************************
1560template< typename MT // Type of the adapted sparse matrix
1561 , bool SO > // Storage order of the adapted sparse matrix
1563{
1564 matrix_.shrinkToFit();
1565}
1567//*************************************************************************************************
1568
1569
1570//*************************************************************************************************
1577template< typename MT // Type of the adapted sparse matrix
1578 , bool SO > // Storage order of the adapted sparse matrix
1579inline void StrictlyUpperMatrix<MT,SO,false>::swap( StrictlyUpperMatrix& m ) noexcept
1580{
1581 using std::swap;
1582
1583 swap( matrix_, m.matrix_ );
1584}
1586//*************************************************************************************************
1587
1588
1589//*************************************************************************************************
1601template< typename MT // Type of the adapted dense matrix
1602 , bool SO > // Storage order of the adapted dense matrix
1603constexpr size_t StrictlyUpperMatrix<MT,SO,false>::maxNonZeros() noexcept
1604{
1606
1607 return maxNonZeros( Size_v<MT,0UL> );
1608}
1610//*************************************************************************************************
1611
1612
1613//*************************************************************************************************
1623template< typename MT // Type of the adapted dense matrix
1624 , bool SO > // Storage order of the adapted dense matrix
1625constexpr size_t StrictlyUpperMatrix<MT,SO,false>::maxNonZeros( size_t n ) noexcept
1626{
1627 return ( ( n - 1UL ) * n ) / 2UL;
1628}
1630//*************************************************************************************************
1631
1632
1633//*************************************************************************************************
1639template< typename MT // Type of the adapted dense matrix
1640 , bool SO > // Storage order of the adapted dense matrix
1641inline void StrictlyUpperMatrix<MT,SO,false>::resetLower()
1642{
1643 using blaze::erase;
1644
1645 if( SO ) {
1646 for( size_t j=0UL; j<columns(); ++j )
1647 erase( matrix_, j, matrix_.upperBound( j, j ), matrix_.end( j ) );
1648 }
1649 else {
1650 for( size_t i=1UL; i<rows(); ++i )
1651 erase( matrix_, i, matrix_.begin( i ), matrix_.lowerBound( i, i ) );
1652 }
1653}
1655//*************************************************************************************************
1656
1657
1658
1659
1660//=================================================================================================
1661//
1662// INSERTION FUNCTIONS
1663//
1664//=================================================================================================
1665
1666//*************************************************************************************************
1682template< typename MT // Type of the adapted sparse matrix
1683 , bool SO > // Storage order of the adapted sparse matrix
1684inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
1685 StrictlyUpperMatrix<MT,SO,false>::set( size_t i, size_t j, const ElementType& value )
1686{
1687 if( i >= j ) {
1688 BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or lower matrix element" );
1689 }
1690
1691 return matrix_.set( i, j, value );
1692}
1694//*************************************************************************************************
1695
1696
1697//*************************************************************************************************
1714template< typename MT // Type of the adapted sparse matrix
1715 , bool SO > // Storage order of the adapted sparse matrix
1716inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
1717 StrictlyUpperMatrix<MT,SO,false>::insert( size_t i, size_t j, const ElementType& value )
1718{
1719 if( i >= j ) {
1720 BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or lower matrix element" );
1721 }
1722
1723 return matrix_.insert( i, j, value );
1724}
1726//*************************************************************************************************
1727
1728
1729//*************************************************************************************************
1779template< typename MT // Type of the adapted sparse matrix
1780 , bool SO > // Storage order of the adapted sparse matrix
1781inline void StrictlyUpperMatrix<MT,SO,false>::append( size_t i, size_t j, const ElementType& value, bool check )
1782{
1783 if( i >= j ) {
1784 BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to diagonal or lower matrix element" );
1785 }
1786
1787 matrix_.append( i, j, value, check );
1788}
1790//*************************************************************************************************
1791
1792
1793//*************************************************************************************************
1807template< typename MT // Type of the adapted sparse matrix
1808 , bool SO > // Storage order of the adapted sparse matrix
1809inline void StrictlyUpperMatrix<MT,SO,false>::finalize( size_t i )
1810{
1811 matrix_.finalize( i );
1812}
1814//*************************************************************************************************
1815
1816
1817
1818
1819//=================================================================================================
1820//
1821// ERASE FUNCTIONS
1822//
1823//=================================================================================================
1824
1825//*************************************************************************************************
1835template< typename MT // Type of the adapted sparse matrix
1836 , bool SO > // Storage order of the adapted sparse matrix
1837inline void StrictlyUpperMatrix<MT,SO,false>::erase( size_t i, size_t j )
1838{
1839 using blaze::erase;
1840
1841 erase( matrix_, i, j );
1842}
1844//*************************************************************************************************
1845
1846
1847//*************************************************************************************************
1859template< typename MT // Type of the adapted sparse matrix
1860 , bool SO > // Storage order of the adapted sparse matrix
1861inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
1862 StrictlyUpperMatrix<MT,SO,false>::erase( size_t i, Iterator pos )
1863{
1864 using blaze::erase;
1865
1866 return erase( matrix_, i, pos );
1867}
1869//*************************************************************************************************
1870
1871
1872//*************************************************************************************************
1886template< typename MT // Type of the adapted sparse matrix
1887 , bool SO > // Storage order of the adapted sparse matrix
1888inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
1889 StrictlyUpperMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last )
1890{
1891 using blaze::erase;
1892
1893 return erase( matrix_, i, first, last );
1894}
1896//*************************************************************************************************
1897
1898
1899//*************************************************************************************************
1921template< typename MT // Type of the adapted sparse matrix
1922 , bool SO > // Storage order of the adapted sparse matrix
1923template< typename Pred > // Type of the unary predicate
1924inline void StrictlyUpperMatrix<MT,SO,false>::erase( Pred predicate )
1925{
1926 using blaze::erase;
1927
1928 erase( matrix_, predicate );
1929
1930 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1931}
1933//*************************************************************************************************
1934
1935
1936//*************************************************************************************************
1964template< typename MT // Type of the adapted sparse matrix
1965 , bool SO > // Storage order of the adapted sparse matrix
1966template< typename Pred > // Type of the unary predicate
1967inline void StrictlyUpperMatrix<MT,SO,false>::erase( size_t i, Iterator first, Iterator last, Pred predicate )
1968{
1969 using blaze::erase;
1970
1971 erase( matrix_, i, first, last, predicate );
1972
1973 BLAZE_INTERNAL_ASSERT( isIntact(), "Broken invariant detected" );
1974}
1976//*************************************************************************************************
1977
1978
1979
1980
1981//=================================================================================================
1982//
1983// LOOKUP FUNCTIONS
1984//
1985//=================================================================================================
1986
1987//*************************************************************************************************
2003template< typename MT // Type of the adapted sparse matrix
2004 , bool SO > // Storage order of the adapted sparse matrix
2005inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
2006 StrictlyUpperMatrix<MT,SO,false>::find( size_t i, size_t j )
2007{
2008 return matrix_.find( i, j );
2009}
2011//*************************************************************************************************
2012
2013
2014//*************************************************************************************************
2030template< typename MT // Type of the adapted sparse matrix
2031 , bool SO > // Storage order of the adapted sparse matrix
2032inline typename StrictlyUpperMatrix<MT,SO,false>::ConstIterator
2033 StrictlyUpperMatrix<MT,SO,false>::find( size_t i, size_t j ) const
2034{
2035 return matrix_.find( i, j );
2036}
2038//*************************************************************************************************
2039
2040
2041//*************************************************************************************************
2057template< typename MT // Type of the adapted sparse matrix
2058 , bool SO > // Storage order of the adapted sparse matrix
2059inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
2061{
2062 return matrix_.lowerBound( i, j );
2063}
2065//*************************************************************************************************
2066
2067
2068//*************************************************************************************************
2084template< typename MT // Type of the adapted sparse matrix
2085 , bool SO > // Storage order of the adapted sparse matrix
2086inline typename StrictlyUpperMatrix<MT,SO,false>::ConstIterator
2087 StrictlyUpperMatrix<MT,SO,false>::lowerBound( size_t i, size_t j ) const
2088{
2089 return matrix_.lowerBound( i, j );
2090}
2092//*************************************************************************************************
2093
2094
2095//*************************************************************************************************
2111template< typename MT // Type of the adapted sparse matrix
2112 , bool SO > // Storage order of the adapted sparse matrix
2113inline typename StrictlyUpperMatrix<MT,SO,false>::Iterator
2115{
2116 return matrix_.upperBound( i, j );
2117}
2119//*************************************************************************************************
2120
2121
2122//*************************************************************************************************
2138template< typename MT // Type of the adapted sparse matrix
2139 , bool SO > // Storage order of the adapted sparse matrix
2140inline typename StrictlyUpperMatrix<MT,SO,false>::ConstIterator
2141 StrictlyUpperMatrix<MT,SO,false>::upperBound( size_t i, size_t j ) const
2142{
2143 return matrix_.upperBound( i, j );
2144}
2146//*************************************************************************************************
2147
2148
2149
2150
2151//=================================================================================================
2152//
2153// NUMERIC FUNCTIONS
2154//
2155//=================================================================================================
2156
2157//*************************************************************************************************
2175template< typename MT // Type of the adapted sparse matrix
2176 , bool SO > // Storage order of the adapted sparse matrix
2177template< typename Other > // Data type of the scalar value
2178inline StrictlyUpperMatrix<MT,SO,false>&
2179 StrictlyUpperMatrix<MT,SO,false>::scale( const Other& scalar )
2180{
2181 matrix_.scale( scalar );
2182 return *this;
2183}
2185//*************************************************************************************************
2186
2187
2188
2189
2190//=================================================================================================
2191//
2192// DEBUGGING FUNCTIONS
2193//
2194//=================================================================================================
2195
2196//*************************************************************************************************
2206template< typename MT // Type of the adapted sparse matrix
2207 , bool SO > // Storage order of the adapted sparse matrix
2208inline bool StrictlyUpperMatrix<MT,SO,false>::isIntact() const noexcept
2209{
2210 using blaze::isIntact;
2211
2212 return ( isIntact( matrix_ ) && isStrictlyUpper( matrix_ ) );
2213}
2215//*************************************************************************************************
2216
2217
2218
2219
2220//=================================================================================================
2221//
2222// EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2223//
2224//=================================================================================================
2225
2226//*************************************************************************************************
2237template< typename MT // Type of the adapted sparse matrix
2238 , bool SO > // Storage order of the adapted sparse matrix
2239template< typename Other > // Data type of the foreign expression
2240inline bool StrictlyUpperMatrix<MT,SO,false>::canAlias( const Other* alias ) const noexcept
2241{
2242 return matrix_.canAlias( alias );
2243}
2245//*************************************************************************************************
2246
2247
2248//*************************************************************************************************
2259template< typename MT // Type of the adapted sparse matrix
2260 , bool SO > // Storage order of the adapted sparse matrix
2261template< typename Other > // Data type of the foreign expression
2262inline bool StrictlyUpperMatrix<MT,SO,false>::isAliased( const Other* alias ) const noexcept
2263{
2264 return matrix_.isAliased( alias );
2265}
2267//*************************************************************************************************
2268
2269
2270//*************************************************************************************************
2281template< typename MT // Type of the adapted sparse matrix
2282 , bool SO > // Storage order of the adapted sparse matrix
2283inline bool StrictlyUpperMatrix<MT,SO,false>::canSMPAssign() const noexcept
2284{
2285 return matrix_.canSMPAssign();
2286}
2288//*************************************************************************************************
2289
2290} // namespace blaze
2291
2292#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 IsStrictlyUpper 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 StrictlyUpperProxy 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 StrictlyUpperMatrix.
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
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
bool isStrictlyUpper(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a strictly upper triangular matrix.
Definition: DenseMatrix.h:2363
decltype(auto) declupp(const DenseMatrix< MT, SO > &dm)
Declares the given dense matrix expression dm as upper.
Definition: DMatDeclUppExpr.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.
Header file for the generic max algorithm.