Row.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_ROW_H_
36 #define _BLAZE_MATH_VIEWS_ROW_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/math/Exception.h>
71 #include <blaze/math/views/Check.h>
76 #include <blaze/util/Assert.h>
77 #include <blaze/util/EnableIf.h>
80 #include <blaze/util/TrueType.h>
81 #include <blaze/util/TypeList.h>
82 #include <blaze/util/Types.h>
83 #include <blaze/util/Unused.h>
84 
85 
86 namespace blaze {
87 
88 //=================================================================================================
89 //
90 // GLOBAL FUNCTIONS
91 //
92 //=================================================================================================
93 
94 //*************************************************************************************************
129 template< size_t I // Row index
130  , typename MT // Type of the matrix
131  , bool SO // Storage order
132  , typename... RRAs > // Optional row arguments
133 inline decltype(auto) row( Matrix<MT,SO>& matrix, RRAs... args )
134 {
136 
137  using ReturnType = Row_<MT,I>;
138  return ReturnType( ~matrix, args... );
139 }
140 //*************************************************************************************************
141 
142 
143 //*************************************************************************************************
178 template< size_t I // Row index
179  , typename MT // Type of the matrix
180  , bool SO // Storage order
181  , typename... RRAs > // Optional row arguments
182 inline decltype(auto) row( const Matrix<MT,SO>& matrix, RRAs... args )
183 {
185 
186  using ReturnType = const Row_<const MT,I>;
187  return ReturnType( ~matrix, args... );
188 }
189 //*************************************************************************************************
190 
191 
192 //*************************************************************************************************
206 template< size_t I // Row index
207  , typename MT // Type of the matrix
208  , bool SO // Storage order
209  , typename... RRAs > // Optional row arguments
210 inline decltype(auto) row( Matrix<MT,SO>&& matrix, RRAs... args )
211 {
213 
214  using ReturnType = Row_<MT,I>;
215  return ReturnType( ~matrix, args... );
216 }
217 //*************************************************************************************************
218 
219 
220 //*************************************************************************************************
256 template< typename MT // Type of the matrix
257  , bool SO // Storage order
258  , typename... RRAs > // Optional row arguments
259 inline decltype(auto) row( Matrix<MT,SO>& matrix, size_t index, RRAs... args )
260 {
262 
263  using ReturnType = Row_<MT>;
264  return ReturnType( ~matrix, index, args... );
265 }
266 //*************************************************************************************************
267 
268 
269 //*************************************************************************************************
305 template< typename MT // Type of the matrix
306  , bool SO // Storage order
307  , typename... RRAs > // Optional row arguments
308 inline decltype(auto) row( const Matrix<MT,SO>& matrix, size_t index, RRAs... args )
309 {
311 
312  using ReturnType = const Row_<const MT>;
313  return ReturnType( ~matrix, index, args... );
314 }
315 //*************************************************************************************************
316 
317 
318 //*************************************************************************************************
333 template< typename MT // Type of the matrix
334  , bool SO // Storage order
335  , typename... RRAs > // Optional row arguments
336 inline decltype(auto) row( Matrix<MT,SO>&& matrix, size_t index, RRAs... args )
337 {
339 
340  using ReturnType = Row_<MT>;
341  return ReturnType( ~matrix, index, args... );
342 }
343 //*************************************************************************************************
344 
345 
346 
347 
348 //=================================================================================================
349 //
350 // GLOBAL RESTRUCTURING FUNCTIONS
351 //
352 //=================================================================================================
353 
354 //*************************************************************************************************
366 template< size_t... CRAs // Compile time row arguments
367  , typename MT // Matrix base type of the expression
368  , typename... RRAs > // Runtime row arguments
369 inline decltype(auto) row( const MatMatAddExpr<MT>& matrix, RRAs... args )
370 {
372 
373  return row<CRAs...>( (~matrix).leftOperand(), args... ) +
374  row<CRAs...>( (~matrix).rightOperand(), args... );
375 }
377 //*************************************************************************************************
378 
379 
380 //*************************************************************************************************
392 template< size_t... CRAs // Compile time row arguments
393  , typename MT // Matrix base type of the expression
394  , typename... RRAs > // Runtime row arguments
395 inline decltype(auto) row( const MatMatSubExpr<MT>& matrix, RRAs... args )
396 {
398 
399  return row<CRAs...>( (~matrix).leftOperand(), args... ) -
400  row<CRAs...>( (~matrix).rightOperand(), args... );
401 }
403 //*************************************************************************************************
404 
405 
406 //*************************************************************************************************
417 template< size_t... CRAs // Compile time row arguments
418  , typename MT // Matrix base type of the expression
419  , typename... RRAs > // Runtime row arguments
420 inline decltype(auto) row( const SchurExpr<MT>& matrix, RRAs... args )
421 {
423 
424  return row<CRAs...>( (~matrix).leftOperand(), args... ) *
425  row<CRAs...>( (~matrix).rightOperand(), args... );
426 }
428 //*************************************************************************************************
429 
430 
431 //*************************************************************************************************
443 template< size_t... CRAs // Compile time row arguments
444  , typename MT // Matrix base type of the expression
445  , typename... RRAs > // Runtime row arguments
446 inline decltype(auto) row( const MatMatMultExpr<MT>& matrix, RRAs... args )
447 {
449 
450  return row<CRAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
451 }
453 //*************************************************************************************************
454 
455 
456 //*************************************************************************************************
468 template< size_t I // Row index
469  , typename MT // Matrix base type of the expression
470  , typename... RRAs > // Optional row arguments
471 inline decltype(auto) row( const VecTVecMultExpr<MT>& matrix, RRAs... args )
472 {
474 
475  UNUSED_PARAMETER( args... );
476 
477  if( !Contains_v< TypeList<RRAs...>, Unchecked > ) {
478  if( (~matrix).rows() <= I ) {
479  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
480  }
481  }
482 
483  return (~matrix).leftOperand()[I] * (~matrix).rightOperand();
484 }
486 //*************************************************************************************************
487 
488 
489 //*************************************************************************************************
502 template< typename MT // Matrix base type of the expression
503  , typename... RRAs > // Optional row arguments
504 inline decltype(auto) row( const VecTVecMultExpr<MT>& matrix, size_t index, RRAs... args )
505 {
507 
508  UNUSED_PARAMETER( args... );
509 
510  if( !Contains_v< TypeList<RRAs...>, Unchecked > ) {
511  if( (~matrix).rows() <= index ) {
512  BLAZE_THROW_INVALID_ARGUMENT( "Invalid row access index" );
513  }
514  }
515 
516  return (~matrix).leftOperand()[index] * (~matrix).rightOperand();
517 }
519 //*************************************************************************************************
520 
521 
522 //*************************************************************************************************
534 template< size_t... CRAs // Compile time row arguments
535  , typename MT // Matrix base type of the expression
536  , typename... RRAs > // Runtime row arguments
537 inline decltype(auto) row( const MatScalarMultExpr<MT>& matrix, RRAs... args )
538 {
540 
541  return row<CRAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
542 }
544 //*************************************************************************************************
545 
546 
547 //*************************************************************************************************
559 template< size_t... CRAs // Compile time row arguments
560  , typename MT // Matrix base type of the expression
561  , typename... RRAs > // Runtime row arguments
562 inline decltype(auto) row( const MatScalarDivExpr<MT>& matrix, RRAs... args )
563 {
565 
566  return row<CRAs...>( (~matrix).leftOperand(), args... ) / (~matrix).rightOperand();
567 }
569 //*************************************************************************************************
570 
571 
572 //*************************************************************************************************
584 template< size_t... CRAs // Compile time row arguments
585  , typename MT // Matrix base type of the expression
586  , typename... RRAs > // Runtime row arguments
587 inline decltype(auto) row( const MatMapExpr<MT>& matrix, RRAs... args )
588 {
590 
591  return map( row<CRAs...>( (~matrix).operand(), args... ), (~matrix).operation() );
592 }
594 //*************************************************************************************************
595 
596 
597 //*************************************************************************************************
609 template< size_t... CRAs // Compile time row arguments
610  , typename MT // Matrix base type of the expression
611  , typename... RRAs > // Runtime row arguments
612 inline decltype(auto) row( const MatMatMapExpr<MT>& matrix, RRAs... args )
613 {
615 
616  return map( row<CRAs...>( (~matrix).leftOperand(), args... ),
617  row<CRAs...>( (~matrix).rightOperand(), args... ),
618  (~matrix).operation() );
619 }
621 //*************************************************************************************************
622 
623 
624 //*************************************************************************************************
636 template< size_t... CRAs // Compile time row arguments
637  , typename MT // Matrix base type of the expression
638  , typename... RRAs > // Runtime row arguments
639 inline decltype(auto) row( const MatEvalExpr<MT>& matrix, RRAs... args )
640 {
642 
643  return eval( row<CRAs...>( (~matrix).operand(), args... ) );
644 }
646 //*************************************************************************************************
647 
648 
649 //*************************************************************************************************
661 template< size_t... CRAs // Compile time row arguments
662  , typename MT // Matrix base type of the expression
663  , typename... RRAs > // Runtime row arguments
664 inline decltype(auto) row( const MatSerialExpr<MT>& matrix, RRAs... args )
665 {
667 
668  return serial( row<CRAs...>( (~matrix).operand(), args... ) );
669 }
671 //*************************************************************************************************
672 
673 
674 //*************************************************************************************************
686 template< size_t... CRAs // Compile time row arguments
687  , typename MT // Matrix base type of the expression
688  , typename... RRAs > // Runtime row arguments
689 inline decltype(auto) row( const DeclExpr<MT>& matrix, RRAs... args )
690 {
692 
693  return row<CRAs...>( (~matrix).operand(), args... );
694 }
696 //*************************************************************************************************
697 
698 
699 //*************************************************************************************************
711 template< size_t... CRAs // Compile time row arguments
712  , typename MT // Matrix base type of the expression
713  , typename... RRAs > // Runtime row arguments
714 inline decltype(auto) row( const MatTransExpr<MT>& matrix, RRAs... args )
715 {
717 
718  return trans( column<CRAs...>( (~matrix).operand(), args... ) );
719 }
721 //*************************************************************************************************
722 
723 
724 //*************************************************************************************************
736 template< size_t... CRAs // Compile time row arguments
737  , typename MT // Matrix base type of the expression
738  , size_t... CEAs // Compile time expansion arguments
739  , typename... RRAs // Runtime row arguments
740  , EnableIf_t< IsRowMajorMatrix_v<MT> >* = nullptr >
741 inline decltype(auto) row( const VecExpandExpr<MT,CEAs...>& matrix, RRAs... args )
742 {
744 
745  UNUSED_PARAMETER( args... );
746 
747  return subvector( (~matrix).operand(), 0UL, (~matrix).columns() );
748 }
750 //*************************************************************************************************
751 
752 
753 //*************************************************************************************************
765 template< size_t... CRAs // Compile time row arguments
766  , typename MT // Matrix base type of the expression
767  , size_t... CEAs // Compile time expansion arguments
768  , typename... RRAs // Runtime row arguments
769  , EnableIf_t< !IsRowMajorMatrix_v<MT> >* = nullptr >
770 inline decltype(auto) row( const VecExpandExpr<MT,CEAs...>& matrix, RRAs... args )
771 {
773 
774  using ET = ElementType_t< MatrixType_t<MT> >;
775 
776  const RowData<CRAs...> rd( args... );
777 
778  return UniformVector<ET,rowVector>( (~matrix).columns(), (~matrix).operand()[rd.row()] );
779 }
781 //*************************************************************************************************
782 
783 
784 
785 
786 //=================================================================================================
787 //
788 // ROW OPERATORS
789 //
790 //=================================================================================================
791 
792 //*************************************************************************************************
800 template< typename MT // Type of the matrix
801  , bool SO // Storage order
802  , bool DF // Density flag
803  , bool SF // Symmetry flag
804  , size_t... CRAs > // Compile time row arguments
805 inline void reset( Row<MT,SO,DF,SF,CRAs...>& row )
806 {
807  row.reset();
808 }
810 //*************************************************************************************************
811 
812 
813 //*************************************************************************************************
821 template< typename MT // Type of the matrix
822  , bool SO // Storage order
823  , bool DF // Density flag
824  , bool SF // Symmetry flag
825  , size_t... CRAs > // Compile time row arguments
826 inline void reset( Row<MT,SO,DF,SF,CRAs...>&& row )
827 {
828  row.reset();
829 }
831 //*************************************************************************************************
832 
833 
834 //*************************************************************************************************
844 template< typename MT // Type of the matrix
845  , bool SO // Storage order
846  , bool DF // Density flag
847  , bool SF // Symmetry flag
848  , size_t... CRAs > // Compile time row arguments
849 inline void clear( Row<MT,SO,DF,SF,CRAs...>& row )
850 {
851  row.reset();
852 }
854 //*************************************************************************************************
855 
856 
857 //*************************************************************************************************
867 template< typename MT // Type of the matrix
868  , bool SO // Storage order
869  , bool DF // Density flag
870  , bool SF // Symmetry flag
871  , size_t... CRAs > // Compile time row arguments
872 inline void clear( Row<MT,SO,DF,SF,CRAs...>&& row )
873 {
874  row.reset();
875 }
877 //*************************************************************************************************
878 
879 
880 //*************************************************************************************************
906 template< bool RF // Relaxation flag
907  , typename MT // Type of the matrix
908  , bool SO // Storage order
909  , bool SF // Symmetry flag
910  , size_t... CRAs > // Compile time row arguments
911 inline bool isDefault( const Row<MT,SO,true,SF,CRAs...>& row )
912 {
913  using blaze::isDefault;
914 
915  for( size_t i=0UL; i<row.size(); ++i )
916  if( !isDefault<RF>( row[i] ) ) return false;
917  return true;
918 }
920 //*************************************************************************************************
921 
922 
923 //*************************************************************************************************
949 template< bool RF // Relaxation flag
950  , typename MT // Type of the matrix
951  , bool SO // Storage order
952  , bool SF // Symmetry flag
953  , size_t... CRAs > // Compile time row arguments
954 inline bool isDefault( const Row<MT,SO,false,SF,CRAs...>& row )
955 {
956  using blaze::isDefault;
957 
958  for( const auto& element : row )
959  if( !isDefault<RF>( element.value() ) ) return false;
960  return true;
961 }
963 //*************************************************************************************************
964 
965 
966 //*************************************************************************************************
984 template< typename MT // Type of the matrix
985  , bool SO // Storage order
986  , bool DF // Density flag
987  , bool SF // Symmetry flag
988  , size_t... CRAs > // Compile time row arguments
989 inline bool isIntact( const Row<MT,SO,DF,SF,CRAs...>& row ) noexcept
990 {
991  return ( row.row() < row.operand().rows() &&
992  isIntact( row.operand() ) );
993 }
995 //*************************************************************************************************
996 
997 
998 //*************************************************************************************************
1011 template< typename MT1 // Type of the matrix of the left-hand side row
1012  , bool SO // Storage order
1013  , bool DF // Density flag
1014  , bool SF1 // Symmetry flag of the left-hand side row
1015  , size_t... CRAs1 // Compile time row arguments of the left-hand side row
1016  , typename MT2 // Type of the matrix of the right-hand side row
1017  , bool SF2 // Symmetry flag of the right-hand side row
1018  , size_t... CRAs2 > // Compile time row arguments of the right-hand side row
1019 inline bool isSame( const Row<MT1,SO,DF,SF1,CRAs1...>& a,
1020  const Row<MT2,SO,DF,SF2,CRAs2...>& b ) noexcept
1021 {
1022  return ( isSame( a.operand(), b.operand() ) && ( a.row() == b.row() ) );
1023 }
1025 //*************************************************************************************************
1026 
1027 
1028 //*************************************************************************************************
1043 template< typename MT // Type of the matrix
1044  , bool SO // Storage order
1045  , bool DF // Density flag
1046  , bool SF // Symmetry flag
1047  , size_t... CRAs // Compile time row arguments
1048  , typename ET > // Type of the element
1049 inline bool trySet( const Row<MT,SO,DF,SF,CRAs...>& row, size_t index, const ET& value )
1050 {
1051  BLAZE_INTERNAL_ASSERT( index < row.size(), "Invalid vector access index" );
1052 
1053  return trySet( row.operand(), row.row(), index, value );
1054 }
1056 //*************************************************************************************************
1057 
1058 
1059 //*************************************************************************************************
1074 template< typename MT // Type of the matrix
1075  , bool SO // Storage order
1076  , bool DF // Density flag
1077  , bool SF // Symmetry flag
1078  , size_t... CRAs // Compile time row arguments
1079  , typename ET > // Type of the element
1080 inline bool tryAdd( const Row<MT,SO,DF,SF,CRAs...>& row, size_t index, const ET& value )
1081 {
1082  BLAZE_INTERNAL_ASSERT( index < row.size(), "Invalid vector access index" );
1083 
1084  return tryAdd( row.operand(), row.row(), index, value );
1085 }
1087 //*************************************************************************************************
1088 
1089 
1090 //*************************************************************************************************
1105 template< typename MT // Type of the matrix
1106  , bool SO // Storage order
1107  , bool DF // Density flag
1108  , bool SF // Symmetry flag
1109  , size_t... CRAs // Compile time row arguments
1110  , typename ET > // Type of the element
1111 inline bool trySub( const Row<MT,SO,DF,SF,CRAs...>& row, size_t index, const ET& value )
1112 {
1113  BLAZE_INTERNAL_ASSERT( index < row.size(), "Invalid vector access index" );
1114 
1115  return trySub( row.operand(), row.row(), index, value );
1116 }
1118 //*************************************************************************************************
1119 
1120 
1121 //*************************************************************************************************
1136 template< typename MT // Type of the matrix
1137  , bool SO // Storage order
1138  , bool DF // Density flag
1139  , bool SF // Symmetry flag
1140  , size_t... CRAs // Compile time row arguments
1141  , typename ET > // Type of the element
1142 inline bool tryMult( const Row<MT,SO,DF,SF,CRAs...>& row, size_t index, const ET& value )
1143 {
1144  BLAZE_INTERNAL_ASSERT( index < row.size(), "Invalid vector access index" );
1145 
1146  return tryMult( row.operand(), row.row(), index, value );
1147 }
1149 //*************************************************************************************************
1150 
1151 
1152 //*************************************************************************************************
1168 template< typename MT // Type of the matrix
1169  , bool SO // Storage order
1170  , bool DF // Density flag
1171  , bool SF // Symmetry flag
1172  , size_t... CRAs // Compile time row arguments
1173  , typename ET > // Type of the element
1175  tryMult( const Row<MT,SO,DF,SF,CRAs...>& row, size_t index, size_t size, const ET& value )
1176 {
1177  BLAZE_INTERNAL_ASSERT( index <= (~row).size(), "Invalid vector access index" );
1178  BLAZE_INTERNAL_ASSERT( index + size <= (~row).size(), "Invalid range size" );
1179 
1180  return tryMult( row.operand(), row.row(), index, 1UL, size, value );
1181 }
1183 //*************************************************************************************************
1184 
1185 
1186 //*************************************************************************************************
1201 template< typename MT // Type of the matrix
1202  , bool SO // Storage order
1203  , bool DF // Density flag
1204  , bool SF // Symmetry flag
1205  , size_t... CRAs // Compile time row arguments
1206  , typename ET > // Type of the element
1207 inline bool tryDiv( const Row<MT,SO,DF,SF,CRAs...>& row, size_t index, const ET& value )
1208 {
1209  BLAZE_INTERNAL_ASSERT( index < row.size(), "Invalid vector access index" );
1210 
1211  return tryDiv( row.operand(), row.row(), index, value );
1212 }
1214 //*************************************************************************************************
1215 
1216 
1217 //*************************************************************************************************
1233 template< typename MT // Type of the matrix
1234  , bool SO // Storage order
1235  , bool DF // Density flag
1236  , bool SF // Symmetry flag
1237  , size_t... CRAs // Compile time row arguments
1238  , typename ET > // Type of the element
1240  tryDiv( const Row<MT,SO,DF,SF,CRAs...>& row, size_t index, size_t size, const ET& value )
1241 {
1242  BLAZE_INTERNAL_ASSERT( index <= (~row).size(), "Invalid vector access index" );
1243  BLAZE_INTERNAL_ASSERT( index + size <= (~row).size(), "Invalid range size" );
1244 
1245  return tryDiv( row.operand(), row.row(), index, 1UL, size, value );
1246 }
1248 //*************************************************************************************************
1249 
1250 
1251 //*************************************************************************************************
1266 template< typename MT // Type of the matrix
1267  , bool SO // Storage order
1268  , bool DF // Density flag
1269  , bool SF // Symmetry flag
1270  , size_t... CRAs // Compile time row arguments
1271  , typename VT > // Type of the right-hand side vector
1272 inline bool tryAssign( const Row<MT,SO,DF,SF,CRAs...>& lhs,
1273  const Vector<VT,true>& rhs, size_t index )
1274 {
1275  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1276  BLAZE_INTERNAL_ASSERT( index + (~rhs).size() <= lhs.size(), "Invalid vector size" );
1277 
1278  return tryAssign( lhs.operand(), ~rhs, lhs.row(), index );
1279 }
1281 //*************************************************************************************************
1282 
1283 
1284 //*************************************************************************************************
1299 template< typename MT // Type of the matrix
1300  , bool SO // Storage order
1301  , bool DF // Density flag
1302  , bool SF // Symmetry flag
1303  , size_t... CRAs // Compile time row arguments
1304  , typename VT > // Type of the right-hand side vector
1305 inline bool tryAddAssign( const Row<MT,SO,DF,SF,CRAs...>& lhs,
1306  const Vector<VT,true>& rhs, size_t index )
1307 {
1308  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1309  BLAZE_INTERNAL_ASSERT( index + (~rhs).size() <= lhs.size(), "Invalid vector size" );
1310 
1311  return tryAddAssign( lhs.operand(), ~rhs, lhs.row(), index );
1312 }
1314 //*************************************************************************************************
1315 
1316 
1317 //*************************************************************************************************
1332 template< typename MT // Type of the matrix
1333  , bool SO // Storage order
1334  , bool DF // Density flag
1335  , bool SF // Symmetry flag
1336  , size_t... CRAs // Compile time row arguments
1337  , typename VT > // Type of the right-hand side vector
1338 inline bool trySubAssign( const Row<MT,SO,DF,SF,CRAs...>& lhs,
1339  const Vector<VT,true>& rhs, size_t index )
1340 {
1341  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1342  BLAZE_INTERNAL_ASSERT( index + (~rhs).size() <= lhs.size(), "Invalid vector size" );
1343 
1344  return trySubAssign( lhs.operand(), ~rhs, lhs.row(), index );
1345 }
1347 //*************************************************************************************************
1348 
1349 
1350 //*************************************************************************************************
1365 template< typename MT // Type of the matrix
1366  , bool SO // Storage order
1367  , bool DF // Density flag
1368  , bool SF // Symmetry flag
1369  , size_t... CRAs // Compile time row arguments
1370  , typename VT > // Type of the right-hand side vector
1371 inline bool tryMultAssign( const Row<MT,SO,DF,SF,CRAs...>& lhs,
1372  const Vector<VT,true>& rhs, size_t index )
1373 {
1374  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1375  BLAZE_INTERNAL_ASSERT( index + (~rhs).size() <= lhs.size(), "Invalid vector size" );
1376 
1377  return tryMultAssign( lhs.operand(), ~rhs, lhs.row(), index );
1378 }
1380 //*************************************************************************************************
1381 
1382 
1383 //*************************************************************************************************
1398 template< typename MT // Type of the matrix
1399  , bool SO // Storage order
1400  , bool DF // Density flag
1401  , bool SF // Symmetry flag
1402  , size_t... CRAs // Compile time row arguments
1403  , typename VT > // Type of the right-hand side vector
1404 inline bool tryDivAssign( const Row<MT,SO,DF,SF,CRAs...>& lhs,
1405  const Vector<VT,true>& rhs, size_t index )
1406 {
1407  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1408  BLAZE_INTERNAL_ASSERT( index + (~rhs).size() <= lhs.size(), "Invalid vector size" );
1409 
1410  return tryDivAssign( lhs.operand(), ~rhs, lhs.row(), index );
1411 }
1413 //*************************************************************************************************
1414 
1415 
1416 //*************************************************************************************************
1431 template< typename MT // Type of the matrix
1432  , bool SO // Storage order
1433  , bool DF // Density flag
1434  , bool SF // Symmetry flag
1435  , size_t I > // Row index
1436 inline decltype(auto) derestrict( Row<MT,SO,DF,SF,I>& r )
1437 {
1438  return row<I>( derestrict( r.operand() ), unchecked );
1439 }
1441 //*************************************************************************************************
1442 
1443 
1444 //*************************************************************************************************
1459 template< typename MT // Type of the matrix
1460  , bool SO // Storage order
1461  , bool DF // Density flag
1462  , bool SF // Symmetry flag
1463  , size_t I > // Row index
1464 inline decltype(auto) derestrict( Row<MT,SO,DF,SF,I>&& r )
1465 {
1466  return row<I>( derestrict( r.operand() ), unchecked );
1467 }
1469 //*************************************************************************************************
1470 
1471 
1472 //*************************************************************************************************
1487 template< typename MT // Type of the matrix
1488  , bool SO // Storage order
1489  , bool DF // Density flag
1490  , bool SF > // Symmetry flag
1491 inline decltype(auto) derestrict( Row<MT,SO,DF,SF>& r )
1492 {
1493  return row( derestrict( r.operand() ), r.row(), unchecked );
1494 }
1496 //*************************************************************************************************
1497 
1498 
1499 //*************************************************************************************************
1514 template< typename MT // Type of the matrix
1515  , bool SO // Storage order
1516  , bool DF // Density flag
1517  , bool SF > // Symmetry flag
1518 inline decltype(auto) derestrict( Row<MT,SO,DF,SF>&& r )
1519 {
1520  return row( derestrict( r.operand() ), r.row(), unchecked );
1521 }
1523 //*************************************************************************************************
1524 
1525 
1526 
1527 
1528 //=================================================================================================
1529 //
1530 // SIZE SPECIALIZATIONS
1531 //
1532 //=================================================================================================
1533 
1534 //*************************************************************************************************
1536 template< typename MT, bool SO, bool DF, bool SF, size_t... CRAs >
1537 struct Size< Row<MT,SO,DF,SF,CRAs...>, 0UL >
1538  : public Size<MT,1UL>
1539 {};
1541 //*************************************************************************************************
1542 
1543 
1544 
1545 
1546 //=================================================================================================
1547 //
1548 // MAXSIZE SPECIALIZATIONS
1549 //
1550 //=================================================================================================
1551 
1552 //*************************************************************************************************
1554 template< typename MT, bool SO, bool DF, bool SF, size_t... CRAs >
1555 struct MaxSize< Row<MT,SO,DF,SF,CRAs...>, 0UL >
1556  : public MaxSize<MT,1UL>
1557 {};
1559 //*************************************************************************************************
1560 
1561 
1562 
1563 
1564 //=================================================================================================
1565 //
1566 // ISRESTRICTED SPECIALIZATIONS
1567 //
1568 //=================================================================================================
1569 
1570 //*************************************************************************************************
1572 template< typename MT, bool SO, bool DF, bool SF, size_t... CRAs >
1573 struct IsRestricted< Row<MT,SO,DF,SF,CRAs...> >
1574  : public IsRestricted<MT>
1575 {};
1577 //*************************************************************************************************
1578 
1579 
1580 
1581 
1582 //=================================================================================================
1583 //
1584 // HASCONSTDATAACCESS SPECIALIZATIONS
1585 //
1586 //=================================================================================================
1587 
1588 //*************************************************************************************************
1590 template< typename MT, bool SO, bool SF, size_t... CRAs >
1591 struct HasConstDataAccess< Row<MT,SO,true,SF,CRAs...> >
1592  : public HasConstDataAccess<MT>
1593 {};
1595 //*************************************************************************************************
1596 
1597 
1598 
1599 
1600 //=================================================================================================
1601 //
1602 // HASMUTABLEDATAACCESS SPECIALIZATIONS
1603 //
1604 //=================================================================================================
1605 
1606 //*************************************************************************************************
1608 template< typename MT, bool SO, bool SF, size_t... CRAs >
1609 struct HasMutableDataAccess< Row<MT,SO,true,SF,CRAs...> >
1610  : public HasMutableDataAccess<MT>
1611 {};
1613 //*************************************************************************************************
1614 
1615 
1616 
1617 
1618 //=================================================================================================
1619 //
1620 // ISALIGNED SPECIALIZATIONS
1621 //
1622 //=================================================================================================
1623 
1624 //*************************************************************************************************
1626 template< typename MT, bool SO, bool SF, size_t... CRAs >
1627 struct IsAligned< Row<MT,SO,true,SF,CRAs...> >
1628  : public BoolConstant< IsAligned_v<MT> && ( IsRowMajorMatrix_v<MT> || IsSymmetric_v<MT> ) >
1629 {};
1631 //*************************************************************************************************
1632 
1633 
1634 
1635 
1636 //=================================================================================================
1637 //
1638 // ISCONTIGUOUS SPECIALIZATIONS
1639 //
1640 //=================================================================================================
1641 
1642 //*************************************************************************************************
1644 template< typename MT, bool SF, size_t... CRAs >
1645 struct IsContiguous< Row<MT,true,true,SF,CRAs...> >
1646  : public IsContiguous<MT>
1647 {};
1649 //*************************************************************************************************
1650 
1651 
1652 
1653 
1654 //=================================================================================================
1655 //
1656 // ISPADDED SPECIALIZATIONS
1657 //
1658 //=================================================================================================
1659 
1660 //*************************************************************************************************
1662 template< typename MT, bool SO, bool SF, size_t... CRAs >
1663 struct IsPadded< Row<MT,SO,true,SF,CRAs...> >
1664  : public BoolConstant< IsPadded_v<MT> && ( IsRowMajorMatrix_v<MT> || IsSymmetric_v<MT> ) >
1665 {};
1667 //*************************************************************************************************
1668 
1669 
1670 
1671 
1672 //=================================================================================================
1673 //
1674 // ISOPPOSEDVIEW SPECIALIZATIONS
1675 //
1676 //=================================================================================================
1677 
1678 //*************************************************************************************************
1680 template< typename MT, bool DF, size_t... CRAs >
1681 struct IsOpposedView< Row<MT,false,DF,false,CRAs...> >
1682  : public TrueType
1683 {};
1685 //*************************************************************************************************
1686 
1687 } // namespace blaze
1688 
1689 #endif
decltype(auto) subvector(Vector< VT, TF > &, RSAs...)
Creating a view on a specific subvector of the given vector.
Definition: Subvector.h:329
#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 the blaze::checked and blaze::unchecked instances.
Header file for the implementation of the RowData class template.
Header file for the UNUSED_PARAMETER function template.
bool isSame(const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b) noexcept
Returns whether the two given matrices represent the same observable state.
Definition: Matrix.h:992
Header file for basic type definitions.
Header file for the implementation of a uniform vector.
Header file for the MatTransExpr base class.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
Row specialization for dense matrices.
constexpr Unchecked unchecked
Global Unchecked instance.The blaze::unchecked instance is an optional token for the creation of view...
Definition: Check.h:138
Header file for the MatEvalExpr base class.
Header file for the MatMatMultExpr base class.
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
Row specialization for sparse matrices.
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the MaxSize type trait.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
Header file for the MatMapExpr base class.
Header file for the implementation of the Row base template.
Header file for the IsSymmetric type trait.
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
Header file for the MatMatSubExpr base class.
constexpr bool Contains_v
Auxiliary variable template for the Contains type trait.The Contains_v variable template provides a c...
Definition: Contains.h:139
Header file for the IsAligned type trait.
Header file for the IsOpposedView type trait.
decltype(auto) eval(const DenseMatrix< MT, SO > &dm)
Forces the evaluation of the given dense matrix expression dm.
Definition: DMatEvalExpr.h:786
Header file for the exception macros of the math module.
Header file for the MatSerialExpr base class.
Header file for the VecTVecMultExpr base class.
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:611
Header file for the IsPadded type trait.
Header file for the HasConstDataAccess type trait.
Header file for the DeclExpr base class.
Header file for the Matrix base class.
Header file for the MatScalarMultExpr base class.
Header file for run time assertion macros.
Header file for the Unique class template.
Header file for the IsContiguous type trait.
Check< false > Unchecked
Type of the blaze::unchecked instance.blaze::Unchecked is the type of the blaze::unchecked instance...
Definition: Check.h:96
Header file for the SchurExpr base class.
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
Header file for the isDefault shim.
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:109
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
Header file for the HasMutableDataAccess type trait.
Header file for the MatMatAddExpr base class.
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:101
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:3081
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
Header file for the VecExpandExpr base class.
Header file for the IsRowMajorMatrix type trait.
Header file for the MatMatMapExpr base class.
Header file for the IntegralConstant class template.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:263
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
Header file for the MatScalarDivExpr base class.
Header file for the Size type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the TrueType type/value trait base class.
Header file for the function trace functionality.
decltype(auto) map(const DenseMatrix< MT1, SO > &lhs, const DenseMatrix< MT2, SO > &rhs, OP op)
Evaluates the given binary operation on each single element of the dense matrices lhs and rhs...
Definition: DMatDMatMapExpr.h:1110