Column.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_VIEWS_COLUMN_H_
36 #define _BLAZE_MATH_VIEWS_COLUMN_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 // Column index
130  , typename MT // Type of the matrix
131  , bool SO // Storage order
132  , typename... RCAs > // Optional column arguments
133 inline decltype(auto) column( Matrix<MT,SO>& matrix, RCAs... args )
134 {
136 
137  using ReturnType = Column_<MT,I>;
138  return ReturnType( ~matrix, args... );
139 }
140 //*************************************************************************************************
141 
142 
143 //*************************************************************************************************
178 template< size_t I // Column index
179  , typename MT // Type of the matrix
180  , bool SO // Storage order
181  , typename... RCAs > // Optional column arguments
182 inline decltype(auto) column( const Matrix<MT,SO>& matrix, RCAs... args )
183 {
185 
186  using ReturnType = const Column_<const MT,I>;
187  return ReturnType( ~matrix, args... );
188 }
189 //*************************************************************************************************
190 
191 
192 //*************************************************************************************************
206 template< size_t I // Column index
207  , typename MT // Type of the matrix
208  , bool SO // Storage order
209  , typename... RCAs > // Optional column arguments
210 inline decltype(auto) column( Matrix<MT,SO>&& matrix, RCAs... args )
211 {
213 
214  using ReturnType = Column_<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... RCAs > // Optional column arguments
259 inline decltype(auto) column( Matrix<MT,SO>& matrix, size_t index, RCAs... args )
260 {
262 
263  using ReturnType = Column_<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... RCAs > // Optional column arguments
308 inline decltype(auto) column( const Matrix<MT,SO>& matrix, size_t index, RCAs... args )
309 {
311 
312  using ReturnType = const Column_<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... RCAs > // Optional column arguments
336 inline decltype(auto) column( Matrix<MT,SO>&& matrix, size_t index, RCAs... args )
337 {
339 
340  using ReturnType = Column_<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... CCAs // Compile time column arguments
367  , typename MT // Matrix base type of the expression
368  , typename... RCAs > // Runtime column arguments
369 inline decltype(auto) column( const MatMatAddExpr<MT>& matrix, RCAs... args )
370 {
372 
373  return column<CCAs...>( (~matrix).leftOperand(), args... ) +
374  column<CCAs...>( (~matrix).rightOperand(), args... );
375 }
377 //*************************************************************************************************
378 
379 
380 //*************************************************************************************************
392 template< size_t... CCAs // Compile time column arguments
393  , typename MT // Matrix base type of the expression
394  , typename... RCAs > // Runtime column arguments
395 inline decltype(auto) column( const MatMatSubExpr<MT>& matrix, RCAs... args )
396 {
398 
399  return column<CCAs...>( (~matrix).leftOperand(), args... ) -
400  column<CCAs...>( (~matrix).rightOperand(), args... );
401 }
403 //*************************************************************************************************
404 
405 
406 //*************************************************************************************************
418 template< size_t... CCAs // Compile time column arguments
419  , typename MT // Matrix base type of the expression
420  , typename... RCAs > // Runtime column arguments
421 inline decltype(auto) column( const SchurExpr<MT>& matrix, RCAs... args )
422 {
424 
425  return column<CCAs...>( (~matrix).leftOperand(), args... ) *
426  column<CCAs...>( (~matrix).rightOperand(), args... );
427 }
429 //*************************************************************************************************
430 
431 
432 //*************************************************************************************************
444 template< size_t... CCAs // Compile time column arguments
445  , typename MT // Matrix base type of the expression
446  , typename... RCAs > // Runtime column arguments
447 inline decltype(auto) column( const MatMatMultExpr<MT>& matrix, RCAs... args )
448 {
450 
451  return (~matrix).leftOperand() * column<CCAs...>( (~matrix).rightOperand(), args... );
452 }
454 //*************************************************************************************************
455 
456 
457 //*************************************************************************************************
470 template< size_t I // Column index
471  , typename MT // Matrix base type of the expression
472  , typename... RCAs > // Optional column arguments
473 inline decltype(auto) column( const VecTVecMultExpr<MT>& matrix, RCAs... args )
474 {
476 
477  UNUSED_PARAMETER( args... );
478 
479  if( !Contains_v< TypeList<RCAs...>, Unchecked > ) {
480  if( (~matrix).columns() <= I ) {
481  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
482  }
483  }
484 
485  return (~matrix).leftOperand() * (~matrix).rightOperand()[I];
486 }
488 //*************************************************************************************************
489 
490 
491 //*************************************************************************************************
505 template< typename MT // Matrix base type of the expression
506  , typename... RCAs > // Optional column arguments
507 inline decltype(auto) column( const VecTVecMultExpr<MT>& matrix, size_t index, RCAs... args )
508 {
510 
511  UNUSED_PARAMETER( args... );
512 
513  if( !Contains_v< TypeList<RCAs...>, Unchecked > ) {
514  if( (~matrix).columns() <= index ) {
515  BLAZE_THROW_INVALID_ARGUMENT( "Invalid column access index" );
516  }
517  }
518 
519  return (~matrix).leftOperand() * (~matrix).rightOperand()[index];
520 }
522 //*************************************************************************************************
523 
524 
525 //*************************************************************************************************
537 template< size_t... CCAs // Compile time column arguments
538  , typename MT // Matrix base type of the expression
539  , typename... RCAs > // Runtime column arguments
540 inline decltype(auto) column( const MatScalarMultExpr<MT>& matrix, RCAs... args )
541 {
543 
544  return column<CCAs...>( (~matrix).leftOperand(), args... ) * (~matrix).rightOperand();
545 }
547 //*************************************************************************************************
548 
549 
550 //*************************************************************************************************
562 template< size_t... CCAs // Compile time column arguments
563  , typename MT // Matrix base type of the expression
564  , typename... RCAs > // Runtime column arguments
565 inline decltype(auto) column( const MatScalarDivExpr<MT>& matrix, RCAs... args )
566 {
568 
569  return column<CCAs...>( (~matrix).leftOperand(), args... ) / (~matrix).rightOperand();
570 }
572 //*************************************************************************************************
573 
574 
575 //*************************************************************************************************
587 template< size_t... CCAs // Compile time column arguments
588  , typename MT // Matrix base type of the expression
589  , typename... RCAs > // Runtime column arguments
590 inline decltype(auto) column( const MatMapExpr<MT>& matrix, RCAs... args )
591 {
593 
594  return map( column<CCAs...>( (~matrix).operand(), args... ), (~matrix).operation() );
595 }
597 //*************************************************************************************************
598 
599 
600 //*************************************************************************************************
612 template< size_t... CCAs // Compile time column arguments
613  , typename MT // Matrix base type of the expression
614  , typename... RCAs > // Runtime column arguments
615 inline decltype(auto) column( const MatMatMapExpr<MT>& matrix, RCAs... args )
616 {
618 
619  return map( column<CCAs...>( (~matrix).leftOperand(), args... ),
620  column<CCAs...>( (~matrix).rightOperand(), args... ),
621  (~matrix).operation() );
622 }
624 //*************************************************************************************************
625 
626 
627 //*************************************************************************************************
639 template< size_t... CCAs // Compile time column arguments
640  , typename MT // Matrix base type of the expression
641  , typename... RCAs > // Runtime column arguments
642 inline decltype(auto) column( const MatEvalExpr<MT>& matrix, RCAs... args )
643 {
645 
646  return eval( column<CCAs...>( (~matrix).operand(), args... ) );
647 }
649 //*************************************************************************************************
650 
651 
652 //*************************************************************************************************
664 template< size_t... CCAs // Compile time column arguments
665  , typename MT // Matrix base type of the expression
666  , typename... RCAs > // Runtime column arguments
667 inline decltype(auto) column( const MatSerialExpr<MT>& matrix, RCAs... args )
668 {
670 
671  return serial( column<CCAs...>( (~matrix).operand(), args... ) );
672 }
674 //*************************************************************************************************
675 
676 
677 //*************************************************************************************************
689 template< size_t... CCAs // Compile time column arguments
690  , typename MT // Matrix base type of the expression
691  , typename... RCAs > // Runtime column arguments
692 inline decltype(auto) column( const DeclExpr<MT>& matrix, RCAs... args )
693 {
695 
696  return column<CCAs...>( (~matrix).operand(), args... );
697 }
699 //*************************************************************************************************
700 
701 
702 //*************************************************************************************************
714 template< size_t... CCAs // Compile time column arguments
715  , typename MT // Matrix base type of the expression
716  , typename... RCAs > // Runtime column arguments
717 inline decltype(auto) column( const MatTransExpr<MT>& matrix, RCAs... args )
718 {
720 
721  return trans( row<CCAs...>( (~matrix).operand(), args... ) );
722 }
724 //*************************************************************************************************
725 
726 
727 //*************************************************************************************************
739 template< size_t... CCAs // Compile time column arguments
740  , typename MT // Matrix base type of the expression
741  , size_t... CEAs // Compile time expansion arguments
742  , typename... RCAs // Runtime column arguments
743  , EnableIf_t< IsColumnMajorMatrix_v<MT> >* = nullptr >
744 inline decltype(auto) column( const VecExpandExpr<MT,CEAs...>& matrix, RCAs... args )
745 {
747 
748  UNUSED_PARAMETER( args... );
749 
750  return subvector( (~matrix).operand(), 0UL, (~matrix).rows() );
751 }
753 //*************************************************************************************************
754 
755 
756 //*************************************************************************************************
768 template< size_t... CCAs // Compile time column arguments
769  , typename MT // Matrix base type of the expression
770  , size_t... CEAs // Compile time expansion arguments
771  , typename... RCAs // Runtime column arguments
772  , EnableIf_t< !IsColumnMajorMatrix_v<MT> >* = nullptr >
773 inline decltype(auto) column( const VecExpandExpr<MT,CEAs...>& matrix, RCAs... args )
774 {
776 
777  using ET = ElementType_t< MatrixType_t<MT> >;
778 
779  const ColumnData<CCAs...> cd( args... );
780 
781  return UniformVector<ET,columnVector>( (~matrix).rows(), (~matrix).operand()[cd.column()] );
782 }
784 //*************************************************************************************************
785 
786 
787 
788 
789 //=================================================================================================
790 //
791 // COLUMN OPERATORS
792 //
793 //=================================================================================================
794 
795 //*************************************************************************************************
803 template< typename MT // Type of the matrix
804  , bool SO // Storage order
805  , bool DF // Density flag
806  , bool SF // Symmetry flag
807  , size_t... CCAs > // Compile time column arguments
808 inline void reset( Column<MT,SO,DF,SF,CCAs...>& column )
809 {
810  column.reset();
811 }
813 //*************************************************************************************************
814 
815 
816 //*************************************************************************************************
824 template< typename MT // Type of the matrix
825  , bool SO // Storage order
826  , bool DF // Density flag
827  , bool SF // Symmetry flag
828  , size_t... CCAs > // Compile time column arguments
829 inline void reset( Column<MT,SO,DF,SF,CCAs...>&& column )
830 {
831  column.reset();
832 }
834 //*************************************************************************************************
835 
836 
837 //*************************************************************************************************
847 template< typename MT // Type of the matrix
848  , bool SO // Storage order
849  , bool DF // Density flag
850  , bool SF // Symmetry flag
851  , size_t... CCAs > // Compile time column arguments
852 inline void clear( Column<MT,SO,DF,SF,CCAs...>& column )
853 {
854  column.reset();
855 }
857 //*************************************************************************************************
858 
859 
860 //*************************************************************************************************
870 template< typename MT // Type of the matrix
871  , bool SO // Storage order
872  , bool DF // Density flag
873  , bool SF // Symmetry flag
874  , size_t... CCAs > // Compile time column arguments
875 inline void clear( Column<MT,SO,DF,SF,CCAs...>&& column )
876 {
877  column.reset();
878 }
880 //*************************************************************************************************
881 
882 
883 //*************************************************************************************************
909 template< bool RF // Relaxation flag
910  , typename MT // Type of the dense matrix
911  , bool SO // Storage order
912  , bool SF // Symmetry flag
913  , size_t... CCAs > // Compile time column arguments
914 inline bool isDefault( const Column<MT,SO,true,SF,CCAs...>& column )
915 {
916  using blaze::isDefault;
917 
918  for( size_t i=0UL; i<column.size(); ++i )
919  if( !isDefault<RF>( column[i] ) ) return false;
920  return true;
921 }
923 //*************************************************************************************************
924 
925 
926 //*************************************************************************************************
952 template< bool RF // Relaxation flag
953  , typename MT // Type of the sparse matrix
954  , bool SO // Storage order
955  , bool SF // Symmetry flag
956  , size_t... CCAs > // Compile time column arguments
957 inline bool isDefault( const Column<MT,SO,false,SF,CCAs...>& column )
958 {
959  using blaze::isDefault;
960 
961  for( const auto& element : column )
962  if( !isDefault<RF>( element.value() ) ) return false;
963  return true;
964 }
966 //*************************************************************************************************
967 
968 
969 //*************************************************************************************************
987 template< typename MT // Type of the matrix
988  , bool SO // Storage order
989  , bool DF // Density flag
990  , bool SF // Symmetry flag
991  , size_t... CCAs > // Compile time column arguments
992 inline bool isIntact( const Column<MT,SO,DF,SF,CCAs...>& column ) noexcept
993 {
994  return ( column.column() < column.operand().columns() &&
995  isIntact( column.operand() ) );
996 }
998 //*************************************************************************************************
999 
1000 
1001 //*************************************************************************************************
1014 template< typename MT1 // Type of the matrix of the left-hand side column
1015  , bool SO // Storage order
1016  , bool DF // Density flag
1017  , bool SF1 // Symmetry flag of the left-hand side column
1018  , size_t... CCAs1 // Compile time column arguments of the left-hand side column
1019  , typename MT2 // Type of the matrix of the right-hand side column
1020  , bool SF2 // Symmetry flag of the right-hand side column
1021  , size_t... CCAs2 > // Compile time column arguments of the right-hand side column
1022 inline bool isSame( const Column<MT1,SO,DF,SF1,CCAs1...>& a,
1023  const Column<MT2,SO,DF,SF2,CCAs2...>& b ) noexcept
1024 {
1025  return ( isSame( a.operand(), b.operand() ) && ( a.column() == b.column() ) );
1026 }
1028 //*************************************************************************************************
1029 
1030 
1031 //*************************************************************************************************
1046 template< typename MT // Type of the matrix
1047  , bool SO // Storage order
1048  , bool DF // Density flag
1049  , bool SF // Symmetry flag
1050  , size_t... CCAs // Compile time column arguments
1051  , typename ET > // Type of the element
1052 inline bool trySet( const Column<MT,SO,DF,SF,CCAs...>& column, size_t index, const ET& value )
1053 {
1054  BLAZE_INTERNAL_ASSERT( index < column.size(), "Invalid vector access index" );
1055 
1056  return trySet( column.operand(), index, column.column(), value );
1057 }
1059 //*************************************************************************************************
1060 
1061 
1062 //*************************************************************************************************
1077 template< typename MT // Type of the matrix
1078  , bool SO // Storage order
1079  , bool DF // Density flag
1080  , bool SF // Symmetry flag
1081  , size_t... CCAs // Compile time column arguments
1082  , typename ET > // Type of the element
1083 inline bool tryAdd( const Column<MT,SO,DF,SF,CCAs...>& column, size_t index, const ET& value )
1084 {
1085  BLAZE_INTERNAL_ASSERT( index < column.size(), "Invalid vector access index" );
1086 
1087  return tryAdd( column.operand(), index, column.column(), value );
1088 }
1090 //*************************************************************************************************
1091 
1092 
1093 //*************************************************************************************************
1108 template< typename MT // Type of the matrix
1109  , bool SO // Storage order
1110  , bool DF // Density flag
1111  , bool SF // Symmetry flag
1112  , size_t... CCAs // Compile time column arguments
1113  , typename ET > // Type of the element
1114 inline bool trySub( const Column<MT,SO,DF,SF,CCAs...>& column, size_t index, const ET& value )
1115 {
1116  BLAZE_INTERNAL_ASSERT( index < column.size(), "Invalid vector access index" );
1117 
1118  return trySub( column.operand(), index, column.column(), value );
1119 }
1121 //*************************************************************************************************
1122 
1123 
1124 //*************************************************************************************************
1139 template< typename MT // Type of the matrix
1140  , bool SO // Storage order
1141  , bool DF // Density flag
1142  , bool SF // Symmetry flag
1143  , size_t... CCAs // Compile time column arguments
1144  , typename ET > // Type of the element
1145 inline bool tryMult( const Column<MT,SO,DF,SF,CCAs...>& column, size_t index, const ET& value )
1146 {
1147  BLAZE_INTERNAL_ASSERT( index < column.size(), "Invalid vector access index" );
1148 
1149  return tryMult( column.operand(), index, column.column(), value );
1150 }
1152 //*************************************************************************************************
1153 
1154 
1155 //*************************************************************************************************
1171 template< typename MT // Type of the matrix
1172  , bool SO // Storage order
1173  , bool DF // Density flag
1174  , bool SF // Symmetry flag
1175  , size_t... CCAs // Compile time column arguments
1176  , typename ET > // Type of the element
1178  tryMult( const Column<MT,SO,DF,SF,CCAs...>& column, size_t index, size_t size, const ET& value )
1179 {
1180  BLAZE_INTERNAL_ASSERT( index <= (~column).size(), "Invalid vector access index" );
1181  BLAZE_INTERNAL_ASSERT( index + size <= (~column).size(), "Invalid range size" );
1182 
1183  return tryMult( column.operand(), index, column.column(), size, 1UL, value );
1184 }
1186 //*************************************************************************************************
1187 
1188 
1189 //*************************************************************************************************
1204 template< typename MT // Type of the matrix
1205  , bool SO // Storage order
1206  , bool DF // Density flag
1207  , bool SF // Symmetry flag
1208  , size_t... CCAs // Compile time column arguments
1209  , typename ET > // Type of the element
1210 inline bool tryDiv( const Column<MT,SO,DF,SF,CCAs...>& column, size_t index, const ET& value )
1211 {
1212  BLAZE_INTERNAL_ASSERT( index < column.size(), "Invalid vector access index" );
1213 
1214  return tryDiv( column.operand(), index, column.column(), value );
1215 }
1217 //*************************************************************************************************
1218 
1219 
1220 //*************************************************************************************************
1236 template< typename MT // Type of the matrix
1237  , bool SO // Storage order
1238  , bool DF // Density flag
1239  , bool SF // Symmetry flag
1240  , size_t... CCAs // Compile time column arguments
1241  , typename ET > // Type of the element
1243  tryDiv( const Column<MT,SO,DF,SF,CCAs...>& column, size_t index, size_t size, const ET& value )
1244 {
1245  BLAZE_INTERNAL_ASSERT( index <= (~column).size(), "Invalid vector access index" );
1246  BLAZE_INTERNAL_ASSERT( index + size <= (~column).size(), "Invalid range size" );
1247 
1248  return tryDiv( column.operand(), index, column.column(), size, 1UL, value );
1249 }
1251 //*************************************************************************************************
1252 
1253 
1254 //*************************************************************************************************
1269 template< typename MT // Type of the matrix
1270  , bool SO // Storage order
1271  , bool DF // Density flag
1272  , bool SF // Symmetry flag
1273  , size_t... CCAs // Compile time column arguments
1274  , typename VT > // Type of the right-hand side vector
1275 inline bool tryAssign( const Column<MT,SO,DF,SF,CCAs...>& lhs,
1276  const Vector<VT,false>& rhs, size_t index )
1277 {
1278  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1279  BLAZE_INTERNAL_ASSERT( index + (~rhs).size() <= lhs.size(), "Invalid vector size" );
1280 
1281  return tryAssign( lhs.operand(), ~rhs, index, lhs.column() );
1282 }
1284 //*************************************************************************************************
1285 
1286 
1287 //*************************************************************************************************
1302 template< typename MT // Type of the matrix
1303  , bool SO // Storage order
1304  , bool DF // Density flag
1305  , bool SF // Symmetry flag
1306  , size_t... CCAs // Compile time column arguments
1307  , typename VT > // Type of the right-hand side vector
1308 inline bool tryAddAssign( const Column<MT,SO,SF,SF,CCAs...>& lhs,
1309  const Vector<VT,false>& rhs, size_t index )
1310 {
1311  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1312  BLAZE_INTERNAL_ASSERT( index + (~rhs).size() <= lhs.size(), "Invalid vector size" );
1313 
1314  return tryAddAssign( lhs.operand(), ~rhs, index, lhs.column() );
1315 }
1317 //*************************************************************************************************
1318 
1319 
1320 //*************************************************************************************************
1335 template< typename MT // Type of the matrix
1336  , bool SO // Storage order
1337  , bool DF // Density flag
1338  , bool SF // Symmetry flag
1339  , size_t... CCAs // Compile time column arguments
1340  , typename VT > // Type of the right-hand side vector
1341 inline bool trySubAssign( const Column<MT,SO,DF,SF,CCAs...>& lhs,
1342  const Vector<VT,false>& rhs, size_t index )
1343 {
1344  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1345  BLAZE_INTERNAL_ASSERT( index + (~rhs).size() <= lhs.size(), "Invalid vector size" );
1346 
1347  return trySubAssign( lhs.operand(), ~rhs, index, lhs.column() );
1348 }
1350 //*************************************************************************************************
1351 
1352 
1353 //*************************************************************************************************
1368 template< typename MT // Type of the matrix
1369  , bool SO // Storage order
1370  , bool DF // Density flag
1371  , bool SF // Symmetry flag
1372  , size_t... CCAs // Compile time column arguments
1373  , typename VT > // Type of the right-hand side vector
1374 inline bool tryMultAssign( const Column<MT,SO,DF,SF,CCAs...>& lhs,
1375  const Vector<VT,false>& rhs, size_t index )
1376 {
1377  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1378  BLAZE_INTERNAL_ASSERT( index + (~rhs).size() <= lhs.size(), "Invalid vector size" );
1379 
1380  return tryMultAssign( lhs.operand(), ~rhs, index, lhs.column() );
1381 }
1383 //*************************************************************************************************
1384 
1385 
1386 //*************************************************************************************************
1401 template< typename MT // Type of the matrix
1402  , bool SO // Storage order
1403  , bool DF // Density flag
1404  , bool SF // Symmetry flag
1405  , size_t... CCAs // Compile time column arguments
1406  , typename VT > // Type of the right-hand side vector
1407 inline bool tryDivAssign( const Column<MT,SO,DF,SF,CCAs...>& lhs,
1408  const Vector<VT,false>& rhs, size_t index )
1409 {
1410  BLAZE_INTERNAL_ASSERT( index <= lhs.size(), "Invalid vector access index" );
1411  BLAZE_INTERNAL_ASSERT( index + (~rhs).size() <= lhs.size(), "Invalid vector size" );
1412 
1413  return tryDivAssign( lhs.operand(), ~rhs, index, lhs.column() );
1414 }
1416 //*************************************************************************************************
1417 
1418 
1419 //*************************************************************************************************
1434 template< typename MT // Type of the matrix
1435  , bool SO // Storage order
1436  , bool DF // Density flag
1437  , bool SF // Symmetry flag
1438  , size_t I > // Compile time column arguments
1439 inline decltype(auto) derestrict( Column<MT,SO,DF,SF,I>& c )
1440 {
1441  return column<I>( derestrict( c.operand() ), unchecked );
1442 }
1444 //*************************************************************************************************
1445 
1446 
1447 //*************************************************************************************************
1462 template< typename MT // Type of the matrix
1463  , bool SO // Storage order
1464  , bool DF // Density flag
1465  , bool SF // Symmetry flag
1466  , size_t I > // Compile time column arguments
1467 inline decltype(auto) derestrict( Column<MT,SO,DF,SF,I>&& c )
1468 {
1469  return column<I>( derestrict( c.operand() ), unchecked );
1470 }
1472 //*************************************************************************************************
1473 
1474 
1475 //*************************************************************************************************
1490 template< typename MT // Type of the matrix
1491  , bool SO // Storage order
1492  , bool DF // Density flag
1493  , bool SF > // Symmetry flag
1494 inline decltype(auto) derestrict( Column<MT,SO,DF,SF>& c )
1495 {
1496  return column( derestrict( c.operand() ), c.column(), unchecked );
1497 }
1499 //*************************************************************************************************
1500 
1501 
1502 //*************************************************************************************************
1517 template< typename MT // Type of the matrix
1518  , bool SO // Storage order
1519  , bool DF // Density flag
1520  , bool SF > // Symmetry flag
1521 inline decltype(auto) derestrict( Column<MT,SO,DF,SF>&& c )
1522 {
1523  return column( derestrict( c.operand() ), c.column(), unchecked );
1524 }
1526 //*************************************************************************************************
1527 
1528 
1529 
1530 
1531 //=================================================================================================
1532 //
1533 // SIZE SPECIALIZATIONS
1534 //
1535 //=================================================================================================
1536 
1537 //*************************************************************************************************
1539 template< typename MT, bool SO, bool DF, bool SF, size_t... CRAs >
1540 struct Size< Column<MT,SO,DF,SF,CRAs...>, 0UL >
1541  : public Size<MT,0UL>
1542 {};
1544 //*************************************************************************************************
1545 
1546 
1547 
1548 
1549 //=================================================================================================
1550 //
1551 // MAXSIZE SPECIALIZATIONS
1552 //
1553 //=================================================================================================
1554 
1555 //*************************************************************************************************
1557 template< typename MT, bool SO, bool DF, bool SF, size_t... CRAs >
1558 struct MaxSize< Column<MT,SO,DF,SF,CRAs...>, 0UL >
1559  : public MaxSize<MT,0UL>
1560 {};
1562 //*************************************************************************************************
1563 
1564 
1565 
1566 
1567 //=================================================================================================
1568 //
1569 // ISRESTRICTED SPECIALIZATIONS
1570 //
1571 //=================================================================================================
1572 
1573 //*************************************************************************************************
1575 template< typename MT, bool SO, bool DF, bool SF, size_t... CCAs >
1576 struct IsRestricted< Column<MT,SO,DF,SF,CCAs...> >
1577  : public IsRestricted<MT>
1578 {};
1580 //*************************************************************************************************
1581 
1582 
1583 
1584 
1585 //=================================================================================================
1586 //
1587 // HASCONSTDATAACCESS SPECIALIZATIONS
1588 //
1589 //=================================================================================================
1590 
1591 //*************************************************************************************************
1593 template< typename MT, bool SO, bool SF, size_t... CCAs >
1594 struct HasConstDataAccess< Column<MT,SO,true,SF,CCAs...> >
1595  : public HasConstDataAccess<MT>
1596 {};
1598 //*************************************************************************************************
1599 
1600 
1601 
1602 
1603 //=================================================================================================
1604 //
1605 // HASMUTABLEDATAACCESS SPECIALIZATIONS
1606 //
1607 //=================================================================================================
1608 
1609 //*************************************************************************************************
1611 template< typename MT, bool SO, bool SF, size_t... CCAs >
1612 struct HasMutableDataAccess< Column<MT,SO,true,SF,CCAs...> >
1613  : public HasMutableDataAccess<MT>
1614 {};
1616 //*************************************************************************************************
1617 
1618 
1619 
1620 
1621 //=================================================================================================
1622 //
1623 // ISALIGNED SPECIALIZATIONS
1624 //
1625 //=================================================================================================
1626 
1627 //*************************************************************************************************
1629 template< typename MT, bool SO, bool SF, size_t... CCAs >
1630 struct IsAligned< Column<MT,SO,true,SF,CCAs...> >
1631  : public BoolConstant< IsAligned_v<MT> && ( IsColumnMajorMatrix_v<MT> || IsSymmetric_v<MT> ) >
1632 {};
1634 //*************************************************************************************************
1635 
1636 
1637 
1638 
1639 //=================================================================================================
1640 //
1641 // ISCONTIGOUS SPECIALIZATIONS
1642 //
1643 //=================================================================================================
1644 
1645 //*************************************************************************************************
1647 template< typename MT, bool SF, size_t... CCAs >
1648 struct IsContiguous< Column<MT,true,true,SF,CCAs...> >
1649  : public IsContiguous<MT>
1650 {};
1652 //*************************************************************************************************
1653 
1654 
1655 
1656 
1657 //=================================================================================================
1658 //
1659 // ISPADDED SPECIALIZATIONS
1660 //
1661 //=================================================================================================
1662 
1663 //*************************************************************************************************
1665 template< typename MT, bool SO, bool SF, size_t... CCAs >
1666 struct IsPadded< Column<MT,SO,true,SF,CCAs...> >
1667  : BoolConstant< IsPadded_v<MT> && ( IsColumnMajorMatrix_v<MT> || IsSymmetric_v<MT> ) >
1668 {};
1670 //*************************************************************************************************
1671 
1672 
1673 
1674 
1675 //=================================================================================================
1676 //
1677 // ISOPPOSEDVIEW SPECIALIZATIONS
1678 //
1679 //=================================================================================================
1680 
1681 //*************************************************************************************************
1683 template< typename MT, bool DF, size_t... CCAs >
1684 struct IsOpposedView< Column<MT,false,DF,false,CCAs...> >
1685  : public TrueType
1686 {};
1688 //*************************************************************************************************
1689 
1690 } // namespace blaze
1691 
1692 #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
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Header file for the blaze::checked and blaze::unchecked instances.
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.
Header file for the IsColumnMajorMatrix type trait.
Header file for the implementation of the Column base template.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:591
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
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
Column specialization for dense matrices.
Header file for the MatMapExpr base class.
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.
#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 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
Column specialization for sparse matrices.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:631
Header file for the implementation of the ColumnData class template.
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