Blaze 3.9
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>
54#include <blaze/system/Inline.h>
55#include <blaze/util/Assert.h>
56#include <blaze/util/EnableIf.h>
59#include <blaze/util/Types.h>
61
62
63namespace blaze {
64
65//=================================================================================================
66//
67// CLASS DEFINITION
68//
69//=================================================================================================
70
71//*************************************************************************************************
82template< typename MT // Type of the matrix
83 , bool SO > // Storage order
84class Matrix
85{
86 public:
87 //**Type definitions****************************************************************************
88 using MatrixType = MT;
89 //**********************************************************************************************
90
91 //**Compilation flags***************************************************************************
92 static constexpr bool storageOrder = SO;
93 //**********************************************************************************************
94
95 //**Conversion operators************************************************************************
98 [[deprecated]] BLAZE_ALWAYS_INLINE constexpr MT& operator~() noexcept;
99 [[deprecated]] BLAZE_ALWAYS_INLINE constexpr const MT& operator~() const noexcept;
100
101 constexpr MT& operator*() noexcept;
102 constexpr const MT& operator*() const noexcept;
104 //**********************************************************************************************
105
106 protected:
107 //**Special member functions********************************************************************
110 Matrix() = default;
111 Matrix( const Matrix& ) = default;
112 Matrix( Matrix&& ) = default;
113 ~Matrix() = default;
114 Matrix& operator=( const Matrix& ) = default;
115 Matrix& operator=( Matrix&& ) = default;
117 //**********************************************************************************************
118};
119//*************************************************************************************************
120
121
122
123
124//=================================================================================================
125//
126// CONVERSION OPERATIONS
127//
128//=================================================================================================
129
130//*************************************************************************************************
139template< typename MT // Type of the matrix
140 , bool SO > // Storage order
141[[deprecated]] BLAZE_ALWAYS_INLINE constexpr MT& Matrix<MT,SO>::operator~() noexcept
142{
143 return static_cast<MT&>( *this );
144}
145//*************************************************************************************************
146
147
148//*************************************************************************************************
157template< typename MT // Type of the matrix
158 , bool SO > // Storage order
159[[deprecated]] BLAZE_ALWAYS_INLINE constexpr const MT& Matrix<MT,SO>::operator~() const noexcept
160{
161 return static_cast<const MT&>( *this );
162}
163//*************************************************************************************************
164
165
166//*************************************************************************************************
174template< typename MT // Type of the matrix
175 , bool SO > // Storage order
177{
178 return static_cast<MT&>( *this );
179}
180//*************************************************************************************************
181
182
183//*************************************************************************************************
191template< typename MT // Type of the matrix
192 , bool SO > // Storage order
193BLAZE_ALWAYS_INLINE constexpr const MT& Matrix<MT,SO>::operator*() const noexcept
194{
195 return static_cast<const MT&>( *this );
196}
197//*************************************************************************************************
198
199
200
201
202//=================================================================================================
203//
204// GLOBAL OPERATORS
205//
206//=================================================================================================
207
208//*************************************************************************************************
222template< typename VT // Type of the left-hand side column vector
223 , typename MT // Type of the right-hand side matrix
224 , bool SO > // Storage order of the right-hand side matrix
225inline VT& operator*=( Vector<VT,false>& lhs, const Matrix<MT,SO>& rhs )
226{
227 ResultType_t<VT> tmp( (*rhs) * (*lhs) );
228 (*lhs) = std::move( tmp );
229 return (*lhs);
230}
232//*************************************************************************************************
233
234
235//*************************************************************************************************
249template< typename VT // Type of the left-hand side column vector
250 , typename MT // Type of the right-hand side matrix
251 , bool SO > // Storage order of the right-hand side matrix
252inline VT& operator*=( Vector<VT,false>&& lhs, const Matrix<MT,SO>& rhs )
253{
254 return (*lhs) *= (*rhs);
255}
257//*************************************************************************************************
258
259
260//*************************************************************************************************
274template< typename VT // Type of the left-hand side row vector
275 , typename MT // Type of the right-hand side matrix
276 , bool SO > // Storage order of the right-hand side matrix
277inline VT& operator*=( Vector<VT,true>& lhs, const Matrix<MT,SO>& rhs )
278{
279 ResultType_t<VT> tmp( (*lhs) * (*rhs) );
280 (*lhs) = std::move( tmp );
281 return (*lhs);
282}
284//*************************************************************************************************
285
286
287//*************************************************************************************************
301template< typename VT // Type of the left-hand side row vector
302 , typename MT // Type of the right-hand side matrix
303 , bool SO > // Storage order of the right-hand side matrix
304inline VT& operator*=( Vector<VT,true>&& lhs, const Matrix<MT,SO>& rhs )
305{
306 return (*lhs) *= (*rhs);
307}
309//*************************************************************************************************
310
311
312//*************************************************************************************************
325template< typename MT1 // Type of the left-hand side matrix
326 , bool SO1 // Storage order of the left-hand side matrix
327 , typename MT2 // Type of the right-hand side matrix
328 , bool SO2 > // Storage order of the right-hand side matrix
329inline MT1& operator*=( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
330{
331 ResultType_t<MT1> tmp( (*lhs) * (*rhs) );
332 (*lhs) = std::move( tmp );
333 return (*lhs);
334}
336//*************************************************************************************************
337
338
339//*************************************************************************************************
353template< typename MT1 // Type of the left-hand side matrix
354 , bool SO1 // Storage order of the left-hand side matrix
355 , typename MT2 // Type of the right-hand side matrix
356 , bool SO2 > // Storage order of the right-hand side matrix
357inline MT1& operator*=( Matrix<MT1,SO1>&& lhs, const Matrix<MT2,SO2>& rhs )
358{
359 return (*lhs) *= (*rhs);
360}
362//*************************************************************************************************
363
364
365
366
367//=================================================================================================
368//
369// GLOBAL FUNCTIONS
370//
371//=================================================================================================
372
373//*************************************************************************************************
376template< typename MT, bool SO >
377MT& crtp_cast( Matrix<MT,SO>& matrix );
378
379template< typename MT, bool SO >
380const MT& crtp_cast( const Matrix<MT,SO>& matrix );
381
382template< typename MT, bool SO >
383typename MT::Iterator begin( Matrix<MT,SO>& matrix, size_t i );
384
385template< typename MT, bool SO >
386typename MT::ConstIterator begin( const Matrix<MT,SO>& matrix, size_t i );
387
388template< typename MT, bool SO >
389typename MT::ConstIterator cbegin( const Matrix<MT,SO>& matrix, size_t i );
390
391template< typename MT, bool SO >
392typename MT::Iterator end( Matrix<MT,SO>& matrix, size_t i );
393
394template< typename MT, bool SO >
395typename MT::ConstIterator end( const Matrix<MT,SO>& matrix, size_t i );
396
397template< typename MT, bool SO >
398typename MT::ConstIterator cend( const Matrix<MT,SO>& matrix, size_t i );
399
400template< typename MT, bool SO >
401constexpr size_t rows( const Matrix<MT,SO>& matrix ) noexcept;
402
403template< typename MT, bool SO >
404constexpr size_t columns( const Matrix<MT,SO>& matrix ) noexcept;
405
406template< typename MT, bool SO >
407constexpr size_t size( const Matrix<MT,SO>& matrix ) noexcept;
408
409template< typename MT, bool SO >
410size_t capacity( const Matrix<MT,SO>& matrix ) noexcept;
411
412template< typename MT, bool SO >
413size_t capacity( const Matrix<MT,SO>& matrix, size_t i ) noexcept;
414
415template< typename MT, bool SO >
416size_t nonZeros( const Matrix<MT,SO>& matrix );
417
418template< typename MT, bool SO >
419size_t nonZeros( const Matrix<MT,SO>& matrix, size_t i );
420
421template< typename MT, bool SO >
422constexpr void reset( Matrix<MT,SO>& matrix );
423
424template< typename MT, bool SO >
425constexpr void reset( Matrix<MT,SO>&& matrix );
426
427template< typename MT, bool SO >
428constexpr void reset( Matrix<MT,SO>& matrix, size_t i );
429
430template< typename MT, bool SO >
431constexpr void reset( Matrix<MT,SO>&& matrix, size_t i );
432
433template< typename MT, bool SO >
434constexpr void clear( Matrix<MT,SO>& matrix );
435
436template< typename MT, bool SO >
437constexpr void clear( Matrix<MT,SO>&& matrix );
438
439template< typename MT, bool SO >
440void resize( Matrix<MT,SO>& matrix, size_t rows, size_t columns, bool preserve=true );
441
442template< typename MT, bool SO >
443void shrinkToFit( Matrix<MT,SO>& matrix );
444
445template< typename MT, bool SO >
446void transpose( Matrix<MT,SO>& matrix );
447
448template< typename MT, bool SO >
449void ctranspose( Matrix<MT,SO>& matrix );
450
451template< typename MT, bool SO >
452typename MT::ResultType evaluate( const Matrix<MT,SO>& matrix );
453
454template< bool B, typename MT, bool SO >
455typename MT::ResultType evaluateIf( const Matrix<MT,SO>& matrix );
456
457template< typename MT, bool SO >
458constexpr bool isEmpty( const Matrix<MT,SO>& matrix ) noexcept;
459
460template< typename MT, bool SO >
461bool isSquare( const Matrix<MT,SO>& matrix ) noexcept;
462
463template< typename MT1, bool SO1, typename MT2, bool SO2 >
464bool isSame( const Matrix<MT1,SO1>& a, const Matrix<MT2,SO2>& b ) noexcept;
466//*************************************************************************************************
467
468
469//*************************************************************************************************
477template< typename MT // Type of the matrix
478 , bool SO > // Storage order of the matrix
480{
481 return *matrix;
482}
483//*************************************************************************************************
484
485
486//*************************************************************************************************
494template< typename MT // Type of the matrix
495 , bool SO > // Storage order of the matrix
497{
498 return *matrix;
499}
500//*************************************************************************************************
501
502
503//*************************************************************************************************
516template< typename MT // Type of the matrix
517 , bool SO > // Storage order of the matrix
518BLAZE_ALWAYS_INLINE typename MT::Iterator begin( Matrix<MT,SO>& matrix, size_t i )
519{
520 return (*matrix).begin(i);
521}
522//*************************************************************************************************
523
524
525//*************************************************************************************************
538template< typename MT // Type of the matrix
539 , bool SO > // Storage order of the matrix
540BLAZE_ALWAYS_INLINE typename MT::ConstIterator begin( const Matrix<MT,SO>& matrix, size_t i )
541{
542 return (*matrix).begin(i);
543}
544//*************************************************************************************************
545
546
547//*************************************************************************************************
560template< typename MT // Type of the matrix
561 , bool SO > // Storage order of the matrix
562BLAZE_ALWAYS_INLINE typename MT::ConstIterator cbegin( const Matrix<MT,SO>& matrix, size_t i )
563{
564 return (*matrix).cbegin(i);
565}
566//*************************************************************************************************
567
568
569//*************************************************************************************************
582template< typename MT // Type of the matrix
583 , bool SO > // Storage order of the matrix
584BLAZE_ALWAYS_INLINE typename MT::Iterator end( Matrix<MT,SO>& matrix, size_t i )
585{
586 return (*matrix).end(i);
587}
588//*************************************************************************************************
589
590
591//*************************************************************************************************
604template< typename MT // Type of the matrix
605 , bool SO > // Storage order of the matrix
606BLAZE_ALWAYS_INLINE typename MT::ConstIterator end( const Matrix<MT,SO>& matrix, size_t i )
607{
608 return (*matrix).end(i);
609}
610//*************************************************************************************************
611
612
613//*************************************************************************************************
626template< typename MT // Type of the matrix
627 , bool SO > // Storage order of the matrix
628BLAZE_ALWAYS_INLINE typename MT::ConstIterator cend( const Matrix<MT,SO>& matrix, size_t i )
629{
630 return (*matrix).cend(i);
631}
632//*************************************************************************************************
633
634
635//*************************************************************************************************
642template< typename MT // Type of the matrix
643 , bool SO > // Storage order of the matrix
644BLAZE_ALWAYS_INLINE constexpr size_t rows( const Matrix<MT,SO>& matrix ) noexcept
645{
646 return (*matrix).rows();
647}
648//*************************************************************************************************
649
650
651//*************************************************************************************************
658template< typename MT // Type of the matrix
659 , bool SO > // Storage order of the matrix
660BLAZE_ALWAYS_INLINE constexpr size_t columns( const Matrix<MT,SO>& matrix ) noexcept
661{
662 return (*matrix).columns();
663}
664//*************************************************************************************************
665
666
667//*************************************************************************************************
674template< typename MT // Type of the matrix
675 , bool SO > // Storage order of the matrix
676BLAZE_ALWAYS_INLINE constexpr size_t size( const Matrix<MT,SO>& matrix ) noexcept
677{
678 return (*matrix).rows() * (*matrix).columns();
679}
680//*************************************************************************************************
681
682
683//*************************************************************************************************
690template< typename MT // Type of the matrix
691 , bool SO > // Storage order of the matrix
692BLAZE_ALWAYS_INLINE size_t capacity( const Matrix<MT,SO>& matrix ) noexcept
693{
694 return (*matrix).capacity();
695}
696//*************************************************************************************************
697
698
699//*************************************************************************************************
712template< typename MT // Type of the matrix
713 , bool SO > // Storage order of the matrix
714BLAZE_ALWAYS_INLINE size_t capacity( const Matrix<MT,SO>& matrix, size_t i ) noexcept
715{
716 return (*matrix).capacity( i );
717}
718//*************************************************************************************************
719
720
721//*************************************************************************************************
728template< typename MT // Type of the matrix
729 , bool SO > // Storage order of the matrix
731{
732 return (*matrix).nonZeros();
733}
734//*************************************************************************************************
735
736
737//*************************************************************************************************
750template< typename MT // Type of the matrix
751 , bool SO > // Storage order of the matrix
752BLAZE_ALWAYS_INLINE size_t nonZeros( const Matrix<MT,SO>& matrix, size_t i )
753{
754 return (*matrix).nonZeros( i );
755}
756//*************************************************************************************************
757
758
759//*************************************************************************************************
767template< typename MT // Type of the matrix
768 , bool SO > // Storage order of the matrix
769constexpr auto reset_backend( Matrix<MT,SO>& matrix )
770 -> DisableIf_t< IsZero_v<MT> || IsIdentity_v<MT> >
771{
772 (*matrix).reset();
773}
775//*************************************************************************************************
776
777
778//*************************************************************************************************
786template< typename MT // Type of the matrix
787 , bool SO > // Storage order of the matrix
788constexpr auto reset_backend( Matrix<MT,SO>& matrix )
789 -> EnableIf_t< IsZero_v<MT> || IsIdentity_v<MT> >
790{
791 MAYBE_UNUSED( matrix );
792}
794//*************************************************************************************************
795
796
797//*************************************************************************************************
804template< typename MT // Type of the matrix
805 , bool SO > // Storage order of the matrix
806constexpr void reset( Matrix<MT,SO>& matrix )
807{
808 reset_backend( *matrix );
809}
810//*************************************************************************************************
811
812
813//*************************************************************************************************
820template< typename MT // Type of the matrix
821 , bool SO > // Storage order of the matrix
822constexpr void reset( Matrix<MT,SO>&& matrix )
823{
824 reset_backend( *matrix );
825}
826//*************************************************************************************************
827
828
829//*************************************************************************************************
838template< typename MT // Type of the matrix
839 , bool SO > // Storage order of the matrix
840constexpr auto reset_backend( Matrix<MT,SO>& matrix, size_t i )
841 -> DisableIf_t< IsZero_v<MT> || IsIdentity_v<MT> >
842{
843 (*matrix).reset( i );
844}
846//*************************************************************************************************
847
848
849//*************************************************************************************************
858template< typename MT // Type of the matrix
859 , bool SO > // Storage order of the matrix
860constexpr auto reset_backend( Matrix<MT,SO>& matrix, size_t i )
861 -> EnableIf_t< IsZero_v<MT> || IsIdentity_v<MT> >
862{
863 MAYBE_UNUSED( matrix, i );
864}
866//*************************************************************************************************
867
868
869//*************************************************************************************************
882template< typename MT // Type of the matrix
883 , bool SO > // Storage order of the matrix
884constexpr void reset( Matrix<MT,SO>& matrix, size_t i )
885{
886 reset_backend( *matrix, i );
887}
888//*************************************************************************************************
889
890
891//*************************************************************************************************
904template< typename MT // Type of the matrix
905 , bool SO > // Storage order of the matrix
906constexpr void reset( Matrix<MT,SO>&& matrix, size_t i )
907{
908 reset_backend( *matrix, i );
909}
910//*************************************************************************************************
911
912
913//*************************************************************************************************
921template< typename MT // Type of the matrix
922 , bool SO > // Storage order of the matrix
923constexpr auto clear_backend( Matrix<MT,SO>& matrix )
924 -> DisableIf_t< IsClearable_v<MT> >
925{
926 (*matrix).reset();
927}
929//*************************************************************************************************
930
931
932//*************************************************************************************************
940template< typename MT // Type of the matrix
941 , bool SO > // Storage order of the matrix
942constexpr auto clear_backend( Matrix<MT,SO>& matrix )
943 -> EnableIf_t< IsClearable_v<MT> >
944{
945 (*matrix).clear();
946}
948//*************************************************************************************************
949
950
951//*************************************************************************************************
958template< typename MT // Type of the matrix
959 , bool SO > // Storage order of the matrix
960constexpr void clear( Matrix<MT,SO>& matrix )
961{
962 clear_backend( *matrix );
963}
964//*************************************************************************************************
965
966
967//*************************************************************************************************
974template< typename MT // Type of the matrix
975 , bool SO > // Storage order of the matrix
976constexpr void clear( Matrix<MT,SO>&& matrix )
977{
978 clear_backend( *matrix );
979}
980//*************************************************************************************************
981
982
983//*************************************************************************************************
1000template< typename MT // Type of the matrix
1001 , bool SO > // Storage order of the matrix
1002BLAZE_ALWAYS_INLINE auto resize_backend( Matrix<MT,SO>& matrix, size_t m, size_t n, bool preserve )
1003 -> DisableIf_t< IsResizable_v<MT> >
1004{
1005 MAYBE_UNUSED( preserve );
1006
1007 if( (*matrix).rows() != m || (*matrix).columns() != n ) {
1008 BLAZE_THROW_INVALID_ARGUMENT( "Matrix cannot be resized" );
1009 }
1010}
1012//*************************************************************************************************
1013
1014
1015//*************************************************************************************************
1028template< typename MT // Type of the matrix
1029 , bool SO > // Storage order of the matrix
1030BLAZE_ALWAYS_INLINE auto resize_backend( Matrix<MT,SO>& matrix, size_t m, size_t n, bool preserve )
1031 -> EnableIf_t< IsResizable_v<MT> && !IsSquare_v<MT> >
1032{
1033 (*matrix).resize( m, n, preserve );
1034}
1036//*************************************************************************************************
1037
1038
1039//*************************************************************************************************
1053template< typename MT // Type of the matrix
1054 , bool SO > // Storage order of the matrix
1055BLAZE_ALWAYS_INLINE auto resize_backend( Matrix<MT,SO>& matrix, size_t m, size_t n, bool preserve )
1056 -> EnableIf_t< IsResizable_v<MT> && IsSquare_v<MT> >
1057{
1058 if( m != n ) {
1059 BLAZE_THROW_INVALID_ARGUMENT( "Invalid resize arguments for square matrix" );
1060 }
1061
1062 (*matrix).resize( m, preserve );
1063}
1065//*************************************************************************************************
1066
1067
1068//*************************************************************************************************
1106template< typename MT // Type of the matrix
1107 , bool SO > // Storage order of the matrix
1108BLAZE_ALWAYS_INLINE void resize( Matrix<MT,SO>& matrix, size_t m, size_t n, bool preserve )
1109{
1110 resize_backend( matrix, m, n, preserve );
1111}
1112//*************************************************************************************************
1113
1114
1115//*************************************************************************************************
1123template< typename MT // Type of the matrix
1124 , bool SO > // Storage order of the matrix
1125BLAZE_ALWAYS_INLINE auto shrinkToFit_backend( Matrix<MT,SO>& matrix )
1126 -> DisableIf_t< IsShrinkable_v<MT> >
1127{
1128 MAYBE_UNUSED( matrix );
1129}
1131//*************************************************************************************************
1132
1133
1134//*************************************************************************************************
1142template< typename MT // Type of the matrix
1143 , bool SO > // Storage order of the matrix
1144BLAZE_ALWAYS_INLINE auto shrinkToFit_backend( Matrix<MT,SO>& matrix )
1145 -> EnableIf_t< IsShrinkable_v<MT> >
1146{
1147 (*matrix).shrinkToFit();
1148}
1150//*************************************************************************************************
1151
1152
1153//*************************************************************************************************
1167template< typename MT // Type of the matrix
1168 , bool SO > // Storage order of the matrix
1170{
1171 shrinkToFit_backend( matrix );
1172}
1173//*************************************************************************************************
1174
1175
1176//*************************************************************************************************
1193template< typename MT // Type of the matrix
1194 , bool SO > // Storage order of the matrix
1196{
1197 (*matrix).transpose();
1198}
1199//*************************************************************************************************
1200
1201
1202//*************************************************************************************************
1219template< typename MT // Type of the matrix
1220 , bool SO > // Storage order of the matrix
1222{
1223 (*matrix).ctranspose();
1224}
1225//*************************************************************************************************
1226
1227
1228//*************************************************************************************************
1280template< typename MT // Type of the matrix
1281 , bool SO > // Storage order of the matrix
1282inline typename MT::ResultType evaluate( const Matrix<MT,SO>& matrix )
1283{
1284 typename MT::ResultType tmp( *matrix );
1285 return tmp;
1286}
1287//*************************************************************************************************
1288
1289
1290//*************************************************************************************************
1301template< typename MT // Type of the matrix
1302 , bool SO > // Storage order of the matrix
1303inline decltype(auto) evaluateIf( FalseType, const Matrix<MT,SO>& matrix )
1304{
1305 return *matrix;
1306}
1308//*************************************************************************************************
1309
1310
1311//*************************************************************************************************
1321template< typename MT // Type of the matrix
1322 , bool SO > // Storage order of the matrix
1323inline decltype(auto) evaluateIf( TrueType, const Matrix<MT,SO>& matrix )
1324{
1325 return evaluate( *matrix );
1326}
1328//*************************************************************************************************
1329
1330
1331//*************************************************************************************************
1342template< bool B // Compile time condition
1343 , typename MT // Type of the matrix
1344 , bool SO > // Storage order of the matrix
1345inline decltype(auto) evaluateIf( const Matrix<MT,SO>& matrix )
1346{
1347 return evaluateIf( BoolConstant<B>{}, *matrix );
1348}
1349//*************************************************************************************************
1350
1351
1352//*************************************************************************************************
1362template< typename MT // Type of the matrix
1363 , bool SO > // Storage order of the matrix
1364BLAZE_ALWAYS_INLINE constexpr bool isEmpty( const Matrix<MT,SO>& matrix ) noexcept
1365{
1366 return size( *matrix ) == 0UL;
1367}
1368//*************************************************************************************************
1369
1370
1371//*************************************************************************************************
1381template< typename MT // Type of the matrix
1382 , bool SO > // Storage order
1383BLAZE_ALWAYS_INLINE bool isSquare( const Matrix<MT,SO>& matrix ) noexcept
1384{
1385 return ( IsSquare_v<MT> || (*matrix).rows() == (*matrix).columns() );
1386}
1387//*************************************************************************************************
1388
1389
1390//*************************************************************************************************
1420template< typename MT1 // Type of the left-hand side matrix
1421 , bool SO1 // Storage order of the left-hand side matrix
1422 , typename MT2 // Type of the right-hand side matrix
1423 , bool SO2 > // Storage order of the right-hand side matrix
1425{
1426 return ( IsSame_v<MT1,MT2> &&
1427 reinterpret_cast<const void*>( &a ) == reinterpret_cast<const void*>( &b ) );
1428}
1429//*************************************************************************************************
1430
1431
1432//*************************************************************************************************
1441template< typename MT1 // Type of the left-hand side matrix
1442 , typename MT2 // Type of the right-hand side matrix
1443 , bool SO > // Storage order of both matrices
1444BLAZE_ALWAYS_INLINE void assign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,SO>& rhs )
1445{
1447
1448 (*lhs).assign( *rhs );
1449}
1451//*************************************************************************************************
1452
1453
1454//*************************************************************************************************
1463template< typename MT1 // Type of the left-hand side matrix
1464 , bool SO // Storage order of the left-hand side matrix
1465 , typename MT2 > // Type of the right-hand side matrix
1466BLAZE_ALWAYS_INLINE auto assign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1467 -> DisableIf_t< IsSymmetric_v<MT2> >
1468{
1470
1472
1473 (*lhs).assign( *rhs );
1474}
1476//*************************************************************************************************
1477
1478
1479//*************************************************************************************************
1489template< typename MT1 // Type of the left-hand side matrix
1490 , bool SO // Storage order of the left-hand side matrix
1491 , typename MT2 > // Type of the right-hand side matrix
1492BLAZE_ALWAYS_INLINE auto assign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1493 -> EnableIf_t< IsSymmetric_v<MT2> >
1494{
1496
1497 BLAZE_INTERNAL_ASSERT( isSquare( *rhs ), "Non-square symmetric matrix detected" );
1498
1499 (*lhs).assign( trans( *rhs ) );
1500}
1502//*************************************************************************************************
1503
1504
1505//*************************************************************************************************
1520template< typename MT1 // Type of the left-hand side matrix
1521 , bool SO1 // Storage order of the left-hand side matrix
1522 , typename MT2 // Type of the right-hand side matrix
1523 , bool SO2 > // Storage order of the right-hand side matrix
1524BLAZE_ALWAYS_INLINE void assign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
1525{
1527
1528 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == (*rhs).rows() , "Invalid number of rows" );
1529 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == (*rhs).columns(), "Invalid number of columns" );
1530
1531 assign_backend( *lhs, *rhs );
1532}
1534//*************************************************************************************************
1535
1536
1537//*************************************************************************************************
1547template< typename MT1 // Type of the left-hand side matrix
1548 , typename MT2 // Type of the right-hand side matrix
1549 , bool SO > // Storage order of both matrices
1550BLAZE_ALWAYS_INLINE void addAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,SO>& rhs )
1551{
1553
1554 (*lhs).addAssign( *rhs );
1555}
1557//*************************************************************************************************
1558
1559
1560//*************************************************************************************************
1570template< typename MT1 // Type of the left-hand side matrix
1571 , bool SO // Storage order of the left-hand side matrix
1572 , typename MT2 > // Type of the right-hand side matrix
1573BLAZE_ALWAYS_INLINE auto addAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1574 -> DisableIf_t< IsSymmetric_v<MT2> >
1575{
1577
1579
1580 (*lhs).addAssign( *rhs );
1581}
1583//*************************************************************************************************
1584
1585
1586//*************************************************************************************************
1596template< typename MT1 // Type of the left-hand side matrix
1597 , bool SO // Storage order of the left-hand side matrix
1598 , typename MT2 > // Type of the right-hand side matrix
1599BLAZE_ALWAYS_INLINE auto addAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1600 -> EnableIf_t< IsSymmetric_v<MT2> >
1601{
1603
1604 BLAZE_INTERNAL_ASSERT( isSquare( *rhs ), "Non-square symmetric matrix detected" );
1605
1606 (*lhs).addAssign( trans( *rhs ) );
1607}
1609//*************************************************************************************************
1610
1611
1612//*************************************************************************************************
1627template< typename MT1 // Type of the left-hand side matrix
1628 , bool SO1 // Storage order of the left-hand side matrix
1629 , typename MT2 // Type of the right-hand side matrix
1630 , bool SO2 > // Storage order of the right-hand side matrix
1631BLAZE_ALWAYS_INLINE void addAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
1632{
1634
1635 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == (*rhs).rows() , "Invalid number of rows" );
1636 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == (*rhs).columns(), "Invalid number of columns" );
1637
1638 addAssign_backend( *lhs, *rhs );
1639}
1641//*************************************************************************************************
1642
1643
1644//*************************************************************************************************
1654template< typename MT1 // Type of the left-hand side matrix
1655 , typename MT2 // Type of the right-hand side matrix
1656 , bool SO > // Storage order of both matrices
1657BLAZE_ALWAYS_INLINE void subAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,SO>& rhs )
1658{
1660
1661 (*lhs).subAssign( *rhs );
1662}
1664//*************************************************************************************************
1665
1666
1667//*************************************************************************************************
1677template< typename MT1 // Type of the left-hand side matrix
1678 , bool SO // Storage order of the left-hand side matrix
1679 , typename MT2 > // Type of the right-hand side matrix
1680BLAZE_ALWAYS_INLINE auto subAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1681 -> DisableIf_t< IsSymmetric_v<MT2> >
1682{
1684
1686
1687 (*lhs).subAssign( *rhs );
1688}
1690//*************************************************************************************************
1691
1692
1693//*************************************************************************************************
1703template< typename MT1 // Type of the left-hand side matrix
1704 , bool SO // Storage order of the left-hand side matrix
1705 , typename MT2 > // Type of the right-hand side matrix
1706BLAZE_ALWAYS_INLINE auto subAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1707 -> EnableIf_t< IsSymmetric_v<MT2> >
1708{
1710
1711 BLAZE_INTERNAL_ASSERT( isSquare( *rhs ), "Non-square symmetric matrix detected" );
1712
1713 (*lhs).subAssign( trans( *rhs ) );
1714}
1716//*************************************************************************************************
1717
1718
1719//*************************************************************************************************
1734template< typename MT1 // Type of the left-hand side matrix
1735 , bool SO1 // Storage order of the left-hand side matrix
1736 , typename MT2 // Type of the right-hand side matrix
1737 , bool SO2 > // Storage order of the right-hand side matrix
1738BLAZE_ALWAYS_INLINE void subAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
1739{
1741
1742 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == (*rhs).rows() , "Invalid number of rows" );
1743 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == (*rhs).columns(), "Invalid number of columns" );
1744
1745 subAssign_backend( *lhs, *rhs );
1746}
1748//*************************************************************************************************
1749
1750
1751//*************************************************************************************************
1761template< typename MT1 // Type of the left-hand side matrix
1762 , typename MT2 // Type of the right-hand side matrix
1763 , bool SO > // Storage order of both matrices
1764BLAZE_ALWAYS_INLINE void schurAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,SO>& rhs )
1765{
1767
1768 (*lhs).schurAssign( *rhs );
1769}
1771//*************************************************************************************************
1772
1773
1774//*************************************************************************************************
1784template< typename MT1 // Type of the left-hand side matrix
1785 , bool SO // Storage order of the left-hand side matrix
1786 , typename MT2 > // Type of the right-hand side matrix
1787BLAZE_ALWAYS_INLINE auto schurAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1788 -> DisableIf_t< IsSymmetric_v<MT2> >
1789{
1791
1793
1794 (*lhs).schurAssign( *rhs );
1795}
1797//*************************************************************************************************
1798
1799
1800//*************************************************************************************************
1810template< typename MT1 // Type of the left-hand side matrix
1811 , bool SO // Storage order of the left-hand side matrix
1812 , typename MT2 > // Type of the right-hand side matrix
1813BLAZE_ALWAYS_INLINE auto schurAssign_backend( Matrix<MT1,SO>& lhs, const Matrix<MT2,!SO>& rhs )
1814 -> EnableIf_t< IsSymmetric_v<MT2> >
1815{
1817
1818 BLAZE_INTERNAL_ASSERT( isSquare( *rhs ), "Non-square symmetric matrix detected" );
1819
1820 (*lhs).schurAssign( trans( *rhs ) );
1821}
1823//*************************************************************************************************
1824
1825
1826//*************************************************************************************************
1841template< typename MT1 // Type of the left-hand side matrix
1842 , bool SO1 // Storage order of the left-hand side matrix
1843 , typename MT2 // Type of the right-hand side matrix
1844 , bool SO2 > // Storage order of the right-hand side matrix
1845BLAZE_ALWAYS_INLINE void schurAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
1846{
1848
1849 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == (*rhs).rows() , "Invalid number of rows" );
1850 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == (*rhs).columns(), "Invalid number of columns" );
1851
1852 schurAssign_backend( *lhs, *rhs );
1853}
1855//*************************************************************************************************
1856
1857
1858//*************************************************************************************************
1873template< typename MT1 // Type of the left-hand side matrix
1874 , bool SO1 // Storage order of the left-hand side matrix
1875 , typename MT2 // Type of the right-hand side matrix
1876 , bool SO2 > // Storage order of the right-hand side matrix
1877BLAZE_ALWAYS_INLINE void multAssign( Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs )
1878{
1880
1881 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == (*rhs).rows(), "Invalid matrix sizes" );
1882
1883 (*lhs).multAssign( *rhs );
1884}
1886//*************************************************************************************************
1887
1888
1889//*************************************************************************************************
1905template< typename MT // Type of the matrix
1906 , bool SO // Storage order
1907 , typename ET > // Type of the element
1908BLAZE_ALWAYS_INLINE bool trySet( const Matrix<MT,SO>& mat, size_t i, size_t j, const ET& value )
1909{
1910 BLAZE_INTERNAL_ASSERT( i < (*mat).rows(), "Invalid row access index" );
1911 BLAZE_INTERNAL_ASSERT( j < (*mat).columns(), "Invalid column access index" );
1912
1913 MAYBE_UNUSED( mat, i, j, value );
1914
1915 return true;
1916}
1918//*************************************************************************************************
1919
1920
1921//*************************************************************************************************
1939template< typename MT // Type of the matrix
1940 , bool SO // Storage order
1941 , typename ET > // Type of the element
1943 trySet( const Matrix<MT,SO>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
1944{
1945 BLAZE_INTERNAL_ASSERT( row <= (*mat).rows(), "Invalid row access index" );
1946 BLAZE_INTERNAL_ASSERT( column <= (*mat).columns(), "Invalid column access index" );
1947 BLAZE_INTERNAL_ASSERT( row + m <= (*mat).rows(), "Invalid number of rows" );
1948 BLAZE_INTERNAL_ASSERT( column + n <= (*mat).columns(), "Invalid number of columns" );
1949
1950 MAYBE_UNUSED( mat, row, column, m, n, value );
1951
1952 return true;
1953}
1955//*************************************************************************************************
1956
1957
1958//*************************************************************************************************
1974template< typename MT // Type of the matrix
1975 , bool SO // Storage order
1976 , typename ET > // Type of the element
1977BLAZE_ALWAYS_INLINE bool tryAdd( const Matrix<MT,SO>& mat, size_t i, size_t j, const ET& value )
1978{
1979 BLAZE_INTERNAL_ASSERT( i < (*mat).rows(), "Invalid row access index" );
1980 BLAZE_INTERNAL_ASSERT( j < (*mat).columns(), "Invalid column access index" );
1981
1982 MAYBE_UNUSED( mat, i, j, value );
1983
1984 return true;
1985}
1987//*************************************************************************************************
1988
1989
1990//*************************************************************************************************
2008template< typename MT // Type of the matrix
2009 , bool SO // Storage order
2010 , typename ET > // Type of the element
2012 tryAdd( const Matrix<MT,SO>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
2013{
2014 BLAZE_INTERNAL_ASSERT( row <= (*mat).rows(), "Invalid row access index" );
2015 BLAZE_INTERNAL_ASSERT( column <= (*mat).columns(), "Invalid column access index" );
2016 BLAZE_INTERNAL_ASSERT( row + m <= (*mat).rows(), "Invalid number of rows" );
2017 BLAZE_INTERNAL_ASSERT( column + n <= (*mat).columns(), "Invalid number of columns" );
2018
2019 MAYBE_UNUSED( mat, row, column, m, n, value );
2020
2021 return true;
2022}
2024//*************************************************************************************************
2025
2026
2027//*************************************************************************************************
2043template< typename MT // Type of the matrix
2044 , bool SO // Storage order
2045 , typename ET > // Type of the element
2046BLAZE_ALWAYS_INLINE bool trySub( const Matrix<MT,SO>& mat, size_t i, size_t j, const ET& value )
2047{
2048 BLAZE_INTERNAL_ASSERT( i < (*mat).rows(), "Invalid row access index" );
2049 BLAZE_INTERNAL_ASSERT( j < (*mat).columns(), "Invalid column access index" );
2050
2051 MAYBE_UNUSED( mat, i, j, value );
2052
2053 return true;
2054}
2056//*************************************************************************************************
2057
2058
2059//*************************************************************************************************
2077template< typename MT // Type of the matrix
2078 , bool SO // Storage order
2079 , typename ET > // Type of the element
2081 trySub( const Matrix<MT,SO>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
2082{
2083 BLAZE_INTERNAL_ASSERT( row <= (*mat).rows(), "Invalid row access index" );
2084 BLAZE_INTERNAL_ASSERT( column <= (*mat).columns(), "Invalid column access index" );
2085 BLAZE_INTERNAL_ASSERT( row + m <= (*mat).rows(), "Invalid number of rows" );
2086 BLAZE_INTERNAL_ASSERT( column + n <= (*mat).columns(), "Invalid number of columns" );
2087
2088 MAYBE_UNUSED( mat, row, column, m, n, value );
2089
2090 return true;
2091}
2093//*************************************************************************************************
2094
2095
2096//*************************************************************************************************
2112template< typename MT // Type of the matrix
2113 , bool SO // Storage order
2114 , typename ET > // Type of the element
2115BLAZE_ALWAYS_INLINE bool tryMult( const Matrix<MT,SO>& mat, size_t i, size_t j, const ET& value )
2116{
2117 BLAZE_INTERNAL_ASSERT( i < (*mat).rows(), "Invalid row access index" );
2118 BLAZE_INTERNAL_ASSERT( j < (*mat).columns(), "Invalid column access index" );
2119
2120 MAYBE_UNUSED( mat, i, j, value );
2121
2122 return true;
2123}
2125//*************************************************************************************************
2126
2127
2128//*************************************************************************************************
2146template< typename MT // Type of the matrix
2147 , bool SO // Storage order
2148 , typename ET > // Type of the element
2150 tryMult( const Matrix<MT,SO>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
2151{
2152 BLAZE_INTERNAL_ASSERT( row <= (*mat).rows(), "Invalid row access index" );
2153 BLAZE_INTERNAL_ASSERT( column <= (*mat).columns(), "Invalid column access index" );
2154 BLAZE_INTERNAL_ASSERT( row + m <= (*mat).rows(), "Invalid number of rows" );
2155 BLAZE_INTERNAL_ASSERT( column + n <= (*mat).columns(), "Invalid number of columns" );
2156
2157 MAYBE_UNUSED( mat, row, column, m, n, value );
2158
2159 return true;
2160}
2162//*************************************************************************************************
2163
2164
2165//*************************************************************************************************
2181template< typename MT // Type of the matrix
2182 , bool SO // Storage order
2183 , typename ET > // Type of the element
2184BLAZE_ALWAYS_INLINE bool tryDiv( const Matrix<MT,SO>& mat, size_t i, size_t j, const ET& value )
2185{
2186 BLAZE_INTERNAL_ASSERT( i < (*mat).rows(), "Invalid row access index" );
2187 BLAZE_INTERNAL_ASSERT( j < (*mat).columns(), "Invalid column access index" );
2188
2189 MAYBE_UNUSED( mat, i, j, value );
2190
2191 return true;
2192}
2194//*************************************************************************************************
2195
2196
2197//*************************************************************************************************
2215template< typename MT // Type of the matrix
2216 , bool SO // Storage order
2217 , typename ET > // Type of the element
2219 tryDiv( const Matrix<MT,SO>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
2220{
2221 BLAZE_INTERNAL_ASSERT( row <= (*mat).rows(), "Invalid row access index" );
2222 BLAZE_INTERNAL_ASSERT( column <= (*mat).columns(), "Invalid column access index" );
2223 BLAZE_INTERNAL_ASSERT( row + m <= (*mat).rows(), "Invalid number of rows" );
2224 BLAZE_INTERNAL_ASSERT( column + n <= (*mat).columns(), "Invalid number of columns" );
2225
2226 MAYBE_UNUSED( mat, row, column, m, n, value );
2227
2228 return true;
2229}
2231//*************************************************************************************************
2232
2233
2234//*************************************************************************************************
2250template< typename MT // Type of the matrix
2251 , bool SO > // Storage order
2252BLAZE_ALWAYS_INLINE bool tryShift( const Matrix<MT,SO>& mat, size_t i, size_t j, int count )
2253{
2254 BLAZE_INTERNAL_ASSERT( i < (*mat).rows(), "Invalid row access index" );
2255 BLAZE_INTERNAL_ASSERT( j < (*mat).columns(), "Invalid column access index" );
2256
2257 MAYBE_UNUSED( mat, i, j, count );
2258
2259 return true;
2260}
2262//*************************************************************************************************
2263
2264
2265//*************************************************************************************************
2283template< typename MT // Type of the matrix
2284 , bool SO > // Storage order
2286 tryShift( const Matrix<MT,SO>& mat, size_t row, size_t column, size_t m, size_t n, int count )
2287{
2288 BLAZE_INTERNAL_ASSERT( row <= (*mat).rows(), "Invalid row access index" );
2289 BLAZE_INTERNAL_ASSERT( column <= (*mat).columns(), "Invalid column access index" );
2290 BLAZE_INTERNAL_ASSERT( row + m <= (*mat).rows(), "Invalid number of rows" );
2291 BLAZE_INTERNAL_ASSERT( column + n <= (*mat).columns(), "Invalid number of columns" );
2292
2293 MAYBE_UNUSED( mat, row, column, m, n, count );
2294
2295 return true;
2296}
2298//*************************************************************************************************
2299
2300
2301//*************************************************************************************************
2317template< typename MT // Type of the matrix
2318 , bool SO // Storage order
2319 , typename ET > // Type of the element
2320BLAZE_ALWAYS_INLINE bool tryBitand( const Matrix<MT,SO>& mat, size_t i, size_t j, const ET& value )
2321{
2322 BLAZE_INTERNAL_ASSERT( i < (*mat).rows(), "Invalid row access index" );
2323 BLAZE_INTERNAL_ASSERT( j < (*mat).columns(), "Invalid column access index" );
2324
2325 MAYBE_UNUSED( mat, i, j, value );
2326
2327 return true;
2328}
2330//*************************************************************************************************
2331
2332
2333//*************************************************************************************************
2351template< typename MT // Type of the matrix
2352 , bool SO // Storage order
2353 , typename ET > // Type of the element
2355 tryBitand( const Matrix<MT,SO>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
2356{
2357 BLAZE_INTERNAL_ASSERT( row <= (*mat).rows(), "Invalid row access index" );
2358 BLAZE_INTERNAL_ASSERT( column <= (*mat).columns(), "Invalid column access index" );
2359 BLAZE_INTERNAL_ASSERT( row + m <= (*mat).rows(), "Invalid number of rows" );
2360 BLAZE_INTERNAL_ASSERT( column + n <= (*mat).columns(), "Invalid number of columns" );
2361
2362 MAYBE_UNUSED( mat, row, column, m, n, value );
2363
2364 return true;
2365}
2367//*************************************************************************************************
2368
2369
2370//*************************************************************************************************
2386template< typename MT // Type of the matrix
2387 , bool SO // Storage order
2388 , typename ET > // Type of the element
2389BLAZE_ALWAYS_INLINE bool tryBitor( const Matrix<MT,SO>& mat, size_t i, size_t j, const ET& value )
2390{
2391 BLAZE_INTERNAL_ASSERT( i < (*mat).rows(), "Invalid row access index" );
2392 BLAZE_INTERNAL_ASSERT( j < (*mat).columns(), "Invalid column access index" );
2393
2394 MAYBE_UNUSED( mat, i, j, value );
2395
2396 return true;
2397}
2399//*************************************************************************************************
2400
2401
2402//*************************************************************************************************
2420template< typename MT // Type of the matrix
2421 , bool SO // Storage order
2422 , typename ET > // Type of the element
2424 tryBitor( const Matrix<MT,SO>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
2425{
2426 BLAZE_INTERNAL_ASSERT( row <= (*mat).rows(), "Invalid row access index" );
2427 BLAZE_INTERNAL_ASSERT( column <= (*mat).columns(), "Invalid column access index" );
2428 BLAZE_INTERNAL_ASSERT( row + m <= (*mat).rows(), "Invalid number of rows" );
2429 BLAZE_INTERNAL_ASSERT( column + n <= (*mat).columns(), "Invalid number of columns" );
2430
2431 MAYBE_UNUSED( mat, row, column, m, n, value );
2432
2433 return true;
2434}
2436//*************************************************************************************************
2437
2438
2439//*************************************************************************************************
2455template< typename MT // Type of the matrix
2456 , bool SO // Storage order
2457 , typename ET > // Type of the element
2458BLAZE_ALWAYS_INLINE bool tryBitxor( const Matrix<MT,SO>& mat, size_t i, size_t j, const ET& value )
2459{
2460 BLAZE_INTERNAL_ASSERT( i < (*mat).rows(), "Invalid row access index" );
2461 BLAZE_INTERNAL_ASSERT( j < (*mat).columns(), "Invalid column access index" );
2462
2463 MAYBE_UNUSED( mat, i, j, value );
2464
2465 return true;
2466}
2468//*************************************************************************************************
2469
2470
2471//*************************************************************************************************
2489template< typename MT // Type of the matrix
2490 , bool SO // Storage order
2491 , typename ET > // Type of the element
2493 tryBitxor( const Matrix<MT,SO>& mat, size_t row, size_t column, size_t m, size_t n, const ET& value )
2494{
2495 BLAZE_INTERNAL_ASSERT( row <= (*mat).rows(), "Invalid row access index" );
2496 BLAZE_INTERNAL_ASSERT( column <= (*mat).columns(), "Invalid column access index" );
2497 BLAZE_INTERNAL_ASSERT( row + m <= (*mat).rows(), "Invalid number of rows" );
2498 BLAZE_INTERNAL_ASSERT( column + n <= (*mat).columns(), "Invalid number of columns" );
2499
2500 MAYBE_UNUSED( mat, row, column, m, n, value );
2501
2502 return true;
2503}
2505//*************************************************************************************************
2506
2507
2508//*************************************************************************************************
2524template< typename MT // Type of the left-hand side matrix
2525 , bool SO // Storage order of the left-hand side matrix
2526 , typename VT // Type of the right-hand side vector
2527 , bool TF > // Transpose flag of the right-hand side vector
2528BLAZE_ALWAYS_INLINE bool tryAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
2529 size_t row, size_t column )
2530{
2531 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
2532 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
2533 BLAZE_INTERNAL_ASSERT( TF || ( row + (*rhs).size() <= (*lhs).rows() ), "Invalid number of rows" );
2534 BLAZE_INTERNAL_ASSERT( !TF || ( column + (*rhs).size() <= (*lhs).columns() ), "Invalid number of columns" );
2535
2536 MAYBE_UNUSED( lhs, rhs, row, column );
2537
2538 return true;
2539}
2541//*************************************************************************************************
2542
2543
2544//*************************************************************************************************
2561template< typename MT // Type of the left-hand side matrix
2562 , bool SO // Storage order of the left-hand side matrix
2563 , typename VT // Type of the right-hand side vector
2564 , bool TF > // Transpose flag of the right-hand side vector
2565BLAZE_ALWAYS_INLINE bool tryAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
2566 ptrdiff_t band, size_t row, size_t column )
2567{
2568 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
2569 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
2570 BLAZE_INTERNAL_ASSERT( row + (*rhs).size() <= (*lhs).rows(), "Invalid number of rows" );
2571 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= (*lhs).columns(), "Invalid number of columns" );
2572
2573 MAYBE_UNUSED( lhs, rhs, band, row, column );
2574
2575 return true;
2576}
2578//*************************************************************************************************
2579
2580
2581//*************************************************************************************************
2597template< typename MT1 // Type of the left-hand side matrix
2598 , bool SO1 // Storage order of the left-hand side matrix
2599 , typename MT2 // Type of the right-hand side matrix
2600 , bool SO2 > // Storage order of the right-hand side matrix
2601BLAZE_ALWAYS_INLINE bool tryAssign( const Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs,
2602 size_t row, size_t column )
2603{
2604 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
2605 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
2606 BLAZE_INTERNAL_ASSERT( row + (*rhs).rows() <= (*lhs).rows(), "Invalid number of rows" );
2607 BLAZE_INTERNAL_ASSERT( column + (*rhs).columns() <= (*lhs).columns(), "Invalid number of columns" );
2608
2609 MAYBE_UNUSED( lhs, rhs, row, column );
2610
2611 return true;
2612}
2614//*************************************************************************************************
2615
2616
2617//*************************************************************************************************
2633template< typename MT // Type of the left-hand side matrix
2634 , bool SO // Storage order of the left-hand side matrix
2635 , typename VT // Type of the right-hand side vector
2636 , bool TF > // Transpose flag of the right-hand side vector
2637BLAZE_ALWAYS_INLINE bool tryAddAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
2638 size_t row, size_t column )
2639{
2640 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
2641 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
2642 BLAZE_INTERNAL_ASSERT( TF || ( row + (*rhs).size() <= (*lhs).rows() ), "Invalid number of rows" );
2643 BLAZE_INTERNAL_ASSERT( !TF || ( column + (*rhs).size() <= (*lhs).columns() ), "Invalid number of columns" );
2644
2645 MAYBE_UNUSED( lhs, rhs, row, column );
2646
2647 return true;
2648}
2650//*************************************************************************************************
2651
2652
2653//*************************************************************************************************
2670template< typename MT // Type of the left-hand side matrix
2671 , bool SO // Storage order of the left-hand side matrix
2672 , typename VT // Type of the right-hand side vector
2673 , bool TF > // Transpose flag of the right-hand side vector
2674BLAZE_ALWAYS_INLINE bool tryAddAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
2675 ptrdiff_t band, size_t row, size_t column )
2676{
2677 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
2678 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
2679 BLAZE_INTERNAL_ASSERT( row + (*rhs).size() <= (*lhs).rows(), "Invalid number of rows" );
2680 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= (*lhs).columns(), "Invalid number of columns" );
2681
2682 MAYBE_UNUSED( lhs, rhs, band, row, column );
2683
2684 return true;
2685}
2687//*************************************************************************************************
2688
2689
2690//*************************************************************************************************
2706template< typename MT1 // Type of the left-hand side matrix
2707 , bool SO1 // Storage order of the left-hand side matrix
2708 , typename MT2 // Type of the right-hand side matrix
2709 , bool SO2 > // Storage order of the right-hand side matrix
2710BLAZE_ALWAYS_INLINE bool tryAddAssign( const Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs,
2711 size_t row, size_t column )
2712{
2713 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
2714 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
2715 BLAZE_INTERNAL_ASSERT( row + (*rhs).rows() <= (*lhs).rows(), "Invalid number of rows" );
2716 BLAZE_INTERNAL_ASSERT( column + (*rhs).columns() <= (*lhs).columns(), "Invalid number of columns" );
2717
2718 MAYBE_UNUSED( lhs, rhs, row, column );
2719
2720 return true;
2721}
2723//*************************************************************************************************
2724
2725
2726//*************************************************************************************************
2742template< typename MT // Type of the left-hand side matrix
2743 , bool SO // Storage order of the left-hand side matrix
2744 , typename VT // Type of the right-hand side vector
2745 , bool TF > // Transpose flag of the right-hand side vector
2746BLAZE_ALWAYS_INLINE bool trySubAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
2747 size_t row, size_t column )
2748{
2749 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
2750 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
2751 BLAZE_INTERNAL_ASSERT( TF || ( row + (*rhs).size() <= (*lhs).rows() ), "Invalid number of rows" );
2752 BLAZE_INTERNAL_ASSERT( !TF || ( column + (*rhs).size() <= (*lhs).columns() ), "Invalid number of columns" );
2753
2754 MAYBE_UNUSED( lhs, rhs, row, column );
2755
2756 return true;
2757}
2759//*************************************************************************************************
2760
2761
2762//*************************************************************************************************
2780template< typename MT // Type of the left-hand side matrix
2781 , bool SO // Storage order of the left-hand side matrix
2782 , typename VT // Type of the right-hand side vector
2783 , bool TF > // Transpose flag of the right-hand side vector
2784BLAZE_ALWAYS_INLINE bool trySubAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
2785 ptrdiff_t band, size_t row, size_t column )
2786{
2787 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
2788 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
2789 BLAZE_INTERNAL_ASSERT( row + (*rhs).size() <= (*lhs).rows(), "Invalid number of rows" );
2790 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= (*lhs).columns(), "Invalid number of columns" );
2791
2792 MAYBE_UNUSED( lhs, rhs, band, row, column );
2793
2794 return true;
2795}
2797//*************************************************************************************************
2798
2799
2800//*************************************************************************************************
2816template< typename MT1 // Type of the left-hand side matrix
2817 , bool SO1 // Storage order of the left-hand side matrix
2818 , typename MT2 // Type of the right-hand side matrix
2819 , bool SO2 > // Storage order of the right-hand side matrix
2820BLAZE_ALWAYS_INLINE bool trySubAssign( const Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs,
2821 size_t row, size_t column )
2822{
2823 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
2824 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
2825 BLAZE_INTERNAL_ASSERT( row + (*rhs).rows() <= (*lhs).rows(), "Invalid number of rows" );
2826 BLAZE_INTERNAL_ASSERT( column + (*rhs).columns() <= (*lhs).columns(), "Invalid number of columns" );
2827
2828 MAYBE_UNUSED( lhs, rhs, row, column );
2829
2830 return true;
2831}
2833//*************************************************************************************************
2834
2835
2836//*************************************************************************************************
2852template< typename MT // Type of the left-hand side matrix
2853 , bool SO // Storage order of the left-hand side matrix
2854 , typename VT // Type of the right-hand side vector
2855 , bool TF > // Transpose flag of the right-hand side vector
2856BLAZE_ALWAYS_INLINE bool tryMultAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
2857 size_t row, size_t column )
2858{
2859 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
2860 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
2861 BLAZE_INTERNAL_ASSERT( TF || ( row + (*rhs).size() <= (*lhs).rows() ), "Invalid number of rows" );
2862 BLAZE_INTERNAL_ASSERT( !TF || ( column + (*rhs).size() <= (*lhs).columns() ), "Invalid number of columns" );
2863
2864 MAYBE_UNUSED( lhs, rhs, row, column );
2865
2866 return true;
2867}
2869//*************************************************************************************************
2870
2871
2872//*************************************************************************************************
2890template< typename MT // Type of the left-hand side matrix
2891 , bool SO // Storage order of the left-hand side matrix
2892 , typename VT // Type of the right-hand side vector
2893 , bool TF > // Transpose flag of the right-hand side vector
2894BLAZE_ALWAYS_INLINE bool tryMultAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
2895 ptrdiff_t band, size_t row, size_t column )
2896{
2897 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
2898 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
2899 BLAZE_INTERNAL_ASSERT( row + (*rhs).size() <= (*lhs).rows(), "Invalid number of rows" );
2900 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= (*lhs).columns(), "Invalid number of columns" );
2901
2902 MAYBE_UNUSED( lhs, rhs, band, row, column );
2903
2904 return true;
2905}
2907//*************************************************************************************************
2908
2909
2910//*************************************************************************************************
2926template< typename MT1 // Type of the left-hand side matrix
2927 , bool SO1 // Storage order of the left-hand side matrix
2928 , typename MT2 // Type of the right-hand side matrix
2929 , bool SO2 > // Storage order of the right-hand side matrix
2930BLAZE_ALWAYS_INLINE bool trySchurAssign( const Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs,
2931 size_t row, size_t column )
2932{
2933 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
2934 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
2935 BLAZE_INTERNAL_ASSERT( row + (*rhs).rows() <= (*lhs).rows(), "Invalid number of rows" );
2936 BLAZE_INTERNAL_ASSERT( column + (*rhs).columns() <= (*lhs).columns(), "Invalid number of columns" );
2937
2938 MAYBE_UNUSED( lhs, rhs, row, column );
2939
2940 return true;
2941}
2943//*************************************************************************************************
2944
2945
2946//*************************************************************************************************
2962template< typename MT // Type of the left-hand side matrix
2963 , bool SO // Storage order of the left-hand side matrix
2964 , typename VT // Type of the right-hand side vector
2965 , bool TF > // Transpose flag of the right-hand side vector
2966BLAZE_ALWAYS_INLINE bool tryDivAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
2967 size_t row, size_t column )
2968{
2969 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
2970 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
2971 BLAZE_INTERNAL_ASSERT( TF || ( row + (*rhs).size() <= (*lhs).rows() ), "Invalid number of rows" );
2972 BLAZE_INTERNAL_ASSERT( !TF || ( column + (*rhs).size() <= (*lhs).columns() ), "Invalid number of columns" );
2973
2974 MAYBE_UNUSED( lhs, rhs, row, column );
2975
2976 return true;
2977}
2979//*************************************************************************************************
2980
2981
2982//*************************************************************************************************
3000template< typename MT // Type of the left-hand side matrix
3001 , bool SO // Storage order of the left-hand side matrix
3002 , typename VT // Type of the right-hand side vector
3003 , bool TF > // Transpose flag of the right-hand side vector
3004BLAZE_ALWAYS_INLINE bool tryDivAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
3005 ptrdiff_t band, size_t row, size_t column )
3006{
3007 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
3008 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
3009 BLAZE_INTERNAL_ASSERT( row + (*rhs).size() <= (*lhs).rows(), "Invalid number of rows" );
3010 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= (*lhs).columns(), "Invalid number of columns" );
3011
3012 MAYBE_UNUSED( lhs, rhs, band, row, column );
3013
3014 return true;
3015}
3017//*************************************************************************************************
3018
3019
3020//*************************************************************************************************
3036template< typename MT // Type of the left-hand side matrix
3037 , bool SO // Storage order of the left-hand side matrix
3038 , typename VT // Type of the right-hand side vector
3039 , bool TF > // Transpose flag of the right-hand side vector
3040BLAZE_ALWAYS_INLINE bool tryShiftAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
3041 size_t row, size_t column )
3042{
3043 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
3044 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
3045 BLAZE_INTERNAL_ASSERT( TF || ( row + (*rhs).size() <= (*lhs).rows() ), "Invalid number of rows" );
3046 BLAZE_INTERNAL_ASSERT( !TF || ( column + (*rhs).size() <= (*lhs).columns() ), "Invalid number of columns" );
3047
3048 MAYBE_UNUSED( lhs, rhs, row, column );
3049
3050 return true;
3051}
3053//*************************************************************************************************
3054
3055
3056//*************************************************************************************************
3073template< typename MT // Type of the left-hand side matrix
3074 , bool SO // Storage order of the left-hand side matrix
3075 , typename VT // Type of the right-hand side vector
3076 , bool TF > // Transpose flag of the right-hand side vector
3077BLAZE_ALWAYS_INLINE bool tryShiftAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
3078 ptrdiff_t band, size_t row, size_t column )
3079{
3080 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
3081 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
3082 BLAZE_INTERNAL_ASSERT( row + (*rhs).size() <= (*lhs).rows(), "Invalid number of rows" );
3083 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= (*lhs).columns(), "Invalid number of columns" );
3084
3085 MAYBE_UNUSED( lhs, rhs, band, row, column );
3086
3087 return true;
3088}
3090//*************************************************************************************************
3091
3092
3093//*************************************************************************************************
3109template< typename MT1 // Type of the left-hand side matrix
3110 , bool SO1 // Storage order of the left-hand side matrix
3111 , typename MT2 // Type of the right-hand side matrix
3112 , bool SO2 > // Storage order of the right-hand side matrix
3113BLAZE_ALWAYS_INLINE bool tryShiftAssign( const Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs,
3114 size_t row, size_t column )
3115{
3116 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
3117 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
3118 BLAZE_INTERNAL_ASSERT( row + (*rhs).rows() <= (*lhs).rows(), "Invalid number of rows" );
3119 BLAZE_INTERNAL_ASSERT( column + (*rhs).columns() <= (*lhs).columns(), "Invalid number of columns" );
3120
3121 MAYBE_UNUSED( lhs, rhs, row, column );
3122
3123 return true;
3124}
3126//*************************************************************************************************
3127
3128
3129//*************************************************************************************************
3145template< typename MT // Type of the left-hand side matrix
3146 , bool SO // Storage order of the left-hand side matrix
3147 , typename VT // Type of the right-hand side vector
3148 , bool TF > // Transpose flag of the right-hand side vector
3149BLAZE_ALWAYS_INLINE bool tryBitandAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
3150 size_t row, size_t column )
3151{
3152 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
3153 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
3154 BLAZE_INTERNAL_ASSERT( TF || ( row + (*rhs).size() <= (*lhs).rows() ), "Invalid number of rows" );
3155 BLAZE_INTERNAL_ASSERT( !TF || ( column + (*rhs).size() <= (*lhs).columns() ), "Invalid number of columns" );
3156
3157 MAYBE_UNUSED( lhs, rhs, row, column );
3158
3159 return true;
3160}
3162//*************************************************************************************************
3163
3164
3165//*************************************************************************************************
3183template< typename MT // Type of the left-hand side matrix
3184 , bool SO // Storage order of the left-hand side matrix
3185 , typename VT // Type of the right-hand side vector
3186 , bool TF > // Transpose flag of the right-hand side vector
3187BLAZE_ALWAYS_INLINE bool tryBitandAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
3188 ptrdiff_t band, size_t row, size_t column )
3189{
3190 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
3191 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
3192 BLAZE_INTERNAL_ASSERT( row + (*rhs).size() <= (*lhs).rows(), "Invalid number of rows" );
3193 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= (*lhs).columns(), "Invalid number of columns" );
3194
3195 MAYBE_UNUSED( lhs, rhs, band, row, column );
3196
3197 return true;
3198}
3200//*************************************************************************************************
3201
3202
3203//*************************************************************************************************
3219template< typename MT1 // Type of the left-hand side matrix
3220 , bool SO1 // Storage order of the left-hand side matrix
3221 , typename MT2 // Type of the right-hand side matrix
3222 , bool SO2 > // Storage order of the right-hand side matrix
3223BLAZE_ALWAYS_INLINE bool tryBitandAssign( const Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs,
3224 size_t row, size_t column )
3225{
3226 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
3227 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
3228 BLAZE_INTERNAL_ASSERT( row + (*rhs).rows() <= (*lhs).rows(), "Invalid number of rows" );
3229 BLAZE_INTERNAL_ASSERT( column + (*rhs).columns() <= (*lhs).columns(), "Invalid number of columns" );
3230
3231 MAYBE_UNUSED( lhs, rhs, row, column );
3232
3233 return true;
3234}
3236//*************************************************************************************************
3237
3238
3239//*************************************************************************************************
3255template< typename MT // Type of the left-hand side matrix
3256 , bool SO // Storage order of the left-hand side matrix
3257 , typename VT // Type of the right-hand side vector
3258 , bool TF > // Transpose flag of the right-hand side vector
3259BLAZE_ALWAYS_INLINE bool tryBitorAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
3260 size_t row, size_t column )
3261{
3262 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
3263 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
3264 BLAZE_INTERNAL_ASSERT( TF || ( row + (*rhs).size() <= (*lhs).rows() ), "Invalid number of rows" );
3265 BLAZE_INTERNAL_ASSERT( !TF || ( column + (*rhs).size() <= (*lhs).columns() ), "Invalid number of columns" );
3266
3267 MAYBE_UNUSED( lhs, rhs, row, column );
3268
3269 return true;
3270}
3272//*************************************************************************************************
3273
3274
3275//*************************************************************************************************
3293template< typename MT // Type of the left-hand side matrix
3294 , bool SO // Storage order of the left-hand side matrix
3295 , typename VT // Type of the right-hand side vector
3296 , bool TF > // Transpose flag of the right-hand side vector
3297BLAZE_ALWAYS_INLINE bool tryBitorAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
3298 ptrdiff_t band, size_t row, size_t column )
3299{
3300 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
3301 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
3302 BLAZE_INTERNAL_ASSERT( row + (*rhs).size() <= (*lhs).rows(), "Invalid number of rows" );
3303 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= (*lhs).columns(), "Invalid number of columns" );
3304
3305 MAYBE_UNUSED( lhs, rhs, band, row, column );
3306
3307 return true;
3308}
3310//*************************************************************************************************
3311
3312
3313//*************************************************************************************************
3329template< typename MT1 // Type of the left-hand side matrix
3330 , bool SO1 // Storage order of the left-hand side matrix
3331 , typename MT2 // Type of the right-hand side matrix
3332 , bool SO2 > // Storage order of the right-hand side matrix
3333BLAZE_ALWAYS_INLINE bool tryBitorAssign( const Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs,
3334 size_t row, size_t column )
3335{
3336 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
3337 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
3338 BLAZE_INTERNAL_ASSERT( row + (*rhs).rows() <= (*lhs).rows(), "Invalid number of rows" );
3339 BLAZE_INTERNAL_ASSERT( column + (*rhs).columns() <= (*lhs).columns(), "Invalid number of columns" );
3340
3341 MAYBE_UNUSED( lhs, rhs, row, column );
3342
3343 return true;
3344}
3346//*************************************************************************************************
3347
3348
3349//*************************************************************************************************
3365template< typename MT // Type of the left-hand side matrix
3366 , bool SO // Storage order of the left-hand side matrix
3367 , typename VT // Type of the right-hand side vector
3368 , bool TF > // Transpose flag of the right-hand side vector
3369BLAZE_ALWAYS_INLINE bool tryBitxorAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
3370 size_t row, size_t column )
3371{
3372 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
3373 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
3374 BLAZE_INTERNAL_ASSERT( TF || ( row + (*rhs).size() <= (*lhs).rows() ), "Invalid number of rows" );
3375 BLAZE_INTERNAL_ASSERT( !TF || ( column + (*rhs).size() <= (*lhs).columns() ), "Invalid number of columns" );
3376
3377 MAYBE_UNUSED( lhs, rhs, row, column );
3378
3379 return true;
3380}
3382//*************************************************************************************************
3383
3384
3385//*************************************************************************************************
3403template< typename MT // Type of the left-hand side matrix
3404 , bool SO // Storage order of the left-hand side matrix
3405 , typename VT // Type of the right-hand side vector
3406 , bool TF > // Transpose flag of the right-hand side vector
3407BLAZE_ALWAYS_INLINE bool tryBitxorAssign( const Matrix<MT,SO>& lhs, const Vector<VT,TF>& rhs,
3408 ptrdiff_t band, size_t row, size_t column )
3409{
3410 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
3411 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
3412 BLAZE_INTERNAL_ASSERT( row + (*rhs).size() <= (*lhs).rows(), "Invalid number of rows" );
3413 BLAZE_INTERNAL_ASSERT( column + (*rhs).size() <= (*lhs).columns(), "Invalid number of columns" );
3414
3415 MAYBE_UNUSED( lhs, rhs, band, row, column );
3416
3417 return true;
3418}
3420//*************************************************************************************************
3421
3422
3423//*************************************************************************************************
3439template< typename MT1 // Type of the left-hand side matrix
3440 , bool SO1 // Storage order of the left-hand side matrix
3441 , typename MT2 // Type of the right-hand side matrix
3442 , bool SO2 > // Storage order of the right-hand side matrix
3443BLAZE_ALWAYS_INLINE bool tryBitxorAssign( const Matrix<MT1,SO1>& lhs, const Matrix<MT2,SO2>& rhs,
3444 size_t row, size_t column )
3445{
3446 BLAZE_INTERNAL_ASSERT( row <= (*lhs).rows(), "Invalid row access index" );
3447 BLAZE_INTERNAL_ASSERT( column <= (*lhs).columns(), "Invalid column access index" );
3448 BLAZE_INTERNAL_ASSERT( row + (*rhs).rows() <= (*lhs).rows(), "Invalid number of rows" );
3449 BLAZE_INTERNAL_ASSERT( column + (*rhs).columns() <= (*lhs).columns(), "Invalid number of columns" );
3450
3451 MAYBE_UNUSED( lhs, rhs, row, column );
3452
3453 return true;
3454}
3456//*************************************************************************************************
3457
3458
3459//*************************************************************************************************
3474template< typename MT // Type of the matrix
3475 , bool SO > // Storage order
3476BLAZE_ALWAYS_INLINE MT& derestrict( Matrix<MT,SO>& matrix )
3477{
3478 return *matrix;
3479}
3481//*************************************************************************************************
3482
3483
3484//*************************************************************************************************
3498template< typename MT // Type of the matrix
3499 , bool SO > // Storage order
3500BLAZE_ALWAYS_INLINE MT& unview( Matrix<MT,SO>& matrix )
3501{
3502 return *matrix;
3503}
3505//*************************************************************************************************
3506
3507
3508//*************************************************************************************************
3522template< typename MT // Type of the matrix
3523 , bool SO > // Storage order
3524BLAZE_ALWAYS_INLINE const MT& unview( const Matrix<MT,SO>& matrix )
3525{
3526 return *matrix;
3527}
3529//*************************************************************************************************
3530
3531} // namespace blaze
3532
3533#endif
Header file for auxiliary alias declarations.
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
Header file for run time assertion macros.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Header file for the IsClearable type trait.
Header file for the IsIdentity type trait.
Header file for the IsResizable type trait.
Header file for the IsSame and IsStrictlySame type traits.
Header file for the IsShrinkable type trait.
Header file for the IsSquare type trait.
Header file for the IsSymmetric type trait.
Header file for the MAYBE_UNUSED function template.
Constraint on the data type.
Base class for matrices.
Definition: Matrix.h:85
constexpr MT & operator*() noexcept
CRTP-based conversion operation for non-constant matrices.
Definition: Matrix.h:176
static constexpr bool storageOrder
Storage order of the matrix.
Definition: Matrix.h:92
MT MatrixType
Type of the matrix.
Definition: Matrix.h:88
BLAZE_ALWAYS_INLINE constexpr MT & operator~() noexcept
CRTP-based conversion operation for non-constant matrices.
Definition: Matrix.h:141
Base class for N-dimensional vectors.
Definition: Vector.h:82
Pointer difference type of the Blaze library.
MT & crtp_cast(Matrix< MT, SO > &matrix)
CRTP-based conversion operation for non-constant matrices.
Definition: Matrix.h:479
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:140
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:137
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766
auto operator*=(DenseMatrix< MT, SO > &mat, ST scalar) -> EnableIf_t< IsScalar_v< ST >, MT & >
Multiplication assignment operator for the multiplication of a dense matrix and a scalar value ( ).
Definition: DenseMatrix.h:510
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Symmetric.h:79
MT::ResultType evaluate(const Matrix< MT, SO > &matrix)
Evaluates the given matrix expression.
Definition: Matrix.h:1282
BLAZE_ALWAYS_INLINE 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:628
BLAZE_ALWAYS_INLINE constexpr bool isEmpty(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is empty.
Definition: Matrix.h:1364
BLAZE_ALWAYS_INLINE size_t capacity(const Matrix< MT, SO > &matrix, size_t i) noexcept
Returns the current capacity of the specified row/column.
Definition: Matrix.h:714
BLAZE_ALWAYS_INLINE constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:644
BLAZE_ALWAYS_INLINE size_t nonZeros(const Matrix< MT, SO > &matrix, size_t i)
Returns the number of non-zero elements in the specified row/column.
Definition: Matrix.h:752
BLAZE_ALWAYS_INLINE 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:562
BLAZE_ALWAYS_INLINE constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:660
BLAZE_ALWAYS_INLINE 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:1424
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t m, size_t n, bool preserve)
Changing the size of the matrix.
Definition: Matrix.h:1108
BLAZE_ALWAYS_INLINE MT::ConstIterator end(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:606
BLAZE_ALWAYS_INLINE MT::ConstIterator begin(const Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:540
BLAZE_ALWAYS_INLINE void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:1221
constexpr void reset(Matrix< MT, SO > &&matrix, size_t i)
Reset the specified row/column of the given temporary matrix.
Definition: Matrix.h:906
BLAZE_ALWAYS_INLINE constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:676
BLAZE_ALWAYS_INLINE void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:1195
constexpr void clear(Matrix< MT, SO > &&matrix)
Clearing the given temporary matrix.
Definition: Matrix.h:976
decltype(auto) evaluateIf(const Matrix< MT, SO > &matrix)
Conditional evaluation of the given matrix expression.
Definition: Matrix.h:1345
BLAZE_ALWAYS_INLINE void shrinkToFit(Matrix< MT, SO > &matrix)
Requesting the removal of unused capacity.
Definition: Matrix.h:1169
BLAZE_ALWAYS_INLINE bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition: Matrix.h:1383
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:137
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
BoolConstant< true > TrueType
Type traits base class.
Definition: IntegralConstant.h:132
BoolConstant< false > FalseType
Type/value traits base class.
Definition: IntegralConstant.h:121
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition: Exception.h:235
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
Header file for the exception macros of the math module.
Header file for all forward declarations for expression class templates.
Generic wrapper for a compile time constant integral value.
Definition: IntegralConstant.h:74
System settings for the inline keywords.
Header file for the IsZero type trait.
Header file for basic type definitions.