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
76  : public SparseMatrix< PT, IsColumnMajorMatrix_v<MT> >
77 {
78  public:
79  //**Type definitions****************************************************************************
90  //**********************************************************************************************
91 
92  //**Compilation flags***************************************************************************
94  static constexpr bool smpAssignable = MT::smpAssignable;
95  //**********************************************************************************************
96 
97  //**Data access functions***********************************************************************
100  inline Reference operator()( size_t i, size_t j ) const;
101  inline Reference at( size_t i, size_t j ) const;
102 
103  inline Iterator begin ( size_t i ) const;
104  inline ConstIterator cbegin( size_t i ) const;
105  inline Iterator end ( size_t i ) const;
106  inline ConstIterator cend ( size_t i ) const;
108  //**********************************************************************************************
109 
110  //**Utility functions***************************************************************************
113  inline size_t rows() const;
114  inline size_t columns() const;
115  inline size_t capacity() const;
116  inline size_t capacity( size_t i ) const;
117  inline size_t nonZeros() const;
118  inline size_t nonZeros( size_t i ) const;
119  inline void reset() const;
120  inline void reset( size_t i ) const;
121  inline void clear() const;
122  inline void finalize( size_t i ) const;
123  inline void resize( size_t m, size_t n, bool preserve=true ) const;
124  inline void reserve( size_t n ) const;
125  inline void reserve( size_t i, size_t n ) const;
126  inline void trim() const;
127  inline void trim( size_t i ) const;
129  //**********************************************************************************************
130 
131  //**Insertion functions*************************************************************************
134  inline Iterator set ( size_t i, size_t j, const ElementType& value ) const;
135  inline Iterator insert( size_t i, size_t j, const ElementType& value ) const;
136  inline void append( size_t i, size_t j, const ElementType& value, bool check=false ) const;
138  //**********************************************************************************************
139 
140  //**Erase functions*****************************************************************************
143  inline void erase( size_t i, size_t j ) const;
144  inline Iterator erase( size_t i, Iterator pos ) const;
145  inline Iterator erase( size_t i, Iterator first, Iterator last ) const;
146 
147  template< typename Pred >
148  inline void erase( Pred predicate );
149 
150  template< typename Pred >
151  inline void erase( size_t i, Iterator first, Iterator last, Pred predicate );
153  //**********************************************************************************************
154 
155  //**Lookup functions****************************************************************************
158  inline Iterator find ( size_t i, size_t j ) const;
159  inline Iterator lowerBound( size_t i, size_t j ) const;
160  inline Iterator upperBound( size_t i, size_t j ) const;
162  //**********************************************************************************************
163 
164  //**Numeric functions***************************************************************************
167  inline void transpose() const;
168  inline void ctranspose() const;
169 
170  template< typename Other > inline void scale( const Other& scalar ) const;
172  //**********************************************************************************************
173 
174  private:
175  //**Compile time checks*************************************************************************
179  //**********************************************************************************************
180 };
181 //*************************************************************************************************
182 
183 
184 
185 
186 //=================================================================================================
187 //
188 // DATA ACCESS FUNCTIONS
189 //
190 //=================================================================================================
191 
192 //*************************************************************************************************
206 template< typename PT // Type of the proxy
207  , typename MT > // Type of the sparse matrix
209  SparseMatrixProxy<PT,MT>::operator()( size_t i, size_t j ) const
210 {
211  if( (~*this).isRestricted() ) {
212  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
213  }
214 
215  return (~*this).get()(i,j);
216 }
217 //*************************************************************************************************
218 
219 
220 //*************************************************************************************************
234 template< typename PT // Type of the proxy
235  , typename MT > // Type of the sparse matrix
237  SparseMatrixProxy<PT,MT>::at( size_t i, size_t j ) const
238 {
239  if( (~*this).isRestricted() ) {
240  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
241  }
242 
243  return (~*this).get().at(i,j);
244 }
245 //*************************************************************************************************
246 
247 
248 //*************************************************************************************************
259 template< typename PT // Type of the proxy
260  , typename MT > // Type of the sparse matrix
263 {
264  return (~*this).get().begin(i);
265 }
266 //*************************************************************************************************
267 
268 
269 //*************************************************************************************************
280 template< typename PT // Type of the proxy
281  , typename MT > // Type of the sparse matrix
284 {
285  return (~*this).get().cbegin(i);
286 }
287 //*************************************************************************************************
288 
289 
290 //*************************************************************************************************
301 template< typename PT // Type of the proxy
302  , typename MT > // Type of the sparse matrix
305 {
306  return (~*this).get().end(i);
307 }
308 //*************************************************************************************************
309 
310 
311 //*************************************************************************************************
322 template< typename PT // Type of the proxy
323  , typename MT > // Type of the sparse matrix
326 {
327  return (~*this).get().cend(i);
328 }
329 //*************************************************************************************************
330 
331 
332 
333 
334 //=================================================================================================
335 //
336 // UTILITY FUNCTIONS
337 //
338 //=================================================================================================
339 
340 //*************************************************************************************************
345 template< typename PT // Type of the proxy
346  , typename MT > // Type of the sparse matrix
347 inline size_t SparseMatrixProxy<PT,MT>::rows() const
348 {
349  return (~*this).get().rows();
350 }
351 //*************************************************************************************************
352 
353 
354 //*************************************************************************************************
359 template< typename PT // Type of the proxy
360  , typename MT > // Type of the sparse matrix
362 {
363  return (~*this).get().columns();
364 }
365 //*************************************************************************************************
366 
367 
368 //*************************************************************************************************
373 template< typename PT // Type of the proxy
374  , typename MT > // Type of the sparse matrix
376 {
377  return (~*this).get().capacity();
378 }
379 //*************************************************************************************************
380 
381 
382 //*************************************************************************************************
393 template< typename PT // Type of the proxy
394  , typename MT > // Type of the sparse matrix
395 inline size_t SparseMatrixProxy<PT,MT>::capacity( size_t i ) const
396 {
397  return (~*this).get().capacity(i);
398 }
399 //*************************************************************************************************
400 
401 
402 //*************************************************************************************************
407 template< typename PT // Type of the proxy
408  , typename MT > // Type of the sparse matrix
410 {
411  return (~*this).get().nonZeros();
412 }
413 //*************************************************************************************************
414 
415 
416 //*************************************************************************************************
427 template< typename PT // Type of the proxy
428  , typename MT > // Type of the sparse matrix
429 inline size_t SparseMatrixProxy<PT,MT>::nonZeros( size_t i ) const
430 {
431  return (~*this).get().nonZeros(i);
432 }
433 //*************************************************************************************************
434 
435 
436 //*************************************************************************************************
443 template< typename PT // Type of the proxy
444  , typename MT > // Type of the sparse matrix
446 {
447  using blaze::reset;
448 
449  reset( (~*this).get() );
450 }
451 //*************************************************************************************************
452 
453 
454 //*************************************************************************************************
465 template< typename PT // Type of the proxy
466  , typename MT > // Type of the sparse matrix
467 inline void SparseMatrixProxy<PT,MT>::reset( size_t i ) const
468 {
469  using blaze::reset;
470 
471  reset( (~*this).get(), i );
472 }
473 //*************************************************************************************************
474 
475 
476 //*************************************************************************************************
483 template< typename PT // Type of the proxy
484  , typename MT > // Type of the sparse matrix
486 {
487  using blaze::clear;
488 
489  clear( (~*this).get() );
490 }
491 //*************************************************************************************************
492 
493 
494 //*************************************************************************************************
508 template< typename PT // Type of the proxy
509  , typename MT > // Type of the sparse matrix
511  SparseMatrixProxy<PT,MT>::set( size_t i, size_t j, const ElementType& value ) const
512 {
513  if( (~*this).isRestricted() ) {
514  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
515  }
516 
517  return (~*this).get().set( i, j, value );
518 }
519 //*************************************************************************************************
520 
521 
522 //*************************************************************************************************
536 template< typename PT // Type of the proxy
537  , typename MT > // Type of the sparse matrix
539  SparseMatrixProxy<PT,MT>::insert( size_t i, size_t j, const ElementType& value ) const
540 {
541  if( (~*this).isRestricted() ) {
542  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
543  }
544 
545  return (~*this).get().insert( i, j, value );
546 }
547 //*************************************************************************************************
548 
549 
550 //*************************************************************************************************
577 template< typename PT // Type of the proxy
578  , typename MT > // Type of the sparse matrix
579 inline void SparseMatrixProxy<PT,MT>::append( size_t i, size_t j, const ElementType& value, bool check ) const
580 {
581  if( (~*this).isRestricted() ) {
582  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
583  }
584 
585  (~*this).get().append( i, j, value, check );
586 }
587 //*************************************************************************************************
588 
589 
590 //*************************************************************************************************
604 template< typename PT // Type of the proxy
605  , typename MT > // Type of the sparse matrix
606 inline void SparseMatrixProxy<PT,MT>::finalize( size_t i ) const
607 {
608  if( (~*this).isRestricted() ) {
609  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
610  }
611 
612  (~*this).get().finalize( i );
613 }
614 //*************************************************************************************************
615 
616 
617 //*************************************************************************************************
633 template< typename PT // Type of the proxy
634  , typename MT > // Type of the sparse matrix
635 inline void SparseMatrixProxy<PT,MT>::resize( size_t m, size_t n, bool preserve ) const
636 {
637  if( (~*this).isRestricted() ) {
638  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
639  }
640 
641  (~*this).get().resize( m, n, preserve );
642 }
643 //*************************************************************************************************
644 
645 
646 //*************************************************************************************************
657 template< typename PT // Type of the proxy
658  , typename MT > // Type of the sparse matrix
659 inline void SparseMatrixProxy<PT,MT>::reserve( size_t n ) const
660 {
661  if( (~*this).isRestricted() ) {
662  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
663  }
664 
665  (~*this).get().reserve( n );
666 }
667 //*************************************************************************************************
668 
669 
670 //*************************************************************************************************
685 template< typename PT // Type of the proxy
686  , typename MT > // Type of the sparse matrix
687 inline void SparseMatrixProxy<PT,MT>::reserve( size_t i, size_t n ) const
688 {
689  if( (~*this).isRestricted() ) {
690  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
691  }
692 
693  (~*this).get().reserve( i, n );
694 }
695 //*************************************************************************************************
696 
697 
698 //*************************************************************************************************
709 template< typename PT // Type of the proxy
710  , typename MT > // Type of the sparse matrix
712 {
713  if( (~*this).isRestricted() ) {
714  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
715  }
716 
717  (~*this).get().trim();
718 }
719 //*************************************************************************************************
720 
721 
722 //*************************************************************************************************
734 template< typename PT // Type of the proxy
735  , typename MT > // Type of the sparse matrix
736 inline void SparseMatrixProxy<PT,MT>::trim( size_t i ) const
737 {
738  if( (~*this).isRestricted() ) {
739  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
740  }
741 
742  (~*this).get().trim( i );
743 }
744 //*************************************************************************************************
745 
746 
747 //*************************************************************************************************
753 template< typename PT // Type of the proxy
754  , typename MT > // Type of the sparse matrix
756 {
757  if( (~*this).isRestricted() ) {
758  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
759  }
760 
761  (~*this).get().transpose();
762 }
763 //*************************************************************************************************
764 
765 
766 //*************************************************************************************************
772 template< typename PT // Type of the proxy
773  , typename MT > // Type of the sparse matrix
775 {
776  if( (~*this).isRestricted() ) {
777  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
778  }
779 
780  (~*this).get().ctranspose();
781 }
782 //*************************************************************************************************
783 
784 
785 //*************************************************************************************************
796 template< typename PT // Type of the proxy
797  , typename MT > // Type of the sparse matrix
798 template< typename Other > // Data type of the scalar value
799 inline void SparseMatrixProxy<PT,MT>::scale( const Other& scalar ) const
800 {
801  if( (~*this).isRestricted() ) {
802  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
803  }
804 
805  (~*this).get().scale( scalar );
806 }
807 //*************************************************************************************************
808 
809 
810 
811 
812 //=================================================================================================
813 //
814 // ERASE FUNCTIONS
815 //
816 //=================================================================================================
817 
818 //*************************************************************************************************
828 template< typename PT // Type of the proxy
829  , typename MT > // Type of the sparse matrix
830 inline void SparseMatrixProxy<PT,MT>::erase( size_t i, size_t j ) const
831 {
832  if( (~*this).isRestricted() ) {
833  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
834  }
835 
836  (~*this).get().erase( i, j );
837 }
838 //*************************************************************************************************
839 
840 
841 //*************************************************************************************************
853 template< typename PT // Type of the proxy
854  , typename MT > // Type of the sparse matrix
857 {
858  if( (~*this).isRestricted() ) {
859  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
860  }
861 
862  return (~*this).get().erase( i, pos );
863 }
864 //*************************************************************************************************
865 
866 
867 //*************************************************************************************************
880 template< typename PT // Type of the proxy
881  , typename MT > // Type of the sparse matrix
883  SparseMatrixProxy<PT,MT>::erase( size_t i, Iterator first, Iterator last ) const
884 {
885  if( (~*this).isRestricted() ) {
886  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
887  }
888 
889  return (~*this).get().erase( i, first, last );
890 }
891 //*************************************************************************************************
892 
893 
894 //*************************************************************************************************
907 template< typename PT // Type of the proxy
908  , typename MT > // Type of the sparse matrix
909 template< typename Pred > // Type of the unary predicate
910 inline void SparseMatrixProxy<PT,MT>::erase( Pred predicate )
911 {
912  if( (~*this).isRestricted() ) {
913  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
914  }
915 
916  (~*this).get().erase( predicate );
917 }
918 //*************************************************************************************************
919 
920 
921 //*************************************************************************************************
939 template< typename PT // Type of the proxy
940  , typename MT > // Type of the sparse matrix
941 template< typename Pred > // Type of the unary predicate
942 inline void SparseMatrixProxy<PT,MT>::erase( size_t i, Iterator first, Iterator last, Pred predicate )
943 {
944  if( (~*this).isRestricted() ) {
945  BLAZE_THROW_INVALID_ARGUMENT( "Invalid access to restricted element" );
946  }
947 
948  (~*this).get().erase( i, first, last, predicate );
949 }
950 //*************************************************************************************************
951 
952 
953 
954 
955 //=================================================================================================
956 //
957 // LOOKUP FUNCTIONS
958 //
959 //=================================================================================================
960 
961 //*************************************************************************************************
976 template< typename PT // Type of the proxy
977  , typename MT > // Type of the sparse matrix
979  SparseMatrixProxy<PT,MT>::find( size_t i, size_t j ) const
980 {
981  return (~*this).get().find( i, j );
982 }
983 //*************************************************************************************************
984 
985 
986 //*************************************************************************************************
1001 template< typename PT // Type of the proxy
1002  , typename MT > // Type of the sparse matrix
1003 inline typename SparseMatrixProxy<PT,MT>::Iterator
1004  SparseMatrixProxy<PT,MT>::lowerBound( size_t i, size_t j ) const
1005 {
1006  return (~*this).get().lowerBound( i, j );
1007 }
1008 //*************************************************************************************************
1009 
1010 
1011 //*************************************************************************************************
1026 template< typename PT // Type of the proxy
1027  , typename MT > // Type of the sparse matrix
1028 inline typename SparseMatrixProxy<PT,MT>::Iterator
1029  SparseMatrixProxy<PT,MT>::upperBound( size_t i, size_t j ) const
1030 {
1031  return (~*this).get().upperBound( i, j );
1032 }
1033 //*************************************************************************************************
1034 
1035 
1036 
1037 
1038 //=================================================================================================
1039 //
1040 // GLOBAL FUNCTIONS
1041 //
1042 //=================================================================================================
1043 
1044 //*************************************************************************************************
1047 template< typename PT, typename MT >
1049  begin( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
1050 
1051 template< typename PT, typename MT >
1053  cbegin( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
1054 
1055 template< typename PT, typename MT >
1057  end( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
1058 
1059 template< typename PT, typename MT >
1061  cend( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
1062 
1063 template< typename PT, typename MT >
1064 size_t rows( const SparseMatrixProxy<PT,MT>& proxy );
1065 
1066 template< typename PT, typename MT >
1067 size_t columns( const SparseMatrixProxy<PT,MT>& proxy );
1068 
1069 template< typename PT, typename MT >
1070 size_t capacity( const SparseMatrixProxy<PT,MT>& proxy );
1071 
1072 template< typename PT, typename MT >
1073 size_t capacity( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
1074 
1075 template< typename PT, typename MT >
1076 size_t nonZeros( const SparseMatrixProxy<PT,MT>& proxy );
1077 
1078 template< typename PT, typename MT >
1079 size_t nonZeros( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
1080 
1081 template< typename PT, typename MT >
1082 void resize( const SparseMatrixProxy<PT,MT>& proxy, size_t m, size_t n, bool preserve=true );
1083 
1084 template< typename PT, typename MT >
1085 void reset( const SparseMatrixProxy<PT,MT>& proxy );
1086 
1087 template< typename PT, typename MT >
1088 void reset( const SparseMatrixProxy<PT,MT>& proxy, size_t i );
1089 
1090 template< typename PT, typename MT >
1091 void clear( const SparseMatrixProxy<PT,MT>& proxy );
1093 //*************************************************************************************************
1094 
1095 
1096 //*************************************************************************************************
1109 template< typename PT // Type of the proxy
1110  , typename MT > // Type of the sparse matrix
1112  begin( const SparseMatrixProxy<PT,MT>& proxy, size_t i )
1113 {
1114  return proxy.begin(i);
1115 }
1116 //*************************************************************************************************
1117 
1118 
1119 //*************************************************************************************************
1132 template< typename PT // Type of the proxy
1133  , typename MT > // Type of the sparse matrix
1135  cbegin( const SparseMatrixProxy<PT,MT>& proxy, size_t i )
1136 {
1137  return proxy.cbegin(i);
1138 }
1139 //*************************************************************************************************
1140 
1141 
1142 //*************************************************************************************************
1156 template< typename PT // Type of the proxy
1157  , typename MT > // Type of the sparse matrix
1159  end( const SparseMatrixProxy<PT,MT>& proxy, size_t i )
1160 {
1161  return proxy.end(i);
1162 }
1163 //*************************************************************************************************
1164 
1165 
1166 //*************************************************************************************************
1180 template< typename PT // Type of the proxy
1181  , typename MT > // Type of the sparse matrix
1183  cend( const SparseMatrixProxy<PT,MT>& proxy, size_t i )
1184 {
1185  return proxy.cend(i);
1186 }
1187 //*************************************************************************************************
1188 
1189 
1190 //*************************************************************************************************
1197 template< typename PT // Type of the proxy
1198  , typename MT > // Type of the sparse matrix
1200 {
1201  return proxy.rows();
1202 }
1203 //*************************************************************************************************
1204 
1205 
1206 //*************************************************************************************************
1213 template< typename PT // Type of the proxy
1214  , typename MT > // Type of the sparse matrix
1216 {
1217  return proxy.columns();
1218 }
1219 //*************************************************************************************************
1220 
1221 
1222 //*************************************************************************************************
1229 template< typename PT // Type of the proxy
1230  , typename MT > // Type of the sparse matrix
1232 {
1233  return proxy.capacity();
1234 }
1235 //*************************************************************************************************
1236 
1237 
1238 //*************************************************************************************************
1251 template< typename PT // Type of the proxy
1252  , typename MT > // Type of the sparse matrix
1254 {
1255  return proxy.capacity(i);
1256 }
1257 //*************************************************************************************************
1258 
1259 
1260 //*************************************************************************************************
1267 template< typename PT // Type of the proxy
1268  , typename MT > // Type of the sparse matrix
1270 {
1271  return proxy.nonZeros();
1272 }
1273 //*************************************************************************************************
1274 
1275 
1276 //*************************************************************************************************
1289 template< typename PT // Type of the proxy
1290  , typename MT > // Type of the sparse matrix
1292 {
1293  return proxy.nonZeros(i);
1294 }
1295 //*************************************************************************************************
1296 
1297 
1298 //*************************************************************************************************
1311 template< typename PT // Type of the proxy
1312  , typename MT > // Type of the sparse matrix
1313 BLAZE_ALWAYS_INLINE DisableIf_t< IsSquare_v<MT> >
1314  resize_backend( const SparseMatrixProxy<PT,MT>& proxy, size_t m, size_t n, bool preserve )
1315 {
1316  proxy.resize( m, n, preserve );
1317 }
1319 //*************************************************************************************************
1320 
1321 
1322 //*************************************************************************************************
1336 template< typename PT // Type of the proxy
1337  , typename MT > // Type of the sparse matrix
1338 BLAZE_ALWAYS_INLINE EnableIf_t< IsSquare_v<MT> >
1339  resize_backend( const SparseMatrixProxy<PT,MT>& proxy, size_t m, size_t n, bool preserve )
1340 {
1341  if( m != n ) {
1342  BLAZE_THROW_INVALID_ARGUMENT( "Invalid resize arguments for square matrix" );
1343  }
1344 
1345  proxy.resize( m, preserve );
1346 }
1348 //*************************************************************************************************
1349 
1350 
1351 //*************************************************************************************************
1367 template< typename PT // Type of the proxy
1368  , typename MT > // Type of the sparse matrix
1369 BLAZE_ALWAYS_INLINE void resize( const SparseMatrixProxy<PT,MT>& proxy, size_t m, size_t n, bool preserve )
1370 {
1371  resize_backend( proxy, m, n, preserve );
1372 }
1373 //*************************************************************************************************
1374 
1375 
1376 //*************************************************************************************************
1385 template< typename PT // Type of the proxy
1386  , typename MT > // Type of the sparse matrix
1388 {
1389  proxy.reset();
1390 }
1391 //*************************************************************************************************
1392 
1393 
1394 //*************************************************************************************************
1407 template< typename PT // Type of the proxy
1408  , typename MT > // Type of the sparse matrix
1410 {
1411  proxy.reset(i);
1412 }
1413 //*************************************************************************************************
1414 
1415 
1416 //*************************************************************************************************
1425 template< typename PT // Type of the proxy
1426  , typename MT > // Type of the sparse matrix
1428 {
1429  proxy.clear();
1430 }
1431 //*************************************************************************************************
1432 
1433 } // namespace blaze
1434 
1435 #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:375
Header file for auxiliary alias declarations.
Iterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SparseMatrixProxy.h:979
Iterator begin(size_t i) const
Returns an iterator to the first element of row/column i of the represented matrix.
Definition: SparseMatrixProxy.h:262
ReturnType_t< MT > ReturnType
Return type for expression template evaluations.
Definition: SparseMatrixProxy.h:84
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
Header file for basic type definitions.
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
typename T::Reference Reference_t
Alias declaration for nested Reference type definitions.The Reference_t alias declaration provides a ...
Definition: Aliases.h:330
ResultType_t< MT > ResultType
Result type for expression template evaluations.
Definition: SparseMatrixProxy.h:80
size_t nonZeros() const
Returns the number of non-zero elements in the represented matrix.
Definition: SparseMatrixProxy.h:409
OppositeType_t< MT > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SparseMatrixProxy.h:81
MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:372
void trim() const
Removing all excessive capacity from all rows/columns.
Definition: SparseMatrixProxy.h:711
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:591
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: CompressedMatrix.h:3113
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:579
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
Header file for the reset shim.
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
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:482
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:416
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
ConstIterator cbegin(size_t i) const
Returns an iterator to the first element of row/column i of the represented matrix.
Definition: SparseMatrixProxy.h:283
void resize(size_t m, size_t n, bool preserve=true) const
Changing the size of the represented matrix.
Definition: SparseMatrixProxy.h:635
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:755
void scale(const Other &scalar) const
Scaling of the sparse matrix by the scalar value scalar ( ).
Definition: SparseMatrixProxy.h:799
Constraint on the data type.
Iterator_t< MT > Iterator
Iterator over non-constant elements.
Definition: SparseMatrixProxy.h:88
ConstReference_t< MT > ConstReference
Reference to a constant matrix value.
Definition: SparseMatrixProxy.h:87
size_t columns() const
Returns the current number of columns of the represented matrix.
Definition: SparseMatrixProxy.h:361
Header file for the DisableIf class template.
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: SparseMatrixProxy.h:94
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#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:511
void reset() const
Reset to the default initial value.
Definition: SparseMatrixProxy.h:445
ConstIterator_t< MT > ConstIterator
Iterator over constant elements.
Definition: SparseMatrixProxy.h:89
Iterator insert(size_t i, size_t j, const ElementType &value) const
Inserting an element into the represented sparse matrix.
Definition: SparseMatrixProxy.h:539
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:237
void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:738
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:438
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:485
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:611
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.The OppositeType_t alias declaration provi...
Definition: Aliases.h:270
typename T::Iterator Iterator_t
Alias declaration for nested Iterator type definitions.The Iterator_t alias declaration provides a co...
Definition: Aliases.h:190
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
ElementType_t< MT > ElementType
Type of the sparse matrix elements.
Definition: SparseMatrixProxy.h:83
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:304
Reference operator()(size_t i, size_t j) const
Function call operator for the direct access to matrix elements.
Definition: SparseMatrixProxy.h:209
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:325
CompositeType_t< MT > CompositeType
Data type for composite expression templates.
Definition: SparseMatrixProxy.h:85
void finalize(size_t i) const
Finalizing the element insertion of a row/column.
Definition: SparseMatrixProxy.h:606
typename T::ConstReference ConstReference_t
Alias declaration for nested ConstReference type definitions.The ConstReference_t alias declaration p...
Definition: Aliases.h:150
void erase(size_t i, size_t j) const
Erasing an element from the sparse matrix.
Definition: SparseMatrixProxy.h:830
void reserve(size_t n) const
Setting the minimum capacity of the represented matrix.
Definition: SparseMatrixProxy.h:659
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
Iterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SparseMatrixProxy.h:1029
TransposeType_t< MT > TransposeType
Transpose type for expression template evaluations.
Definition: SparseMatrixProxy.h:82
typename T::ConstIterator ConstIterator_t
Alias declaration for nested ConstIterator type definitions.The ConstIterator_t alias declaration pro...
Definition: Aliases.h:110
Reference_t< MT > Reference
Reference to a non-constant matrix value.
Definition: SparseMatrixProxy.h:86
size_t rows() const
Returns the current number of rows of the represented matrix.
Definition: SparseMatrixProxy.h:347
void ctranspose() const
In-place conjugate transpose of the represented matrix.
Definition: SparseMatrixProxy.h:774
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
Header file for the clear shim.
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:1004