Blaze 3.9
Loading...
Searching...
No Matches
UniformMatrix.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_DENSE_UNIFORMMATRIX_H_
36#define _BLAZE_MATH_DENSE_UNIFORMMATRIX_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <utility>
44#include <blaze/math/Aliases.h>
52#include <blaze/math/Forward.h>
58#include <blaze/math/SIMD.h>
88#include <blaze/system/Inline.h>
90#include <blaze/util/Assert.h>
96#include <blaze/util/EnableIf.h>
99#include <blaze/util/Types.h>
103
104
105namespace blaze {
106
107//=================================================================================================
108//
109// CLASS DEFINITION
110//
111//=================================================================================================
112
113//*************************************************************************************************
192template< typename Type // Data type of the matrix
193 , bool SO // Storage order
194 , typename Tag > // Tag type
196 : public Expression< DenseMatrix< UniformMatrix<Type,SO,Tag>, SO > >
197{
198 public:
199 //**Type definitions****************************************************************************
202
205
208
211
214 using TagType = Tag;
215 using ReturnType = const Type&;
216 using CompositeType = const This&;
217
218 using Reference = const Type&;
219 using ConstReference = const Type&;
220 using Pointer = const Type*;
221 using ConstPointer = const Type*;
222
225 //**********************************************************************************************
226
227 //**Rebind struct definition********************************************************************
230 template< typename NewType > // Data type of the other matrix
234 //**********************************************************************************************
235
236 //**Resize struct definition********************************************************************
239 template< size_t NewM // Number of rows of the other matrix
240 , size_t NewN > // Number of columns of the other matrix
244 //**********************************************************************************************
245
246 //**Compilation flags***************************************************************************
248
252 static constexpr bool simdEnabled = IsVectorizable_v<Type>;
253
255
258 static constexpr bool smpAssignable = !IsSMPAssignable_v<Type>;
259 //**********************************************************************************************
260
261 //**Constructors********************************************************************************
264 constexpr UniformMatrix() noexcept;
265 constexpr UniformMatrix( size_t m, size_t n );
266 constexpr UniformMatrix( size_t m, size_t n, const Type& init );
267
268 template< typename MT, bool SO2 >
269 inline UniformMatrix( const Matrix<MT,SO2>& m );
270
271 inline UniformMatrix( const UniformMatrix& m ) = default;
272 inline UniformMatrix( UniformMatrix&& m ) = default;
273
275 //**********************************************************************************************
276
277 //**Destructor**********************************************************************************
280 ~UniformMatrix() = default;
282 //**********************************************************************************************
283
284 //**Data access functions***********************************************************************
287 constexpr ConstReference operator()( size_t i, size_t j ) const noexcept;
288 inline ConstReference at( size_t i, size_t j ) const;
289 constexpr ConstPointer data () const noexcept;
290 constexpr ConstPointer data ( size_t i ) const noexcept;
291 constexpr ConstIterator begin ( size_t i ) const noexcept;
292 constexpr ConstIterator cbegin( size_t i ) const noexcept;
293 constexpr ConstIterator end ( size_t i ) const noexcept;
294 constexpr ConstIterator cend ( size_t i ) const noexcept;
296 //**********************************************************************************************
297
298 //**Assignment operators************************************************************************
301 constexpr UniformMatrix& operator=( const Type& rhs ) &;
302
303 UniformMatrix& operator=( const UniformMatrix& ) & = default;
304 UniformMatrix& operator=( UniformMatrix&& ) & = default;
305
306 template< typename MT, bool SO2 > inline UniformMatrix& operator= ( const Matrix<MT,SO2>& rhs ) &;
307 template< typename MT, bool SO2 > inline UniformMatrix& operator+=( const Matrix<MT,SO2>& rhs ) &;
308 template< typename MT, bool SO2 > inline UniformMatrix& operator-=( const Matrix<MT,SO2>& rhs ) &;
309 template< typename MT, bool SO2 > inline UniformMatrix& operator%=( const Matrix<MT,SO2>& rhs ) &;
310 template< typename MT, bool SO2 > inline UniformMatrix& operator*=( const Matrix<MT,SO2>& rhs ) &;
311
312 template< typename ST >
313 inline auto operator*=( ST rhs ) & -> EnableIf_t< IsScalar_v<ST>, UniformMatrix& >;
314
315 template< typename ST >
316 inline auto operator/=( ST rhs ) & -> EnableIf_t< IsScalar_v<ST>, UniformMatrix& >;
318 //**********************************************************************************************
319
320 //**Utility functions***************************************************************************
323 constexpr size_t rows() const noexcept;
324 constexpr size_t columns() const noexcept;
325 constexpr size_t spacing() const noexcept;
326 constexpr size_t capacity() const noexcept;
327 constexpr size_t capacity( size_t i ) const noexcept;
328 inline size_t nonZeros() const;
329 inline size_t nonZeros( size_t i ) const;
330 constexpr void reset();
331 constexpr void clear();
332 constexpr void resize ( size_t m, size_t n, bool preserve=true );
333 constexpr void extend ( size_t m, size_t n, bool preserve=true );
334 constexpr void swap( UniformMatrix& m ) noexcept;
336 //**********************************************************************************************
337
338 //**Numeric functions***************************************************************************
343
344 template< typename Other > inline UniformMatrix& scale( const Other& scalar );
346 //**********************************************************************************************
347
348 private:
349 //**********************************************************************************************
351 static constexpr size_t SIMDSIZE = SIMDTrait<ElementType>::size;
352 //**********************************************************************************************
353
354 public:
355 //**Expression template evaluation functions****************************************************
358 template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
359 template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
360
361 inline bool isAligned () const noexcept;
362 inline bool canSMPAssign() const noexcept;
363
364 BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
365 BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
366 BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
368 //**********************************************************************************************
369
370 private:
371 //**Member variables****************************************************************************
374 size_t m_;
375 size_t n_;
378 //**********************************************************************************************
379
380 //**Compile time checks*************************************************************************
387 //**********************************************************************************************
388};
389//*************************************************************************************************
390
391
392
393
394//=================================================================================================
395//
396// CONSTRUCTORS
397//
398//=================================================================================================
399
400//*************************************************************************************************
403template< typename Type // Data type of the matrix
404 , bool SO // Storage order
405 , typename Tag > // Tag type
406constexpr UniformMatrix<Type,SO,Tag>::UniformMatrix() noexcept
407 : m_ ( 0UL ) // The current number of rows of the matrix
408 , n_ ( 0UL ) // The current number of columns of the matrix
409 , value_() // The value of all elements of the uniform matrix
410{}
411//*************************************************************************************************
412
413
414//*************************************************************************************************
420template< typename Type // Data type of the matrix
421 , bool SO // Storage order
422 , typename Tag > // Tag type
423constexpr UniformMatrix<Type,SO,Tag>::UniformMatrix( size_t m, size_t n )
424 : m_ ( m ) // The current number of rows of the matrix
425 , n_ ( n ) // The current number of columns of the matrix
426 , value_() // The value of all elements of the uniform matrix
427{}
428//*************************************************************************************************
429
430
431//*************************************************************************************************
440template< typename Type // Data type of the matrix
441 , bool SO // Storage order
442 , typename Tag > // Tag type
443constexpr UniformMatrix<Type,SO,Tag>::UniformMatrix( size_t m, size_t n, const Type& init )
444 : m_ ( m ) // The current number of rows of the matrix
445 , n_ ( n ) // The current number of columns of the matrix
446 , value_( init ) // The value of all elements of the uniform matrix
447{}
448//*************************************************************************************************
449
450
451//*************************************************************************************************
460template< typename Type // Data type of the matrix
461 , bool SO // Storage order
462 , typename Tag > // Tag type
463template< typename MT // Type of the foreign matrix
464 , bool SO2 > // Storage order of the foreign matrix
466 : m_ ( (*m).rows() ) // The current number of rows of the matrix
467 , n_ ( (*m).columns() ) // The current number of columns of the matrix
468 , value_() // The value of all elements of the uniform vector
469{
470 if( !IsUniform_v<MT> && !isUniform( *m ) ) {
471 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of uniform matrix" );
472 }
473
474 if( m_ > 0UL && n_ > 0UL ) {
475 value_ = (*m)(0UL,0UL);
476 }
477}
478//*************************************************************************************************
479
480
481
482
483//=================================================================================================
484//
485// DATA ACCESS FUNCTIONS
486//
487//=================================================================================================
488
489//*************************************************************************************************
499template< typename Type // Data type of the matrix
500 , bool SO // Storage order
501 , typename Tag > // Type tag
503 UniformMatrix<Type,SO,Tag>::operator()( size_t i, size_t j ) const noexcept
504{
505 MAYBE_UNUSED( i, j );
506
507 BLAZE_USER_ASSERT( i < m_, "Invalid row access index" );
508 BLAZE_USER_ASSERT( j < n_, "Invalid column access index" );
509
510 return value_;
511}
512//*************************************************************************************************
513
514
515//*************************************************************************************************
526template< typename Type // Data type of the matrix
527 , bool SO // Storage order
528 , typename Tag > // Type tag
530 UniformMatrix<Type,SO,Tag>::at( size_t i, size_t j ) const
531{
532 if( i >= m_ ) {
533 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
534 }
535 if( j >= n_ ) {
536 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
537 }
538
539 return (*this)(i,j);
540}
541//*************************************************************************************************
542
543
544//*************************************************************************************************
556template< typename Type // Data type of the matrix
557 , bool SO // Storage order
558 , typename Tag > // Type tag
561{
562 return &value_;
563}
564//*************************************************************************************************
565
566
567//*************************************************************************************************
575template< typename Type // Data type of the matrix
576 , bool SO // Storage order
577 , typename Tag > // Type tag
579 UniformMatrix<Type,SO,Tag>::data( size_t i ) const noexcept
580{
581 MAYBE_UNUSED( i );
582
583 BLAZE_USER_ASSERT( SO || i < m_, "Invalid dense matrix row access index" );
584 BLAZE_USER_ASSERT( !SO || i < n_, "Invalid dense matrix row access index" );
585
586 return &value_;
587}
588//*************************************************************************************************
589
590
591//*************************************************************************************************
602template< typename Type // Data type of the matrix
603 , bool SO // Storage order
604 , typename Tag > // Type tag
606 UniformMatrix<Type,SO,Tag>::begin( size_t i ) const noexcept
607{
608 MAYBE_UNUSED( i );
609
610 BLAZE_USER_ASSERT( SO || i < m_, "Invalid dense matrix row access index" );
611 BLAZE_USER_ASSERT( !SO || i < n_, "Invalid dense matrix row access index" );
612
613 return ConstIterator( &value_, 0UL );
614}
615//*************************************************************************************************
616
617
618//*************************************************************************************************
629template< typename Type // Data type of the matrix
630 , bool SO // Storage order
631 , typename Tag > // Type tag
633 UniformMatrix<Type,SO,Tag>::cbegin( size_t i ) const noexcept
634{
635 MAYBE_UNUSED( i );
636
637 BLAZE_USER_ASSERT( SO || i < m_, "Invalid dense matrix row access index" );
638 BLAZE_USER_ASSERT( !SO || i < n_, "Invalid dense matrix row access index" );
639
640 return ConstIterator( &value_, 0UL );
641}
642//*************************************************************************************************
643
644
645//*************************************************************************************************
656template< typename Type // Data type of the matrix
657 , bool SO // Storage order
658 , typename Tag > // Type tag
660 UniformMatrix<Type,SO,Tag>::end( size_t i ) const noexcept
661{
662 MAYBE_UNUSED( i );
663
664 BLAZE_USER_ASSERT( SO || i < m_, "Invalid dense matrix row access index" );
665 BLAZE_USER_ASSERT( !SO || i < n_, "Invalid dense matrix row access index" );
666
667 return ConstIterator( &value_, SO ? m_ : n_ );
668}
669//*************************************************************************************************
670
671
672//*************************************************************************************************
683template< typename Type // Data type of the matrix
684 , bool SO // Storage order
685 , typename Tag > // Type tag
687 UniformMatrix<Type,SO,Tag>::cend( size_t i ) const noexcept
688{
689 MAYBE_UNUSED( i );
690
691 BLAZE_USER_ASSERT( SO || i < m_, "Invalid dense matrix row access index" );
692 BLAZE_USER_ASSERT( !SO || i < n_, "Invalid dense matrix row access index" );
693
694 return ConstIterator( &value_, SO ? m_ : n_ );
695}
696//*************************************************************************************************
697
698
699
700
701//=================================================================================================
702//
703// ASSIGNMENT OPERATORS
704//
705//=================================================================================================
706
707//*************************************************************************************************
713template< typename Type // Data type of the matrix
714 , bool SO // Storage order
715 , typename Tag > // Type tag
718{
719 value_ = rhs;
720
721 return *this;
722}
723//*************************************************************************************************
724
725
726//*************************************************************************************************
735template< typename Type // Data type of the matrix
736 , bool SO // Storage order
737 , typename Tag > // Type tag
738template< typename MT // Type of the right-hand side matrix
739 , bool SO2 > // Storage order of the right-hand side matrix
742{
743 using TT = decltype( trans( *this ) );
744 using CT = decltype( ctrans( *this ) );
745
747
748 if( !IsUniform_v<MT> && !isUniform( *rhs ) ) {
749 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment of uniform matrix" );
750 }
751
752 if( IsSame_v<MT,TT> && (*rhs).isAliased( this ) ) {
753 transpose();
754 }
755 else if( IsSame_v<MT,CT> && (*rhs).isAliased( this ) ) {
756 ctranspose();
757 }
758 else {
759 m_ = (*rhs).rows();
760 n_ = (*rhs).columns();
761
762 if( (*rhs).rows() > 0UL && (*rhs).columns() > 0UL ) {
763 value_ = (*rhs)(0UL,0UL);
764 }
765 }
766
767 return *this;
768}
769//*************************************************************************************************
770
771
772//*************************************************************************************************
782template< typename Type // Data type of the matrix
783 , bool SO // Storage order
784 , typename Tag > // Type tag
785template< typename MT // Type of the right-hand side matrix
786 , bool SO2 > // Storage order of the right-hand side matrix
788 UniformMatrix<Type,SO,Tag>::operator+=( const Matrix<MT,SO2>& rhs ) &
789{
791
792 if( (*rhs).rows() != m_ || (*rhs).columns() != n_ ) {
793 BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
794 }
795
796 if( !IsUniform_v<MT> && !isUniform( *rhs ) ) {
797 BLAZE_THROW_INVALID_ARGUMENT( "Invalid addition assignment to uniform matrix" );
798 }
799
800 if( m_ > 0UL && n_ > 0UL ) {
801 value_ += (*rhs)(0UL,0UL);
802 }
803
804 return *this;
805}
806//*************************************************************************************************
807
808
809//*************************************************************************************************
819template< typename Type // Data type of the matrix
820 , bool SO // Storage order
821 , typename Tag > // Type tag
822template< typename MT // Type of the right-hand side matrix
823 , bool SO2 > // Storage order of the right-hand side matrix
825 UniformMatrix<Type,SO,Tag>::operator-=( const Matrix<MT,SO2>& rhs ) &
826{
828
829 if( (*rhs).rows() != m_ || (*rhs).columns() != n_ ) {
830 BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
831 }
832
833 if( !IsUniform_v<MT> && !isUniform( *rhs ) ) {
834 BLAZE_THROW_INVALID_ARGUMENT( "Invalid subtraction assignment to uniform matrix" );
835 }
836
837 if( m_ > 0UL && n_ > 0UL ) {
838 value_ -= (*rhs)(0UL,0UL);
839 }
840
841 return *this;
842}
843//*************************************************************************************************
844
845
846//*************************************************************************************************
856template< typename Type // Data type of the matrix
857 , bool SO // Storage order
858 , typename Tag > // Type tag
859template< typename MT // Type of the right-hand side matrix
860 , bool SO2 > // Storage order of the right-hand side matrix
862 UniformMatrix<Type,SO,Tag>::operator%=( const Matrix<MT,SO2>& rhs ) &
863{
865
866 if( (*rhs).rows() != m_ || (*rhs).columns() != n_ ) {
867 BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
868 }
869
870 if( !IsUniform_v<MT> && !isUniform( *rhs ) ) {
871 BLAZE_THROW_INVALID_ARGUMENT( "Invalid Schur product assignment to uniform matrix" );
872 }
873
874 if( m_ > 0UL && n_ > 0UL ) {
875 value_ *= (*rhs)(0UL,0UL);
876 }
877
878 return *this;
879}
880//*************************************************************************************************
881
882
883//*************************************************************************************************
893template< typename Type // Data type of the matrix
894 , bool SO // Storage order
895 , typename Tag > // Type tag
896template< typename MT // Type of the right-hand side matrix
897 , bool SO2 > // Storage order of the right-hand side matrix
899 UniformMatrix<Type,SO,Tag>::operator*=( const Matrix<MT,SO2>& rhs ) &
900{
902
903 if( (*rhs).rows() != n_ ) {
904 BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
905 }
906
907 if( !IsUniform_v<MT> && !isUniform( *rhs ) ) {
908 BLAZE_THROW_INVALID_ARGUMENT( "Invalid multiplication assignment to uniform matrix" );
909 }
910
911 n_ = (*rhs).columns();
912
913 if( m_ > 0UL && n_ > 0UL ) {
914 value_ = ( value_ * (*rhs)(0UL,0UL) ) * Type( (*rhs).rows() );
915 }
916
917 return *this;
918}
919//*************************************************************************************************
920
921
922//*************************************************************************************************
929template< typename Type // Data type of the matrix
930 , bool SO // Storage order
931 , typename Tag > // Type tag
932template< typename ST > // Data type of the right-hand side scalar
933inline auto UniformMatrix<Type,SO,Tag>::operator*=( ST scalar ) &
935{
936 if( rows() > 0UL && columns() > 0UL ) {
937 value_ *= scalar;
938 }
939
940 return *this;
941}
942//*************************************************************************************************
943
944
945//*************************************************************************************************
952template< typename Type // Data type of the matrix
953 , bool SO // Storage order
954 , typename Tag > // Type tag
955template< typename ST > // Data type of the right-hand side scalar
958{
959 if( rows() > 0UL && columns() > 0UL ) {
960 value_ /= scalar;
961 }
962
963 return *this;
964}
965//*************************************************************************************************
966
967
968
969
970//=================================================================================================
971//
972// UTILITY FUNCTIONS
973//
974//=================================================================================================
975
976//*************************************************************************************************
981template< typename Type // Data type of the matrix
982 , bool SO // Storage order
983 , typename Tag > // Type tag
984constexpr size_t UniformMatrix<Type,SO,Tag>::rows() const noexcept
985{
986 return m_;
987}
988//*************************************************************************************************
989
990
991//*************************************************************************************************
996template< typename Type // Data type of the matrix
997 , bool SO // Storage order
998 , typename Tag > // Type tag
999constexpr size_t UniformMatrix<Type,SO,Tag>::columns() const noexcept
1000{
1001 return n_;
1002}
1003//*************************************************************************************************
1004
1005
1006//*************************************************************************************************
1016template< typename Type // Data type of the matrix
1017 , bool SO // Storage order
1018 , typename Tag > // Type tag
1019constexpr size_t UniformMatrix<Type,SO,Tag>::spacing() const noexcept
1020{
1021 return SO ? m_ : n_;
1022}
1023//*************************************************************************************************
1024
1025
1026//*************************************************************************************************
1031template< typename Type // Data type of the matrix
1032 , bool SO // Storage order
1033 , typename Tag > // Type tag
1034constexpr size_t UniformMatrix<Type,SO,Tag>::capacity() const noexcept
1035{
1036 return m_ * n_;
1037}
1038//*************************************************************************************************
1039
1040
1041//*************************************************************************************************
1052template< typename Type // Data type of the matrix
1053 , bool SO // Storage order
1054 , typename Tag > // Type tag
1055constexpr size_t UniformMatrix<Type,SO,Tag>::capacity( size_t i ) const noexcept
1056{
1057 MAYBE_UNUSED( i );
1058 BLAZE_USER_ASSERT( SO || i < m_, "Invalid dense matrix row access index" );
1059 BLAZE_USER_ASSERT( !SO || i < n_, "Invalid dense matrix row access index" );
1060 return SO ? m_ : n_;
1061}
1062//*************************************************************************************************
1063
1064
1065//*************************************************************************************************
1074template< typename Type // Data type of the matrix
1075 , bool SO // Storage order
1076 , typename Tag > // Type tag
1078{
1079 if( m_ == 0UL || n_ == 0UL || isDefault<strict>( value_ ) )
1080 return 0UL;
1081 else
1082 return m_ * n_;
1083}
1084//*************************************************************************************************
1085
1086
1087//*************************************************************************************************
1099template< typename Type // Data type of the matrix
1100 , bool SO // Storage order
1101 , typename Tag > // Type tag
1102inline size_t UniformMatrix<Type,SO,Tag>::nonZeros( size_t i ) const
1103{
1104 MAYBE_UNUSED( i );
1105
1106 BLAZE_USER_ASSERT( SO || i < m_, "Invalid dense matrix row access index" );
1107 BLAZE_USER_ASSERT( !SO || i < n_, "Invalid dense matrix row access index" );
1108
1109 const size_t tmp( SO ? m_ : n_ );
1110 if( tmp == 0UL || isDefault<strict>( value_ ) )
1111 return 0UL;
1112 else
1113 return tmp;
1114}
1115//*************************************************************************************************
1116
1117
1118//*************************************************************************************************
1123template< typename Type // Data type of the matrix
1124 , bool SO // Storage order
1125 , typename Tag > // Type tag
1127{
1128 using blaze::clear;
1129
1130 clear( value_ );
1131}
1132//*************************************************************************************************
1133
1134
1135//*************************************************************************************************
1142template< typename Type // Data type of the matrix
1143 , bool SO // Storage order
1144 , typename Tag > // Type tag
1146{
1147 m_ = 0UL;
1148 n_ = 0UL;
1149}
1150//*************************************************************************************************
1151
1152
1153//*************************************************************************************************
1167template< typename Type // Data type of the matrix
1168 , bool SO // Storage order
1169 , typename Tag > // Type tag
1170void constexpr UniformMatrix<Type,SO,Tag>::resize( size_t m, size_t n, bool preserve )
1171{
1172 MAYBE_UNUSED( preserve );
1173
1174 m_ = m;
1175 n_ = n;
1176}
1177//*************************************************************************************************
1178
1179
1180//*************************************************************************************************
1192template< typename Type // Data type of the matrix
1193 , bool SO // Storage order
1194 , typename Tag > // Type tag
1195constexpr void UniformMatrix<Type,SO,Tag>::extend( size_t m, size_t n, bool preserve )
1196{
1197 resize( m_+m, n_+n, preserve );
1198}
1199//*************************************************************************************************
1200
1201
1202//*************************************************************************************************
1208template< typename Type // Data type of the matrix
1209 , bool SO // Storage order
1210 , typename Tag > // Type tag
1212{
1213 using std::swap;
1214
1215 swap( m_, m.m_ );
1216 swap( n_, m.n_ );
1217 swap( value_, m.value_ );
1218}
1219//*************************************************************************************************
1220
1221
1222
1223
1224//=================================================================================================
1225//
1226// NUMERIC FUNCTIONS
1227//
1228//=================================================================================================
1229
1230//*************************************************************************************************
1235template< typename Type // Data type of the matrix
1236 , bool SO // Storage order
1237 , typename Tag > // Type tag
1239{
1240 using std::swap;
1241
1242 swap( m_, n_ );
1243
1244 return *this;
1245}
1246//*************************************************************************************************
1247
1248
1249//*************************************************************************************************
1254template< typename Type // Data type of the matrix
1255 , bool SO // Storage order
1256 , typename Tag > // Type tag
1258{
1259 using std::swap;
1260
1261 swap( m_, n_ );
1262 conjugate( value_ );
1263
1264 return *this;
1265}
1266//*************************************************************************************************
1267
1268
1269//*************************************************************************************************
1286template< typename Type // Data type of the matrix
1287 , bool SO // Storage order
1288 , typename Tag > // Type tag
1289template< typename Other > // Data type of the scalar value
1290inline UniformMatrix<Type,SO,Tag>& UniformMatrix<Type,SO,Tag>::scale( const Other& scalar )
1291{
1292 if( m_ > 0UL && n_ > 0UL ) {
1293 value_ *= scalar;
1294 }
1295
1296 return *this;
1297}
1298//*************************************************************************************************
1299
1300
1301
1302
1303//=================================================================================================
1304//
1305// EXPRESSION TEMPLATE EVALUATION FUNCTIONS
1306//
1307//=================================================================================================
1308
1309//*************************************************************************************************
1319template< typename Type // Data type of the matrix
1320 , bool SO // Storage order
1321 , typename Tag > // Type tag
1322template< typename Other > // Data type of the foreign expression
1323inline bool UniformMatrix<Type,SO,Tag>::canAlias( const Other* alias ) const noexcept
1324{
1325 return static_cast<const void*>( this ) == static_cast<const void*>( alias );
1326}
1327//*************************************************************************************************
1328
1329
1330//*************************************************************************************************
1340template< typename Type // Data type of the matrix
1341 , bool SO // Storage order
1342 , typename Tag > // Type tag
1343template< typename Other > // Data type of the foreign expression
1344inline bool UniformMatrix<Type,SO,Tag>::isAliased( const Other* alias ) const noexcept
1345{
1346 return static_cast<const void*>( this ) == static_cast<const void*>( alias );
1347}
1348//*************************************************************************************************
1349
1350
1351//*************************************************************************************************
1360template< typename Type // Data type of the matrix
1361 , bool SO // Storage order
1362 , typename Tag > // Type tag
1363inline bool UniformMatrix<Type,SO,Tag>::isAligned() const noexcept
1364{
1365 return true;
1366}
1367//*************************************************************************************************
1368
1369
1370//*************************************************************************************************
1380template< typename Type // Data type of the matrix
1381 , bool SO // Storage order
1382 , typename Tag > // Type tag
1384{
1385 return ( rows() * columns() >= SMP_DMATASSIGN_THRESHOLD );
1386}
1387//*************************************************************************************************
1388
1389
1390//*************************************************************************************************
1405template< typename Type // Data type of the matrix
1406 , bool SO // Storage order
1407 , typename Tag > // Type tag
1409 UniformMatrix<Type,SO,Tag>::load( size_t i, size_t j ) const noexcept
1410{
1411 return loada( i, j );
1412}
1413//*************************************************************************************************
1414
1415
1416//*************************************************************************************************
1431template< typename Type // Data type of the matrix
1432 , bool SO // Storage order
1433 , typename Tag > // Type tag
1435 UniformMatrix<Type,SO,Tag>::loada( size_t i, size_t j ) const noexcept
1436{
1437 MAYBE_UNUSED( i, j );
1438
1440
1441 BLAZE_INTERNAL_ASSERT( i < m_, "Invalid row access index" );
1442 BLAZE_INTERNAL_ASSERT( j < n_, "Invalid column access index" );
1443 BLAZE_INTERNAL_ASSERT( SO || j + SIMDSIZE <= n_, "Invalid column access index" );
1444 BLAZE_INTERNAL_ASSERT( !SO || i + SIMDSIZE <= m_, "Invalid row access index" );
1445
1446 return set( value_ );
1447}
1448//*************************************************************************************************
1449
1450
1451//*************************************************************************************************
1466template< typename Type // Data type of the matrix
1467 , bool SO // Storage order
1468 , typename Tag > // Type tag
1470 UniformMatrix<Type,SO,Tag>::loadu( size_t i, size_t j ) const noexcept
1471{
1472 MAYBE_UNUSED( i, j );
1473
1475
1476 BLAZE_INTERNAL_ASSERT( i < m_, "Invalid row access index" );
1477 BLAZE_INTERNAL_ASSERT( j < n_, "Invalid column access index" );
1478 BLAZE_INTERNAL_ASSERT( SO || j + SIMDSIZE <= n_, "Invalid column access index" );
1479 BLAZE_INTERNAL_ASSERT( !SO || i + SIMDSIZE <= m_, "Invalid row access index" );
1480
1481 return set( value_ );
1482}
1483//*************************************************************************************************
1484
1485
1486
1487
1488
1489
1490
1491
1492//=================================================================================================
1493//
1494// UNIFORMMATRIX OPERATORS
1495//
1496//=================================================================================================
1497
1498//*************************************************************************************************
1501template< RelaxationFlag RF, typename Type, bool SO, typename Tag >
1502constexpr bool isDefault( const UniformMatrix<Type,SO,Tag>& m );
1503
1504template< typename Type, bool SO, typename Tag >
1505constexpr bool isIntact( const UniformMatrix<Type,SO,Tag>& m ) noexcept;
1506
1507template< typename Type, bool SO, typename Tag >
1508constexpr void swap( UniformMatrix<Type,SO,Tag>& a, UniformMatrix<Type,SO,Tag>& b ) noexcept;
1510//*************************************************************************************************
1511
1512
1513//*************************************************************************************************
1538template< RelaxationFlag RF // Relaxation flag
1539 , typename Type // Data type of the matrix
1540 , bool SO // Storage order
1541 , typename Tag > // Type tag
1542constexpr bool isDefault( const UniformMatrix<Type,SO,Tag>& m )
1543{
1544 return ( m.rows() == 0UL && m.columns() == 0UL );
1545}
1546//*************************************************************************************************
1547
1548
1549//*************************************************************************************************
1567template< typename Type // Data type of the matrix
1568 , bool SO // Storage order
1569 , typename Tag > // Type tag
1570constexpr bool isIntact( const UniformMatrix<Type,SO,Tag>& m ) noexcept
1571{
1572 MAYBE_UNUSED( m );
1573
1574 return true;
1575}
1576//*************************************************************************************************
1577
1578
1579//*************************************************************************************************
1587template< typename Type // Data type of the matrix
1588 , bool SO // Storage order
1589 , typename Tag > // Type tag
1591{
1592 a.swap( b );
1593}
1594//*************************************************************************************************
1595
1596
1597
1598
1599//=================================================================================================
1600//
1601// GLOBAL FUNCTIONS
1602//
1603//=================================================================================================
1604
1605//*************************************************************************************************
1639template< bool SO = defaultStorageOrder, typename T >
1640constexpr decltype(auto) uniform( size_t m, size_t n, T&& init )
1641{
1642 return UniformMatrix< RemoveCVRef_t<T>, SO >( m, n, std::forward<T>( init ) );
1643}
1644//*************************************************************************************************
1645
1646
1647
1648
1649//=================================================================================================
1650//
1651// ISUNIFORM SPECIALIZATIONS
1652//
1653//=================================================================================================
1654
1655//*************************************************************************************************
1657template< typename Type, bool SO, typename Tag >
1658struct IsUniform< UniformMatrix<Type,SO,Tag> >
1659 : public TrueType
1660{};
1662//*************************************************************************************************
1663
1664
1665
1666
1667//=================================================================================================
1668//
1669// ISALIGNED SPECIALIZATIONS
1670//
1671//=================================================================================================
1672
1673//*************************************************************************************************
1675template< typename Type, bool SO, typename Tag >
1676struct IsAligned< UniformMatrix<Type,SO,Tag> >
1677 : public TrueType
1678{};
1680//*************************************************************************************************
1681
1682
1683
1684
1685//=================================================================================================
1686//
1687// ADDTRAIT SPECIALIZATIONS
1688//
1689//=================================================================================================
1690
1691//*************************************************************************************************
1693template< typename T1, typename T2 >
1694struct AddTraitEval1< T1, T2
1695 , EnableIf_t< IsMatrix_v<T1> &&
1698 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1699{
1700 static constexpr bool SO1 = StorageOrder_v<T1>;
1701 static constexpr bool SO2 = StorageOrder_v<T2>;
1702
1703 static constexpr bool SO = ( IsDenseMatrix_v<T1> && IsDenseMatrix_v<T2>
1706 ? SO2
1707 : SO1 )
1708 : SO1 && SO2 )
1710 ? SO1
1711 : SO2 ) );
1712
1714 , SO
1716};
1718//*************************************************************************************************
1719
1720
1721
1722
1723//=================================================================================================
1724//
1725// SUBTRAIT SPECIALIZATIONS
1726//
1727//=================================================================================================
1728
1729//*************************************************************************************************
1731template< typename T1, typename T2 >
1732struct SubTraitEval1< T1, T2
1733 , EnableIf_t< IsMatrix_v<T1> &&
1736 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1737{
1738 static constexpr bool SO1 = StorageOrder_v<T1>;
1739 static constexpr bool SO2 = StorageOrder_v<T2>;
1740
1741 static constexpr bool SO = ( IsDenseMatrix_v<T1> && IsDenseMatrix_v<T2>
1744 ? SO2
1745 : SO1 )
1746 : SO1 && SO2 )
1748 ? SO1
1749 : SO2 ) );
1750
1752 , SO
1754};
1756//*************************************************************************************************
1757
1758
1759
1760
1761//=================================================================================================
1762//
1763// SCHURTRAIT SPECIALIZATIONS
1764//
1765//=================================================================================================
1766
1767//*************************************************************************************************
1769template< typename T1, typename T2 >
1770struct SchurTraitEval1< T1, T2
1771 , EnableIf_t< IsMatrix_v<T1> &&
1774 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1775{
1776 static constexpr bool SO1 = StorageOrder_v<T1>;
1777 static constexpr bool SO2 = StorageOrder_v<T2>;
1778
1779 static constexpr bool SO = ( IsSymmetric_v<T1> ^ IsSymmetric_v<T2>
1781 ? SO2
1782 : SO1 )
1783 : SO1 && SO2 );
1784
1786 , SO
1788};
1790//*************************************************************************************************
1791
1792
1793
1794
1795//=================================================================================================
1796//
1797// MULTTRAIT SPECIALIZATIONS
1798//
1799//=================================================================================================
1800
1801//*************************************************************************************************
1803template< typename T1, typename T2 >
1804struct MultTraitEval1< T1, T2
1805 , EnableIf_t< IsMatrix_v<T1> &&
1807 !IsZero_v<T1> &&
1808 IsScalar_v<T2> > >
1809{
1813};
1814
1815template< typename T1, typename T2 >
1816struct MultTraitEval1< T1, T2
1817 , EnableIf_t< IsScalar_v<T1> &&
1820 !IsZero_v<T2> > >
1821{
1825};
1826
1827template< typename T1, typename T2 >
1828struct MultTraitEval1< T1, T2
1832 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1833{
1835 , false
1837};
1838
1839template< typename T1, typename T2 >
1840struct MultTraitEval1< T1, T2
1841 , EnableIf_t< IsMatrix_v<T1> &&
1844 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1845{
1847 using MultTag = MultTrait_t< TagType_t<T1>, TagType_t<T2> >;
1848
1852};
1854//*************************************************************************************************
1855
1856
1857
1858
1859//=================================================================================================
1860//
1861// KRONTRAIT SPECIALIZATIONS
1862//
1863//=================================================================================================
1864
1865//*************************************************************************************************
1867template< typename T1, typename T2 >
1868struct KronTraitEval1< T1, T2
1869 , EnableIf_t< IsMatrix_v<T1> &&
1872 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1873{
1877};
1879//*************************************************************************************************
1880
1881
1882
1883
1884//=================================================================================================
1885//
1886// DIVTRAIT SPECIALIZATIONS
1887//
1888//=================================================================================================
1889
1890//*************************************************************************************************
1892template< typename T1, typename T2 >
1893struct DivTraitEval1< T1, T2
1894 , EnableIf_t< IsMatrix_v<T1> &&
1897{
1900 , DivTrait_t< TagType_t<T1>, T2 > >;
1901};
1903//*************************************************************************************************
1904
1905
1906
1907
1908//=================================================================================================
1909//
1910// MAPTRAIT SPECIALIZATIONS
1911//
1912//=================================================================================================
1913
1914//*************************************************************************************************
1916template< typename T, typename OP >
1917struct UnaryMapTraitEval1< T, OP
1918 , EnableIf_t< IsMatrix_v<T> &&
1921{
1922 using ElementType = decltype( std::declval<OP>()( std::declval< ElementType_t<T> >() ) );
1923
1926 , MapTrait_t< TagType_t<T>, OP > >;
1927};
1929//*************************************************************************************************
1930
1931
1932//*************************************************************************************************
1934template< typename T1, typename T2, typename OP >
1935struct BinaryMapTraitEval1< T1, T2, OP
1940{
1941 using ElementType = decltype( std::declval<OP>()( std::declval< ElementType_t<T1> >()
1942 , std::declval< ElementType_t<T2> >() ) );
1943
1945 , false
1947};
1948
1949template< typename T1, typename T2, typename OP >
1950struct BinaryMapTraitEval1< T1, T2, OP
1951 , EnableIf_t< IsMatrix_v<T1> &&
1955{
1956 using ElementType = decltype( std::declval<OP>()( std::declval< ElementType_t<T1> >()
1957 , std::declval< ElementType_t<T2> >() ) );
1958
1959 static constexpr bool SO1 = StorageOrder_v<T1>;
1960 static constexpr bool SO2 = StorageOrder_v<T2>;
1961
1962 static constexpr bool SO = ( IsDenseMatrix_v<T1> && IsDenseMatrix_v<T2>
1965 ? SO2
1966 : SO1 )
1967 : SO1 && SO2 )
1969 ? SO1
1970 : SO2 ) );
1971
1973 , SO
1975};
1977//*************************************************************************************************
1978
1979
1980
1981
1982//=================================================================================================
1983//
1984// EXPANDTRAIT SPECIALIZATIONS
1985//
1986//=================================================================================================
1987
1988//*************************************************************************************************
1990template< typename T, size_t E >
1991struct ExpandTraitEval1< T, E
1992 , EnableIf_t< IsVector_v<T> &&
1994{
1997 , TagType_t<T> >;
1998};
2000//*************************************************************************************************
2001
2002
2003
2004
2005//=================================================================================================
2006//
2007// REPEATTRAIT SPECIALIZATIONS
2008//
2009//=================================================================================================
2010
2011//*************************************************************************************************
2013template< typename T, size_t R0, size_t R1 >
2014struct RepeatTraitEval1< T, R0, R1, inf
2015 , EnableIf_t< IsMatrix_v<T> &&
2017{
2020 , TagType_t<T> >;
2021};
2023//*************************************************************************************************
2024
2025
2026
2027
2028//=================================================================================================
2029//
2030// HIGHTYPE SPECIALIZATIONS
2031//
2032//=================================================================================================
2033
2034//*************************************************************************************************
2036template< typename T1, bool SO, typename Tag, typename T2 >
2037struct HighType< UniformMatrix<T1,SO,Tag>, UniformMatrix<T2,SO,Tag> >
2038{
2039 using Type = UniformMatrix< typename HighType<T1,T2>::Type, SO, Tag >;
2040};
2042//*************************************************************************************************
2043
2044
2045
2046
2047//=================================================================================================
2048//
2049// LOWTYPE SPECIALIZATIONS
2050//
2051//=================================================================================================
2052
2053//*************************************************************************************************
2055template< typename T1, bool SO, typename Tag, typename T2 >
2056struct LowType< UniformMatrix<T1,SO,Tag>, UniformMatrix<T2,SO,Tag> >
2057{
2058 using Type = UniformMatrix< typename LowType<T1,T2>::Type, SO, Tag >;
2059};
2061//*************************************************************************************************
2062
2063
2064
2065
2066//=================================================================================================
2067//
2068// SUBMATRIXTRAIT SPECIALIZATIONS
2069//
2070//=================================================================================================
2071
2072//*************************************************************************************************
2074template< typename MT, size_t I, size_t J, size_t M, size_t N >
2075struct SubmatrixTraitEval1< MT, I, J, M, N
2076 , EnableIf_t< IsUniform_v<MT> && !IsZero_v<MT> > >
2077{
2080 , TagType_t<MT> >;
2081};
2083//*************************************************************************************************
2084
2085
2086
2087
2088//=================================================================================================
2089//
2090// ROWSTRAIT SPECIALIZATIONS
2091//
2092//=================================================================================================
2093
2094//*************************************************************************************************
2096template< typename MT, size_t M >
2097struct RowsTraitEval1< MT, M
2098 , EnableIf_t< IsUniform_v<MT> && !IsZero_v<MT> > >
2099{
2101 , false
2102 , TagType_t<MT> >;
2103};
2105//*************************************************************************************************
2106
2107
2108
2109
2110//=================================================================================================
2111//
2112// COLUMNSTRAIT SPECIALIZATIONS
2113//
2114//=================================================================================================
2115
2116//*************************************************************************************************
2118template< typename MT, size_t N >
2119struct ColumnsTraitEval1< MT, N
2120 , EnableIf_t< IsUniform_v<MT> && !IsZero_v<MT> > >
2121{
2123 , true
2124 , TagType_t<MT> >;
2125};
2127//*************************************************************************************************
2128
2129} // namespace blaze
2130
2131#endif
Header file for the addition trait.
Header file for auxiliary alias declarations.
typename ResultType_t< T >::TagType TagType_t
Alias declaration for nested TagType type definitions.
Definition Aliases.h:530
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition Aliases.h:190
Header file for the alignment flag enumeration.
Header file for run time assertion macros.
Header file for the columns trait.
Header file for the conjugate shim.
Constraint on the data type.
Header file for the division trait.
Header file for the EnableIf class template.
Header file for the EvaluateTrait class template.
Header file for the expand trait.
Header file for the HighType type trait.
Header file for the IntegralConstant class template.
Header file for the IsAligned type trait.
Header file for the IsColumnVector type trait.
Header file for the isDefault shim.
Header file for the IsDenseMatrix type trait.
Header file for the IsMatrix type trait.
Header file for the IsRowVector type trait.
Header file for the IsSMPAssignable type trait.
Header file for the IsScalar type trait.
Header file for the IsSymmetric type trait.
Header file for the IsUniform type trait.
Header file for the IsVector type trait.
Header file for the IsVectorizable type trait.
Header file for the Kron product trait.
Header file for the LowType type trait.
Header file for the map trait.
Header file for the MAYBE_UNUSED function template.
Header file for the multiplication trait.
Constraint on the data type.
Constraint on the data type.
Header file for the relaxation flag enumeration.
Header file for the RemoveCVRef type trait.
Header file for the RemoveConst type trait.
Header file for the repeat trait.
Header file for the rows trait.
Header file for all SIMD functionality.
Data type constraint.
Header file for the Schur product trait.
Header file for the subtraction trait.
Header file for the submatrix trait.
Header file for the UniformIterator class template.
Constraint on the data type.
Constraint on the data type.
Header file for the YieldsUniform type trait.
Header file for the YieldsZero type trait.
Base class for matrices.
Definition Matrix.h:85
Implementation of a generic iterator for uniform vectors and matrices.
Definition UniformIterator.h:60
Efficient implementation of a uniform matrix.
Definition UniformMatrix.h:197
static constexpr size_t SIMDSIZE
Definition UniformMatrix.h:351
constexpr UniformMatrix & ctranspose()
size_t m_
Definition UniformMatrix.h:374
ConstReference at(size_t i, size_t j) const
constexpr size_t columns() const noexcept
UniformMatrix< Type, SO, Tag > This
Type of this UniformMatrix instance.
Definition UniformMatrix.h:200
Tag TagType
Definition UniformMatrix.h:214
BLAZE_ALWAYS_INLINE SIMDType loada(size_t i, size_t j) const noexcept
static constexpr bool simdEnabled
Definition UniformMatrix.h:252
BLAZE_ALWAYS_INLINE SIMDType loadu(size_t i, size_t j) const noexcept
auto operator/=(ST rhs) &-> EnableIf_t< IsScalar_v< ST >, UniformMatrix & >
Division assignment operator for the division between a matrix and a scalar value ( ).
Definition UniformMatrix.h:956
Type value_
Definition UniformMatrix.h:376
BLAZE_ALWAYS_INLINE SIMDType load(size_t i, size_t j) const noexcept
constexpr UniformMatrix() noexcept
The default constructor for UniformMatrix.
Definition UniformMatrix.h:406
bool isAliased(const Other *alias) const noexcept
constexpr UniformMatrix & transpose()
constexpr void resize(size_t m, size_t n, bool preserve=true)
constexpr size_t spacing() const noexcept
bool canSMPAssign() const noexcept
constexpr void swap(UniformMatrix &m) noexcept
constexpr ConstReference operator()(size_t i, size_t j) const noexcept
2D-access to the matrix elements.
Definition UniformMatrix.h:503
constexpr void extend(size_t m, size_t n, bool preserve=true)
constexpr ConstIterator end(size_t i) const noexcept
constexpr UniformMatrix & operator=(const Type &rhs) &
Homogenous assignment to all matrix elements.
Definition UniformMatrix.h:717
const Type & Reference
Definition UniformMatrix.h:218
size_t n_
Definition UniformMatrix.h:375
const This & CompositeType
Definition UniformMatrix.h:216
constexpr ConstIterator cbegin(size_t i) const noexcept
const Type & ConstReference
Definition UniformMatrix.h:219
UniformIterator< const Type, aligned > Iterator
Definition UniformMatrix.h:223
const Type * ConstPointer
Definition UniformMatrix.h:221
This ResultType
Result type for expression template evaluations.
Definition UniformMatrix.h:204
constexpr ConstPointer data() const noexcept
constexpr size_t rows() const noexcept
Type ElementType
Definition UniformMatrix.h:212
Expression< DenseMatrix< This, SO > > BaseType
Base type of this UniformMatrix instance.
Definition UniformMatrix.h:201
constexpr size_t capacity() const noexcept
constexpr ConstIterator begin(size_t i) const noexcept
bool canAlias(const Other *alias) const noexcept
constexpr ConstIterator cend(size_t i) const noexcept
UniformMatrix< Type,!SO, Tag > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition UniformMatrix.h:207
const Type * Pointer
Definition UniformMatrix.h:220
UniformIterator< const Type, aligned > ConstIterator
Definition UniformMatrix.h:224
const Type & ReturnType
Definition UniformMatrix.h:215
SIMDTrait_t< ElementType > SIMDType
Definition UniformMatrix.h:213
static constexpr bool smpAssignable
Definition UniformMatrix.h:258
UniformMatrix< Type,!SO, Tag > TransposeType
Definition UniformMatrix.h:210
Header file for the DenseMatrix base class.
Header file for the Expression base class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.
Definition Volatile.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.
Definition Pointer.h:79
#define BLAZE_CONSTRAINT_MUST_BE_VECTORIZABLE_TYPE(T)
Constraint on the data type.
Definition Vectorizable.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.
Definition Const.h:79
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TAG(A, B)
Data type constraint.
Definition SameTag.h:68
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.
Definition Reference.h:79
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition DMatMapExpr.h:1501
bool isUniform(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a uniform matrix.
Definition DenseMatrix.h:1766
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition DMatTransExpr.h:766
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition DiagonalMatrix.h:207
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition DiagonalMatrix.h:225
bool isDefault(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the given diagonal matrix is in default state.
Definition DiagonalMatrix.h:169
BLAZE_ALWAYS_INLINE void conjugate(T &a) noexcept(IsNumeric_v< T >)
In-place conjugation of the given value/object.
Definition Conjugate.h:118
typename SubTrait< T1, T2 >::Type SubTrait_t
Auxiliary alias declaration for the SubTrait class template.
Definition SubTrait.h:163
typename AddTrait< T1, T2 >::Type AddTrait_t
Auxiliary alias declaration for the AddTrait class template.
Definition AddTrait.h:163
typename MapTrait< Args... >::Type MapTrait_t
Auxiliary alias declaration for the MapTrait class template.
Definition MapTrait.h:131
typename DivTrait< T1, T2 >::Type DivTrait_t
Auxiliary alias declaration for the DivTrait class template.
Definition DivTrait.h:164
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition MultTrait.h:165
constexpr bool IsSymmetric_v
Auxiliary variable template for the IsSymmetric type trait.
Definition IsSymmetric.h:172
constexpr bool IsScalar_v
Auxiliary variable template for the IsScalar type trait.
Definition IsScalar.h:104
constexpr bool IsUniform_v
Auxiliary variable template for the IsUniform type trait.
Definition IsUniform.h:164
constexpr bool StorageOrder_v
Auxiliary variable template for the StorageOrder type trait.
Definition StorageOrder.h:93
constexpr bool IsVector_v
Auxiliary variable template for the IsVector type trait.
Definition IsVector.h:125
constexpr bool YieldsUniform_v
Auxiliary variable template for the YieldsUniform type trait.
Definition YieldsUniform.h:125
constexpr bool IsZero_v
Auxiliary variable template for the IsZero type trait.
Definition IsZero.h:166
constexpr bool YieldsZero_v
Auxiliary variable template for the YieldsZero type trait.
Definition YieldsZero.h:125
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.
Definition IsMatrix.h:124
constexpr bool IsColumnVector_v
Auxiliary variable template for the IsColumnVector type trait.
Definition IsColumnVector.h:126
constexpr bool IsSMPAssignable_v
Auxiliary variable template for the IsSMPAssignable type trait.
Definition IsSMPAssignable.h:132
constexpr bool IsRowVector_v
Auxiliary variable template for the IsRowVector type trait.
Definition IsRowVector.h:126
constexpr bool IsDenseMatrix_v
Auxiliary variable template for the IsDenseMatrix type trait.
Definition IsDenseMatrix.h:124
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition RelaxationFlag.h:66
constexpr Infinity inf
Global Infinity instance.
Definition Infinity.h:1080
constexpr void clear(Matrix< MT, SO > &matrix)
Clearing the given matrix.
Definition Matrix.h:960
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition Matrix.h:676
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition Assert.h:101
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition Assert.h:117
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > set(T value) noexcept
Sets all values in the vector to the given 1-byte integral value.
Definition Set.h:75
typename SIMDTrait< T >::Type SIMDTrait_t
Auxiliary alias declaration for the SIMDTrait class template.
Definition SIMDTrait.h:315
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition Inline.h:85
constexpr bool IsSame_v
Auxiliary variable template for the IsSame type trait.
Definition IsSame.h:159
constexpr bool IsVectorizable_v
Auxiliary variable template for the IsVectorizable type trait.
Definition IsVectorizable.h:157
constexpr decltype(auto) uniform(size_t m, size_t n, T &&init)
Creating a uniform matrix.
Definition UniformMatrix.h:1640
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition MaybeUnused.h:81
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:138
BoolConstant< true > TrueType
Type traits base class.
Definition IntegralConstant.h:132
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition Exception.h:235
Header file for the exception macros of the math module.
Header file for all forward declarations of the math module.
constexpr bool rowMajor
Storage order flag for row-major matrices.
Definition StorageOrder.h:71
constexpr bool columnMajor
Storage order flag for column-major matrices.
Definition StorageOrder.h:99
Header file for all forward declarations for dense vectors and matrices.
Header file for the StorageOrder type trait.
Header file for the clear shim.
Header file for the reset shim.
Base class for all expression templates.
Definition Expression.h:60
Base template for the HighType type trait.
Definition HighType.h:322
Compile time check for the alignment of data types.
Definition IsAligned.h:88
Base template for the LowType type trait.
Definition LowType.h:322
Rebind mechanism to obtain a UniformMatrix with different data/element type.
Definition UniformMatrix.h:231
UniformMatrix< NewType, SO, Tag > Other
The type of the other UniformMatrix.
Definition UniformMatrix.h:232
Resize mechanism to obtain a UniformMatrix with different fixed dimensions.
Definition UniformMatrix.h:241
UniformMatrix< Type, SO, Tag > Other
The type of the other UniformMatrix.
Definition UniformMatrix.h:242
System settings for the inline keywords.
Header file for the thresholds for matrix/vector and matrix/matrix multiplications.
Header file for the IsZero type trait.
Header file for basic type definitions.