SparseMatrixProxy.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_PROXY_SPARSEMATRIXPROXY_H_
36 #define _BLAZE_MATH_PROXY_SPARSEMATRIXPROXY_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
45 #include <blaze/math/Exception.h>
47 #include <blaze/math/shims/Clear.h>
48 #include <blaze/math/shims/Reset.h>
51 #include <blaze/system/Inline.h>
52 #include <blaze/util/DisableIf.h>
53 #include <blaze/util/EnableIf.h>
54 #include <blaze/util/Types.h>
55 
56 
57 namespace blaze {
58 
59 //=================================================================================================
60 //
61 // CLASS DEFINITION
62 //
63 //=================================================================================================
64 
65 //*************************************************************************************************
73 template< typename PT // Type of the proxy
74  , typename MT > // Type of the sparse matrix
75 class SparseMatrixProxy : public SparseMatrix< PT, IsColumnMajorMatrix<MT>::value >
76 {
77  public:
78  //**Type definitions****************************************************************************
89  //**********************************************************************************************
90 
91  //**Compilation flags***************************************************************************
93  enum : bool { smpAssignable = MT::smpAssignable };
94  //**********************************************************************************************
95 
96  //**Data access functions***********************************************************************
99  inline Reference operator()( size_t i, size_t j ) const;
100  inline Reference at( size_t i, size_t j ) const;
101 
102  inline Iterator begin ( size_t i ) const;
103  inline ConstIterator cbegin( size_t i ) const;
104  inline Iterator end ( size_t i ) const;
105  inline ConstIterator cend ( size_t i ) const;
107  //**********************************************************************************************
108 
109  //**Utility functions***************************************************************************
112  inline size_t rows() const;
113  inline size_t columns() const;
114  inline size_t capacity() const;
115  inline size_t capacity( size_t i ) const;
116  inline size_t nonZeros() const;
117  inline size_t nonZeros( size_t i ) const;
118  inline void reset() const;
119  inline void reset( size_t i ) const;
120  inline void clear() const;
121  inline Iterator set( size_t i, size_t j, const ElementType& value ) const;
122  inline Iterator insert( size_t i, size_t j, const ElementType& value ) const;
123  inline void append( size_t i, size_t j, const ElementType& value, bool check=false ) const;
124  inline void finalize( size_t i ) const;
125  inline void erase( size_t i, size_t j ) const;
126  inline Iterator erase( size_t i, Iterator pos ) const;
127  inline Iterator erase( size_t i, Iterator first, Iterator last ) const;
128  inline void resize( size_t m, size_t n, bool preserve=true ) const;
129  inline void reserve( size_t n ) const;
130  inline void reserve( size_t i, size_t n ) const;
131  inline void trim() const;
132  inline void trim( size_t i ) const;
133  inline void transpose() const;
134  inline void ctranspose() const;
135 
136  template< typename Other > inline void scale( const Other& scalar ) const;
138  //**********************************************************************************************
139 
140  //**Lookup functions****************************************************************************
143  inline Iterator find ( size_t i, size_t j ) const;
144  inline Iterator lowerBound( size_t i, size_t j ) const;
145  inline Iterator upperBound( size_t i, size_t j ) const;
147  //**********************************************************************************************
148 
149  private:
150  //**Compile time checks*************************************************************************
154  //**********************************************************************************************
155 };
156 //*************************************************************************************************
157 
158 
159 
160 
161 //=================================================================================================
162 //
163 // DATA ACCESS FUNCTIONS
164 //
165 //=================================================================================================
166 
167 //*************************************************************************************************
181 template< typename PT // Type of the proxy
182  , typename MT > // Type of the sparse matrix
184  SparseMatrixProxy<PT,MT>::operator()( size_t i, size_t j ) const
185 {
186  if( (~*this).isRestricted() ) {
187  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
188  }
189 
190  return (~*this).get()(i,j);
191 }
192 //*************************************************************************************************
193 
194 
195 //*************************************************************************************************
209 template< typename PT // Type of the proxy
210  , typename MT > // Type of the sparse matrix
212  SparseMatrixProxy<PT,MT>::at( size_t i, size_t j ) const
213 {
214  if( (~*this).isRestricted() ) {
215  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
216  }
217 
218  return (~*this).get().at(i,j);
219 }
220 //*************************************************************************************************
221 
222 
223 //*************************************************************************************************
234 template< typename PT // Type of the proxy
235  , typename MT > // Type of the sparse matrix
238 {
239  return (~*this).get().begin(i);
240 }
241 //*************************************************************************************************
242 
243 
244 //*************************************************************************************************
255 template< typename PT // Type of the proxy
256  , typename MT > // Type of the sparse matrix
259 {
260  return (~*this).get().cbegin(i);
261 }
262 //*************************************************************************************************
263 
264 
265 //*************************************************************************************************
276 template< typename PT // Type of the proxy
277  , typename MT > // Type of the sparse matrix
280 {
281  return (~*this).get().end(i);
282 }
283 //*************************************************************************************************
284 
285 
286 //*************************************************************************************************
297 template< typename PT // Type of the proxy
298  , typename MT > // Type of the sparse matrix
301 {
302  return (~*this).get().cend(i);
303 }
304 //*************************************************************************************************
305 
306 
307 
308 
309 //=================================================================================================
310 //
311 // UTILITY FUNCTIONS
312 //
313 //=================================================================================================
314 
315 //*************************************************************************************************
320 template< typename PT // Type of the proxy
321  , typename MT > // Type of the sparse matrix
322 inline size_t SparseMatrixProxy<PT,MT>::rows() const
323 {
324  return (~*this).get().rows();
325 }
326 //*************************************************************************************************
327 
328 
329 //*************************************************************************************************
334 template< typename PT // Type of the proxy
335  , typename MT > // Type of the sparse matrix
337 {
338  return (~*this).get().columns();
339 }
340 //*************************************************************************************************
341 
342 
343 //*************************************************************************************************
348 template< typename PT // Type of the proxy
349  , typename MT > // Type of the sparse matrix
351 {
352  return (~*this).get().capacity();
353 }
354 //*************************************************************************************************
355 
356 
357 //*************************************************************************************************
368 template< typename PT // Type of the proxy
369  , typename MT > // Type of the sparse matrix
370 inline size_t SparseMatrixProxy<PT,MT>::capacity( size_t i ) const
371 {
372  return (~*this).get().capacity(i);
373 }
374 //*************************************************************************************************
375 
376 
377 //*************************************************************************************************
382 template< typename PT // Type of the proxy
383  , typename MT > // Type of the sparse matrix
385 {
386  return (~*this).get().nonZeros();
387 }
388 //*************************************************************************************************
389 
390 
391 //*************************************************************************************************
402 template< typename PT // Type of the proxy
403  , typename MT > // Type of the sparse matrix
404 inline size_t SparseMatrixProxy<PT,MT>::nonZeros( size_t i ) const
405 {
406  return (~*this).get().nonZeros(i);
407 }
408 //*************************************************************************************************
409 
410 
411 //*************************************************************************************************
418 template< typename PT // Type of the proxy
419  , typename MT > // Type of the sparse matrix
421 {
422  using blaze::reset;
423 
424  reset( (~*this).get() );
425 }
426 //*************************************************************************************************
427 
428 
429 //*************************************************************************************************
440 template< typename PT // Type of the proxy
441  , typename MT > // Type of the sparse matrix
442 inline void SparseMatrixProxy<PT,MT>::reset( size_t i ) const
443 {
444  using blaze::reset;
445 
446  reset( (~*this).get(), i );
447 }
448 //*************************************************************************************************
449 
450 
451 //*************************************************************************************************
458 template< typename PT // Type of the proxy
459  , typename MT > // Type of the sparse matrix
461 {
462  using blaze::clear;
463 
464  clear( (~*this).get() );
465 }
466 //*************************************************************************************************
467 
468 
469 //*************************************************************************************************
483 template< typename PT // Type of the proxy
484  , typename MT > // Type of the sparse matrix
486  SparseMatrixProxy<PT,MT>::set( size_t i, size_t j, const ElementType& value ) const
487 {
488  if( (~*this).isRestricted() ) {
489  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
490  }
491 
492  return (~*this).get().set( i, j, value );
493 }
494 //*************************************************************************************************
495 
496 
497 //*************************************************************************************************
511 template< typename PT // Type of the proxy
512  , typename MT > // Type of the sparse matrix
514  SparseMatrixProxy<PT,MT>::insert( size_t i, size_t j, const ElementType& value ) const
515 {
516  if( (~*this).isRestricted() ) {
517  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
518  }
519 
520  return (~*this).get().insert( i, j, value );
521 }
522 //*************************************************************************************************
523 
524 
525 //*************************************************************************************************
552 template< typename PT // Type of the proxy
553  , typename MT > // Type of the sparse matrix
554 inline void SparseMatrixProxy<PT,MT>::append( size_t i, size_t j, const ElementType& value, bool check ) const
555 {
556  if( (~*this).isRestricted() ) {
557  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
558  }
559 
560  (~*this).get().append( i, j, value, check );
561 }
562 //*************************************************************************************************
563 
564 
565 //*************************************************************************************************
579 template< typename PT // Type of the proxy
580  , typename MT > // Type of the sparse matrix
581 inline void SparseMatrixProxy<PT,MT>::finalize( size_t i ) const
582 {
583  if( (~*this).isRestricted() ) {
584  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
585  }
586 
587  (~*this).get().finalize( i );
588 }
589 //*************************************************************************************************
590 
591 
592 //*************************************************************************************************
602 template< typename PT // Type of the proxy
603  , typename MT > // Type of the sparse matrix
604 inline void SparseMatrixProxy<PT,MT>::erase( size_t i, size_t j ) const
605 {
606  if( (~*this).isRestricted() ) {
607  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
608  }
609 
610  (~*this).get().erase( i, j );
611 }
612 //*************************************************************************************************
613 
614 
615 //*************************************************************************************************
627 template< typename PT // Type of the proxy
628  , typename MT > // Type of the sparse matrix
631 {
632  if( (~*this).isRestricted() ) {
633  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
634  }
635 
636  return (~*this).get().erase( i, pos );
637 }
638 //*************************************************************************************************
639 
640 
641 //*************************************************************************************************
654 template< typename PT // Type of the proxy
655  , typename MT > // Type of the sparse matrix
657  SparseMatrixProxy<PT,MT>::erase( size_t i, Iterator first, Iterator last ) const
658 {
659  if( (~*this).isRestricted() ) {
660  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
661  }
662 
663  return (~*this).get().erase( i, first, last );
664 }
665 //*************************************************************************************************
666 
667 
668 //*************************************************************************************************
684 template< typename PT // Type of the proxy
685  , typename MT > // Type of the sparse matrix
686 inline void SparseMatrixProxy<PT,MT>::resize( size_t m, size_t n, bool preserve ) const
687 {
688  if( (~*this).isRestricted() ) {
689  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
690  }
691 
692  (~*this).get().resize( m, n, preserve );
693 }
694 //*************************************************************************************************
695 
696 
697 //*************************************************************************************************
708 template< typename PT // Type of the proxy
709  , typename MT > // Type of the sparse matrix
710 inline void SparseMatrixProxy<PT,MT>::reserve( size_t n ) const
711 {
712  if( (~*this).isRestricted() ) {
713  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
714  }
715 
716  (~*this).get().reserve( n );
717 }
718 //*************************************************************************************************
719 
720 
721 //*************************************************************************************************
736 template< typename PT // Type of the proxy
737  , typename MT > // Type of the sparse matrix
738 inline void SparseMatrixProxy<PT,MT>::reserve( size_t i, size_t n ) const
739 {
740  if( (~*this).isRestricted() ) {
741  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
742  }
743 
744  (~*this).get().reserve( i, n );
745 }
746 //*************************************************************************************************
747 
748 
749 //*************************************************************************************************
760 template< typename PT // Type of the proxy
761  , typename MT > // Type of the sparse matrix
763 {
764  if( (~*this).isRestricted() ) {
765  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
766  }
767 
768  (~*this).get().trim();
769 }
770 //*************************************************************************************************
771 
772 
773 //*************************************************************************************************
785 template< typename PT // Type of the proxy
786  , typename MT > // Type of the sparse matrix
787 inline void SparseMatrixProxy<PT,MT>::trim( size_t i ) const
788 {
789  if( (~*this).isRestricted() ) {
790  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
791  }
792 
793  (~*this).get().trim( i );
794 }
795 //*************************************************************************************************
796 
797 
798 //*************************************************************************************************
804 template< typename PT // Type of the proxy
805  , typename MT > // Type of the sparse matrix
807 {
808  if( (~*this).isRestricted() ) {
809  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
810  }
811 
812  (~*this).get().transpose();
813 }
814 //*************************************************************************************************
815 
816 
817 //*************************************************************************************************
823 template< typename PT // Type of the proxy
824  , typename MT > // Type of the sparse matrix
826 {
827  if( (~*this).isRestricted() ) {
828  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
829  }
830 
831  (~*this).get().ctranspose();
832 }
833 //*************************************************************************************************
834 
835 
836 //*************************************************************************************************
843 template< typename PT // Type of the proxy
844  , typename MT > // Type of the sparse matrix
845 template< typename Other > // Data type of the scalar value
846 inline void SparseMatrixProxy<PT,MT>::scale( const Other& scalar ) const
847 {
848  if( (~*this).isRestricted() ) {
849  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
850  }
851 
852  (~*this).get().scale( scalar );
853 }
854 //*************************************************************************************************
855 
856 
857 
858 
859 //=================================================================================================
860 //
861 // LOOKUP FUNCTIONS
862 //
863 //=================================================================================================
864 
865 //*************************************************************************************************
880 template< typename PT // Type of the proxy
881  , typename MT > // Type of the sparse matrix
883  SparseMatrixProxy<PT,MT>::find( size_t i, size_t j ) const
884 {
885  return (~*this).get().find( i, j );
886 }
887 //*************************************************************************************************
888 
889 
890 //*************************************************************************************************
905 template< typename PT // Type of the proxy
906  , typename MT > // Type of the sparse matrix
908  SparseMatrixProxy<PT,MT>::lowerBound( size_t i, size_t j ) const
909 {
910  return (~*this).get().lowerBound( i, j );
911 }
912 //*************************************************************************************************
913 
914 
915 //*************************************************************************************************
930 template< typename PT // Type of the proxy
931  , typename MT > // Type of the sparse matrix
933  SparseMatrixProxy<PT,MT>::upperBound( size_t i, size_t j ) const
934 {
935  return (~*this).get().upperBound( i, j );
936 }
937 //*************************************************************************************************
938 
939 
940 
941 
942 //=================================================================================================
943 //
944 // GLOBAL FUNCTIONS
945 //
946 //=================================================================================================
947 
948 //*************************************************************************************************
951 template< typename PT, typename MT >
953  begin( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
954 
955 template< typename PT, typename MT >
957  cbegin( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
958 
959 template< typename PT, typename MT >
961  end( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
962 
963 template< typename PT, typename MT >
965  cend( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
966 
967 template< typename PT, typename MT >
968 BLAZE_ALWAYS_INLINE size_t rows( const SparseMatrixProxy<PT,MT>& proxy );
969 
970 template< typename PT, typename MT >
972 
973 template< typename PT, typename MT >
975 
976 template< typename PT, typename MT >
977 BLAZE_ALWAYS_INLINE size_t capacity( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
978 
979 template< typename PT, typename MT >
981 
982 template< typename PT, typename MT >
983 BLAZE_ALWAYS_INLINE size_t nonZeros( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
984 
985 template< typename PT, typename MT >
986 BLAZE_ALWAYS_INLINE void resize( const SparseMatrixProxy<PT,MT>& proxy, size_t m, size_t n, bool preserve=true );
987 
988 template< typename PT, typename MT >
990 
991 template< typename PT, typename MT >
992 BLAZE_ALWAYS_INLINE void reset( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
993 
994 template< typename PT, typename MT >
997 //*************************************************************************************************
998 
999 
1000 //*************************************************************************************************
1013 template< typename PT // Type of the proxy
1014  , typename MT > // Type of the sparse matrix
1016  begin( const SparseMatrixProxy<PT,MT>& proxy, size_t i )
1017 {
1018  return proxy.begin(i);
1019 }
1020 //*************************************************************************************************
1021 
1022 
1023 //*************************************************************************************************
1036 template< typename PT // Type of the proxy
1037  , typename MT > // Type of the sparse matrix
1039  cbegin( const SparseMatrixProxy<PT,MT>& proxy, size_t i )
1040 {
1041  return proxy.cbegin(i);
1042 }
1043 //*************************************************************************************************
1044 
1045 
1046 //*************************************************************************************************
1060 template< typename PT // Type of the proxy
1061  , typename MT > // Type of the sparse matrix
1063  end( const SparseMatrixProxy<PT,MT>& proxy, size_t i )
1064 {
1065  return proxy.end(i);
1066 }
1067 //*************************************************************************************************
1068 
1069 
1070 //*************************************************************************************************
1084 template< typename PT // Type of the proxy
1085  , typename MT > // Type of the sparse matrix
1087  cend( const SparseMatrixProxy<PT,MT>& proxy, size_t i )
1088 {
1089  return proxy.cend(i);
1090 }
1091 //*************************************************************************************************
1092 
1093 
1094 //*************************************************************************************************
1101 template< typename PT // Type of the proxy
1102  , typename MT > // Type of the sparse matrix
1104 {
1105  return proxy.rows();
1106 }
1107 //*************************************************************************************************
1108 
1109 
1110 //*************************************************************************************************
1117 template< typename PT // Type of the proxy
1118  , typename MT > // Type of the sparse matrix
1120 {
1121  return proxy.columns();
1122 }
1123 //*************************************************************************************************
1124 
1125 
1126 //*************************************************************************************************
1133 template< typename PT // Type of the proxy
1134  , typename MT > // Type of the sparse matrix
1136 {
1137  return proxy.capacity();
1138 }
1139 //*************************************************************************************************
1140 
1141 
1142 //*************************************************************************************************
1155 template< typename PT // Type of the proxy
1156  , typename MT > // Type of the sparse matrix
1158 {
1159  return proxy.capacity(i);
1160 }
1161 //*************************************************************************************************
1162 
1163 
1164 //*************************************************************************************************
1171 template< typename PT // Type of the proxy
1172  , typename MT > // Type of the sparse matrix
1174 {
1175  return proxy.nonZeros();
1176 }
1177 //*************************************************************************************************
1178 
1179 
1180 //*************************************************************************************************
1193 template< typename PT // Type of the proxy
1194  , typename MT > // Type of the sparse matrix
1196 {
1197  return proxy.nonZeros(i);
1198 }
1199 //*************************************************************************************************
1200 
1201 
1202 //*************************************************************************************************
1215 template< typename PT // Type of the proxy
1216  , typename MT > // Type of the sparse matrix
1217 BLAZE_ALWAYS_INLINE DisableIf_< IsSquare<MT> >
1218  resize_backend( const SparseMatrixProxy<PT,MT>& proxy, size_t m, size_t n, bool preserve )
1219 {
1220  proxy.resize( m, n, preserve );
1221 }
1223 //*************************************************************************************************
1224 
1225 
1226 //*************************************************************************************************
1240 template< typename PT // Type of the proxy
1241  , typename MT > // Type of the sparse matrix
1242 BLAZE_ALWAYS_INLINE EnableIf_< IsSquare<MT> >
1243  resize_backend( const SparseMatrixProxy<PT,MT>& proxy, size_t m, size_t n, bool preserve )
1244 {
1245  if( m != n ) {
1246  BLAZE_THROW_INVALID_ARGUMENT( "Invalid resize arguments for square matrix" );
1247  }
1248 
1249  proxy.resize( m, preserve );
1250 }
1252 //*************************************************************************************************
1253 
1254 
1255 //*************************************************************************************************
1271 template< typename PT // Type of the proxy
1272  , typename MT > // Type of the sparse matrix
1273 BLAZE_ALWAYS_INLINE void resize( const SparseMatrixProxy<PT,MT>& proxy, size_t m, size_t n, bool preserve )
1274 {
1275  resize_backend( proxy, m, n, preserve );
1276 }
1277 //*************************************************************************************************
1278 
1279 
1280 //*************************************************************************************************
1289 template< typename PT // Type of the proxy
1290  , typename MT > // Type of the sparse matrix
1292 {
1293  proxy.reset();
1294 }
1295 //*************************************************************************************************
1296 
1297 
1298 //*************************************************************************************************
1311 template< typename PT // Type of the proxy
1312  , typename MT > // Type of the sparse matrix
1314 {
1315  proxy.reset(i);
1316 }
1317 //*************************************************************************************************
1318 
1319 
1320 //*************************************************************************************************
1329 template< typename PT // Type of the proxy
1330  , typename MT > // Type of the sparse matrix
1332 {
1333  proxy.clear();
1334 }
1335 //*************************************************************************************************
1336 
1337 } // namespace blaze
1338 
1339 #endif
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Iterator set(size_t i, size_t j, const ElementType &value) const
Setting an element of the represented sparse matrix.
Definition: SparseMatrixProxy.h:486
void append(size_t i, size_t j, const ElementType &value, bool check=false) const
Appending an element to the specified row/column of the sparse matrix.
Definition: SparseMatrixProxy.h:554
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:346
Header file for basic type definitions.
Iterator insert(size_t i, size_t j, const ElementType &value) const
Inserting an element into the represented sparse matrix.
Definition: SparseMatrixProxy.h:514
size_t nonZeros() const
Returns the number of non-zero elements in the represented matrix.
Definition: SparseMatrixProxy.h:384
ResultType_< MT > ResultType
Result type for expression template evaluations.
Definition: SparseMatrixProxy.h:79
ConstReference_< MT > ConstReference
Reference to a constant matrix value.
Definition: SparseMatrixProxy.h:86
void reset() const
Reset to the default initial value.
Definition: SparseMatrixProxy.h:420
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:188
void erase(size_t i, size_t j) const
Erasing an element from the sparse matrix.
Definition: SparseMatrixProxy.h:604
Header file for the IsColumnMajorMatrix type trait.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
Iterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SparseMatrixProxy.h:933
size_t capacity() const
Returns the maximum capacity of the represented matrix.
Definition: SparseMatrixProxy.h:350
void transpose() const
In-place transpose of the represented matrix.
Definition: SparseMatrixProxy.h:806
ConstIterator cend(size_t i) const
Returns an iterator just past the last element of row/column i of the represented matrix...
Definition: SparseMatrixProxy.h:300
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:384
void finalize(size_t i) const
Finalizing the element insertion of a row/column.
Definition: SparseMatrixProxy.h:581
Iterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: SparseMatrixProxy.h:908
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
Iterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SparseMatrixProxy.h:883
BLAZE_ALWAYS_INLINE MT::ConstIterator cend(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:298
BLAZE_ALWAYS_INLINE MT::ConstIterator cbegin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:232
typename T::ReturnType ReturnType_
Alias declaration for nested ReturnType type definitions.The ReturnType_ alias declaration provides a...
Definition: Aliases.h:343
Header file for the SparseMatrix base class.
Reference at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SparseMatrixProxy.h:212
Header file for the IsSquare type trait.
CompositeType_< MT > CompositeType
Data type for composite expression templates.
Definition: SparseMatrixProxy.h:84
Constraint on the data type.
void trim() const
Removing all excessive capacity from all rows/columns.
Definition: SparseMatrixProxy.h:762
Iterator begin(size_t i) const
Returns an iterator to the first element of row/column i of the represented matrix.
Definition: SparseMatrixProxy.h:237
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
void reserve(size_t n) const
Setting the minimum capacity of the represented matrix.
Definition: SparseMatrixProxy.h:710
Header file for the DisableIf class template.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2647
void scale(const Other &scalar) const
Scaling of the sparse matrix by the scalar value scalar ( ).
Definition: SparseMatrixProxy.h:846
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:330
ReturnType_< MT > ReturnType
Return type for expression template evaluations.
Definition: SparseMatrixProxy.h:83
Header file for the exception macros of the math module.
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:538
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:254
Proxy backend for sparse matrix types.The SparseMatrixProxy class serves as a backend for the Proxy c...
Definition: Forward.h:52
ConstIterator cbegin(size_t i) const
Returns an iterator to the first element of row/column i of the represented matrix.
Definition: SparseMatrixProxy.h:258
typename T::Reference Reference_
Alias declaration for nested Reference type definitions.The Reference_ alias declaration provides a c...
Definition: Aliases.h:283
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
TransposeType_< MT > TransposeType
Transpose type for expression template evaluations.
Definition: SparseMatrixProxy.h:81
void clear() const
Clearing the represented vector.
Definition: SparseMatrixProxy.h:460
size_t columns() const
Returns the current number of columns of the represented matrix.
Definition: SparseMatrixProxy.h:336
Reference_< MT > Reference
Reference to a non-constant matrix value.
Definition: SparseMatrixProxy.h:85
ElementType_< MT > ElementType
Type of the sparse matrix elements.
Definition: SparseMatrixProxy.h:82
Header file for the reset shim.
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2646
Reference operator()(size_t i, size_t j) const
Function call operator for the direct access to matrix elements.
Definition: SparseMatrixProxy.h:184
typename T::OppositeType OppositeType_
Alias declaration for nested OppositeType type definitions.The OppositeType_ alias declaration provid...
Definition: Aliases.h:243
typename T::Iterator Iterator_
Alias declaration for nested Iterator type definitions.The Iterator_ alias declaration provides a con...
Definition: Aliases.h:183
OppositeType_< MT > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SparseMatrixProxy.h:80
typename T::ConstReference ConstReference_
Alias declaration for nested ConstReference type definitions.The ConstReference_ alias declaration pr...
Definition: Aliases.h:143
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:314
void ctranspose() const
In-place conjugate transpose of the represented matrix.
Definition: SparseMatrixProxy.h:825
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
Iterator_< MT > Iterator
Iterator over non-constant elements.
Definition: SparseMatrixProxy.h:87
Iterator end(size_t i) const
Returns an iterator just past the last element of row/column i of the represented matrix...
Definition: SparseMatrixProxy.h:279
ConstIterator_< MT > ConstIterator
Iterator over constant elements.
Definition: SparseMatrixProxy.h:88
size_t rows() const
Returns the current number of rows of the represented matrix.
Definition: SparseMatrixProxy.h:322
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2644
typename T::TransposeType TransposeType_
Alias declaration for nested TransposeType type definitions.The TransposeType_ alias declaration prov...
Definition: Aliases.h:403
System settings for the inline keywords.
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:61
void resize(size_t m, size_t n, bool preserve=true) const
Changing the size of the represented matrix.
Definition: SparseMatrixProxy.h:686