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 void finalize( size_t i ) const;
122  inline void resize( size_t m, size_t n, bool preserve=true ) const;
123  inline void reserve( size_t n ) const;
124  inline void reserve( size_t i, size_t n ) const;
125  inline void trim() const;
126  inline void trim( size_t i ) const;
128  //**********************************************************************************************
129 
130  //**Insertion functions*************************************************************************
133  inline Iterator set ( size_t i, size_t j, const ElementType& value ) const;
134  inline Iterator insert( size_t i, size_t j, const ElementType& value ) const;
135  inline void append( size_t i, size_t j, const ElementType& value, bool check=false ) const;
137  //**********************************************************************************************
138 
139  //**Erase functions*****************************************************************************
142  inline void erase( size_t i, size_t j ) const;
143  inline Iterator erase( size_t i, Iterator pos ) const;
144  inline Iterator erase( size_t i, Iterator first, Iterator last ) const;
145 
146  template< typename Pred >
147  inline void erase( Pred predicate );
148 
149  template< typename Pred >
150  inline void erase( size_t i, Iterator first, Iterator last, Pred predicate );
152  //**********************************************************************************************
153 
154  //**Lookup functions****************************************************************************
157  inline Iterator find ( size_t i, size_t j ) const;
158  inline Iterator lowerBound( size_t i, size_t j ) const;
159  inline Iterator upperBound( size_t i, size_t j ) const;
161  //**********************************************************************************************
162 
163  //**Numeric functions***************************************************************************
166  inline void transpose() const;
167  inline void ctranspose() const;
168 
169  template< typename Other > inline void scale( const Other& scalar ) const;
171  //**********************************************************************************************
172 
173  private:
174  //**Compile time checks*************************************************************************
178  //**********************************************************************************************
179 };
180 //*************************************************************************************************
181 
182 
183 
184 
185 //=================================================================================================
186 //
187 // DATA ACCESS FUNCTIONS
188 //
189 //=================================================================================================
190 
191 //*************************************************************************************************
205 template< typename PT // Type of the proxy
206  , typename MT > // Type of the sparse matrix
208  SparseMatrixProxy<PT,MT>::operator()( size_t i, size_t j ) const
209 {
210  if( (~*this).isRestricted() ) {
211  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
212  }
213 
214  return (~*this).get()(i,j);
215 }
216 //*************************************************************************************************
217 
218 
219 //*************************************************************************************************
233 template< typename PT // Type of the proxy
234  , typename MT > // Type of the sparse matrix
236  SparseMatrixProxy<PT,MT>::at( size_t i, size_t j ) const
237 {
238  if( (~*this).isRestricted() ) {
239  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
240  }
241 
242  return (~*this).get().at(i,j);
243 }
244 //*************************************************************************************************
245 
246 
247 //*************************************************************************************************
258 template< typename PT // Type of the proxy
259  , typename MT > // Type of the sparse matrix
262 {
263  return (~*this).get().begin(i);
264 }
265 //*************************************************************************************************
266 
267 
268 //*************************************************************************************************
279 template< typename PT // Type of the proxy
280  , typename MT > // Type of the sparse matrix
283 {
284  return (~*this).get().cbegin(i);
285 }
286 //*************************************************************************************************
287 
288 
289 //*************************************************************************************************
300 template< typename PT // Type of the proxy
301  , typename MT > // Type of the sparse matrix
304 {
305  return (~*this).get().end(i);
306 }
307 //*************************************************************************************************
308 
309 
310 //*************************************************************************************************
321 template< typename PT // Type of the proxy
322  , typename MT > // Type of the sparse matrix
325 {
326  return (~*this).get().cend(i);
327 }
328 //*************************************************************************************************
329 
330 
331 
332 
333 //=================================================================================================
334 //
335 // UTILITY FUNCTIONS
336 //
337 //=================================================================================================
338 
339 //*************************************************************************************************
344 template< typename PT // Type of the proxy
345  , typename MT > // Type of the sparse matrix
346 inline size_t SparseMatrixProxy<PT,MT>::rows() const
347 {
348  return (~*this).get().rows();
349 }
350 //*************************************************************************************************
351 
352 
353 //*************************************************************************************************
358 template< typename PT // Type of the proxy
359  , typename MT > // Type of the sparse matrix
361 {
362  return (~*this).get().columns();
363 }
364 //*************************************************************************************************
365 
366 
367 //*************************************************************************************************
372 template< typename PT // Type of the proxy
373  , typename MT > // Type of the sparse matrix
375 {
376  return (~*this).get().capacity();
377 }
378 //*************************************************************************************************
379 
380 
381 //*************************************************************************************************
392 template< typename PT // Type of the proxy
393  , typename MT > // Type of the sparse matrix
394 inline size_t SparseMatrixProxy<PT,MT>::capacity( size_t i ) const
395 {
396  return (~*this).get().capacity(i);
397 }
398 //*************************************************************************************************
399 
400 
401 //*************************************************************************************************
406 template< typename PT // Type of the proxy
407  , typename MT > // Type of the sparse matrix
409 {
410  return (~*this).get().nonZeros();
411 }
412 //*************************************************************************************************
413 
414 
415 //*************************************************************************************************
426 template< typename PT // Type of the proxy
427  , typename MT > // Type of the sparse matrix
428 inline size_t SparseMatrixProxy<PT,MT>::nonZeros( size_t i ) const
429 {
430  return (~*this).get().nonZeros(i);
431 }
432 //*************************************************************************************************
433 
434 
435 //*************************************************************************************************
442 template< typename PT // Type of the proxy
443  , typename MT > // Type of the sparse matrix
445 {
446  using blaze::reset;
447 
448  reset( (~*this).get() );
449 }
450 //*************************************************************************************************
451 
452 
453 //*************************************************************************************************
464 template< typename PT // Type of the proxy
465  , typename MT > // Type of the sparse matrix
466 inline void SparseMatrixProxy<PT,MT>::reset( size_t i ) const
467 {
468  using blaze::reset;
469 
470  reset( (~*this).get(), i );
471 }
472 //*************************************************************************************************
473 
474 
475 //*************************************************************************************************
482 template< typename PT // Type of the proxy
483  , typename MT > // Type of the sparse matrix
485 {
486  using blaze::clear;
487 
488  clear( (~*this).get() );
489 }
490 //*************************************************************************************************
491 
492 
493 //*************************************************************************************************
507 template< typename PT // Type of the proxy
508  , typename MT > // Type of the sparse matrix
510  SparseMatrixProxy<PT,MT>::set( size_t i, size_t j, const ElementType& value ) const
511 {
512  if( (~*this).isRestricted() ) {
513  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
514  }
515 
516  return (~*this).get().set( i, j, value );
517 }
518 //*************************************************************************************************
519 
520 
521 //*************************************************************************************************
535 template< typename PT // Type of the proxy
536  , typename MT > // Type of the sparse matrix
538  SparseMatrixProxy<PT,MT>::insert( size_t i, size_t j, const ElementType& value ) const
539 {
540  if( (~*this).isRestricted() ) {
541  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
542  }
543 
544  return (~*this).get().insert( i, j, value );
545 }
546 //*************************************************************************************************
547 
548 
549 //*************************************************************************************************
576 template< typename PT // Type of the proxy
577  , typename MT > // Type of the sparse matrix
578 inline void SparseMatrixProxy<PT,MT>::append( size_t i, size_t j, const ElementType& value, bool check ) const
579 {
580  if( (~*this).isRestricted() ) {
581  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
582  }
583 
584  (~*this).get().append( i, j, value, check );
585 }
586 //*************************************************************************************************
587 
588 
589 //*************************************************************************************************
603 template< typename PT // Type of the proxy
604  , typename MT > // Type of the sparse matrix
605 inline void SparseMatrixProxy<PT,MT>::finalize( size_t i ) const
606 {
607  if( (~*this).isRestricted() ) {
608  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
609  }
610 
611  (~*this).get().finalize( i );
612 }
613 //*************************************************************************************************
614 
615 
616 //*************************************************************************************************
632 template< typename PT // Type of the proxy
633  , typename MT > // Type of the sparse matrix
634 inline void SparseMatrixProxy<PT,MT>::resize( size_t m, size_t n, bool preserve ) const
635 {
636  if( (~*this).isRestricted() ) {
637  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
638  }
639 
640  (~*this).get().resize( m, n, preserve );
641 }
642 //*************************************************************************************************
643 
644 
645 //*************************************************************************************************
656 template< typename PT // Type of the proxy
657  , typename MT > // Type of the sparse matrix
658 inline void SparseMatrixProxy<PT,MT>::reserve( size_t n ) const
659 {
660  if( (~*this).isRestricted() ) {
661  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
662  }
663 
664  (~*this).get().reserve( n );
665 }
666 //*************************************************************************************************
667 
668 
669 //*************************************************************************************************
684 template< typename PT // Type of the proxy
685  , typename MT > // Type of the sparse matrix
686 inline void SparseMatrixProxy<PT,MT>::reserve( size_t i, size_t n ) const
687 {
688  if( (~*this).isRestricted() ) {
689  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
690  }
691 
692  (~*this).get().reserve( i, n );
693 }
694 //*************************************************************************************************
695 
696 
697 //*************************************************************************************************
708 template< typename PT // Type of the proxy
709  , typename MT > // Type of the sparse matrix
711 {
712  if( (~*this).isRestricted() ) {
713  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
714  }
715 
716  (~*this).get().trim();
717 }
718 //*************************************************************************************************
719 
720 
721 //*************************************************************************************************
733 template< typename PT // Type of the proxy
734  , typename MT > // Type of the sparse matrix
735 inline void SparseMatrixProxy<PT,MT>::trim( size_t i ) const
736 {
737  if( (~*this).isRestricted() ) {
738  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
739  }
740 
741  (~*this).get().trim( i );
742 }
743 //*************************************************************************************************
744 
745 
746 //*************************************************************************************************
752 template< typename PT // Type of the proxy
753  , typename MT > // Type of the sparse matrix
755 {
756  if( (~*this).isRestricted() ) {
757  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
758  }
759 
760  (~*this).get().transpose();
761 }
762 //*************************************************************************************************
763 
764 
765 //*************************************************************************************************
771 template< typename PT // Type of the proxy
772  , typename MT > // Type of the sparse matrix
774 {
775  if( (~*this).isRestricted() ) {
776  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
777  }
778 
779  (~*this).get().ctranspose();
780 }
781 //*************************************************************************************************
782 
783 
784 //*************************************************************************************************
791 template< typename PT // Type of the proxy
792  , typename MT > // Type of the sparse matrix
793 template< typename Other > // Data type of the scalar value
794 inline void SparseMatrixProxy<PT,MT>::scale( const Other& scalar ) const
795 {
796  if( (~*this).isRestricted() ) {
797  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
798  }
799 
800  (~*this).get().scale( scalar );
801 }
802 //*************************************************************************************************
803 
804 
805 
806 
807 //=================================================================================================
808 //
809 // ERASE FUNCTIONS
810 //
811 //=================================================================================================
812 
813 //*************************************************************************************************
823 template< typename PT // Type of the proxy
824  , typename MT > // Type of the sparse matrix
825 inline void SparseMatrixProxy<PT,MT>::erase( size_t i, size_t j ) const
826 {
827  if( (~*this).isRestricted() ) {
828  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
829  }
830 
831  (~*this).get().erase( i, j );
832 }
833 //*************************************************************************************************
834 
835 
836 //*************************************************************************************************
848 template< typename PT // Type of the proxy
849  , typename MT > // Type of the sparse matrix
852 {
853  if( (~*this).isRestricted() ) {
854  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
855  }
856 
857  return (~*this).get().erase( i, pos );
858 }
859 //*************************************************************************************************
860 
861 
862 //*************************************************************************************************
875 template< typename PT // Type of the proxy
876  , typename MT > // Type of the sparse matrix
878  SparseMatrixProxy<PT,MT>::erase( size_t i, Iterator first, Iterator last ) const
879 {
880  if( (~*this).isRestricted() ) {
881  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
882  }
883 
884  return (~*this).get().erase( i, first, last );
885 }
886 //*************************************************************************************************
887 
888 
889 //*************************************************************************************************
902 template< typename PT // Type of the proxy
903  , typename MT > // Type of the sparse matrix
904 template< typename Pred > // Type of the unary predicate
905 inline void SparseMatrixProxy<PT,MT>::erase( Pred predicate )
906 {
907  if( (~*this).isRestricted() ) {
908  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
909  }
910 
911  (~*this).get().erase( predicate );
912 }
913 //*************************************************************************************************
914 
915 
916 //*************************************************************************************************
934 template< typename PT // Type of the proxy
935  , typename MT > // Type of the sparse matrix
936 template< typename Pred > // Type of the unary predicate
937 inline void SparseMatrixProxy<PT,MT>::erase( size_t i, Iterator first, Iterator last, Pred predicate )
938 {
939  if( (~*this).isRestricted() ) {
940  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
941  }
942 
943  (~*this).get().erase( i, first, last, predicate );
944 }
945 //*************************************************************************************************
946 
947 
948 
949 
950 //=================================================================================================
951 //
952 // LOOKUP FUNCTIONS
953 //
954 //=================================================================================================
955 
956 //*************************************************************************************************
971 template< typename PT // Type of the proxy
972  , typename MT > // Type of the sparse matrix
974  SparseMatrixProxy<PT,MT>::find( size_t i, size_t j ) const
975 {
976  return (~*this).get().find( i, j );
977 }
978 //*************************************************************************************************
979 
980 
981 //*************************************************************************************************
996 template< typename PT // Type of the proxy
997  , typename MT > // Type of the sparse matrix
999  SparseMatrixProxy<PT,MT>::lowerBound( size_t i, size_t j ) const
1000 {
1001  return (~*this).get().lowerBound( i, j );
1002 }
1003 //*************************************************************************************************
1004 
1005 
1006 //*************************************************************************************************
1021 template< typename PT // Type of the proxy
1022  , typename MT > // Type of the sparse matrix
1023 inline typename SparseMatrixProxy<PT,MT>::Iterator
1024  SparseMatrixProxy<PT,MT>::upperBound( size_t i, size_t j ) const
1025 {
1026  return (~*this).get().upperBound( i, j );
1027 }
1028 //*************************************************************************************************
1029 
1030 
1031 
1032 
1033 //=================================================================================================
1034 //
1035 // GLOBAL FUNCTIONS
1036 //
1037 //=================================================================================================
1038 
1039 //*************************************************************************************************
1042 template< typename PT, typename MT >
1044  begin( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
1045 
1046 template< typename PT, typename MT >
1048  cbegin( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
1049 
1050 template< typename PT, typename MT >
1052  end( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
1053 
1054 template< typename PT, typename MT >
1056  cend( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
1057 
1058 template< typename PT, typename MT >
1059 BLAZE_ALWAYS_INLINE size_t rows( const SparseMatrixProxy<PT,MT>& proxy );
1060 
1061 template< typename PT, typename MT >
1063 
1064 template< typename PT, typename MT >
1066 
1067 template< typename PT, typename MT >
1068 BLAZE_ALWAYS_INLINE size_t capacity( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
1069 
1070 template< typename PT, typename MT >
1072 
1073 template< typename PT, typename MT >
1074 BLAZE_ALWAYS_INLINE size_t nonZeros( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
1075 
1076 template< typename PT, typename MT >
1077 BLAZE_ALWAYS_INLINE void resize( const SparseMatrixProxy<PT,MT>& proxy, size_t m, size_t n, bool preserve=true );
1078 
1079 template< typename PT, typename MT >
1081 
1082 template< typename PT, typename MT >
1083 BLAZE_ALWAYS_INLINE void reset( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
1084 
1085 template< typename PT, typename MT >
1088 //*************************************************************************************************
1089 
1090 
1091 //*************************************************************************************************
1104 template< typename PT // Type of the proxy
1105  , typename MT > // Type of the sparse matrix
1107  begin( const SparseMatrixProxy<PT,MT>& proxy, size_t i )
1108 {
1109  return proxy.begin(i);
1110 }
1111 //*************************************************************************************************
1112 
1113 
1114 //*************************************************************************************************
1127 template< typename PT // Type of the proxy
1128  , typename MT > // Type of the sparse matrix
1130  cbegin( const SparseMatrixProxy<PT,MT>& proxy, size_t i )
1131 {
1132  return proxy.cbegin(i);
1133 }
1134 //*************************************************************************************************
1135 
1136 
1137 //*************************************************************************************************
1151 template< typename PT // Type of the proxy
1152  , typename MT > // Type of the sparse matrix
1154  end( const SparseMatrixProxy<PT,MT>& proxy, size_t i )
1155 {
1156  return proxy.end(i);
1157 }
1158 //*************************************************************************************************
1159 
1160 
1161 //*************************************************************************************************
1175 template< typename PT // Type of the proxy
1176  , typename MT > // Type of the sparse matrix
1178  cend( const SparseMatrixProxy<PT,MT>& proxy, size_t i )
1179 {
1180  return proxy.cend(i);
1181 }
1182 //*************************************************************************************************
1183 
1184 
1185 //*************************************************************************************************
1192 template< typename PT // Type of the proxy
1193  , typename MT > // Type of the sparse matrix
1195 {
1196  return proxy.rows();
1197 }
1198 //*************************************************************************************************
1199 
1200 
1201 //*************************************************************************************************
1208 template< typename PT // Type of the proxy
1209  , typename MT > // Type of the sparse matrix
1211 {
1212  return proxy.columns();
1213 }
1214 //*************************************************************************************************
1215 
1216 
1217 //*************************************************************************************************
1224 template< typename PT // Type of the proxy
1225  , typename MT > // Type of the sparse matrix
1227 {
1228  return proxy.capacity();
1229 }
1230 //*************************************************************************************************
1231 
1232 
1233 //*************************************************************************************************
1246 template< typename PT // Type of the proxy
1247  , typename MT > // Type of the sparse matrix
1249 {
1250  return proxy.capacity(i);
1251 }
1252 //*************************************************************************************************
1253 
1254 
1255 //*************************************************************************************************
1262 template< typename PT // Type of the proxy
1263  , typename MT > // Type of the sparse matrix
1265 {
1266  return proxy.nonZeros();
1267 }
1268 //*************************************************************************************************
1269 
1270 
1271 //*************************************************************************************************
1284 template< typename PT // Type of the proxy
1285  , typename MT > // Type of the sparse matrix
1287 {
1288  return proxy.nonZeros(i);
1289 }
1290 //*************************************************************************************************
1291 
1292 
1293 //*************************************************************************************************
1306 template< typename PT // Type of the proxy
1307  , typename MT > // Type of the sparse matrix
1309  resize_backend( const SparseMatrixProxy<PT,MT>& proxy, size_t m, size_t n, bool preserve )
1310 {
1311  proxy.resize( m, n, preserve );
1312 }
1314 //*************************************************************************************************
1315 
1316 
1317 //*************************************************************************************************
1331 template< typename PT // Type of the proxy
1332  , typename MT > // Type of the sparse matrix
1334  resize_backend( const SparseMatrixProxy<PT,MT>& proxy, size_t m, size_t n, bool preserve )
1335 {
1336  if( m != n ) {
1337  BLAZE_THROW_INVALID_ARGUMENT( "Invalid resize arguments for square matrix" );
1338  }
1339 
1340  proxy.resize( m, preserve );
1341 }
1343 //*************************************************************************************************
1344 
1345 
1346 //*************************************************************************************************
1362 template< typename PT // Type of the proxy
1363  , typename MT > // Type of the sparse matrix
1364 BLAZE_ALWAYS_INLINE void resize( const SparseMatrixProxy<PT,MT>& proxy, size_t m, size_t n, bool preserve )
1365 {
1366  resize_backend( proxy, m, n, preserve );
1367 }
1368 //*************************************************************************************************
1369 
1370 
1371 //*************************************************************************************************
1380 template< typename PT // Type of the proxy
1381  , typename MT > // Type of the sparse matrix
1383 {
1384  proxy.reset();
1385 }
1386 //*************************************************************************************************
1387 
1388 
1389 //*************************************************************************************************
1402 template< typename PT // Type of the proxy
1403  , typename MT > // Type of the sparse matrix
1405 {
1406  proxy.reset(i);
1407 }
1408 //*************************************************************************************************
1409 
1410 
1411 //*************************************************************************************************
1420 template< typename PT // Type of the proxy
1421  , typename MT > // Type of the sparse matrix
1423 {
1424  proxy.clear();
1425 }
1426 //*************************************************************************************************
1427 
1428 } // namespace blaze
1429 
1430 #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
size_t capacity() const
Returns the maximum capacity of the represented matrix.
Definition: SparseMatrixProxy.h:374
Header file for auxiliary alias declarations.
Iterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SparseMatrixProxy.h:974
Iterator begin(size_t i) const
Returns an iterator to the first element of row/column i of the represented matrix.
Definition: SparseMatrixProxy.h:261
Header file for basic type definitions.
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
size_t nonZeros() const
Returns the number of non-zero elements in the represented matrix.
Definition: SparseMatrixProxy.h:408
void trim() const
Removing all excessive capacity from all rows/columns.
Definition: SparseMatrixProxy.h:710
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
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
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:578
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:323
ConstIterator cbegin(size_t i) const
Returns an iterator to the first element of row/column i of the represented matrix.
Definition: SparseMatrixProxy.h:282
void resize(size_t m, size_t n, bool preserve=true) const
Changing the size of the represented matrix.
Definition: SparseMatrixProxy.h:634
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.
Header file for the IsSquare type trait.
void transpose() const
In-place transpose of the represented matrix.
Definition: SparseMatrixProxy.h:754
void scale(const Other &scalar) const
Scaling of the sparse matrix by the scalar value scalar ( ).
Definition: SparseMatrixProxy.h:794
CompositeType_< MT > CompositeType
Data type for composite expression templates.
Definition: SparseMatrixProxy.h:84
Constraint on the data type.
typename T::CompositeType CompositeType_
Alias declaration for nested CompositeType type definitions.The CompositeType_ alias declaration prov...
Definition: Aliases.h:83
size_t columns() const
Returns the current number of columns of the represented matrix.
Definition: SparseMatrixProxy.h:360
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
Iterator set(size_t i, size_t j, const ElementType &value) const
Setting an element of the represented sparse matrix.
Definition: SparseMatrixProxy.h:510
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
void reset() const
Reset to the default initial value.
Definition: SparseMatrixProxy.h:444
ReturnType_< MT > ReturnType
Return type for expression template evaluations.
Definition: SparseMatrixProxy.h:83
Iterator insert(size_t i, size_t j, const ElementType &value) const
Inserting an element into the represented sparse matrix.
Definition: SparseMatrixProxy.h:538
Header file for the exception macros of the math module.
Reference at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SparseMatrixProxy.h:236
Proxy backend for sparse matrix types.The SparseMatrixProxy class serves as a backend for the Proxy c...
Definition: Forward.h:52
void clear() const
Clearing the represented vector.
Definition: SparseMatrixProxy.h:484
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
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.
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:303
Reference operator()(size_t i, size_t j) const
Function call operator for the direct access to matrix elements.
Definition: SparseMatrixProxy.h:208
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:324
void finalize(size_t i) const
Finalizing the element insertion of a row/column.
Definition: SparseMatrixProxy.h:605
void erase(size_t i, size_t j) const
Erasing an element from the sparse matrix.
Definition: SparseMatrixProxy.h:825
void reserve(size_t n) const
Setting the minimum capacity of the represented matrix.
Definition: SparseMatrixProxy.h:658
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
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
Iterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SparseMatrixProxy.h:1024
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
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
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:346
void ctranspose() const
In-place conjugate transpose of the represented matrix.
Definition: SparseMatrixProxy.h:773
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
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:999