Matrix.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_MATRIX_H_
36 #define _BLAZE_MATH_EXPRESSIONS_MATRIX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/Aliases.h>
45 #include <blaze/math/Exception.h>
51 #include <blaze/system/Inline.h>
52 #include <blaze/util/Assert.h>
53 #include <blaze/util/DisableIf.h>
54 #include <blaze/util/EnableIf.h>
56 #include <blaze/util/Types.h>
58 #include <blaze/util/Unused.h>
59 
60 
61 namespace blaze {
62 
63 //=================================================================================================
64 //
65 // CLASS DEFINITION
66 //
67 //=================================================================================================
68 
69 //*************************************************************************************************
80 template< typename MT // Type of the matrix
81  , bool SO > // Storage order
82 struct Matrix
83 {
84  //**Type definitions****************************************************************************
85  using MatrixType = MT;
86  //**********************************************************************************************
87 
88  //**Compilation flags***************************************************************************
89  static constexpr bool storageOrder = SO;
90  //**********************************************************************************************
91 
92  //**Non-const conversion operator***************************************************************
97  BLAZE_ALWAYS_INLINE constexpr MatrixType& operator~() noexcept {
98  return *static_cast<MatrixType*>( this );
99  }
100  //**********************************************************************************************
101 
102  //**Const conversion operator*******************************************************************
107  BLAZE_ALWAYS_INLINE constexpr const MatrixType& operator~() const noexcept {
108  return *static_cast<const MatrixType*>( this );
109  }
110  //**********************************************************************************************
111 };
112 //*************************************************************************************************
113 
114 
115 
116 
117 //=================================================================================================
118 //
119 // GLOBAL OPERATORS
120 //
121 //=================================================================================================
122 
123 //*************************************************************************************************
137 template< typename VT // Type of the left-hand side column vector
138  , typename MT // Type of the right-hand side matrix
139  , bool SO > // Storage order of the right-hand side matrix
140 inline VT& operator*=( Vector<VT,false>& lhs, const Matrix<MT,SO>& rhs )
141 {
142  ResultType_t<VT> tmp( (~rhs) * (~lhs) );
143  (~lhs) = std::move( tmp );
144  return (~lhs);
145 }
147 //*************************************************************************************************
148 
149 
150 //*************************************************************************************************
164 template< typename VT // Type of the left-hand side column vector
165  , typename MT // Type of the right-hand side matrix
166  , bool SO > // Storage order of the right-hand side matrix
167 inline VT& operator*=( Vector<VT,false>&& lhs, const Matrix<MT,SO>& rhs )
168 {
169  return (~lhs) *= (~rhs);
170 }
172 //*************************************************************************************************
173 
174 
175 //*************************************************************************************************
189 template< typename VT // Type of the left-hand side row vector
190  , typename MT // Type of the right-hand side matrix
191  , bool SO > // Storage order of the right-hand side matrix
192 inline VT& operator*=( Vector<VT,true>& lhs, const Matrix<MT,SO>& rhs )
193 {
194  ResultType_t<VT> tmp( (~lhs) * (~rhs) );
195  (~lhs) = std::move( tmp );
196  return (~lhs);
197 }
199 //*************************************************************************************************
200 
201 
202 //*************************************************************************************************
216 template< typename VT // Type of the left-hand side row vector
217  , typename MT // Type of the right-hand side matrix
218  , bool SO > // Storage order of the right-hand side matrix
219 inline VT& operator*=( Vector<VT,true>&& lhs, const Matrix<MT,SO>& rhs )
220 {
221  return (~lhs) *= (~rhs);
222 }
224 //*************************************************************************************************
225 
226 
227 //*************************************************************************************************
240 template< typename MT1 // Type of the left-hand side matrix
241  , bool SO1 // Storage order of the left-hand side matrix
242  , typename MT2 // Type of the right-hand side matrix
243  , bool SO2 > // Storage order of the right-hand side matrix
244 inline MT1& operator*=( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
245 {
246  ResultType_t<MT1> tmp( (~lhs) * (~rhs) );
247  (~lhs) = std::move( tmp );
248  return (~lhs);
249 }
251 //*************************************************************************************************
252 
253 
254 //*************************************************************************************************
268 template< typename MT1 // Type of the left-hand side matrix
269  , bool SO1 // Storage order of the left-hand side matrix
270  , typename MT2 // Type of the right-hand side matrix
271  , bool SO2 > // Storage order of the right-hand side matrix
272 inline MT1& operator*=( Matrix<MT1,SO1>&& lhs, const Matrix<MT2,SO2>& rhs )
273 {
274  return (~lhs) *= (~rhs);
275 }
277 //*************************************************************************************************
278 
279 
280 
281 
282 //=================================================================================================
283 //
284 // GLOBAL FUNCTIONS
285 //
286 //=================================================================================================
287 
288 //*************************************************************************************************
291 template< typename MT, bool SO >
292 typename MT::Iterator begin( Matrix<MT,SO>& matrix, size_t i );
293 
294 template< typename MT, bool SO >
295 typename MT::ConstIterator begin( const Matrix<MT,SO>& matrix, size_t i );
296 
297 template< typename MT, bool SO >
298 typename MT::ConstIterator cbegin( const Matrix<MT,SO>& matrix, size_t i );
299 
300 template< typename MT, bool SO >
301 typename MT::Iterator end( Matrix<MT,SO>& matrix, size_t i );
302 
303 template< typename MT, bool SO >
304 typename MT::ConstIterator end( const Matrix<MT,SO>& matrix, size_t i );
305 
306 template< typename MT, bool SO >
307 typename MT::ConstIterator cend( const Matrix<MT,SO>& matrix, size_t i );
308 
309 template< typename MT, bool SO >
310 constexpr size_t rows( const Matrix<MT,SO>& matrix ) noexcept;
311 
312 template< typename MT, bool SO >
313 constexpr size_t columns( const Matrix<MT,SO>& matrix ) noexcept;
314 
315 template< typename MT, bool SO >
316 constexpr size_t size( const Matrix<MT,SO>& matrix ) noexcept;
317 
318 template< typename MT, bool SO >
319 size_t capacity( const Matrix<MT,SO>& matrix ) noexcept;
320 
321 template< typename MT, bool SO >
322 size_t capacity( const Matrix<MT,SO>& matrix, size_t i ) noexcept;
323 
324 template< typename MT, bool SO >
325 size_t nonZeros( const Matrix<MT,SO>& matrix );
326 
327 template< typename MT, bool SO >
328 size_t nonZeros( const Matrix<MT,SO>& matrix, size_t i );
329 
330 template< typename MT, bool SO >
331 void resize( Matrix<MT,SO>& matrix, size_t rows, size_t columns, bool preserve=true );
332 
333 template< typename MT, bool SO >
334 void shrinkToFit( Matrix<MT,SO>& matrix );
335 
336 template< typename MT, bool SO >
337 void transpose( Matrix<MT,SO>& matrix );
338 
339 template< typename MT, bool SO >
340 void ctranspose( Matrix<MT,SO>& matrix );
341 
342 template< typename MT, bool SO >
343 const typename MT::ResultType evaluate( const Matrix<MT,SO>& matrix );
344 
345 template< typename MT, bool SO >
346 constexpr bool isEmpty( const Matrix<MT,SO>& matrix ) noexcept;
347 
348 template< typename MT, bool SO >
349 bool isSquare( const Matrix<MT,SO>& matrix ) noexcept;
350 
351 template< typename MT1, bool SO1, typename MT2, bool SO2 >
352 bool isSame( const Matrix<MT1,SO1>& a, const Matrix<MT2,SO2>& b ) noexcept;
354 //*************************************************************************************************
355 
356 
357 //*************************************************************************************************
370 template< typename MT // Type of the matrix
371  , bool SO > // Storage order of the matrix
373 {
374  return (~matrix).begin(i);
375 }
376 //*************************************************************************************************
377 
378 
379 //*************************************************************************************************
392 template< typename MT // Type of the matrix
393  , bool SO > // Storage order of the matrix
394 BLAZE_ALWAYS_INLINE typename MT::ConstIterator begin( const Matrix<MT,SO>& matrix, size_t i )
395 {
396  return (~matrix).begin(i);
397 }
398 //*************************************************************************************************
399 
400 
401 //*************************************************************************************************
414 template< typename MT // Type of the matrix
415  , bool SO > // Storage order of the matrix
416 BLAZE_ALWAYS_INLINE typename MT::ConstIterator cbegin( const Matrix<MT,SO>& matrix, size_t i )
417 {
418  return (~matrix).cbegin(i);
419 }
420 //*************************************************************************************************
421 
422 
423 //*************************************************************************************************
436 template< typename MT // Type of the matrix
437  , bool SO > // Storage order of the matrix
438 BLAZE_ALWAYS_INLINE typename MT::Iterator end( Matrix<MT,SO>& matrix, size_t i )
439 {
440  return (~matrix).end(i);
441 }
442 //*************************************************************************************************
443 
444 
445 //*************************************************************************************************
458 template< typename MT // Type of the matrix
459  , bool SO > // Storage order of the matrix
460 BLAZE_ALWAYS_INLINE typename MT::ConstIterator end( const Matrix<MT,SO>& matrix, size_t i )
461 {
462  return (~matrix).end(i);
463 }
464 //*************************************************************************************************
465 
466 
467 //*************************************************************************************************
480 template< typename MT // Type of the matrix
481  , bool SO > // Storage order of the matrix
482 BLAZE_ALWAYS_INLINE typename MT::ConstIterator cend( const Matrix<MT,SO>& matrix, size_t i )
483 {
484  return (~matrix).cend(i);
485 }
486 //*************************************************************************************************
487 
488 
489 //*************************************************************************************************
496 template< typename MT // Type of the matrix
497  , bool SO > // Storage order of the matrix
498 BLAZE_ALWAYS_INLINE constexpr size_t rows( const Matrix<MT,SO>& matrix ) noexcept
499 {
500  return (~matrix).rows();
501 }
502 //*************************************************************************************************
503 
504 
505 //*************************************************************************************************
512 template< typename MT // Type of the matrix
513  , bool SO > // Storage order of the matrix
514 BLAZE_ALWAYS_INLINE constexpr size_t columns( const Matrix<MT,SO>& matrix ) noexcept
515 {
516  return (~matrix).columns();
517 }
518 //*************************************************************************************************
519 
520 
521 //*************************************************************************************************
528 template< typename MT // Type of the matrix
529  , bool SO > // Storage order of the matrix
530 BLAZE_ALWAYS_INLINE constexpr size_t size( const Matrix<MT,SO>& matrix ) noexcept
531 {
532  return (~matrix).rows() * (~matrix).columns();
533 }
534 //*************************************************************************************************
535 
536 
537 //*************************************************************************************************
544 template< typename MT // Type of the matrix
545  , bool SO > // Storage order of the matrix
546 BLAZE_ALWAYS_INLINE size_t capacity( const Matrix<MT,SO>& matrix ) noexcept
547 {
548  return (~matrix).capacity();
549 }
550 //*************************************************************************************************
551 
552 
553 //*************************************************************************************************
566 template< typename MT // Type of the matrix
567  , bool SO > // Storage order of the matrix
568 BLAZE_ALWAYS_INLINE size_t capacity( const Matrix<MT,SO>& matrix, size_t i ) noexcept
569 {
570  return (~matrix).capacity( i );
571 }
572 //*************************************************************************************************
573 
574 
575 //*************************************************************************************************
582 template< typename MT // Type of the matrix
583  , bool SO > // Storage order of the matrix
585 {
586  return (~matrix).nonZeros();
587 }
588 //*************************************************************************************************
589 
590 
591 //*************************************************************************************************
604 template< typename MT // Type of the matrix
605  , bool SO > // Storage order of the matrix
606 BLAZE_ALWAYS_INLINE size_t nonZeros( const Matrix<MT,SO>& matrix, size_t i )
607 {
608  return (~matrix).nonZeros( i );
609 }
610 //*************************************************************************************************
611 
612 
613 //*************************************************************************************************
630 template< typename MT // Type of the matrix
631  , bool SO > // Storage order of the matrix
632 BLAZE_ALWAYS_INLINE auto resize_backend( Matrix<MT,SO>& matrix, size_t m, size_t n, bool preserve )
633  -> DisableIf_t< IsResizable_v<MT> >
634 {
635  UNUSED_PARAMETER( preserve );
636 
637  if( (~matrix).rows() != m || (~matrix).columns() != n ) {
638  BLAZE_THROW_INVALID_ARGUMENT( "Matrix cannot be resized" );
639  }
640 }
642 //*************************************************************************************************
643 
644 
645 //*************************************************************************************************
658 template< typename MT // Type of the matrix
659  , bool SO > // Storage order of the matrix
660 BLAZE_ALWAYS_INLINE auto resize_backend( Matrix<MT,SO>& matrix, size_t m, size_t n, bool preserve )
661  -> EnableIf_t< IsResizable_v<MT> && !IsSquare_v<MT> >
662 {
663  (~matrix).resize( m, n, preserve );
664 }
666 //*************************************************************************************************
667 
668 
669 //*************************************************************************************************
683 template< typename MT // Type of the matrix
684  , bool SO > // Storage order of the matrix
685 BLAZE_ALWAYS_INLINE auto resize_backend( Matrix<MT,SO>& matrix, size_t m, size_t n, bool preserve )
686  -> EnableIf_t< IsResizable_v<MT> && IsSquare_v<MT> >
687 {
688  if( m != n ) {
689  BLAZE_THROW_INVALID_ARGUMENT( "Invalid resize arguments for square matrix" );
690  }
691 
692  (~matrix).resize( m, preserve );
693 }
695 //*************************************************************************************************
696 
697 
698 //*************************************************************************************************
736 template< typename MT // Type of the matrix
737  , bool SO > // Storage order of the matrix
738 BLAZE_ALWAYS_INLINE void resize( Matrix<MT,SO>& matrix, size_t m, size_t n, bool preserve )
739 {
740  resize_backend( matrix, m, n, preserve );
741 }
742 //*************************************************************************************************
743 
744 
745 //*************************************************************************************************
753 template< typename MT // Type of the matrix
754  , bool SO > // Storage order of the matrix
755 BLAZE_ALWAYS_INLINE auto shrinkToFit_backend( Matrix<MT,SO>& matrix )
756  -> DisableIf_t< IsShrinkable_v<MT> >
757 {
758  UNUSED_PARAMETER( matrix );
759 }
761 //*************************************************************************************************
762 
763 
764 //*************************************************************************************************
772 template< typename MT // Type of the matrix
773  , bool SO > // Storage order of the matrix
774 BLAZE_ALWAYS_INLINE auto shrinkToFit_backend( Matrix<MT,SO>& matrix )
775  -> EnableIf_t< IsShrinkable_v<MT> >
776 {
777  (~matrix).shrinkToFit();
778 }
780 //*************************************************************************************************
781 
782 
783 //*************************************************************************************************
797 template< typename MT // Type of the matrix
798  , bool SO > // Storage order of the matrix
800 {
801  shrinkToFit_backend( matrix );
802 }
803 //*************************************************************************************************
804 
805 
806 //*************************************************************************************************
823 template< typename MT // Type of the matrix
824  , bool SO > // Storage order of the matrix
826 {
827  (~matrix).transpose();
828 }
829 //*************************************************************************************************
830 
831 
832 //*************************************************************************************************
849 template< typename MT // Type of the matrix
850  , bool SO > // Storage order of the matrix
852 {
853  (~matrix).ctranspose();
854 }
855 //*************************************************************************************************
856 
857 
858 //*************************************************************************************************
910 template< typename MT // Type of the matrix
911  , bool SO > // Storage order of the matrix
912 inline const typename MT::ResultType evaluate( const Matrix<MT,SO>& matrix )
913 {
914  const typename MT::ResultType tmp( ~matrix );
915  return tmp;
916 }
917 //*************************************************************************************************
918 
919 
920 //*************************************************************************************************
930 template< typename MT // Type of the matrix
931  , bool SO > // Storage order of the matrix
932 BLAZE_ALWAYS_INLINE constexpr bool isEmpty( const Matrix<MT,SO>& matrix ) noexcept
933 {
934  return size( ~matrix ) == 0UL;
935 }
936 //*************************************************************************************************
937 
938 
939 //*************************************************************************************************
949 template< typename MT // Type of the matrix
950  , bool SO > // Storage order
951 BLAZE_ALWAYS_INLINE bool isSquare( const Matrix<MT,SO>& matrix ) noexcept
952 {
953  return ( IsSquare_v<MT> || (~matrix).rows() == (~matrix).columns() );
954 }
955 //*************************************************************************************************
956 
957 
958 //*************************************************************************************************
988 template< typename MT1 // Type of the left-hand side matrix
989  , bool SO1 // Storage order of the left-hand side matrix
990  , typename MT2 // Type of the right-hand side matrix
991  , bool SO2 > // Storage order of the right-hand side matrix
992 BLAZE_ALWAYS_INLINE bool isSame( const Matrix<MT1,SO1>& a, const Matrix<MT2,SO2>& b ) noexcept
993 {
994  return ( IsSame_v<MT1,MT2> &&
995  reinterpret_cast<const void*>( &a ) == reinterpret_cast<const void*>( &b ) );
996 }
997 //*************************************************************************************************
998 
999 
1000 //*************************************************************************************************
1009 template< typename MT1 // Type of the left-hand side matrix
1010  , typename MT2 // Type of the right-hand side matrix
1011  , bool SO > // Storage order of both matrices
1012 BLAZE_ALWAYS_INLINE void assign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,SO>& rhs )
1013 {
1015 
1016  (~lhs).assign( ~rhs );
1017 }
1019 //*************************************************************************************************
1020 
1021 
1022 //*************************************************************************************************
1031 template< typename MT1 // Type of the left-hand side matrix
1032  , bool SO // Storage order of the left-hand side matrix
1033  , typename MT2 > // Type of the right-hand side matrix
1034 BLAZE_ALWAYS_INLINE auto assign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1035  -> DisableIf_t< IsSymmetric_v<MT2> >
1036 {
1038 
1040 
1041  (~lhs).assign( ~rhs );
1042 }
1044 //*************************************************************************************************
1045 
1046 
1047 //*************************************************************************************************
1057 template< typename MT1 // Type of the left-hand side matrix
1058  , bool SO // Storage order of the left-hand side matrix
1059  , typename MT2 > // Type of the right-hand side matrix
1060 BLAZE_ALWAYS_INLINE auto assign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1061  -> EnableIf_t< IsSymmetric_v<MT2> >
1062 {
1064 
1066 
1067  BLAZE_INTERNAL_ASSERT( isSquare( ~rhs ), "Non-square symmetric matrix detected" );
1068 
1069  (~lhs).assign( trans( ~rhs ) );
1070 }
1072 //*************************************************************************************************
1073 
1074 
1075 //*************************************************************************************************
1090 template< typename MT1 // Type of the left-hand side matrix
1091  , bool SO1 // Storage order of the left-hand side matrix
1092  , typename MT2 // Type of the right-hand side matrix
1093  , bool SO2 > // Storage order of the right-hand side matrix
1094 BLAZE_ALWAYS_INLINE void assign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
1095 {
1097 
1098  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == (~rhs).rows() , "Invalid number of rows" );
1099  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );
1100 
1101  assign_backend( ~lhs, ~rhs );
1102 }
1104 //*************************************************************************************************
1105 
1106 
1107 //*************************************************************************************************
1117 template< typename MT1 // Type of the left-hand side matrix
1118  , typename MT2 // Type of the right-hand side matrix
1119  , bool SO > // Storage order of both matrices
1120 BLAZE_ALWAYS_INLINE void addAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,SO>& rhs )
1121 {
1123 
1124  (~lhs).addAssign( ~rhs );
1125 }
1127 //*************************************************************************************************
1128 
1129 
1130 //*************************************************************************************************
1140 template< typename MT1 // Type of the left-hand side matrix
1141  , bool SO // Storage order of the left-hand side matrix
1142  , typename MT2 > // Type of the right-hand side matrix
1143 BLAZE_ALWAYS_INLINE auto addAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1144  -> DisableIf_t< IsSymmetric_v<MT2> >
1145 {
1147 
1149 
1150  (~lhs).addAssign( ~rhs );
1151 }
1153 //*************************************************************************************************
1154 
1155 
1156 //*************************************************************************************************
1166 template< typename MT1 // Type of the left-hand side matrix
1167  , bool SO // Storage order of the left-hand side matrix
1168  , typename MT2 > // Type of the right-hand side matrix
1169 BLAZE_ALWAYS_INLINE auto addAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1170  -> EnableIf_t< IsSymmetric_v<MT2> >
1171 {
1173 
1175 
1176  BLAZE_INTERNAL_ASSERT( isSquare( ~rhs ), "Non-square symmetric matrix detected" );
1177 
1178  (~lhs).addAssign( trans( ~rhs ) );
1179 }
1181 //*************************************************************************************************
1182 
1183 
1184 //*************************************************************************************************
1199 template< typename MT1 // Type of the left-hand side matrix
1200  , bool SO1 // Storage order of the left-hand side matrix
1201  , typename MT2 // Type of the right-hand side matrix
1202  , bool SO2 > // Storage order of the right-hand side matrix
1203 BLAZE_ALWAYS_INLINE void addAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
1204 {
1206 
1207  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == (~rhs).rows() , "Invalid number of rows" );
1208  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );
1209 
1210  addAssign_backend( ~lhs, ~rhs );
1211 }
1213 //*************************************************************************************************
1214 
1215 
1216 //*************************************************************************************************
1226 template< typename MT1 // Type of the left-hand side matrix
1227  , typename MT2 // Type of the right-hand side matrix
1228  , bool SO > // Storage order of both matrices
1229 BLAZE_ALWAYS_INLINE void subAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,SO>& rhs )
1230 {
1232 
1233  (~lhs).subAssign( ~rhs );
1234 }
1236 //*************************************************************************************************
1237 
1238 
1239 //*************************************************************************************************
1249 template< typename MT1 // Type of the left-hand side matrix
1250  , bool SO // Storage order of the left-hand side matrix
1251  , typename MT2 > // Type of the right-hand side matrix
1252 BLAZE_ALWAYS_INLINE auto subAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1253  -> DisableIf_t< IsSymmetric_v<MT2> >
1254 {
1256 
1258 
1259  (~lhs).subAssign( ~rhs );
1260 }
1262 //*************************************************************************************************
1263 
1264 
1265 //*************************************************************************************************
1275 template< typename MT1 // Type of the left-hand side matrix
1276  , bool SO // Storage order of the left-hand side matrix
1277  , typename MT2 > // Type of the right-hand side matrix
1278 BLAZE_ALWAYS_INLINE auto subAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1279  -> EnableIf_t< IsSymmetric_v<MT2> >
1280 {
1282 
1284 
1285  BLAZE_INTERNAL_ASSERT( isSquare( ~rhs ), "Non-square symmetric matrix detected" );
1286 
1287  (~lhs).subAssign( trans( ~rhs ) );
1288 }
1290 //*************************************************************************************************
1291 
1292 
1293 //*************************************************************************************************
1308 template< typename MT1 // Type of the left-hand side matrix
1309  , bool SO1 // Storage order of the left-hand side matrix
1310  , typename MT2 // Type of the right-hand side matrix
1311  , bool SO2 > // Storage order of the right-hand side matrix
1312 BLAZE_ALWAYS_INLINE void subAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
1313 {
1315 
1316  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == (~rhs).rows() , "Invalid number of rows" );
1317  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );
1318 
1319  subAssign_backend( ~lhs, ~rhs );
1320 }
1322 //*************************************************************************************************
1323 
1324 
1325 //*************************************************************************************************
1335 template< typename MT1 // Type of the left-hand side matrix
1336  , typename MT2 // Type of the right-hand side matrix
1337  , bool SO > // Storage order of both matrices
1338 BLAZE_ALWAYS_INLINE void schurAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,SO>& rhs )
1339 {
1341 
1342  (~lhs).schurAssign( ~rhs );
1343 }
1345 //*************************************************************************************************
1346 
1347 
1348 //*************************************************************************************************
1358 template< typename MT1 // Type of the left-hand side matrix
1359  , bool SO // Storage order of the left-hand side matrix
1360  , typename MT2 > // Type of the right-hand side matrix
1361 BLAZE_ALWAYS_INLINE auto schurAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1362  -> DisableIf_t< IsSymmetric_v<MT2> >
1363 {
1365 
1367 
1368  (~lhs).schurAssign( ~rhs );
1369 }
1371 //*************************************************************************************************
1372 
1373 
1374 //*************************************************************************************************
1384 template< typename MT1 // Type of the left-hand side matrix
1385  , bool SO // Storage order of the left-hand side matrix
1386  , typename MT2 > // Type of the right-hand side matrix
1387 BLAZE_ALWAYS_INLINE auto schurAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1388  -> EnableIf_t< IsSymmetric_v<MT2> >
1389 {
1391 
1393 
1394  BLAZE_INTERNAL_ASSERT( isSquare( ~rhs ), "Non-square symmetric matrix detected" );
1395 
1396  (~lhs).schurAssign( trans( ~rhs ) );
1397 }
1399 //*************************************************************************************************
1400 
1401 
1402 //*************************************************************************************************
1417 template< typename MT1 // Type of the left-hand side matrix
1418  , bool SO1 // Storage order of the left-hand side matrix
1419  , typename MT2 // Type of the right-hand side matrix
1420  , bool SO2 > // Storage order of the right-hand side matrix
1421 BLAZE_ALWAYS_INLINE void schurAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
1422 {
1424 
1425  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == (~rhs).rows() , "Invalid number of rows" );
1426  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).columns(), "Invalid number of columns" );
1427 
1428  schurAssign_backend( ~lhs, ~rhs );
1429 }
1431 //*************************************************************************************************
1432 
1433 
1434 //*************************************************************************************************
1449 template< typename MT1 // Type of the left-hand side matrix
1450  , bool SO1 // Storage order of the left-hand side matrix
1451  , typename MT2 // Type of the right-hand side matrix
1452  , bool SO2 > // Storage order of the right-hand side matrix
1453 BLAZE_ALWAYS_INLINE void multAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
1454 {
1456 
1457  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == (~rhs).rows(), "Invalid matrix sizes" );
1458 
1459  (~lhs).multAssign( ~rhs );
1460 }
1462 //*************************************************************************************************
1463 
1464 
1465 //*************************************************************************************************
1481 template< typename MT // Type of the matrix
1482  , bool SO // Storage order
1483  , typename ET > // Type of the element
1484 BLAZE_ALWAYS_INLINE bool trySet( const Matrix<MT,SO>& mat, size_t i, size_t j, const ET& value )
1485 {
1486  BLAZE_INTERNAL_ASSERT( i < (~mat).rows(), "Invalid row access index" );
1487  BLAZE_INTERNAL_ASSERT( j < (~mat).columns(), "Invalid column access index" );
1488 
1489  UNUSED_PARAMETER( mat, i, j, value );
1490 
1491  return true;
1492 }
1494 //*************************************************************************************************
1495 
1496 
1497 //*************************************************************************************************
1513 template< typename MT // Type of the matrix
1514  , bool SO // Storage order
1515  , typename ET > // Type of the element
1516 BLAZE_ALWAYS_INLINE bool tryAdd( const Matrix<MT,SO>& mat, size_t i, size_t j, const ET& value )
1517 {
1518  BLAZE_INTERNAL_ASSERT( i < (~mat).rows(), "Invalid row access index" );
1519  BLAZE_INTERNAL_ASSERT( j < (~mat).columns(), "Invalid column access index" );
1520 
1521  UNUSED_PARAMETER( mat, i, j, value );
1522 
1523  return true;
1524 }
1526 //*************************************************************************************************
1527 
1528 
1529 //*************************************************************************************************
1545 template< typename MT // Type of the matrix
1546  , bool SO // Storage order
1547  , typename ET > // Type of the element
1548 BLAZE_ALWAYS_INLINE bool trySub( const Matrix<MT,SO>& mat, size_t i, size_t j, const ET& value )
1549 {
1550  BLAZE_INTERNAL_ASSERT( i < (~mat).rows(), "Invalid row access index" );
1551  BLAZE_INTERNAL_ASSERT( j < (~mat).columns(), "Invalid column access index" );
1552 
1553  UNUSED_PARAMETER( mat, i, j, value );
1554 
1555  return true;
1556 }
1558 //*************************************************************************************************
1559 
1560 
1561 //*************************************************************************************************
1577 template< typename MT // Type of the matrix
1578  , bool SO // Storage order
1579  , typename ET > // Type of the element
1580 BLAZE_ALWAYS_INLINE bool tryMult( const Matrix<MT,SO>& mat, size_t i, size_t j, const ET& value )
1581 {
1582  BLAZE_INTERNAL_ASSERT( i < (~mat).rows(), "Invalid row access index" );
1583  BLAZE_INTERNAL_ASSERT( j < (~mat).columns(), "Invalid column access index" );
1584 
1585  UNUSED_PARAMETER( mat, i, j, value );
1586 
1587  return true;
1588 }
1590 //*************************************************************************************************
1591 
1592 
1593 //*************************************************************************************************
1611 template< typename MT // Type of the matrix
1612  , bool SO // Storage order
1613  , typename ET > // Type of the element
1615  tryMult( const Matrix<MT,SO>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
1616 {
1617  BLAZE_INTERNAL_ASSERT( row <= (~mat).rows(), "Invalid row access index" );
1618  BLAZE_INTERNAL_ASSERT( column <= (~mat).columns(), "Invalid column access index" );
1619  BLAZE_INTERNAL_ASSERT( row + m <= (~mat).rows(), "Invalid number of rows" );
1620  BLAZE_INTERNAL_ASSERT( column + n <= (~mat).columns(), "Invalid number of columns" );
1621 
1622  UNUSED_PARAMETER( mat, row, column, m, n, value );
1623 
1624  return true;
1625 }
1627 //*************************************************************************************************
1628 
1629 
1630 //*************************************************************************************************
1646 template< typename MT // Type of the matrix
1647  , bool SO // Storage order
1648  , typename ET > // Type of the element
1649 BLAZE_ALWAYS_INLINE bool tryDiv( const Matrix<MT,SO>& mat, size_t i, size_t j, const ET& value )
1650 {
1651  BLAZE_INTERNAL_ASSERT( i < (~mat).rows(), "Invalid row access index" );
1652  BLAZE_INTERNAL_ASSERT( j < (~mat).columns(), "Invalid column access index" );
1653 
1654  UNUSED_PARAMETER( mat, i, j, value );
1655 
1656  return true;
1657 }
1659 //*************************************************************************************************
1660 
1661 
1662 //*************************************************************************************************
1680 template< typename MT // Type of the matrix
1681  , bool SO // Storage order
1682  , typename ET > // Type of the element
1684  tryDiv( const Matrix<MT,SO>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
1685 {
1686  BLAZE_INTERNAL_ASSERT( row <= (~mat).rows(), "Invalid row access index" );
1687  BLAZE_INTERNAL_ASSERT( column <= (~mat).columns(), "Invalid column access index" );
1688  BLAZE_INTERNAL_ASSERT( row + m <= (~mat).rows(), "Invalid number of rows" );
1689  BLAZE_INTERNAL_ASSERT( column + n <= (~mat).columns(), "Invalid number of columns" );
1690 
1691  UNUSED_PARAMETER( mat, row, column, m, n, value );
1692 
1693  return true;
1694 }
1696 //*************************************************************************************************
1697 
1698 
1699 //*************************************************************************************************
1715 template< typename MT // Type of the left-hand side matrix
1716  , bool SO // Storage order of the left-hand side matrix
1717  , typename VT // Type of the right-hand side vector
1718  , bool TF > // Transpose flag of the right-hand side vector
1719 BLAZE_ALWAYS_INLINE bool tryAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
1720  size_t row, size_t column )
1721 {
1722  BLAZE_INTERNAL_ASSERT( row <= (~lhs).rows(), "Invalid row access index" );
1723  BLAZE_INTERNAL_ASSERT( column <= (~lhs).columns(), "Invalid column access index" );
1724  BLAZE_INTERNAL_ASSERT( TF || ( row + (~rhs).size() <= (~lhs).rows() ), "Invalid number of rows" );
1725  BLAZE_INTERNAL_ASSERT( !TF || ( column + (~rhs).size() <= (~lhs).columns() ), "Invalid number of columns" );
1726 
1727  UNUSED_PARAMETER( lhs, rhs, row, column );
1728 
1729  return true;
1730 }
1732 //*************************************************************************************************
1733 
1734 
1735 //*************************************************************************************************
1752 template< typename MT // Type of the left-hand side matrix
1753  , bool SO // Storage order of the left-hand side matrix
1754  , typename VT // Type of the right-hand side vector
1755  , bool TF > // Transpose flag of the right-hand side vector
1756 BLAZE_ALWAYS_INLINE bool tryAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
1757  ptrdiff_t band, size_t row, size_t column )
1758 {
1759  BLAZE_INTERNAL_ASSERT( row <= (~lhs).rows(), "Invalid row access index" );
1760  BLAZE_INTERNAL_ASSERT( column <= (~lhs).columns(), "Invalid column access index" );
1761  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= (~lhs).rows(), "Invalid number of rows" );
1762  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= (~lhs).columns(), "Invalid number of columns" );
1763 
1764  UNUSED_PARAMETER( lhs, rhs, band, row, column );
1765 
1766  return true;
1767 }
1769 //*************************************************************************************************
1770 
1771 
1772 //*************************************************************************************************
1788 template< typename MT1 // Type of the left-hand side matrix
1789  , bool SO1 // Storage order of the left-hand side matrix
1790  , typename MT2 // Type of the right-hand side matrix
1791  , bool SO2 > // Storage order of the right-hand side matrix
1792 BLAZE_ALWAYS_INLINE bool tryAssign( const Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs,
1793  size_t row, size_t column )
1794 {
1795  BLAZE_INTERNAL_ASSERT( row <= (~lhs).rows(), "Invalid row access index" );
1796  BLAZE_INTERNAL_ASSERT( column <= (~lhs).columns(), "Invalid column access index" );
1797  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= (~lhs).rows(), "Invalid number of rows" );
1798  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= (~lhs).columns(), "Invalid number of columns" );
1799 
1800  UNUSED_PARAMETER( lhs, rhs, row, column );
1801 
1802  return true;
1803 }
1805 //*************************************************************************************************
1806 
1807 
1808 //*************************************************************************************************
1824 template< typename MT // Type of the left-hand side matrix
1825  , bool SO // Storage order of the left-hand side matrix
1826  , typename VT // Type of the right-hand side vector
1827  , bool TF > // Transpose flag of the right-hand side vector
1828 BLAZE_ALWAYS_INLINE bool tryAddAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
1829  size_t row, size_t column )
1830 {
1831  BLAZE_INTERNAL_ASSERT( row <= (~lhs).rows(), "Invalid row access index" );
1832  BLAZE_INTERNAL_ASSERT( column <= (~lhs).columns(), "Invalid column access index" );
1833  BLAZE_INTERNAL_ASSERT( TF || ( row + (~rhs).size() <= (~lhs).rows() ), "Invalid number of rows" );
1834  BLAZE_INTERNAL_ASSERT( !TF || ( column + (~rhs).size() <= (~lhs).columns() ), "Invalid number of columns" );
1835 
1836  UNUSED_PARAMETER( lhs, rhs, row, column );
1837 
1838  return true;
1839 }
1841 //*************************************************************************************************
1842 
1843 
1844 //*************************************************************************************************
1861 template< typename MT // Type of the left-hand side matrix
1862  , bool SO // Storage order of the left-hand side matrix
1863  , typename VT // Type of the right-hand side vector
1864  , bool TF > // Transpose flag of the right-hand side vector
1865 BLAZE_ALWAYS_INLINE bool tryAddAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
1866  ptrdiff_t band, size_t row, size_t column )
1867 {
1868  BLAZE_INTERNAL_ASSERT( row <= (~lhs).rows(), "Invalid row access index" );
1869  BLAZE_INTERNAL_ASSERT( column <= (~lhs).columns(), "Invalid column access index" );
1870  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= (~lhs).rows(), "Invalid number of rows" );
1871  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= (~lhs).columns(), "Invalid number of columns" );
1872 
1873  UNUSED_PARAMETER( lhs, rhs, band, row, column );
1874 
1875  return true;
1876 }
1878 //*************************************************************************************************
1879 
1880 
1881 //*************************************************************************************************
1897 template< typename MT1 // Type of the left-hand side matrix
1898  , bool SO1 // Storage order of the left-hand side matrix
1899  , typename MT2 // Type of the right-hand side matrix
1900  , bool SO2 > // Storage order of the right-hand side matrix
1901 BLAZE_ALWAYS_INLINE bool tryAddAssign( const Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs,
1902  size_t row, size_t column )
1903 {
1904  BLAZE_INTERNAL_ASSERT( row <= (~lhs).rows(), "Invalid row access index" );
1905  BLAZE_INTERNAL_ASSERT( column <= (~lhs).columns(), "Invalid column access index" );
1906  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= (~lhs).rows(), "Invalid number of rows" );
1907  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= (~lhs).columns(), "Invalid number of columns" );
1908 
1909  UNUSED_PARAMETER( lhs, rhs, row, column );
1910 
1911  return true;
1912 }
1914 //*************************************************************************************************
1915 
1916 
1917 //*************************************************************************************************
1933 template< typename MT // Type of the left-hand side matrix
1934  , bool SO // Storage order of the left-hand side matrix
1935  , typename VT // Type of the right-hand side vector
1936  , bool TF > // Transpose flag of the right-hand side vector
1937 BLAZE_ALWAYS_INLINE bool trySubAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
1938  size_t row, size_t column )
1939 {
1940  BLAZE_INTERNAL_ASSERT( row <= (~lhs).rows(), "Invalid row access index" );
1941  BLAZE_INTERNAL_ASSERT( column <= (~lhs).columns(), "Invalid column access index" );
1942  BLAZE_INTERNAL_ASSERT( TF || ( row + (~rhs).size() <= (~lhs).rows() ), "Invalid number of rows" );
1943  BLAZE_INTERNAL_ASSERT( !TF || ( column + (~rhs).size() <= (~lhs).columns() ), "Invalid number of columns" );
1944 
1945  UNUSED_PARAMETER( lhs, rhs, row, column );
1946 
1947  return true;
1948 }
1950 //*************************************************************************************************
1951 
1952 
1953 //*************************************************************************************************
1971 template< typename MT // Type of the left-hand side matrix
1972  , bool SO // Storage order of the left-hand side matrix
1973  , typename VT // Type of the right-hand side vector
1974  , bool TF > // Transpose flag of the right-hand side vector
1975 BLAZE_ALWAYS_INLINE bool trySubAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
1976  ptrdiff_t band, size_t row, size_t column )
1977 {
1978  BLAZE_INTERNAL_ASSERT( row <= (~lhs).rows(), "Invalid row access index" );
1979  BLAZE_INTERNAL_ASSERT( column <= (~lhs).columns(), "Invalid column access index" );
1980  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= (~lhs).rows(), "Invalid number of rows" );
1981  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= (~lhs).columns(), "Invalid number of columns" );
1982 
1983  UNUSED_PARAMETER( lhs, rhs, band, row, column );
1984 
1985  return true;
1986 }
1988 //*************************************************************************************************
1989 
1990 
1991 //*************************************************************************************************
2007 template< typename MT1 // Type of the left-hand side matrix
2008  , bool SO1 // Storage order of the left-hand side matrix
2009  , typename MT2 // Type of the right-hand side matrix
2010  , bool SO2 > // Storage order of the right-hand side matrix
2011 BLAZE_ALWAYS_INLINE bool trySubAssign( const Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs,
2012  size_t row, size_t column )
2013 {
2014  BLAZE_INTERNAL_ASSERT( row <= (~lhs).rows(), "Invalid row access index" );
2015  BLAZE_INTERNAL_ASSERT( column <= (~lhs).columns(), "Invalid column access index" );
2016  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= (~lhs).rows(), "Invalid number of rows" );
2017  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= (~lhs).columns(), "Invalid number of columns" );
2018 
2019  UNUSED_PARAMETER( lhs, rhs, row, column );
2020 
2021  return true;
2022 }
2024 //*************************************************************************************************
2025 
2026 
2027 //*************************************************************************************************
2043 template< typename MT // Type of the left-hand side matrix
2044  , bool SO // Storage order of the left-hand side matrix
2045  , typename VT // Type of the right-hand side vector
2046  , bool TF > // Transpose flag of the right-hand side vector
2047 BLAZE_ALWAYS_INLINE bool tryMultAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
2048  size_t row, size_t column )
2049 {
2050  BLAZE_INTERNAL_ASSERT( row <= (~lhs).rows(), "Invalid row access index" );
2051  BLAZE_INTERNAL_ASSERT( column <= (~lhs).columns(), "Invalid column access index" );
2052  BLAZE_INTERNAL_ASSERT( TF || ( row + (~rhs).size() <= (~lhs).rows() ), "Invalid number of rows" );
2053  BLAZE_INTERNAL_ASSERT( !TF || ( column + (~rhs).size() <= (~lhs).columns() ), "Invalid number of columns" );
2054 
2055  UNUSED_PARAMETER( lhs, rhs, row, column );
2056 
2057  return true;
2058 }
2060 //*************************************************************************************************
2061 
2062 
2063 //*************************************************************************************************
2081 template< typename MT // Type of the left-hand side matrix
2082  , bool SO // Storage order of the left-hand side matrix
2083  , typename VT // Type of the right-hand side vector
2084  , bool TF > // Transpose flag of the right-hand side vector
2085 BLAZE_ALWAYS_INLINE bool tryMultAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
2086  ptrdiff_t band, size_t row, size_t column )
2087 {
2088  BLAZE_INTERNAL_ASSERT( row <= (~lhs).rows(), "Invalid row access index" );
2089  BLAZE_INTERNAL_ASSERT( column <= (~lhs).columns(), "Invalid column access index" );
2090  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= (~lhs).rows(), "Invalid number of rows" );
2091  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= (~lhs).columns(), "Invalid number of columns" );
2092 
2093  UNUSED_PARAMETER( lhs, rhs, band, row, column );
2094 
2095  return true;
2096 }
2098 //*************************************************************************************************
2099 
2100 
2101 //*************************************************************************************************
2117 template< typename MT1 // Type of the left-hand side matrix
2118  , bool SO1 // Storage order of the left-hand side matrix
2119  , typename MT2 // Type of the right-hand side matrix
2120  , bool SO2 > // Storage order of the right-hand side matrix
2121 BLAZE_ALWAYS_INLINE bool trySchurAssign( const Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs,
2122  size_t row, size_t column )
2123 {
2124  BLAZE_INTERNAL_ASSERT( row <= (~lhs).rows(), "Invalid row access index" );
2125  BLAZE_INTERNAL_ASSERT( column <= (~lhs).columns(), "Invalid column access index" );
2126  BLAZE_INTERNAL_ASSERT( row + (~rhs).rows() <= (~lhs).rows(), "Invalid number of rows" );
2127  BLAZE_INTERNAL_ASSERT( column + (~rhs).columns() <= (~lhs).columns(), "Invalid number of columns" );
2128 
2129  UNUSED_PARAMETER( lhs, rhs, row, column );
2130 
2131  return true;
2132 }
2134 //*************************************************************************************************
2135 
2136 
2137 //*************************************************************************************************
2153 template< typename MT // Type of the left-hand side matrix
2154  , bool SO // Storage order of the left-hand side matrix
2155  , typename VT // Type of the right-hand side vector
2156  , bool TF > // Transpose flag of the right-hand side vector
2157 BLAZE_ALWAYS_INLINE bool tryDivAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
2158  size_t row, size_t column )
2159 {
2160  BLAZE_INTERNAL_ASSERT( row <= (~lhs).rows(), "Invalid row access index" );
2161  BLAZE_INTERNAL_ASSERT( column <= (~lhs).columns(), "Invalid column access index" );
2162  BLAZE_INTERNAL_ASSERT( TF || ( row + (~rhs).size() <= (~lhs).rows() ), "Invalid number of rows" );
2163  BLAZE_INTERNAL_ASSERT( !TF || ( column + (~rhs).size() <= (~lhs).columns() ), "Invalid number of columns" );
2164 
2165  UNUSED_PARAMETER( lhs, rhs, row, column );
2166 
2167  return true;
2168 }
2170 //*************************************************************************************************
2171 
2172 
2173 //*************************************************************************************************
2191 template< typename MT // Type of the left-hand side matrix
2192  , bool SO // Storage order of the left-hand side matrix
2193  , typename VT // Type of the right-hand side vector
2194  , bool TF > // Transpose flag of the right-hand side vector
2195 BLAZE_ALWAYS_INLINE bool tryDivAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
2196  ptrdiff_t band, size_t row, size_t column )
2197 {
2198  BLAZE_INTERNAL_ASSERT( row <= (~lhs).rows(), "Invalid row access index" );
2199  BLAZE_INTERNAL_ASSERT( column <= (~lhs).columns(), "Invalid column access index" );
2200  BLAZE_INTERNAL_ASSERT( row + (~rhs).size() <= (~lhs).rows(), "Invalid number of rows" );
2201  BLAZE_INTERNAL_ASSERT( column + (~rhs).size() <= (~lhs).columns(), "Invalid number of columns" );
2202 
2203  UNUSED_PARAMETER( lhs, rhs, band, row, column );
2204 
2205  return true;
2206 }
2208 //*************************************************************************************************
2209 
2210 
2211 //*************************************************************************************************
2226 template< typename MT // Type of the matrix
2227  , bool SO > // Storage order
2228 BLAZE_ALWAYS_INLINE MT& derestrict( Matrix<MT,SO>& matrix )
2229 {
2230  return ~matrix;
2231 }
2233 //*************************************************************************************************
2234 
2235 } // namespace blaze
2236 
2237 #endif
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
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 UNUSED_PARAMETER function template.
size_t capacity(const Matrix< MT, SO > &matrix) noexcept
Returns the maximum capacity of the matrix.
Definition: Matrix.h:546
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 IsSame and IsStrictlySame type traits.
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:3077
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 shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:799
void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:851
size_t nonZeros(const Matrix< MT, SO > &matrix)
Returns the total number of non-zero elements in the matrix.
Definition: Matrix.h:584
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:3085
BLAZE_ALWAYS_INLINE constexpr const MatrixType & operator~() const noexcept
Conversion operator for constant matrices.
Definition: Matrix.h:107
const MT::ResultType evaluate(const Matrix< MT, SO > &matrix)
Evaluates the given matrix expression.
Definition: Matrix.h:912
constexpr void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
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
Header file for the IsSquare type trait.
Header file for the DisableIf class 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 IsShrinkable type trait.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:3086
Header file for the exception macros of the math module.
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
Header file for all forward declarations for expression class templates.
Header file for the EnableIf class template.
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:135
BLAZE_ALWAYS_INLINE constexpr MatrixType & operator~() noexcept
Conversion operator for non-constant matrices.
Definition: Matrix.h:97
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
static constexpr bool storageOrder
Storage order of the matrix.
Definition: Matrix.h:89
Header file for run time assertion macros.
constexpr bool isEmpty(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is empty.
Definition: Matrix.h:932
Expression object for sparse matrix-scalar divisions.The SMatScalarMult class represents the compile ...
Definition: Forward.h:121
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
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
Constraint on the data type.
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:765
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsNumeric_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( )...
Definition: DenseMatrix.h:290
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:951
Header file for the IsResizable type trait.
System settings for the inline keywords.
#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 function trace functionality.
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:825