Blaze 3.9
StaticMatrix.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_DENSE_STATICMATRIX_H_
36#define _BLAZE_MATH_DENSE_STATICMATRIX_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <array>
44#include <utility>
45#include <blaze/math/Aliases.h>
55#include <blaze/math/Forward.h>
64#include <blaze/math/SIMD.h>
109#include <blaze/system/Inline.h>
115#include <blaze/util/Assert.h>
122#include <blaze/util/EnableIf.h>
125#include <blaze/util/Memory.h>
127#include <blaze/util/Types.h>
134
135
136namespace blaze {
137
138//=================================================================================================
139//
140// CLASS DEFINITION
141//
142//=================================================================================================
143
144//*************************************************************************************************
240template< typename Type // Data type of the matrix
241 , size_t M // Number of rows
242 , size_t N // Number of columns
243 , bool SO // Storage order
244 , AlignmentFlag AF // Alignment flag
245 , PaddingFlag PF // Padding flag
246 , typename Tag > // Type tag
248 : public DenseMatrix< StaticMatrix<Type,M,N,SO,AF,PF,Tag>, SO >
249{
250 public:
251 //**Type definitions****************************************************************************
254
256 using ResultType = This;
257
260
263
264 using ElementType = Type;
266 using TagType = Tag;
267 using ReturnType = const Type&;
268 using CompositeType = const This&;
269
270 using Reference = Type&;
271 using ConstReference = const Type&;
272 using Pointer = Type*;
273 using ConstPointer = const Type*;
274
277 //**********************************************************************************************
278
279 //**Rebind struct definition********************************************************************
282 template< typename NewType > // Data type of the other matrix
283 struct Rebind {
285 };
286 //**********************************************************************************************
287
288 //**Resize struct definition********************************************************************
291 template< size_t NewM // Number of rows of the other matrix
292 , size_t NewN > // Number of columns of the other matrix
293 struct Resize {
295 };
296 //**********************************************************************************************
297
298 //**Compilation flags***************************************************************************
300
304 static constexpr bool simdEnabled = IsVectorizable_v<Type>;
305
307
310 static constexpr bool smpAssignable = false;
311 //**********************************************************************************************
312
313 //**Constructors********************************************************************************
316 inline StaticMatrix();
317 explicit inline StaticMatrix( const Type& init );
318 constexpr StaticMatrix( initializer_list< initializer_list<Type> > list );
319
320 template< typename Other >
321 inline StaticMatrix( size_t m, size_t n, const Other* array );
322
323 template< typename Other, size_t Rows, size_t Cols >
324 inline StaticMatrix( const Other (&array)[Rows][Cols] );
325
326 template< typename Other, size_t Rows, size_t Cols >
327 StaticMatrix( const std::array<std::array<Other,Cols>,Rows>& array );
328
329 constexpr StaticMatrix( const StaticMatrix& m );
330
331 template< typename Other, bool SO2, AlignmentFlag AF2, PaddingFlag PF2 >
333
334 template< typename MT, bool SO2 >
335 inline StaticMatrix( const Matrix<MT,SO2>& m );
337 //**********************************************************************************************
338
339 //**Destructor**********************************************************************************
342 ~StaticMatrix() = default;
344 //**********************************************************************************************
345
346 //**Data access functions***********************************************************************
349 constexpr Reference operator()( size_t i, size_t j ) noexcept;
350 constexpr ConstReference operator()( size_t i, size_t j ) const noexcept;
351 inline Reference at( size_t i, size_t j );
352 inline ConstReference at( size_t i, size_t j ) const;
353 constexpr Pointer data () noexcept;
354 constexpr ConstPointer data () const noexcept;
355 constexpr Pointer data ( size_t i ) noexcept;
356 constexpr ConstPointer data ( size_t i ) const noexcept;
357 constexpr Iterator begin ( size_t i ) noexcept;
358 constexpr ConstIterator begin ( size_t i ) const noexcept;
359 constexpr ConstIterator cbegin( size_t i ) const noexcept;
360 constexpr Iterator end ( size_t i ) noexcept;
361 constexpr ConstIterator end ( size_t i ) const noexcept;
362 constexpr ConstIterator cend ( size_t i ) const noexcept;
364 //**********************************************************************************************
365
366 //**Assignment operators************************************************************************
369 constexpr StaticMatrix& operator=( const Type& set ) &;
370 constexpr StaticMatrix& operator=( initializer_list< initializer_list<Type> > list ) &;
371
372 template< typename Other, size_t Rows, size_t Cols >
373 inline StaticMatrix& operator=( const Other (&array)[Rows][Cols] ) &;
374
375 template< typename Other, size_t Rows, size_t Cols >
376 inline StaticMatrix& operator=( const std::array<std::array<Other,Cols>,Rows>& array ) &;
377
378 constexpr StaticMatrix& operator=( const StaticMatrix& rhs ) &;
379
380 template< typename Other, bool SO2, AlignmentFlag AF2, PaddingFlag PF2 >
381 inline StaticMatrix& operator=( const StaticMatrix<Other,M,N,SO2,AF2,PF2,Tag>& rhs ) &;
382
383 template< typename MT, bool SO2 > inline StaticMatrix& operator= ( const Matrix<MT,SO2>& rhs ) &;
384 template< typename MT, bool SO2 > inline StaticMatrix& operator+=( const Matrix<MT,SO2>& rhs ) &;
385 template< typename MT, bool SO2 > inline StaticMatrix& operator-=( const Matrix<MT,SO2>& rhs ) &;
386 template< typename MT, bool SO2 > inline StaticMatrix& operator%=( const Matrix<MT,SO2>& rhs ) &;
388 //**********************************************************************************************
389
390 //**Utility functions***************************************************************************
393 static constexpr size_t rows() noexcept;
394 static constexpr size_t columns() noexcept;
395 static constexpr size_t spacing() noexcept;
396 static constexpr size_t capacity() noexcept;
397 inline size_t capacity( size_t i ) const noexcept;
398 inline size_t nonZeros() const;
399 inline size_t nonZeros( size_t i ) const;
400 constexpr void reset();
401 inline void reset( size_t i );
402 inline void swap( StaticMatrix& m ) noexcept;
404 //**********************************************************************************************
405
406 //**Numeric functions***************************************************************************
409 inline StaticMatrix& transpose();
410 inline StaticMatrix& ctranspose();
411
412 template< typename Other > inline StaticMatrix& scale( const Other& scalar );
414 //**********************************************************************************************
415
416 //**Memory functions****************************************************************************
419 static inline void* operator new ( std::size_t size );
420 static inline void* operator new[]( std::size_t size );
421 static inline void* operator new ( std::size_t size, const std::nothrow_t& );
422 static inline void* operator new[]( std::size_t size, const std::nothrow_t& );
423
424 static inline void operator delete ( void* ptr );
425 static inline void operator delete[]( void* ptr );
426 static inline void operator delete ( void* ptr, const std::nothrow_t& );
427 static inline void operator delete[]( void* ptr, const std::nothrow_t& );
429 //**********************************************************************************************
430
431 private:
432 //**********************************************************************************************
434 static constexpr size_t SIMDSIZE = SIMDTrait<Type>::size;
435
437 static constexpr size_t NN = ( PF == padded ? nextMultiple( N, SIMDSIZE ) : N );
438 //**********************************************************************************************
439
440 //**********************************************************************************************
442
443 template< typename MT >
444 static constexpr bool VectorizedAssign_v =
445 ( useOptimizedKernels &&
446 NN >= SIMDSIZE &&
447 simdEnabled && MT::simdEnabled &&
448 IsSIMDCombinable_v< Type, ElementType_t<MT> > &&
449 IsRowMajorMatrix_v<MT> );
451 //**********************************************************************************************
452
453 //**********************************************************************************************
455
456 template< typename MT >
457 static constexpr bool VectorizedAddAssign_v =
458 ( VectorizedAssign_v<MT> &&
459 HasSIMDAdd_v< Type, ElementType_t<MT> > &&
460 !IsDiagonal_v<MT> );
462 //**********************************************************************************************
463
464 //**********************************************************************************************
466
467 template< typename MT >
468 static constexpr bool VectorizedSubAssign_v =
469 ( VectorizedAssign_v<MT> &&
470 HasSIMDSub_v< Type, ElementType_t<MT> > &&
471 !IsDiagonal_v<MT> );
473 //**********************************************************************************************
474
475 //**********************************************************************************************
477
478 template< typename MT >
479 static constexpr bool VectorizedSchurAssign_v =
480 ( VectorizedAssign_v<MT> &&
481 HasSIMDMult_v< Type, ElementType_t<MT> > );
483 //**********************************************************************************************
484
485 public:
486 //**Debugging functions*************************************************************************
489 constexpr bool isIntact() const noexcept;
491 //**********************************************************************************************
492
493 //**Expression template evaluation functions****************************************************
496 template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
497 template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
498
499 static constexpr bool isAligned() noexcept;
500
501 BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
502 BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
503 BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
504
505 BLAZE_ALWAYS_INLINE void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
506 BLAZE_ALWAYS_INLINE void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
507 BLAZE_ALWAYS_INLINE void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
508 BLAZE_ALWAYS_INLINE void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
509
510 template< typename MT, bool SO2 >
511 inline auto assign( const DenseMatrix<MT,SO2>& rhs ) -> DisableIf_t< VectorizedAssign_v<MT> >;
512
513 template< typename MT, bool SO2 >
514 inline auto assign( const DenseMatrix<MT,SO2>& rhs ) -> EnableIf_t< VectorizedAssign_v<MT> >;
515
516 template< typename MT > inline void assign( const SparseMatrix<MT,SO>& rhs );
517 template< typename MT > inline void assign( const SparseMatrix<MT,!SO>& rhs );
518
519 template< typename MT, bool SO2 >
520 inline auto addAssign( const DenseMatrix<MT,SO2>& rhs ) -> DisableIf_t< VectorizedAddAssign_v<MT> >;
521
522 template< typename MT, bool SO2 >
523 inline auto addAssign( const DenseMatrix<MT,SO2>& rhs ) -> EnableIf_t< VectorizedAddAssign_v<MT> >;
524
525 template< typename MT > inline void addAssign( const SparseMatrix<MT,SO>& rhs );
526 template< typename MT > inline void addAssign( const SparseMatrix<MT,!SO>& rhs );
527
528 template< typename MT, bool SO2 >
529 inline auto subAssign( const DenseMatrix<MT,SO2>& rhs ) -> DisableIf_t< VectorizedSubAssign_v<MT> >;
530
531 template< typename MT, bool SO2 >
532 inline auto subAssign( const DenseMatrix<MT,SO2>& rhs ) -> EnableIf_t< VectorizedSubAssign_v<MT> >;
533
534 template< typename MT > inline void subAssign( const SparseMatrix<MT,SO>& rhs );
535 template< typename MT > inline void subAssign( const SparseMatrix<MT,!SO>& rhs );
536
537 template< typename MT, bool SO2 >
538 inline auto schurAssign( const DenseMatrix<MT,SO2>& rhs ) -> DisableIf_t< VectorizedSchurAssign_v<MT> >;
539
540 template< typename MT, bool SO2 >
541 inline auto schurAssign( const DenseMatrix<MT,SO2>& rhs ) -> EnableIf_t< VectorizedSchurAssign_v<MT> >;
542
543 template< typename MT > inline void schurAssign( const SparseMatrix<MT,SO>& rhs );
544 template< typename MT > inline void schurAssign( const SparseMatrix<MT,!SO>& rhs );
546 //**********************************************************************************************
547
548 private:
549 //**Utility functions***************************************************************************
551 inline void transpose ( TrueType );
552 inline void transpose ( FalseType );
553 inline void ctranspose( TrueType );
554 inline void ctranspose( FalseType );
556 //**********************************************************************************************
557
558 //**********************************************************************************************
560 static constexpr size_t Alignment =
561 ( AF == aligned ? AlignmentOf_v<Type> : std::alignment_of<Type>::value );
562
565 //**********************************************************************************************
566
567 //**Member variables****************************************************************************
581 //**********************************************************************************************
582
583 //**Compile time checks*************************************************************************
589 BLAZE_STATIC_ASSERT( AF == unaligned || PF == padded || N % SIMDSIZE == 0UL );
590 BLAZE_STATIC_ASSERT( PF == unpadded || NN % SIMDSIZE == 0UL );
591 BLAZE_STATIC_ASSERT( NN >= N );
592 BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || NN == N );
594 //**********************************************************************************************
595};
596//*************************************************************************************************
597
598
599
600
601//=================================================================================================
602//
603// DEDUCTION GUIDES
604//
605//=================================================================================================
606
607//*************************************************************************************************
608#if BLAZE_CPP17_MODE
609
610template< typename Type, size_t M, size_t N >
611StaticMatrix( Type (&)[M][N] ) -> StaticMatrix< RemoveCV_t<Type>, M, N >;
612
613template< typename Type, size_t M, size_t N >
614StaticMatrix( std::array<std::array<Type,N>,M> ) -> StaticMatrix<Type,M,N>;
615
616#endif
617//*************************************************************************************************
618
619
620
621
622//=================================================================================================
623//
624// CONSTRUCTORS
625//
626//=================================================================================================
627
628//*************************************************************************************************
641template< typename Type // Data type of the matrix
642 , size_t M // Number of rows
643 , size_t N // Number of columns
644 , bool SO // Storage order
645 , AlignmentFlag AF // Alignment flag
646 , PaddingFlag PF // Padding flag
647 , typename Tag > // Type tag
649#if BLAZE_USE_DEFAULT_INITIALIZATION
650 : v_() // The statically allocated matrix elements
651#endif
652{
653#if !BLAZE_USE_DEFAULT_INITIALIZATION
654 using blaze::clear;
655
656 if( IsNumeric_v<Type> && PF == padded ) {
657 for( size_t i=0UL; i<M; ++i )
658 for( size_t j=N; j<NN; ++j )
659 clear( v_[i*NN+j] );
660 }
661#endif
662
663 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
664}
665//*************************************************************************************************
666
667
668//*************************************************************************************************
673template< typename Type // Data type of the matrix
674 , size_t M // Number of rows
675 , size_t N // Number of columns
676 , bool SO // Storage order
677 , AlignmentFlag AF // Alignment flag
678 , PaddingFlag PF // Padding flag
679 , typename Tag > // Type tag
681 // v_ is intentionally left uninitialized
682{
683 using blaze::clear;
684
685 for( size_t i=0UL; i<M; ++i ) {
686 for( size_t j=0UL; j<N; ++j )
687 v_[i*NN+j] = init;
688
689 for( size_t j=N; j<NN; ++j )
690 clear( v_[i*NN+j] );
691 }
692
693 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
694}
695//*************************************************************************************************
696
697
698//*************************************************************************************************
721template< typename Type // Data type of the matrix
722 , size_t M // Number of rows
723 , size_t N // Number of columns
724 , bool SO // Storage order
725 , AlignmentFlag AF // Alignment flag
726 , PaddingFlag PF // Padding flag
727 , typename Tag > // Type tag
728constexpr StaticMatrix<Type,M,N,SO,AF,PF,Tag>::StaticMatrix( initializer_list< initializer_list<Type> > list )
729 : v_() // The statically allocated matrix elements
730{
731 if( list.size() != M || determineColumns( list ) > N ) {
732 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static matrix" );
733 }
734
735 size_t i( 0UL );
736
737 for( const auto& rowList : list ) {
738 size_t j( 0UL );
739 for( const auto& element : rowList ) {
740 v_[i*NN+j] = element;
741 ++j;
742 }
743 ++i;
744 }
745
746 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
747}
748//*************************************************************************************************
749
750
751//*************************************************************************************************
777template< typename Type // Data type of the matrix
778 , size_t M // Number of rows
779 , size_t N // Number of columns
780 , bool SO // Storage order
781 , AlignmentFlag AF // Alignment flag
782 , PaddingFlag PF // Padding flag
783 , typename Tag > // Type tag
784template< typename Other > // Data type of the initialization array
785inline StaticMatrix<Type,M,N,SO,AF,PF,Tag>::StaticMatrix( size_t m, size_t n, const Other* array )
786 // v_ is intentionally left uninitialized
787{
788 using blaze::clear;
789
790 if( m > M || n > N ) {
791 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static matrix" );
792 }
793
794 for( size_t i=0UL; i<m; ++i ) {
795 for( size_t j=0UL; j<n; ++j )
796 v_[i*NN+j] = array[i*n+j];
797
798 if( IsNumeric_v<Type> ) {
799 for( size_t j=n; j<NN; ++j )
800 clear( v_[i*NN+j] );
801 }
802 }
803
804 if( IsNumeric_v<Type> ) {
805 for( size_t i=m; i<M; ++i ) {
806 for( size_t j=0UL; j<NN; ++j )
807 clear( v_[i*NN+j] );
808 }
809 }
810
811 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
812}
813//*************************************************************************************************
814
815
816//*************************************************************************************************
836template< typename Type // Data type of the matrix
837 , size_t M // Number of rows
838 , size_t N // Number of columns
839 , bool SO // Storage order
840 , AlignmentFlag AF // Alignment flag
841 , PaddingFlag PF // Padding flag
842 , typename Tag > // Type tag
843template< typename Other // Data type of the static array
844 , size_t Rows // Number of rows of the static array
845 , size_t Cols > // Number of columns of the static array
846inline StaticMatrix<Type,M,N,SO,AF,PF,Tag>::StaticMatrix( const Other (&array)[Rows][Cols] )
847 // v_ is intentionally left uninitialized
848{
849 using blaze::clear;
850
851 BLAZE_STATIC_ASSERT( Rows == M && Cols == N );
852
853 for( size_t i=0UL; i<M; ++i ) {
854 for( size_t j=0UL; j<N; ++j )
855 v_[i*NN+j] = array[i][j];
856
857 for( size_t j=N; j<NN; ++j )
858 clear( v_[i*NN+j] );
859 }
860
861 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
862}
863//*************************************************************************************************
864
865
866//*************************************************************************************************
886template< typename Type // Data type of the matrix
887 , size_t M // Number of rows
888 , size_t N // Number of columns
889 , bool SO // Storage order
890 , AlignmentFlag AF // Alignment flag
891 , PaddingFlag PF // Padding flag
892 , typename Tag > // Type tag
893template< typename Other // Data type of the std::array
894 , size_t Rows // Number of rows of the std::array
895 , size_t Cols > // Number of columns of the std::array
896inline StaticMatrix<Type,M,N,SO,AF,PF,Tag>::StaticMatrix( const std::array<std::array<Other,Cols>,Rows>& array )
897 // v_ is intentionally left uninitialized
898{
899 using blaze::clear;
900
901 BLAZE_STATIC_ASSERT( Rows == M && Cols == N );
902
903 for( size_t i=0UL; i<M; ++i ) {
904 for( size_t j=0UL; j<N; ++j )
905 v_[i*NN+j] = array[i][j];
906
907 for( size_t j=N; j<NN; ++j )
908 clear( v_[i*NN+j] );
909 }
910
911 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
912}
913//*************************************************************************************************
914
915
916//*************************************************************************************************
923template< typename Type // Data type of the matrix
924 , size_t M // Number of rows
925 , size_t N // Number of columns
926 , bool SO // Storage order
927 , AlignmentFlag AF // Alignment flag
928 , PaddingFlag PF // Padding flag
929 , typename Tag > // Type tag
931 : BaseType() // Initialization of the base class
932 , v_( m.v_ ) // The statically allocated matrix elements
933{
934 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
935}
936//*************************************************************************************************
937
938
939//*************************************************************************************************
944template< typename Type // Data type of the matrix
945 , size_t M // Number of rows
946 , size_t N // Number of columns
947 , bool SO // Storage order
948 , AlignmentFlag AF // Alignment flag
949 , PaddingFlag PF // Padding flag
950 , typename Tag > // Type tag
951template< typename Other // Data type of the foreign matrix
952 , bool SO2 // Storage order of the foreign matrix
953 , AlignmentFlag AF2 // Alignment flag of the foreign matrix
954 , PaddingFlag PF2 > // Padding flag of the foreign matrix
956 // v_ is intentionally left uninitialized
957{
958 for( size_t i=0UL; i<M; ++i ) {
959 for( size_t j=0UL; j<N; ++j )
960 v_[i*NN+j] = m(i,j);
961
962 for( size_t j=N; j<NN; ++j )
963 clear( v_[i*NN+j] );
964 }
965
966 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
967}
968//*************************************************************************************************
969
970
971//*************************************************************************************************
981template< typename Type // Data type of the matrix
982 , size_t M // Number of rows
983 , size_t N // Number of columns
984 , bool SO // Storage order
985 , AlignmentFlag AF // Alignment flag
986 , PaddingFlag PF // Padding flag
987 , typename Tag > // Type tag
988template< typename MT // Type of the foreign matrix
989 , bool SO2 > // Storage order of the foreign matrix
991 // v_ is intentionally left uninitialized
992{
993 using blaze::assign;
994 using blaze::clear;
995
997
998 if( (*m).rows() != M || (*m).columns() != N ) {
999 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static matrix" );
1000 }
1001
1002 for( size_t i=0UL; i<M; ++i ) {
1003 for( size_t j=( IsSparseMatrix_v<MT> ? 0UL : N ); j<NN; ++j ) {
1004 clear( v_[i*NN+j] );
1005 }
1006 }
1007
1008 assign( *this, *m );
1009
1010 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1011}
1012//*************************************************************************************************
1013
1014
1015
1016
1017//=================================================================================================
1018//
1019// DATA ACCESS FUNCTIONS
1020//
1021//=================================================================================================
1022
1023//*************************************************************************************************
1033template< typename Type // Data type of the matrix
1034 , size_t M // Number of rows
1035 , size_t N // Number of columns
1036 , bool SO // Storage order
1037 , AlignmentFlag AF // Alignment flag
1038 , PaddingFlag PF // Padding flag
1039 , typename Tag > // Type tag
1042{
1043 BLAZE_USER_ASSERT( i<M, "Invalid row access index" );
1044 BLAZE_USER_ASSERT( j<N, "Invalid column access index" );
1045 return v_[i*NN+j];
1046}
1047//*************************************************************************************************
1048
1049
1050//*************************************************************************************************
1060template< typename Type // Data type of the matrix
1061 , size_t M // Number of rows
1062 , size_t N // Number of columns
1063 , bool SO // Storage order
1064 , AlignmentFlag AF // Alignment flag
1065 , PaddingFlag PF // Padding flag
1066 , typename Tag > // Type tag
1068 StaticMatrix<Type,M,N,SO,AF,PF,Tag>::operator()( size_t i, size_t j ) const noexcept
1069{
1070 BLAZE_USER_ASSERT( i<M, "Invalid row access index" );
1071 BLAZE_USER_ASSERT( j<N, "Invalid column access index" );
1072 return v_[i*NN+j];
1073}
1074//*************************************************************************************************
1075
1076
1077//*************************************************************************************************
1088template< typename Type // Data type of the matrix
1089 , size_t M // Number of rows
1090 , size_t N // Number of columns
1091 , bool SO // Storage order
1092 , AlignmentFlag AF // Alignment flag
1093 , PaddingFlag PF // Padding flag
1094 , typename Tag > // Type tag
1097{
1098 if( i >= M ) {
1099 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1100 }
1101 if( j >= N ) {
1102 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1103 }
1104 return (*this)(i,j);
1105}
1106//*************************************************************************************************
1107
1108
1109//*************************************************************************************************
1120template< typename Type // Data type of the matrix
1121 , size_t M // Number of rows
1122 , size_t N // Number of columns
1123 , bool SO // Storage order
1124 , AlignmentFlag AF // Alignment flag
1125 , PaddingFlag PF // Padding flag
1126 , typename Tag > // Type tag
1129{
1130 if( i >= M ) {
1131 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
1132 }
1133 if( j >= N ) {
1134 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
1135 }
1136 return (*this)(i,j);
1137}
1138//*************************************************************************************************
1139
1140
1141//*************************************************************************************************
1153template< typename Type // Data type of the matrix
1154 , size_t M // Number of rows
1155 , size_t N // Number of columns
1156 , bool SO // Storage order
1157 , AlignmentFlag AF // Alignment flag
1158 , PaddingFlag PF // Padding flag
1159 , typename Tag > // Type tag
1162{
1163 return v_;
1164}
1165//*************************************************************************************************
1166
1167
1168//*************************************************************************************************
1180template< typename Type // Data type of the matrix
1181 , size_t M // Number of rows
1182 , size_t N // Number of columns
1183 , bool SO // Storage order
1184 , AlignmentFlag AF // Alignment flag
1185 , PaddingFlag PF // Padding flag
1186 , typename Tag > // Type tag
1189{
1190 return v_;
1191}
1192//*************************************************************************************************
1193
1194
1195//*************************************************************************************************
1203template< typename Type // Data type of the matrix
1204 , size_t M // Number of rows
1205 , size_t N // Number of columns
1206 , bool SO // Storage order
1207 , AlignmentFlag AF // Alignment flag
1208 , PaddingFlag PF // Padding flag
1209 , typename Tag > // Type tag
1212{
1213 BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1214 return v_ + i*NN;
1215}
1216//*************************************************************************************************
1217
1218
1219//*************************************************************************************************
1227template< typename Type // Data type of the matrix
1228 , size_t M // Number of rows
1229 , size_t N // Number of columns
1230 , bool SO // Storage order
1231 , AlignmentFlag AF // Alignment flag
1232 , PaddingFlag PF // Padding flag
1233 , typename Tag > // Type tag
1236{
1237 BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1238 return v_ + i*NN;
1239}
1240//*************************************************************************************************
1241
1242
1243//*************************************************************************************************
1254template< typename Type // Data type of the matrix
1255 , size_t M // Number of rows
1256 , size_t N // Number of columns
1257 , bool SO // Storage order
1258 , AlignmentFlag AF // Alignment flag
1259 , PaddingFlag PF // Padding flag
1260 , typename Tag > // Type tag
1263{
1264 BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1265 return Iterator( v_ + i*NN );
1266}
1267//*************************************************************************************************
1268
1269
1270//*************************************************************************************************
1281template< typename Type // Data type of the matrix
1282 , size_t M // Number of rows
1283 , size_t N // Number of columns
1284 , bool SO // Storage order
1285 , AlignmentFlag AF // Alignment flag
1286 , PaddingFlag PF // Padding flag
1287 , typename Tag > // Type tag
1290{
1291 BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1292 return ConstIterator( v_ + i*NN );
1293}
1294//*************************************************************************************************
1295
1296
1297//*************************************************************************************************
1308template< typename Type // Data type of the matrix
1309 , size_t M // Number of rows
1310 , size_t N // Number of columns
1311 , bool SO // Storage order
1312 , AlignmentFlag AF // Alignment flag
1313 , PaddingFlag PF // Padding flag
1314 , typename Tag > // Type tag
1317{
1318 BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1319 return ConstIterator( v_ + i*NN );
1320}
1321//*************************************************************************************************
1322
1323
1324//*************************************************************************************************
1335template< typename Type // Data type of the matrix
1336 , size_t M // Number of rows
1337 , size_t N // Number of columns
1338 , bool SO // Storage order
1339 , AlignmentFlag AF // Alignment flag
1340 , PaddingFlag PF // Padding flag
1341 , typename Tag > // Type tag
1344{
1345 BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1346 return Iterator( v_ + i*NN + N );
1347}
1348//*************************************************************************************************
1349
1350
1351//*************************************************************************************************
1362template< typename Type // Data type of the matrix
1363 , size_t M // Number of rows
1364 , size_t N // Number of columns
1365 , bool SO // Storage order
1366 , AlignmentFlag AF // Alignment flag
1367 , PaddingFlag PF // Padding flag
1368 , typename Tag > // Type tag
1371{
1372 BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1373 return ConstIterator( v_ + i*NN + N );
1374}
1375//*************************************************************************************************
1376
1377
1378//*************************************************************************************************
1389template< typename Type // Data type of the matrix
1390 , size_t M // Number of rows
1391 , size_t N // Number of columns
1392 , bool SO // Storage order
1393 , AlignmentFlag AF // Alignment flag
1394 , PaddingFlag PF // Padding flag
1395 , typename Tag > // Type tag
1398{
1399 BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1400 return ConstIterator( v_ + i*NN + N );
1401}
1402//*************************************************************************************************
1403
1404
1405
1406
1407//=================================================================================================
1408//
1409// ASSIGNMENT OPERATORS
1410//
1411//=================================================================================================
1412
1413//*************************************************************************************************
1419template< typename Type // Data type of the matrix
1420 , size_t M // Number of rows
1421 , size_t N // Number of columns
1422 , bool SO // Storage order
1423 , AlignmentFlag AF // Alignment flag
1424 , PaddingFlag PF // Padding flag
1425 , typename Tag > // Type tag
1428{
1429 for( size_t i=0UL; i<M; ++i )
1430 for( size_t j=0UL; j<N; ++j )
1431 v_[i*NN+j] = set;
1432
1433 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1434
1435 return *this;
1436}
1437//*************************************************************************************************
1438
1439
1440//*************************************************************************************************
1464template< typename Type // Data type of the matrix
1465 , size_t M // Number of rows
1466 , size_t N // Number of columns
1467 , bool SO // Storage order
1468 , AlignmentFlag AF // Alignment flag
1469 , PaddingFlag PF // Padding flag
1470 , typename Tag > // Type tag
1472 StaticMatrix<Type,M,N,SO,AF,PF,Tag>::operator=( initializer_list< initializer_list<Type> > list ) &
1473{
1474 using blaze::clear;
1475
1476 if( list.size() != M || determineColumns( list ) > N ) {
1477 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to static matrix" );
1478 }
1479
1480 size_t i( 0UL );
1481
1482 for( const auto& rowList : list ) {
1483 size_t j( 0UL );
1484 for( const auto& element : rowList ) {
1485 v_[i*NN+j] = element;
1486 ++j;
1487 }
1488 for( ; j<N; ++j ) {
1489 clear( v_[i*NN+j] );
1490 }
1491 ++i;
1492 }
1493
1494 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1495
1496 return *this;
1497}
1498//*************************************************************************************************
1499
1500
1501//*************************************************************************************************
1522template< typename Type // Data type of the matrix
1523 , size_t M // Number of rows
1524 , size_t N // Number of columns
1525 , bool SO // Storage order
1526 , AlignmentFlag AF // Alignment flag
1527 , PaddingFlag PF // Padding flag
1528 , typename Tag > // Type tag
1529template< typename Other // Data type of the static array
1530 , size_t Rows // Number of rows of the static array
1531 , size_t Cols > // Number of columns of the static array
1533 StaticMatrix<Type,M,N,SO,AF,PF,Tag>::operator=( const Other (&array)[Rows][Cols] ) &
1534{
1535 BLAZE_STATIC_ASSERT( Rows == M && Cols == N );
1536
1537 for( size_t i=0UL; i<M; ++i )
1538 for( size_t j=0UL; j<N; ++j )
1539 v_[i*NN+j] = array[i][j];
1540
1541 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1542
1543 return *this;
1544}
1545//*************************************************************************************************
1546
1547
1548//*************************************************************************************************
1569template< typename Type // Data type of the matrix
1570 , size_t M // Number of rows
1571 , size_t N // Number of columns
1572 , bool SO // Storage order
1573 , AlignmentFlag AF // Alignment flag
1574 , PaddingFlag PF // Padding flag
1575 , typename Tag > // Type tag
1576template< typename Other // Data type of the static array
1577 , size_t Rows // Number of rows of the static array
1578 , size_t Cols > // Number of columns of the static array
1580 StaticMatrix<Type,M,N,SO,AF,PF,Tag>::operator=( const std::array<std::array<Other,Cols>,Rows>& array ) &
1581{
1582 BLAZE_STATIC_ASSERT( Rows == M && Cols == N );
1583
1584 for( size_t i=0UL; i<M; ++i )
1585 for( size_t j=0UL; j<N; ++j )
1586 v_[i*NN+j] = array[i][j];
1587
1588 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1589
1590 return *this;
1591}
1592//*************************************************************************************************
1593
1594
1595//*************************************************************************************************
1603template< typename Type // Data type of the matrix
1604 , size_t M // Number of rows
1605 , size_t N // Number of columns
1606 , bool SO // Storage order
1607 , AlignmentFlag AF // Alignment flag
1608 , PaddingFlag PF // Padding flag
1609 , typename Tag > // Type tag
1612{
1613 v_ = rhs.v_;
1614
1615 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1616
1617 return *this;
1618}
1619//*************************************************************************************************
1620
1621
1622//*************************************************************************************************
1628template< typename Type // Data type of the matrix
1629 , size_t M // Number of rows
1630 , size_t N // Number of columns
1631 , bool SO // Storage order
1632 , AlignmentFlag AF // Alignment flag
1633 , PaddingFlag PF // Padding flag
1634 , typename Tag > // Type tag
1635template< typename Other // Data type of the foreign matrix
1636 , bool SO2 // Storage order of the foreign matrix
1637 , AlignmentFlag AF2 // Alignment flag of the foreign matrix
1638 , PaddingFlag PF2 > // Padding flag of the foreign matrix
1641{
1642 using blaze::assign;
1643
1644 assign( *this, *rhs );
1645
1646 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1647
1648 return *this;
1649}
1650//*************************************************************************************************
1651
1652
1653//*************************************************************************************************
1664template< typename Type // Data type of the matrix
1665 , size_t M // Number of rows
1666 , size_t N // Number of columns
1667 , bool SO // Storage order
1668 , AlignmentFlag AF // Alignment flag
1669 , PaddingFlag PF // Padding flag
1670 , typename Tag > // Type tag
1671template< typename MT // Type of the right-hand side matrix
1672 , bool SO2 > // Storage order of the right-hand side matrix
1675{
1676 using blaze::assign;
1677
1678 using TT = decltype( trans( *this ) );
1679 using CT = decltype( ctrans( *this ) );
1680 using IT = decltype( inv( *this ) );
1681
1683
1684 if( (*rhs).rows() != M || (*rhs).columns() != N ) {
1685 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to static matrix" );
1686 }
1687
1688 if( IsSame_v<MT,TT> && (*rhs).isAliased( this ) ) {
1689 transpose( typename IsSquare<This>::Type() );
1690 }
1691 else if( IsSame_v<MT,CT> && (*rhs).isAliased( this ) ) {
1692 ctranspose( typename IsSquare<This>::Type() );
1693 }
1694 else if( !IsSame_v<MT,IT> && (*rhs).canAlias( this ) ) {
1695 StaticMatrix tmp( *rhs );
1696 assign( *this, tmp );
1697 }
1698 else {
1699 if( IsSparseMatrix_v<MT> )
1700 reset();
1701 assign( *this, *rhs );
1702 }
1703
1704 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1705
1706 return *this;
1707}
1708//*************************************************************************************************
1709
1710
1711//*************************************************************************************************
1721template< typename Type // Data type of the matrix
1722 , size_t M // Number of rows
1723 , size_t N // Number of columns
1724 , bool SO // Storage order
1725 , AlignmentFlag AF // Alignment flag
1726 , PaddingFlag PF // Padding flag
1727 , typename Tag > // Type tag
1728template< typename MT // Type of the right-hand side matrix
1729 , bool SO2 > // Storage order of the right-hand side matrix
1732{
1733 using blaze::addAssign;
1734
1736
1737 if( (*rhs).rows() != M || (*rhs).columns() != N ) {
1738 BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1739 }
1740
1741 if( (*rhs).canAlias( this ) ) {
1742 const ResultType_t<MT> tmp( *rhs );
1743 addAssign( *this, tmp );
1744 }
1745 else {
1746 addAssign( *this, *rhs );
1747 }
1748
1749 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1750
1751 return *this;
1752}
1753//*************************************************************************************************
1754
1755
1756//*************************************************************************************************
1766template< typename Type // Data type of the matrix
1767 , size_t M // Number of rows
1768 , size_t N // Number of columns
1769 , bool SO // Storage order
1770 , AlignmentFlag AF // Alignment flag
1771 , PaddingFlag PF // Padding flag
1772 , typename Tag > // Type tag
1773template< typename MT // Type of the right-hand side matrix
1774 , bool SO2 > // Storage order of the right-hand side matrix
1777{
1778 using blaze::subAssign;
1779
1781
1782 if( (*rhs).rows() != M || (*rhs).columns() != N ) {
1783 BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1784 }
1785
1786 if( (*rhs).canAlias( this ) ) {
1787 const ResultType_t<MT> tmp( *rhs );
1788 subAssign( *this, tmp );
1789 }
1790 else {
1791 subAssign( *this, *rhs );
1792 }
1793
1794 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1795
1796 return *this;
1797}
1798//*************************************************************************************************
1799
1800
1801//*************************************************************************************************
1811template< typename Type // Data type of the matrix
1812 , size_t M // Number of rows
1813 , size_t N // Number of columns
1814 , bool SO // Storage order
1815 , AlignmentFlag AF // Alignment flag
1816 , PaddingFlag PF // Padding flag
1817 , typename Tag > // Type tag
1818template< typename MT // Type of the right-hand side matrix
1819 , bool SO2 > // Storage order of the right-hand side matrix
1822{
1823 using blaze::schurAssign;
1824
1826
1827 if( (*rhs).rows() != M || (*rhs).columns() != N ) {
1828 BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1829 }
1830
1831 if( (*rhs).canAlias( this ) ) {
1832 const ResultType_t<MT> tmp( *rhs );
1833 schurAssign( *this, tmp );
1834 }
1835 else {
1836 schurAssign( *this, *rhs );
1837 }
1838
1839 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1840
1841 return *this;
1842}
1843//*************************************************************************************************
1844
1845
1846
1847
1848//=================================================================================================
1849//
1850// UTILITY FUNCTIONS
1851//
1852//=================================================================================================
1853
1854//*************************************************************************************************
1859template< typename Type // Data type of the matrix
1860 , size_t M // Number of rows
1861 , size_t N // Number of columns
1862 , bool SO // Storage order
1863 , AlignmentFlag AF // Alignment flag
1864 , PaddingFlag PF // Padding flag
1865 , typename Tag > // Type tag
1867{
1868 return M;
1869}
1870//*************************************************************************************************
1871
1872
1873//*************************************************************************************************
1878template< typename Type // Data type of the matrix
1879 , size_t M // Number of rows
1880 , size_t N // Number of columns
1881 , bool SO // Storage order
1882 , AlignmentFlag AF // Alignment flag
1883 , PaddingFlag PF // Padding flag
1884 , typename Tag > // Type tag
1886{
1887 return N;
1888}
1889//*************************************************************************************************
1890
1891
1892//*************************************************************************************************
1900template< typename Type // Data type of the matrix
1901 , size_t M // Number of rows
1902 , size_t N // Number of columns
1903 , bool SO // Storage order
1904 , AlignmentFlag AF // Alignment flag
1905 , PaddingFlag PF // Padding flag
1906 , typename Tag > // Type tag
1908{
1909 return NN;
1910}
1911//*************************************************************************************************
1912
1913
1914//*************************************************************************************************
1919template< typename Type // Data type of the matrix
1920 , size_t M // Number of rows
1921 , size_t N // Number of columns
1922 , bool SO // Storage order
1923 , AlignmentFlag AF // Alignment flag
1924 , PaddingFlag PF // Padding flag
1925 , typename Tag > // Type tag
1927{
1928 return M*NN;
1929}
1930//*************************************************************************************************
1931
1932
1933//*************************************************************************************************
1944template< typename Type // Data type of the matrix
1945 , size_t M // Number of rows
1946 , size_t N // Number of columns
1947 , bool SO // Storage order
1948 , AlignmentFlag AF // Alignment flag
1949 , PaddingFlag PF // Padding flag
1950 , typename Tag > // Type tag
1951inline size_t StaticMatrix<Type,M,N,SO,AF,PF,Tag>::capacity( size_t i ) const noexcept
1952{
1953 MAYBE_UNUSED( i );
1954
1955 BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
1956
1957 return NN;
1958}
1959//*************************************************************************************************
1960
1961
1962//*************************************************************************************************
1971template< typename Type // Data type of the matrix
1972 , size_t M // Number of rows
1973 , size_t N // Number of columns
1974 , bool SO // Storage order
1975 , AlignmentFlag AF // Alignment flag
1976 , PaddingFlag PF // Padding flag
1977 , typename Tag > // Type tag
1979{
1980 size_t nonzeros( 0UL );
1981
1982 for( size_t i=0UL; i<M; ++i )
1983 for( size_t j=0UL; j<N; ++j )
1984 if( !isDefault<strict>( v_[i*NN+j] ) )
1985 ++nonzeros;
1986
1987 return nonzeros;
1988}
1989//*************************************************************************************************
1990
1991
1992//*************************************************************************************************
2004template< typename Type // Data type of the matrix
2005 , size_t M // Number of rows
2006 , size_t N // Number of columns
2007 , bool SO // Storage order
2008 , AlignmentFlag AF // Alignment flag
2009 , PaddingFlag PF // Padding flag
2010 , typename Tag > // Type tag
2012{
2013 BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
2014
2015 const size_t jend( i*NN + N );
2016 size_t nonzeros( 0UL );
2017
2018 for( size_t j=i*NN; j<jend; ++j )
2019 if( !isDefault<strict>( v_[j] ) )
2020 ++nonzeros;
2021
2022 return nonzeros;
2023}
2024//*************************************************************************************************
2025
2026
2027//*************************************************************************************************
2032template< typename Type // Data type of the matrix
2033 , size_t M // Number of rows
2034 , size_t N // Number of columns
2035 , bool SO // Storage order
2036 , AlignmentFlag AF // Alignment flag
2037 , PaddingFlag PF // Padding flag
2038 , typename Tag > // Type tag
2040{
2041 using blaze::clear;
2042
2043 for( size_t i=0UL; i<M; ++i )
2044 for( size_t j=0UL; j<N; ++j )
2045 clear( v_[i*NN+j] );
2046}
2047//*************************************************************************************************
2048
2049
2050//*************************************************************************************************
2061template< typename Type // Data type of the matrix
2062 , size_t M // Number of rows
2063 , size_t N // Number of columns
2064 , bool SO // Storage order
2065 , AlignmentFlag AF // Alignment flag
2066 , PaddingFlag PF // Padding flag
2067 , typename Tag > // Type tag
2069{
2070 using blaze::clear;
2071
2072 BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
2073 for( size_t j=0UL; j<N; ++j )
2074 clear( v_[i*NN+j] );
2075}
2076//*************************************************************************************************
2077
2078
2079//*************************************************************************************************
2085template< typename Type // Data type of the matrix
2086 , size_t M // Number of rows
2087 , size_t N // Number of columns
2088 , bool SO // Storage order
2089 , AlignmentFlag AF // Alignment flag
2090 , PaddingFlag PF // Padding flag
2091 , typename Tag > // Type tag
2093{
2094 using std::swap;
2095
2096 for( size_t i=0UL; i<M; ++i ) {
2097 for( size_t j=0UL; j<N; ++j ) {
2098 swap( v_[i*NN+j], m(i,j) );
2099 }
2100 }
2101}
2102//*************************************************************************************************
2103
2104
2105
2106
2107//=================================================================================================
2108//
2109// NUMERIC FUNCTIONS
2110//
2111//=================================================================================================
2112
2113//*************************************************************************************************
2121template< typename Type // Data type of the matrix
2122 , size_t M // Number of rows
2123 , size_t N // Number of columns
2124 , bool SO // Storage order
2125 , AlignmentFlag AF // Alignment flag
2126 , PaddingFlag PF // Padding flag
2127 , typename Tag > // Type tag
2129{
2130 using std::swap;
2131
2132 BLAZE_STATIC_ASSERT( M == N );
2133
2134 for( size_t i=1UL; i<M; ++i )
2135 for( size_t j=0UL; j<i; ++j )
2136 swap( v_[i*NN+j], v_[j*NN+i] );
2137
2138 return *this;
2139}
2140//*************************************************************************************************
2141
2142
2143//*************************************************************************************************
2157template< typename Type // Data type of the matrix
2158 , size_t M // Number of rows
2159 , size_t N // Number of columns
2160 , bool SO // Storage order
2161 , AlignmentFlag AF // Alignment flag
2162 , PaddingFlag PF // Padding flag
2163 , typename Tag > // Type tag
2165{
2166 transpose();
2167}
2169//*************************************************************************************************
2170
2171
2172//*************************************************************************************************
2186template< typename Type // Data type of the matrix
2187 , size_t M // Number of rows
2188 , size_t N // Number of columns
2189 , bool SO // Storage order
2190 , AlignmentFlag AF // Alignment flag
2191 , PaddingFlag PF // Padding flag
2192 , typename Tag > // Type tag
2194{}
2196//*************************************************************************************************
2197
2198
2199//*************************************************************************************************
2207template< typename Type // Data type of the matrix
2208 , size_t M // Number of rows
2209 , size_t N // Number of columns
2210 , bool SO // Storage order
2211 , AlignmentFlag AF // Alignment flag
2212 , PaddingFlag PF // Padding flag
2213 , typename Tag > // Type tag
2215{
2216 BLAZE_STATIC_ASSERT( M == N );
2217
2218 for( size_t i=0UL; i<M; ++i ) {
2219 for( size_t j=0UL; j<i; ++j ) {
2220 cswap( v_[i*NN+j], v_[j*NN+i] );
2221 }
2222 conjugate( v_[i*NN+i] );
2223 }
2224
2225 return *this;
2226}
2227//*************************************************************************************************
2228
2229
2230//*************************************************************************************************
2244template< typename Type // Data type of the matrix
2245 , size_t M // Number of rows
2246 , size_t N // Number of columns
2247 , bool SO // Storage order
2248 , AlignmentFlag AF // Alignment flag
2249 , PaddingFlag PF // Padding flag
2250 , typename Tag > // Type tag
2252{
2253 ctranspose();
2254}
2256//*************************************************************************************************
2257
2258
2259//*************************************************************************************************
2273template< typename Type // Data type of the matrix
2274 , size_t M // Number of rows
2275 , size_t N // Number of columns
2276 , bool SO // Storage order
2277 , AlignmentFlag AF // Alignment flag
2278 , PaddingFlag PF // Padding flag
2279 , typename Tag > // Type tag
2281{}
2283//*************************************************************************************************
2284
2285
2286//*************************************************************************************************
2303template< typename Type // Data type of the matrix
2304 , size_t M // Number of rows
2305 , size_t N // Number of columns
2306 , bool SO // Storage order
2307 , AlignmentFlag AF // Alignment flag
2308 , PaddingFlag PF // Padding flag
2309 , typename Tag > // Type tag
2310template< typename Other > // Data type of the scalar value
2311inline StaticMatrix<Type,M,N,SO,AF,PF,Tag>&
2313{
2314 for( size_t i=0UL; i<M; ++i )
2315 for( size_t j=0UL; j<N; ++j )
2316 v_[i*NN+j] *= scalar;
2317
2318 return *this;
2319}
2320//*************************************************************************************************
2321
2322
2323
2324
2325//=================================================================================================
2326//
2327// MEMORY FUNCTIONS
2328//
2329//=================================================================================================
2330
2331//*************************************************************************************************
2341template< typename Type // Data type of the matrix
2342 , size_t M // Number of rows
2343 , size_t N // Number of columns
2344 , bool SO // Storage order
2345 , AlignmentFlag AF // Alignment flag
2346 , PaddingFlag PF // Padding flag
2347 , typename Tag > // Type tag
2349{
2350 MAYBE_UNUSED( size );
2351
2352 BLAZE_INTERNAL_ASSERT( size == sizeof( StaticMatrix ), "Invalid number of bytes detected" );
2353
2354 return allocate<StaticMatrix>( 1UL );
2355}
2356//*************************************************************************************************
2357
2358
2359//*************************************************************************************************
2369template< typename Type // Data type of the matrix
2370 , size_t M // Number of rows
2371 , size_t N // Number of columns
2372 , bool SO // Storage order
2373 , AlignmentFlag AF // Alignment flag
2374 , PaddingFlag PF // Padding flag
2375 , typename Tag > // Type tag
2377{
2378 BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticMatrix ) , "Invalid number of bytes detected" );
2379 BLAZE_INTERNAL_ASSERT( size % sizeof( StaticMatrix ) == 0UL, "Invalid number of bytes detected" );
2380
2381 return allocate<StaticMatrix>( size/sizeof(StaticMatrix) );
2382}
2383//*************************************************************************************************
2384
2385
2386//*************************************************************************************************
2396template< typename Type // Data type of the matrix
2397 , size_t M // Number of rows
2398 , size_t N // Number of columns
2399 , bool SO // Storage order
2400 , AlignmentFlag AF // Alignment flag
2401 , PaddingFlag PF // Padding flag
2402 , typename Tag > // Type tag
2403inline void* StaticMatrix<Type,M,N,SO,AF,PF,Tag>::operator new( std::size_t size, const std::nothrow_t& )
2404{
2405 MAYBE_UNUSED( size );
2406
2407 BLAZE_INTERNAL_ASSERT( size == sizeof( StaticMatrix ), "Invalid number of bytes detected" );
2408
2409 return allocate<StaticMatrix>( 1UL );
2410}
2411//*************************************************************************************************
2412
2413
2414//*************************************************************************************************
2424template< typename Type // Data type of the matrix
2425 , size_t M // Number of rows
2426 , size_t N // Number of columns
2427 , bool SO // Storage order
2428 , AlignmentFlag AF // Alignment flag
2429 , PaddingFlag PF // Padding flag
2430 , typename Tag > // Type tag
2431inline void* StaticMatrix<Type,M,N,SO,AF,PF,Tag>::operator new[]( std::size_t size, const std::nothrow_t& )
2432{
2433 BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticMatrix ) , "Invalid number of bytes detected" );
2434 BLAZE_INTERNAL_ASSERT( size % sizeof( StaticMatrix ) == 0UL, "Invalid number of bytes detected" );
2435
2436 return allocate<StaticMatrix>( size/sizeof(StaticMatrix) );
2437}
2438//*************************************************************************************************
2439
2440
2441//*************************************************************************************************
2447template< typename Type // Data type of the matrix
2448 , size_t M // Number of rows
2449 , size_t N // Number of columns
2450 , bool SO // Storage order
2451 , AlignmentFlag AF // Alignment flag
2452 , PaddingFlag PF // Padding flag
2453 , typename Tag > // Type tag
2455{
2456 deallocate( static_cast<StaticMatrix*>( ptr ) );
2457}
2458//*************************************************************************************************
2459
2460
2461//*************************************************************************************************
2467template< typename Type // Data type of the matrix
2468 , size_t M // Number of rows
2469 , size_t N // Number of columns
2470 , bool SO // Storage order
2471 , AlignmentFlag AF // Alignment flag
2472 , PaddingFlag PF // Padding flag
2473 , typename Tag > // Type tag
2474inline void StaticMatrix<Type,M,N,SO,AF,PF,Tag>::operator delete[]( void* ptr )
2475{
2476 deallocate( static_cast<StaticMatrix*>( ptr ) );
2477}
2478//*************************************************************************************************
2479
2480
2481//*************************************************************************************************
2487template< typename Type // Data type of the matrix
2488 , size_t M // Number of rows
2489 , size_t N // Number of columns
2490 , bool SO // Storage order
2491 , AlignmentFlag AF // Alignment flag
2492 , PaddingFlag PF // Padding flag
2493 , typename Tag > // Type tag
2494inline void StaticMatrix<Type,M,N,SO,AF,PF,Tag>::operator delete( void* ptr, const std::nothrow_t& )
2495{
2496 deallocate( static_cast<StaticMatrix*>( ptr ) );
2497}
2498//*************************************************************************************************
2499
2500
2501//*************************************************************************************************
2507template< typename Type // Data type of the matrix
2508 , size_t M // Number of rows
2509 , size_t N // Number of columns
2510 , bool SO // Storage order
2511 , AlignmentFlag AF // Alignment flag
2512 , PaddingFlag PF // Padding flag
2513 , typename Tag > // Type tag
2514inline void StaticMatrix<Type,M,N,SO,AF,PF,Tag>::operator delete[]( void* ptr, const std::nothrow_t& )
2515{
2516 deallocate( static_cast<StaticMatrix*>( ptr ) );
2517}
2518//*************************************************************************************************
2519
2520
2521
2522
2523//=================================================================================================
2524//
2525// DEBUGGING FUNCTIONS
2526//
2527//=================================================================================================
2528
2529//*************************************************************************************************
2538template< typename Type // Data type of the matrix
2539 , size_t M // Number of rows
2540 , size_t N // Number of columns
2541 , bool SO // Storage order
2542 , AlignmentFlag AF // Alignment flag
2543 , PaddingFlag PF // Padding flag
2544 , typename Tag > // Type tag
2546{
2547 if( IsNumeric_v<Type> ) {
2548 for( size_t i=0UL; i<M; ++i ) {
2549 for( size_t j=N; j<NN; ++j ) {
2550 if( !isDefault<strict>( v_[i*NN+j] ) )
2551 return false;
2552 }
2553 }
2554 }
2555
2556 return true;
2557}
2558//*************************************************************************************************
2559
2560
2561
2562
2563//=================================================================================================
2564//
2565// EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2566//
2567//=================================================================================================
2568
2569//*************************************************************************************************
2579template< typename Type // Data type of the matrix
2580 , size_t M // Number of rows
2581 , size_t N // Number of columns
2582 , bool SO // Storage order
2583 , AlignmentFlag AF // Alignment flag
2584 , PaddingFlag PF // Padding flag
2585 , typename Tag > // Type tag
2586template< typename Other > // Data type of the foreign expression
2587inline bool StaticMatrix<Type,M,N,SO,AF,PF,Tag>::canAlias( const Other* alias ) const noexcept
2588{
2589 return static_cast<const void*>( this ) == static_cast<const void*>( alias );
2590}
2591//*************************************************************************************************
2592
2593
2594//*************************************************************************************************
2604template< typename Type // Data type of the matrix
2605 , size_t M // Number of rows
2606 , size_t N // Number of columns
2607 , bool SO // Storage order
2608 , AlignmentFlag AF // Alignment flag
2609 , PaddingFlag PF // Padding flag
2610 , typename Tag > // Type tag
2611template< typename Other > // Data type of the foreign expression
2612inline bool StaticMatrix<Type,M,N,SO,AF,PF,Tag>::isAliased( const Other* alias ) const noexcept
2613{
2614 return static_cast<const void*>( this ) == static_cast<const void*>( alias );
2615}
2616//*************************************************************************************************
2617
2618
2619//*************************************************************************************************
2628template< typename Type // Data type of the matrix
2629 , size_t M // Number of rows
2630 , size_t N // Number of columns
2631 , bool SO // Storage order
2632 , AlignmentFlag AF // Alignment flag
2633 , PaddingFlag PF // Padding flag
2634 , typename Tag > // Type tag
2636{
2637 return AF == aligned;
2638}
2639//*************************************************************************************************
2640
2641
2642//*************************************************************************************************
2657template< typename Type // Data type of the matrix
2658 , size_t M // Number of rows
2659 , size_t N // Number of columns
2660 , bool SO // Storage order
2661 , AlignmentFlag AF // Alignment flag
2662 , PaddingFlag PF // Padding flag
2663 , typename Tag > // Type tag
2665 StaticMatrix<Type,M,N,SO,AF,PF,Tag>::load( size_t i, size_t j ) const noexcept
2666{
2667 if( AF == aligned )
2668 return loada( i, j );
2669 else
2670 return loadu( i, j );
2671}
2672//*************************************************************************************************
2673
2674
2675//*************************************************************************************************
2690template< typename Type // Data type of the matrix
2691 , size_t M // Number of rows
2692 , size_t N // Number of columns
2693 , bool SO // Storage order
2694 , AlignmentFlag AF // Alignment flag
2695 , PaddingFlag PF // Padding flag
2696 , typename Tag > // Type tag
2698 StaticMatrix<Type,M,N,SO,AF,PF,Tag>::loada( size_t i, size_t j ) const noexcept
2699{
2700 using blaze::loada;
2701
2703
2704 BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
2705 BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
2706 BLAZE_INTERNAL_ASSERT( j + SIMDSIZE <= NN, "Invalid column access index" );
2707 BLAZE_INTERNAL_ASSERT( PF == unpadded || j % SIMDSIZE == 0UL, "Invalid column access index" );
2708 BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[i*NN+j] ), "Invalid alignment detected" );
2709
2710 return loada( &v_[i*NN+j] );
2711}
2712//*************************************************************************************************
2713
2714
2715//*************************************************************************************************
2730template< typename Type // Data type of the matrix
2731 , size_t M // Number of rows
2732 , size_t N // Number of columns
2733 , bool SO // Storage order
2734 , AlignmentFlag AF // Alignment flag
2735 , PaddingFlag PF // Padding flag
2736 , typename Tag > // Type tag
2738 StaticMatrix<Type,M,N,SO,AF,PF,Tag>::loadu( size_t i, size_t j ) const noexcept
2739{
2740 using blaze::loadu;
2741
2743
2744 BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
2745 BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
2746 BLAZE_INTERNAL_ASSERT( j + SIMDSIZE <= NN, "Invalid column access index" );
2747
2748 return loadu( &v_[i*NN+j] );
2749}
2750//*************************************************************************************************
2751
2752
2753//*************************************************************************************************
2769template< typename Type // Data type of the matrix
2770 , size_t M // Number of rows
2771 , size_t N // Number of columns
2772 , bool SO // Storage order
2773 , AlignmentFlag AF // Alignment flag
2774 , PaddingFlag PF // Padding flag
2775 , typename Tag > // Type tag
2777 StaticMatrix<Type,M,N,SO,AF,PF,Tag>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2778{
2779 if( AF == aligned )
2780 storea( i, j, value );
2781 else
2782 storeu( i, j, value );
2783}
2784//*************************************************************************************************
2785
2786
2787//*************************************************************************************************
2803template< typename Type // Data type of the matrix
2804 , size_t M // Number of rows
2805 , size_t N // Number of columns
2806 , bool SO // Storage order
2807 , AlignmentFlag AF // Alignment flag
2808 , PaddingFlag PF // Padding flag
2809 , typename Tag > // Type tag
2811 StaticMatrix<Type,M,N,SO,AF,PF,Tag>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2812{
2813 using blaze::storea;
2814
2816
2817 BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
2818 BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
2819 BLAZE_INTERNAL_ASSERT( j + SIMDSIZE <= NN, "Invalid column access index" );
2820 BLAZE_INTERNAL_ASSERT( PF == unpadded || j % SIMDSIZE == 0UL, "Invalid column access index" );
2821 BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[i*NN+j] ), "Invalid alignment detected" );
2822
2823 storea( &v_[i*NN+j], value );
2824}
2825//*************************************************************************************************
2826
2827
2828//*************************************************************************************************
2844template< typename Type // Data type of the matrix
2845 , size_t M // Number of rows
2846 , size_t N // Number of columns
2847 , bool SO // Storage order
2848 , AlignmentFlag AF // Alignment flag
2849 , PaddingFlag PF // Padding flag
2850 , typename Tag > // Type tag
2852 StaticMatrix<Type,M,N,SO,AF,PF,Tag>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
2853{
2854 using blaze::storeu;
2855
2857
2858 BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
2859 BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
2860 BLAZE_INTERNAL_ASSERT( j + SIMDSIZE <= NN, "Invalid column access index" );
2861
2862 storeu( &v_[i*NN+j], value );
2863}
2864//*************************************************************************************************
2865
2866
2867//*************************************************************************************************
2884template< typename Type // Data type of the matrix
2885 , size_t M // Number of rows
2886 , size_t N // Number of columns
2887 , bool SO // Storage order
2888 , AlignmentFlag AF // Alignment flag
2889 , PaddingFlag PF // Padding flag
2890 , typename Tag > // Type tag
2892 StaticMatrix<Type,M,N,SO,AF,PF,Tag>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
2893{
2894 using blaze::stream;
2895
2897
2898 BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
2899 BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
2900 BLAZE_INTERNAL_ASSERT( j + SIMDSIZE <= NN, "Invalid column access index" );
2901 BLAZE_INTERNAL_ASSERT( PF == unpadded || j % SIMDSIZE == 0UL, "Invalid column access index" );
2902 BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[i*NN+j] ), "Invalid alignment detected" );
2903
2904 stream( &v_[i*NN+j], value );
2905}
2906//*************************************************************************************************
2907
2908
2909//*************************************************************************************************
2920template< typename Type // Data type of the matrix
2921 , size_t M // Number of rows
2922 , size_t N // Number of columns
2923 , bool SO // Storage order
2924 , AlignmentFlag AF // Alignment flag
2925 , PaddingFlag PF // Padding flag
2926 , typename Tag > // Type tag
2927template< typename MT // Type of the right-hand side dense matrix
2928 , bool SO2 > // Storage order of the right-hand side dense matrix
2931{
2932 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
2933
2934 for( size_t i=0UL; i<M; ++i ) {
2935 for( size_t j=0UL; j<N; ++j ) {
2936 v_[i*NN+j] = (*rhs)(i,j);
2937 }
2938 }
2939}
2940//*************************************************************************************************
2941
2942
2943//*************************************************************************************************
2954template< typename Type // Data type of the matrix
2955 , size_t M // Number of rows
2956 , size_t N // Number of columns
2957 , bool SO // Storage order
2958 , AlignmentFlag AF // Alignment flag
2959 , PaddingFlag PF // Padding flag
2960 , typename Tag > // Type tag
2961template< typename MT // Type of the right-hand side dense matrix
2962 , bool SO2 > // Storage order of the right-hand side dense matrix
2965{
2967
2968 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
2969
2970 constexpr bool remainder( PF == unpadded || !IsPadded_v<MT> );
2971
2972 constexpr size_t jpos( remainder ? prevMultiple( N, SIMDSIZE ) : N );
2973 BLAZE_INTERNAL_ASSERT( jpos <= N, "Invalid end calculation" );
2974
2975 for( size_t i=0UL; i<M; ++i )
2976 {
2977 size_t j( 0UL );
2978
2979 for( ; j<jpos; j+=SIMDSIZE ) {
2980 store( i, j, (*rhs).load(i,j) );
2981 }
2982 for( ; remainder && j<N; ++j ) {
2983 v_[i*NN+j] = (*rhs)(i,j);
2984 }
2985 }
2986}
2987//*************************************************************************************************
2988
2989
2990//*************************************************************************************************
3001template< typename Type // Data type of the matrix
3002 , size_t M // Number of rows
3003 , size_t N // Number of columns
3004 , bool SO // Storage order
3005 , AlignmentFlag AF // Alignment flag
3006 , PaddingFlag PF // Padding flag
3007 , typename Tag > // Type tag
3008template< typename MT > // Type of the right-hand side sparse matrix
3010{
3011 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
3012
3013 for( size_t i=0UL; i<M; ++i )
3014 for( auto element=(*rhs).begin(i); element!=(*rhs).end(i); ++element )
3015 v_[i*NN+element->index()] = element->value();
3016}
3017//*************************************************************************************************
3018
3019
3020//*************************************************************************************************
3031template< typename Type // Data type of the matrix
3032 , size_t M // Number of rows
3033 , size_t N // Number of columns
3034 , bool SO // Storage order
3035 , AlignmentFlag AF // Alignment flag
3036 , PaddingFlag PF // Padding flag
3037 , typename Tag > // Type tag
3038template< typename MT > // Type of the right-hand side sparse matrix
3040{
3042
3043 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
3044
3045 for( size_t j=0UL; j<N; ++j )
3046 for( auto element=(*rhs).begin(j); element!=(*rhs).end(j); ++element )
3047 v_[element->index()*NN+j] = element->value();
3048}
3049//*************************************************************************************************
3050
3051
3052//*************************************************************************************************
3063template< typename Type // Data type of the matrix
3064 , size_t M // Number of rows
3065 , size_t N // Number of columns
3066 , bool SO // Storage order
3067 , AlignmentFlag AF // Alignment flag
3068 , PaddingFlag PF // Padding flag
3069 , typename Tag > // Type tag
3070template< typename MT // Type of the right-hand side dense matrix
3071 , bool SO2 > // Storage order of the right-hand side dense matrix
3074{
3075 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
3076
3077 for( size_t i=0UL; i<M; ++i )
3078 {
3079 if( IsDiagonal_v<MT> )
3080 {
3081 v_[i*NN+i] += (*rhs)(i,i);
3082 }
3083 else
3084 {
3085 const size_t jbegin( ( IsUpper_v<MT> )
3086 ?( IsStrictlyUpper_v<MT> ? i+1UL : i )
3087 :( 0UL ) );
3088 const size_t jend ( ( IsLower_v<MT> )
3089 ?( IsStrictlyLower_v<MT> ? i : i+1UL )
3090 :( N ) );
3091 BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
3092
3093 for( size_t j=jbegin; j<jend; ++j ) {
3094 v_[i*NN+j] += (*rhs)(i,j);
3095 }
3096 }
3097 }
3098}
3099//*************************************************************************************************
3100
3101
3102//*************************************************************************************************
3113template< typename Type // Data type of the matrix
3114 , size_t M // Number of rows
3115 , size_t N // Number of columns
3116 , bool SO // Storage order
3117 , AlignmentFlag AF // Alignment flag
3118 , PaddingFlag PF // Padding flag
3119 , typename Tag > // Type tag
3120template< typename MT // Type of the right-hand side dense matrix
3121 , bool SO2 > // Storage order of the right-hand side dense matrix
3124{
3127
3128 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
3129
3130 constexpr bool remainder( PF == unpadded || !IsPadded_v<MT> );
3131
3132 for( size_t i=0UL; i<M; ++i )
3133 {
3134 const size_t jbegin( ( IsUpper_v<MT> )
3135 ?( prevMultiple( ( IsStrictlyUpper_v<MT> ? i+1UL : i ), SIMDSIZE ) )
3136 :( 0UL ) );
3137 const size_t jend ( ( IsLower_v<MT> )
3138 ?( IsStrictlyLower_v<MT> ? i : i+1UL )
3139 :( N ) );
3140 BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
3141
3142 const size_t jpos( remainder ? prevMultiple( jend, SIMDSIZE ) : jend );
3143 BLAZE_INTERNAL_ASSERT( jpos <= jend, "Invalid end calculation" );
3144
3145 size_t j( jbegin );
3146
3147 for( ; j<jpos; j+=SIMDSIZE ) {
3148 store( i, j, load(i,j) + (*rhs).load(i,j) );
3149 }
3150 for( ; remainder && j<jend; ++j ) {
3151 v_[i*NN+j] += (*rhs)(i,j);
3152 }
3153 }
3154}
3155//*************************************************************************************************
3156
3157
3158//*************************************************************************************************
3169template< typename Type // Data type of the matrix
3170 , size_t M // Number of rows
3171 , size_t N // Number of columns
3172 , bool SO // Storage order
3173 , AlignmentFlag AF // Alignment flag
3174 , PaddingFlag PF // Padding flag
3175 , typename Tag > // Type tag
3176template< typename MT > // Type of the right-hand side sparse matrix
3178{
3179 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
3180
3181 for( size_t i=0UL; i<M; ++i )
3182 for( auto element=(*rhs).begin(i); element!=(*rhs).end(i); ++element )
3183 v_[i*NN+element->index()] += element->value();
3184}
3185//*************************************************************************************************
3186
3187
3188//*************************************************************************************************
3199template< typename Type // Data type of the matrix
3200 , size_t M // Number of rows
3201 , size_t N // Number of columns
3202 , bool SO // Storage order
3203 , AlignmentFlag AF // Alignment flag
3204 , PaddingFlag PF // Padding flag
3205 , typename Tag > // Type tag
3206template< typename MT > // Type of the right-hand side sparse matrix
3208{
3210
3211 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
3212
3213 for( size_t j=0UL; j<N; ++j )
3214 for( auto element=(*rhs).begin(j); element!=(*rhs).end(j); ++element )
3215 v_[element->index()*NN+j] += element->value();
3216}
3217//*************************************************************************************************
3218
3219
3220//*************************************************************************************************
3231template< typename Type // Data type of the matrix
3232 , size_t M // Number of rows
3233 , size_t N // Number of columns
3234 , bool SO // Storage order
3235 , AlignmentFlag AF // Alignment flag
3236 , PaddingFlag PF // Padding flag
3237 , typename Tag > // Type tag
3238template< typename MT // Type of the right-hand side dense matrix
3239 , bool SO2 > // Storage order of the right-hand side dense matrix
3242{
3243 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
3244
3245 for( size_t i=0UL; i<M; ++i )
3246 {
3247 if( IsDiagonal_v<MT> )
3248 {
3249 v_[i*NN+i] -= (*rhs)(i,i);
3250 }
3251 else
3252 {
3253 const size_t jbegin( ( IsUpper_v<MT> )
3254 ?( IsStrictlyUpper_v<MT> ? i+1UL : i )
3255 :( 0UL ) );
3256 const size_t jend ( ( IsLower_v<MT> )
3257 ?( IsStrictlyLower_v<MT> ? i : i+1UL )
3258 :( N ) );
3259 BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
3260
3261 for( size_t j=jbegin; j<jend; ++j ) {
3262 v_[i*NN+j] -= (*rhs)(i,j);
3263 }
3264 }
3265 }
3266}
3267//*************************************************************************************************
3268
3269
3270//*************************************************************************************************
3281template< typename Type // Data type of the matrix
3282 , size_t M // Number of rows
3283 , size_t N // Number of columns
3284 , bool SO // Storage order
3285 , AlignmentFlag AF // Alignment flag
3286 , PaddingFlag PF // Padding flag
3287 , typename Tag > // Type tag
3288template< typename MT // Type of the right-hand side dense matrix
3289 , bool SO2 > // Storage order of the right-hand side dense matrix
3292{
3295
3296 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
3297
3298 constexpr bool remainder( PF == unpadded || !IsPadded_v<MT> );
3299
3300 for( size_t i=0UL; i<M; ++i )
3301 {
3302 const size_t jbegin( ( IsUpper_v<MT> )
3303 ?( prevMultiple( ( IsStrictlyUpper_v<MT> ? i+1UL : i ), SIMDSIZE ) )
3304 :( 0UL ) );
3305 const size_t jend ( ( IsLower_v<MT> )
3306 ?( IsStrictlyLower_v<MT> ? i : i+1UL )
3307 :( N ) );
3308 BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
3309
3310 const size_t jpos( remainder ? prevMultiple( jend, SIMDSIZE ) : jend );
3311 BLAZE_INTERNAL_ASSERT( jpos <= jend, "Invalid end calculation" );
3312
3313 size_t j( jbegin );
3314
3315 for( ; j<jpos; j+=SIMDSIZE ) {
3316 store( i, j, load(i,j) - (*rhs).load(i,j) );
3317 }
3318 for( ; remainder && j<jend; ++j ) {
3319 v_[i*NN+j] -= (*rhs)(i,j);
3320 }
3321 }
3322}
3323//*************************************************************************************************
3324
3325
3326//*************************************************************************************************
3337template< typename Type // Data type of the matrix
3338 , size_t M // Number of rows
3339 , size_t N // Number of columns
3340 , bool SO // Storage order
3341 , AlignmentFlag AF // Alignment flag
3342 , PaddingFlag PF // Padding flag
3343 , typename Tag > // Type tag
3344template< typename MT > // Type of the right-hand side sparse matrix
3346{
3347 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
3348
3349 for( size_t i=0UL; i<M; ++i )
3350 for( auto element=(*rhs).begin(i); element!=(*rhs).end(i); ++element )
3351 v_[i*NN+element->index()] -= element->value();
3352}
3353//*************************************************************************************************
3354
3355
3356//*************************************************************************************************
3367template< typename Type // Data type of the matrix
3368 , size_t M // Number of rows
3369 , size_t N // Number of columns
3370 , bool SO // Storage order
3371 , AlignmentFlag AF // Alignment flag
3372 , PaddingFlag PF // Padding flag
3373 , typename Tag > // Type tag
3374template< typename MT > // Type of the right-hand side sparse matrix
3376{
3378
3379 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
3380
3381 for( size_t j=0UL; j<N; ++j )
3382 for( auto element=(*rhs).begin(j); element!=(*rhs).end(j); ++element )
3383 v_[element->index()*NN+j] -= element->value();
3384}
3385//*************************************************************************************************
3386
3387
3388//*************************************************************************************************
3399template< typename Type // Data type of the matrix
3400 , size_t M // Number of rows
3401 , size_t N // Number of columns
3402 , bool SO // Storage order
3403 , AlignmentFlag AF // Alignment flag
3404 , PaddingFlag PF // Padding flag
3405 , typename Tag > // Type tag
3406template< typename MT // Type of the right-hand side dense matrix
3407 , bool SO2 > // Storage order of the right-hand side dense matrix
3410{
3411 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
3412
3413 for( size_t i=0UL; i<M; ++i ) {
3414 for( size_t j=0UL; j<N; ++j ) {
3415 v_[i*NN+j] *= (*rhs)(i,j);
3416 }
3417 }
3418}
3419//*************************************************************************************************
3420
3421
3422//*************************************************************************************************
3433template< typename Type // Data type of the matrix
3434 , size_t M // Number of rows
3435 , size_t N // Number of columns
3436 , bool SO // Storage order
3437 , AlignmentFlag AF // Alignment flag
3438 , PaddingFlag PF // Padding flag
3439 , typename Tag > // Type tag
3440template< typename MT // Type of the right-hand side dense matrix
3441 , bool SO2 > // Storage order of the right-hand side dense matrix
3444{
3446
3447 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
3448
3449 constexpr bool remainder( PF == unpadded || !IsPadded_v<MT> );
3450
3451 constexpr size_t jpos( remainder ? prevMultiple( N, SIMDSIZE ) : N );
3452 BLAZE_INTERNAL_ASSERT( jpos <= N, "Invalid end calculation" );
3453
3454 for( size_t i=0UL; i<M; ++i )
3455 {
3456 size_t j( 0UL );
3457
3458 for( ; j<jpos; j+=SIMDSIZE ) {
3459 store( i, j, load(i,j) * (*rhs).load(i,j) );
3460 }
3461 for( ; remainder && j<N; ++j ) {
3462 v_[i*NN+j] *= (*rhs)(i,j);
3463 }
3464 }
3465}
3466//*************************************************************************************************
3467
3468
3469//*************************************************************************************************
3480template< typename Type // Data type of the matrix
3481 , size_t M // Number of rows
3482 , size_t N // Number of columns
3483 , bool SO // Storage order
3484 , AlignmentFlag AF // Alignment flag
3485 , PaddingFlag PF // Padding flag
3486 , typename Tag > // Type tag
3487template< typename MT > // Type of the right-hand side sparse matrix
3489{
3490 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
3491
3492 const StaticMatrix tmp( serial( *this ) );
3493
3494 reset();
3495
3496 for( size_t i=0UL; i<M; ++i )
3497 for( auto element=(*rhs).begin(i); element!=(*rhs).end(i); ++element )
3498 v_[i*NN+element->index()] = tmp.v_[i*NN+element->index()] * element->value();
3499}
3500//*************************************************************************************************
3501
3502
3503//*************************************************************************************************
3514template< typename Type // Data type of the matrix
3515 , size_t M // Number of rows
3516 , size_t N // Number of columns
3517 , bool SO // Storage order
3518 , AlignmentFlag AF // Alignment flag
3519 , PaddingFlag PF // Padding flag
3520 , typename Tag > // Type tag
3521template< typename MT > // Type of the right-hand side sparse matrix
3523{
3525
3526 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
3527
3528 const StaticMatrix tmp( serial( *this ) );
3529
3530 reset();
3531
3532 for( size_t j=0UL; j<N; ++j )
3533 for( auto element=(*rhs).begin(j); element!=(*rhs).end(j); ++element )
3534 v_[element->index()*NN+j] = tmp.v_[element->index()*NN+j] * element->value();
3535}
3536//*************************************************************************************************
3537
3538
3539
3540
3541
3542
3543
3544
3545//=================================================================================================
3546//
3547// CLASS TEMPLATE SPECIALIZATION FOR COLUMN-MAJOR MATRICES
3548//
3549//=================================================================================================
3550
3551//*************************************************************************************************
3559template< typename Type // Data type of the matrix
3560 , size_t M // Number of rows
3561 , size_t N // Number of columns
3562 , AlignmentFlag AF // Alignment flag
3563 , PaddingFlag PF // Padding flag
3564 , typename Tag > // Type tag
3565class StaticMatrix<Type,M,N,true,AF,PF,Tag>
3566 : public DenseMatrix< StaticMatrix<Type,M,N,true,AF,PF,Tag>, true >
3567{
3568 public:
3569 //**Type definitions****************************************************************************
3572
3574 using ResultType = This;
3575
3578
3581
3582 using ElementType = Type;
3584 using TagType = Tag;
3585 using ReturnType = const Type&;
3586 using CompositeType = const This&;
3587
3588 using Reference = Type&;
3589 using ConstReference = const Type&;
3590 using Pointer = Type*;
3591 using ConstPointer = const Type*;
3592
3595 //**********************************************************************************************
3596
3597 //**Rebind struct definition********************************************************************
3600 template< typename NewType > // Data type of the other matrix
3601 struct Rebind {
3603 };
3604 //**********************************************************************************************
3605
3606 //**Resize struct definition********************************************************************
3609 template< size_t NewM // Number of rows of the other matrix
3610 , size_t NewN > // Number of columns of the other matrix
3611 struct Resize {
3612 using Other = StaticMatrix<Type,NewM,NewN,true,AF,PF,Tag>;
3613 };
3614 //**********************************************************************************************
3615
3616 //**Compilation flags***************************************************************************
3618
3622 static constexpr bool simdEnabled = IsVectorizable_v<Type>;
3623
3625
3628 static constexpr bool smpAssignable = false;
3629 //**********************************************************************************************
3630
3631 //**Constructors********************************************************************************
3634 inline StaticMatrix();
3635 explicit inline StaticMatrix( const Type& init );
3637
3638 template< typename Other >
3639 inline StaticMatrix( size_t m, size_t n, const Other* array );
3640
3641 template< typename Other, size_t Rows, size_t Cols >
3642 inline StaticMatrix( const Other (&array)[Rows][Cols] );
3643
3644 template< typename Other, size_t Rows, size_t Cols >
3645 StaticMatrix( const std::array<std::array<Other,Cols>,Rows>& array );
3646
3647 constexpr StaticMatrix( const StaticMatrix& m );
3648
3649 template< typename Other, bool SO2, AlignmentFlag AF2, PaddingFlag PF2 >
3650 inline StaticMatrix( const StaticMatrix<Other,M,N,SO2,AF2,PF2,Tag>& m );
3651
3652 template< typename MT, bool SO >
3653 inline StaticMatrix( const Matrix<MT,SO>& m );
3655 //**********************************************************************************************
3656
3657 //**Destructor**********************************************************************************
3660 ~StaticMatrix() = default;
3662 //**********************************************************************************************
3663
3664 //**Data access functions***********************************************************************
3667 constexpr Reference operator()( size_t i, size_t j ) noexcept;
3668 constexpr ConstReference operator()( size_t i, size_t j ) const noexcept;
3669 inline Reference at( size_t i, size_t j );
3670 inline ConstReference at( size_t i, size_t j ) const;
3671 constexpr Pointer data () noexcept;
3672 constexpr ConstPointer data () const noexcept;
3673 constexpr Pointer data ( size_t j ) noexcept;
3674 constexpr ConstPointer data ( size_t j ) const noexcept;
3675 constexpr Iterator begin ( size_t j ) noexcept;
3676 constexpr ConstIterator begin ( size_t j ) const noexcept;
3677 constexpr ConstIterator cbegin( size_t j ) const noexcept;
3678 constexpr Iterator end ( size_t j ) noexcept;
3679 constexpr ConstIterator end ( size_t j ) const noexcept;
3680 constexpr ConstIterator cend ( size_t j ) const noexcept;
3682 //**********************************************************************************************
3683
3684 //**Assignment operators************************************************************************
3687 constexpr StaticMatrix& operator=( const Type& set ) &;
3688 constexpr StaticMatrix& operator=( initializer_list< initializer_list<Type> > list ) &;
3689
3690 template< typename Other, size_t Rows, size_t Cols >
3691 inline StaticMatrix& operator=( const Other (&array)[Rows][Cols] ) &;
3692
3693 template< typename Other, size_t Rows, size_t Cols >
3694 inline StaticMatrix& operator=( const std::array<std::array<Other,Cols>,Rows>& array ) &;
3695
3696 constexpr StaticMatrix& operator=( const StaticMatrix& rhs ) &;
3697
3698 template< typename Other, bool SO2, AlignmentFlag AF2, PaddingFlag PF2 >
3699 inline StaticMatrix& operator=( const StaticMatrix<Other,M,N,SO2,AF2,PF2,Tag>& rhs ) &;
3700
3701 template< typename MT, bool SO > inline StaticMatrix& operator= ( const Matrix<MT,SO>& rhs ) &;
3702 template< typename MT, bool SO > inline StaticMatrix& operator+=( const Matrix<MT,SO>& rhs ) &;
3703 template< typename MT, bool SO > inline StaticMatrix& operator-=( const Matrix<MT,SO>& rhs ) &;
3704 template< typename MT, bool SO > inline StaticMatrix& operator%=( const Matrix<MT,SO>& rhs ) &;
3706 //**********************************************************************************************
3707
3708 //**Utility functions***************************************************************************
3711 static constexpr size_t rows() noexcept;
3712 static constexpr size_t columns() noexcept;
3713 static constexpr size_t spacing() noexcept;
3714 static constexpr size_t capacity() noexcept;
3715 inline size_t capacity( size_t j ) const noexcept;
3716 inline size_t nonZeros() const;
3717 inline size_t nonZeros( size_t j ) const;
3718 constexpr void reset();
3719 inline void reset( size_t i );
3720 inline void swap( StaticMatrix& m ) noexcept;
3722 //**********************************************************************************************
3723
3724 //**Numeric functions***************************************************************************
3727 inline StaticMatrix& transpose();
3728 inline StaticMatrix& ctranspose();
3729
3730 template< typename Other > inline StaticMatrix& scale( const Other& scalar );
3732 //**********************************************************************************************
3733
3734 //**Memory functions****************************************************************************
3737 static inline void* operator new ( std::size_t size );
3738 static inline void* operator new[]( std::size_t size );
3739 static inline void* operator new ( std::size_t size, const std::nothrow_t& );
3740 static inline void* operator new[]( std::size_t size, const std::nothrow_t& );
3741
3742 static inline void operator delete ( void* ptr );
3743 static inline void operator delete[]( void* ptr );
3744 static inline void operator delete ( void* ptr, const std::nothrow_t& );
3745 static inline void operator delete[]( void* ptr, const std::nothrow_t& );
3747 //**********************************************************************************************
3748
3749 private:
3750 //**********************************************************************************************
3752 static constexpr size_t SIMDSIZE = SIMDTrait<Type>::size;
3753
3755 static constexpr size_t MM = ( PF == padded ? nextMultiple( M, SIMDSIZE ) : M );
3756 //**********************************************************************************************
3757
3758 //**********************************************************************************************
3760 template< typename MT >
3761 static constexpr bool VectorizedAssign_v =
3762 ( useOptimizedKernels &&
3763 MM >= SIMDSIZE &&
3764 simdEnabled && MT::simdEnabled &&
3765 IsSIMDCombinable_v< Type, ElementType_t<MT> > &&
3767 //**********************************************************************************************
3768
3769 //**********************************************************************************************
3771 template< typename MT >
3772 static constexpr bool VectorizedAddAssign_v =
3773 ( VectorizedAssign_v<MT> &&
3774 HasSIMDAdd_v< Type, ElementType_t<MT> > &&
3775 !IsDiagonal_v<MT> );
3776 //**********************************************************************************************
3777
3778 //**********************************************************************************************
3780 template< typename MT >
3781 static constexpr bool VectorizedSubAssign_v =
3782 ( VectorizedAssign_v<MT> &&
3783 HasSIMDSub_v< Type, ElementType_t<MT> > &&
3784 !IsDiagonal_v<MT> );
3785 //**********************************************************************************************
3786
3787 //**********************************************************************************************
3789 template< typename MT >
3790 static constexpr bool VectorizedSchurAssign_v =
3791 ( VectorizedAssign_v<MT> &&
3792 HasSIMDMult_v< Type, ElementType_t<MT> > );
3793 //**********************************************************************************************
3794
3795 public:
3796 //**Debugging functions*************************************************************************
3799 constexpr bool isIntact() const noexcept;
3801 //**********************************************************************************************
3802
3803 //**Expression template evaluation functions****************************************************
3806 template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
3807 template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
3808
3809 static constexpr bool isAligned() noexcept;
3810
3811 BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
3812 BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
3813 BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
3814
3815 BLAZE_ALWAYS_INLINE void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
3816 BLAZE_ALWAYS_INLINE void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
3817 BLAZE_ALWAYS_INLINE void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
3818 BLAZE_ALWAYS_INLINE void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
3819
3820 template< typename MT, bool SO >
3821 inline auto assign( const DenseMatrix<MT,SO>& rhs ) -> DisableIf_t< VectorizedAssign_v<MT> >;
3822
3823 template< typename MT, bool SO >
3824 inline auto assign( const DenseMatrix<MT,SO>& rhs ) -> EnableIf_t< VectorizedAssign_v<MT> >;
3825
3826 template< typename MT > inline void assign( const SparseMatrix<MT,true>& rhs );
3827 template< typename MT > inline void assign( const SparseMatrix<MT,false>& rhs );
3828
3829 template< typename MT, bool SO >
3830 inline auto addAssign( const DenseMatrix<MT,SO>& rhs ) -> DisableIf_t< VectorizedAddAssign_v<MT> >;
3831
3832 template< typename MT, bool SO >
3833 inline auto addAssign( const DenseMatrix<MT,SO>& rhs ) -> EnableIf_t< VectorizedAddAssign_v<MT> >;
3834
3835 template< typename MT > inline void addAssign( const SparseMatrix<MT,true>& rhs );
3836 template< typename MT > inline void addAssign( const SparseMatrix<MT,false>& rhs );
3837
3838 template< typename MT, bool SO >
3839 inline auto subAssign( const DenseMatrix<MT,SO>& rhs ) -> DisableIf_t< VectorizedSubAssign_v<MT> >;
3840
3841 template< typename MT, bool SO >
3842 inline auto subAssign( const DenseMatrix<MT,SO>& rhs ) -> EnableIf_t< VectorizedSubAssign_v<MT> >;
3843
3844 template< typename MT > inline void subAssign( const SparseMatrix<MT,true>& rhs );
3845 template< typename MT > inline void subAssign( const SparseMatrix<MT,false>& rhs );
3846
3847 template< typename MT, bool SO >
3848 inline auto schurAssign( const DenseMatrix<MT,SO>& rhs ) -> DisableIf_t< VectorizedSchurAssign_v<MT> >;
3849
3850 template< typename MT, bool SO >
3851 inline auto schurAssign( const DenseMatrix<MT,SO>& rhs ) -> EnableIf_t< VectorizedSchurAssign_v<MT> >;
3852
3853 template< typename MT > inline void schurAssign( const SparseMatrix<MT,true>& rhs );
3854 template< typename MT > inline void schurAssign( const SparseMatrix<MT,false>& rhs );
3856 //**********************************************************************************************
3857
3858 private:
3859 //**Utility functions***************************************************************************
3860 inline void transpose ( TrueType );
3861 inline void transpose ( FalseType );
3862 inline void ctranspose( TrueType );
3863 inline void ctranspose( FalseType );
3864 //**********************************************************************************************
3865
3866 //**********************************************************************************************
3868 static constexpr size_t Alignment =
3869 ( AF == aligned ? AlignmentOf_v<Type> : std::alignment_of<Type>::value );
3870
3872 using AlignedStorage = AlignedArray<Type,MM*N,Alignment>;
3873 //**********************************************************************************************
3874
3875 //**Member variables****************************************************************************
3881 //**********************************************************************************************
3882
3883 //**Compile time checks*************************************************************************
3888 BLAZE_STATIC_ASSERT( AF == unaligned || PF == padded || M % SIMDSIZE == 0UL );
3889 BLAZE_STATIC_ASSERT( PF == unpadded || MM % SIMDSIZE == 0UL );
3890 BLAZE_STATIC_ASSERT( MM >= M );
3891 BLAZE_STATIC_ASSERT( IsVectorizable_v<Type> || MM == M );
3892 //**********************************************************************************************
3893};
3895//*************************************************************************************************
3896
3897
3898
3899
3900//=================================================================================================
3901//
3902// xex
3903//
3904//=================================================================================================
3905
3906//*************************************************************************************************
3920template< typename Type // Data type of the matrix
3921 , size_t M // Number of rows
3922 , size_t N // Number of columns
3923 , AlignmentFlag AF // Alignment flag
3924 , PaddingFlag PF // Padding flag
3925 , typename Tag > // Type tag
3926inline StaticMatrix<Type,M,N,true,AF,PF,Tag>::StaticMatrix()
3927#if BLAZE_USE_DEFAULT_INITIALIZATION
3928 : v_() // The statically allocated matrix elements
3929#endif
3930{
3931#if !BLAZE_USE_DEFAULT_INITIALIZATION
3932 using blaze::clear;
3933
3934 if( IsNumeric_v<Type> && PF == padded ) {
3935 for( size_t j=0UL; j<N; ++j )
3936 for( size_t i=M; i<MM; ++i )
3937 clear( v_[i+j*MM] );
3938 }
3939#endif
3940
3941 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3942}
3944//*************************************************************************************************
3945
3946
3947//*************************************************************************************************
3953template< typename Type // Data type of the matrix
3954 , size_t M // Number of rows
3955 , size_t N // Number of columns
3956 , AlignmentFlag AF // Alignment flag
3957 , PaddingFlag PF // Padding flag
3958 , typename Tag > // Type tag
3960 // v_ is intentionally left uninitialized
3961{
3962 using blaze::clear;
3963
3964 for( size_t j=0UL; j<N; ++j ) {
3965 for( size_t i=0UL; i<M; ++i )
3966 v_[i+j*MM] = init;
3967
3968 for( size_t i=M; i<MM; ++i )
3969 clear( v_[i+j*MM] );
3970 }
3971
3972 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3973}
3975//*************************************************************************************************
3976
3977
3978//*************************************************************************************************
4001template< typename Type // Data type of the matrix
4002 , size_t M // Number of rows
4003 , size_t N // Number of columns
4004 , AlignmentFlag AF // Alignment flag
4005 , PaddingFlag PF // Padding flag
4006 , typename Tag > // Type tag
4008 : v_() // The statically allocated matrix elements
4009{
4010 if( list.size() != M || determineColumns( list ) > N ) {
4011 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static matrix" );
4012 }
4013
4014 size_t i( 0UL );
4015
4016 for( const auto& rowList : list ) {
4017 size_t j( 0UL );
4018 for( const auto& element : rowList ) {
4019 v_[i+j*MM] = element;
4020 ++j;
4021 }
4022 ++i;
4023 }
4024
4025 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4026}
4028//*************************************************************************************************
4029
4030
4031//*************************************************************************************************
4058template< typename Type // Data type of the matrix
4059 , size_t M // Number of rows
4060 , size_t N // Number of columns
4061 , AlignmentFlag AF // Alignment flag
4062 , PaddingFlag PF // Padding flag
4063 , typename Tag > // Type tag
4064template< typename Other > // Data type of the initialization array
4065inline StaticMatrix<Type,M,N,true,AF,PF,Tag>::StaticMatrix( size_t m, size_t n, const Other* array )
4066 // v_ is intentionally left uninitialized
4067{
4068 using blaze::clear;
4069
4070 if( m > M || n > N ) {
4071 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static matrix" );
4072 }
4073
4074 for( size_t j=0UL; j<n; ++j ) {
4075 for( size_t i=0UL; i<m; ++i )
4076 v_[i+j*MM] = array[i+j*m];
4077
4078 if( IsNumeric_v<Type> ) {
4079 for( size_t i=m; i<MM; ++i )
4080 clear( v_[i+j*MM] );
4081 }
4082 }
4083
4084 if( IsNumeric_v<Type> ) {
4085 for( size_t j=n; j<N; ++j ) {
4086 for( size_t i=0UL; i<MM; ++i )
4087 clear( v_[i+j*MM] );
4088 }
4089 }
4090
4091 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4092}
4094//*************************************************************************************************
4095
4096
4097//*************************************************************************************************
4118template< typename Type // Data type of the matrix
4119 , size_t M // Number of rows
4120 , size_t N // Number of columns
4121 , AlignmentFlag AF // Alignment flag
4122 , PaddingFlag PF // Padding flag
4123 , typename Tag > // Type tag
4124template< typename Other // Data type of the static array
4125 , size_t Rows // Number of rows of the static array
4126 , size_t Cols > // Number of columns of the static array
4127inline StaticMatrix<Type,M,N,true,AF,PF,Tag>::StaticMatrix( const Other (&array)[Rows][Cols] )
4128 // v_ is intentionally left uninitialized
4129{
4130 using blaze::clear;
4131
4132 BLAZE_STATIC_ASSERT( Rows == M && Cols == N );
4133
4134 for( size_t j=0UL; j<N; ++j ) {
4135 for( size_t i=0UL; i<M; ++i )
4136 v_[i+j*MM] = array[i][j];
4137
4138 for( size_t i=M; i<MM; ++i )
4139 clear( v_[i+j*MM] );
4140 }
4141
4142 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4143}
4145//*************************************************************************************************
4146
4147
4148//*************************************************************************************************
4169template< typename Type // Data type of the matrix
4170 , size_t M // Number of rows
4171 , size_t N // Number of columns
4172 , AlignmentFlag AF // Alignment flag
4173 , PaddingFlag PF // Padding flag
4174 , typename Tag > // Type tag
4175template< typename Other // Data type of the std::array
4176 , size_t Rows // Number of rows of the std::array
4177 , size_t Cols > // Number of columns of the std::array
4178inline StaticMatrix<Type,M,N,true,AF,PF,Tag>::StaticMatrix( const std::array<std::array<Other,Cols>,Rows>& array )
4179 // v_ is intentionally left uninitialized
4180{
4181 using blaze::clear;
4182
4183 BLAZE_STATIC_ASSERT( Rows == M && Cols == N );
4184
4185 for( size_t j=0UL; j<N; ++j ) {
4186 for( size_t i=0UL; i<M; ++i )
4187 v_[i+j*MM] = array[i][j];
4188
4189 for( size_t i=M; i<MM; ++i )
4190 clear( v_[i+j*MM] );
4191 }
4192
4193 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4194}
4196//*************************************************************************************************
4197
4198
4199//*************************************************************************************************
4207template< typename Type // Data type of the matrix
4208 , size_t M // Number of rows
4209 , size_t N // Number of columns
4210 , AlignmentFlag AF // Alignment flag
4211 , PaddingFlag PF // Padding flag
4212 , typename Tag > // Type tag
4213constexpr StaticMatrix<Type,M,N,true,AF,PF,Tag>::StaticMatrix( const StaticMatrix& m )
4214 : BaseType() // Initialization of the base class
4215 , v_( m.v_ ) // The statically allocated matrix elements
4216{
4217 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4218}
4220//*************************************************************************************************
4221
4222
4223//*************************************************************************************************
4229template< typename Type // Data type of the matrix
4230 , size_t M // Number of rows
4231 , size_t N // Number of columns
4232 , AlignmentFlag AF // Alignment flag
4233 , PaddingFlag PF // Padding flag
4234 , typename Tag > // Type tag
4235template< typename Other // Data type of the foreign matrix
4236 , bool SO2 // Storage order of the foreign matrix
4237 , AlignmentFlag AF2 // Alignment flag of the foreign matrix
4238 , PaddingFlag PF2 > // Padding flag of the foreign matrix
4239inline StaticMatrix<Type,M,N,true,AF,PF,Tag>::StaticMatrix( const StaticMatrix<Other,M,N,SO2,AF2,PF2,Tag>& m )
4240 // v_ is intentionally left uninitialized
4241{
4242 using blaze::clear;
4243
4244 for( size_t j=0UL; j<N; ++j ) {
4245 for( size_t i=0UL; i<M; ++i )
4246 v_[i+j*MM] = m(i,j);
4247
4248 for( size_t i=M; i<MM; ++i )
4249 clear( v_[i+j*MM] );
4250 }
4251
4252 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4253}
4255//*************************************************************************************************
4256
4257
4258//*************************************************************************************************
4269template< typename Type // Data type of the matrix
4270 , size_t M // Number of rows
4271 , size_t N // Number of columns
4272 , AlignmentFlag AF // Alignment flag
4273 , PaddingFlag PF // Padding flag
4274 , typename Tag > // Type tag
4275template< typename MT // Type of the foreign matrix
4276 , bool SO > // Storage order of the foreign matrix
4277inline StaticMatrix<Type,M,N,true,AF,PF,Tag>::StaticMatrix( const Matrix<MT,SO>& m )
4278 // v_ is intentionally left uninitialized
4279{
4280 using blaze::assign;
4281 using blaze::clear;
4282
4283 BLAZE_CONSTRAINT_MUST_BE_SAME_TAG( Tag, TagType_t<MT> );
4284
4285 if( (*m).rows() != M || (*m).columns() != N ) {
4286 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static matrix" );
4287 }
4288
4289 for( size_t j=0UL; j<N; ++j ) {
4290 for( size_t i=( IsSparseMatrix_v<MT> ? 0UL : M ); i<MM; ++i ) {
4291 clear( v_[i+j*MM] );
4292 }
4293 }
4294
4295 assign( *this, *m );
4296
4297 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4298}
4300//*************************************************************************************************
4301
4302
4303
4304
4305//=================================================================================================
4306//
4307// DATA ACCESS FUNCTIONS
4308//
4309//=================================================================================================
4310
4311//*************************************************************************************************
4322template< typename Type // Data type of the matrix
4323 , size_t M // Number of rows
4324 , size_t N // Number of columns
4325 , AlignmentFlag AF // Alignment flag
4326 , PaddingFlag PF // Padding flag
4327 , typename Tag > // Type tag
4329 StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator()( size_t i, size_t j ) noexcept
4330{
4331 BLAZE_USER_ASSERT( i<M, "Invalid row access index" );
4332 BLAZE_USER_ASSERT( j<N, "Invalid column access index" );
4333 return v_[i+j*MM];
4334}
4336//*************************************************************************************************
4337
4338
4339//*************************************************************************************************
4350template< typename Type // Data type of the matrix
4351 , size_t M // Number of rows
4352 , size_t N // Number of columns
4353 , AlignmentFlag AF // Alignment flag
4354 , PaddingFlag PF // Padding flag
4355 , typename Tag > // Type tag
4357 StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator()( size_t i, size_t j ) const noexcept
4358{
4359 BLAZE_USER_ASSERT( i<M, "Invalid row access index" );
4360 BLAZE_USER_ASSERT( j<N, "Invalid column access index" );
4361 return v_[i+j*MM];
4362}
4364//*************************************************************************************************
4365
4366
4367//*************************************************************************************************
4379template< typename Type // Data type of the matrix
4380 , size_t M // Number of rows
4381 , size_t N // Number of columns
4382 , AlignmentFlag AF // Alignment flag
4383 , PaddingFlag PF // Padding flag
4384 , typename Tag > // Type tag
4386 StaticMatrix<Type,M,N,true,AF,PF,Tag>::at( size_t i, size_t j )
4387{
4388 if( i >= M ) {
4389 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
4390 }
4391 if( j >= N ) {
4392 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
4393 }
4394 return (*this)(i,j);
4395}
4397//*************************************************************************************************
4398
4399
4400//*************************************************************************************************
4412template< typename Type // Data type of the matrix
4413 , size_t M // Number of rows
4414 , size_t N // Number of columns
4415 , AlignmentFlag AF // Alignment flag
4416 , PaddingFlag PF // Padding flag
4417 , typename Tag > // Type tag
4419 StaticMatrix<Type,M,N,true,AF,PF,Tag>::at( size_t i, size_t j ) const
4420{
4421 if( i >= M ) {
4422 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
4423 }
4424 if( j >= N ) {
4425 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
4426 }
4427 return (*this)(i,j);
4428}
4430//*************************************************************************************************
4431
4432
4433//*************************************************************************************************
4445template< typename Type // Data type of the matrix
4446 , size_t M // Number of rows
4447 , size_t N // Number of columns
4448 , AlignmentFlag AF // Alignment flag
4449 , PaddingFlag PF // Padding flag
4450 , typename Tag > // Type tag
4453{
4454 return v_;
4455}
4457//*************************************************************************************************
4458
4459
4460//*************************************************************************************************
4472template< typename Type // Data type of the matrix
4473 , size_t M // Number of rows
4474 , size_t N // Number of columns
4475 , AlignmentFlag AF // Alignment flag
4476 , PaddingFlag PF // Padding flag
4477 , typename Tag > // Type tag
4480{
4481 return v_;
4482}
4484//*************************************************************************************************
4485
4486
4487//*************************************************************************************************
4496template< typename Type // Data type of the matrix
4497 , size_t M // Number of rows
4498 , size_t N // Number of columns
4499 , AlignmentFlag AF // Alignment flag
4500 , PaddingFlag PF // Padding flag
4501 , typename Tag > // Type tag
4504{
4505 BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4506 return v_ + j*MM;
4507}
4509//*************************************************************************************************
4510
4511
4512//*************************************************************************************************
4521template< typename Type // Data type of the matrix
4522 , size_t M // Number of rows
4523 , size_t N // Number of columns
4524 , AlignmentFlag AF // Alignment flag
4525 , PaddingFlag PF // Padding flag
4526 , typename Tag > // Type tag
4528 StaticMatrix<Type,M,N,true,AF,PF,Tag>::data( size_t j ) const noexcept
4529{
4530 BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4531 return v_ + j*MM;
4532}
4534//*************************************************************************************************
4535
4536
4537//*************************************************************************************************
4544template< typename Type // Data type of the matrix
4545 , size_t M // Number of rows
4546 , size_t N // Number of columns
4547 , AlignmentFlag AF // Alignment flag
4548 , PaddingFlag PF // Padding flag
4549 , typename Tag > // Type tag
4552{
4553 BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4554 return Iterator( v_ + j*MM );
4555}
4557//*************************************************************************************************
4558
4559
4560//*************************************************************************************************
4567template< typename Type // Data type of the matrix
4568 , size_t M // Number of rows
4569 , size_t N // Number of columns
4570 , AlignmentFlag AF // Alignment flag
4571 , PaddingFlag PF // Padding flag
4572 , typename Tag > // Type tag
4574 StaticMatrix<Type,M,N,true,AF,PF,Tag>::begin( size_t j ) const noexcept
4575{
4576 BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4577 return ConstIterator( v_ + j*MM );
4578}
4580//*************************************************************************************************
4581
4582
4583//*************************************************************************************************
4590template< typename Type // Data type of the matrix
4591 , size_t M // Number of rows
4592 , size_t N // Number of columns
4593 , AlignmentFlag AF // Alignment flag
4594 , PaddingFlag PF // Padding flag
4595 , typename Tag > // Type tag
4597 StaticMatrix<Type,M,N,true,AF,PF,Tag>::cbegin( size_t j ) const noexcept
4598{
4599 BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4600 return ConstIterator( v_ + j*MM );
4601}
4603//*************************************************************************************************
4604
4605
4606//*************************************************************************************************
4613template< typename Type // Data type of the matrix
4614 , size_t M // Number of rows
4615 , size_t N // Number of columns
4616 , AlignmentFlag AF // Alignment flag
4617 , PaddingFlag PF // Padding flag
4618 , typename Tag > // Type tag
4621{
4622 BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4623 return Iterator( v_ + j*MM + M );
4624}
4626//*************************************************************************************************
4627
4628
4629//*************************************************************************************************
4636template< typename Type // Data type of the matrix
4637 , size_t M // Number of rows
4638 , size_t N // Number of columns
4639 , AlignmentFlag AF // Alignment flag
4640 , PaddingFlag PF // Padding flag
4641 , typename Tag > // Type tag
4643 StaticMatrix<Type,M,N,true,AF,PF,Tag>::end( size_t j ) const noexcept
4644{
4645 BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4646 return ConstIterator( v_ + j*MM + M );
4647}
4649//*************************************************************************************************
4650
4651
4652//*************************************************************************************************
4659template< typename Type // Data type of the matrix
4660 , size_t M // Number of rows
4661 , size_t N // Number of columns
4662 , AlignmentFlag AF // Alignment flag
4663 , PaddingFlag PF // Padding flag
4664 , typename Tag > // Type tag
4666 StaticMatrix<Type,M,N,true,AF,PF,Tag>::cend( size_t j ) const noexcept
4667{
4668 BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4669 return ConstIterator( v_ + j*MM + M );
4670}
4672//*************************************************************************************************
4673
4674
4675
4676
4677//=================================================================================================
4678//
4679// ASSIGNMENT OPERATORS
4680//
4681//=================================================================================================
4682
4683//*************************************************************************************************
4690template< typename Type // Data type of the matrix
4691 , size_t M // Number of rows
4692 , size_t N // Number of columns
4693 , AlignmentFlag AF // Alignment flag
4694 , PaddingFlag PF // Padding flag
4695 , typename Tag > // Type tag
4696constexpr StaticMatrix<Type,M,N,true,AF,PF,Tag>&
4698{
4699 for( size_t j=0UL; j<N; ++j )
4700 for( size_t i=0UL; i<M; ++i )
4701 v_[i+j*MM] = set;
4702
4703 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4704
4705 return *this;
4706}
4708//*************************************************************************************************
4709
4710
4711//*************************************************************************************************
4735template< typename Type // Data type of the matrix
4736 , size_t M // Number of rows
4737 , size_t N // Number of columns
4738 , AlignmentFlag AF // Alignment flag
4739 , PaddingFlag PF // Padding flag
4740 , typename Tag > // Type tag
4741constexpr StaticMatrix<Type,M,N,true,AF,PF,Tag>&
4743{
4744 using blaze::clear;
4745
4746 if( list.size() != M || determineColumns( list ) > N ) {
4747 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to static matrix" );
4748 }
4749
4750 size_t i( 0UL );
4751
4752 for( const auto& rowList : list ) {
4753 size_t j( 0UL );
4754 for( const auto& element : rowList ) {
4755 v_[i+j*MM] = element;
4756 ++j;
4757 }
4758 for( ; j<N; ++j ) {
4759 clear( v_[i+j*MM] );
4760 }
4761 ++i;
4762 }
4763
4764 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4765
4766 return *this;
4767}
4769//*************************************************************************************************
4770
4771
4772//*************************************************************************************************
4794template< typename Type // Data type of the matrix
4795 , size_t M // Number of rows
4796 , size_t N // Number of columns
4797 , AlignmentFlag AF // Alignment flag
4798 , PaddingFlag PF // Padding flag
4799 , typename Tag > // Type tag
4800template< typename Other // Data type of the static array
4801 , size_t Rows // Number of rows of the static array
4802 , size_t Cols > // Number of columns of the static array
4803inline StaticMatrix<Type,M,N,true,AF,PF,Tag>&
4804 StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator=( const Other (&array)[Rows][Cols] ) &
4805{
4806 BLAZE_STATIC_ASSERT( Rows == M && Cols == N );
4807
4808 for( size_t j=0UL; j<N; ++j )
4809 for( size_t i=0UL; i<M; ++i )
4810 v_[i+j*MM] = array[i][j];
4811
4812 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4813
4814 return *this;
4815}
4817//*************************************************************************************************
4818
4819
4820//*************************************************************************************************
4841template< typename Type // Data type of the matrix
4842 , size_t M // Number of rows
4843 , size_t N // Number of columns
4844 , AlignmentFlag AF // Alignment flag
4845 , PaddingFlag PF // Padding flag
4846 , typename Tag > // Type tag
4847template< typename Other // Data type of the static array
4848 , size_t Rows // Number of rows of the static array
4849 , size_t Cols > // Number of columns of the static array
4850inline StaticMatrix<Type,M,N,true,AF,PF,Tag>&
4851 StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator=( const std::array<std::array<Other,Cols>,Rows>& array ) &
4852{
4853 BLAZE_STATIC_ASSERT( Rows == M && Cols == N );
4854
4855 for( size_t j=0UL; j<N; ++j )
4856 for( size_t i=0UL; i<M; ++i )
4857 v_[i+j*MM] = array[i][j];
4858
4859 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4860
4861 return *this;
4862}
4863//*************************************************************************************************
4864
4865
4866//*************************************************************************************************
4875template< typename Type // Data type of the matrix
4876 , size_t M // Number of rows
4877 , size_t N // Number of columns
4878 , AlignmentFlag AF // Alignment flag
4879 , PaddingFlag PF // Padding flag
4880 , typename Tag > // Type tag
4883{
4884 v_ = rhs.v_;
4885
4886 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4887
4888 return *this;
4889}
4891//*************************************************************************************************
4892
4893
4894//*************************************************************************************************
4901template< typename Type // Data type of the matrix
4902 , size_t M // Number of rows
4903 , size_t N // Number of columns
4904 , AlignmentFlag AF // Alignment flag
4905 , PaddingFlag PF // Padding flag
4906 , typename Tag > // Type tag
4907template< typename Other // Data type of the foreign matrix
4908 , bool SO2 // Storage order of the foreign matrix
4909 , AlignmentFlag AF2 // Alignment flag of the foreign matrix
4910 , PaddingFlag PF2 > // Padding flag of the foreign matrix
4911inline StaticMatrix<Type,M,N,true,AF,PF,Tag>&
4912 StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator=( const StaticMatrix<Other,M,N,SO2,AF2,PF2,Tag>& rhs ) &
4913{
4914 using blaze::assign;
4915
4916 assign( *this, *rhs );
4917
4918 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4919
4920 return *this;
4921}
4923//*************************************************************************************************
4924
4925
4926//*************************************************************************************************
4938template< typename Type // Data type of the matrix
4939 , size_t M // Number of rows
4940 , size_t N // Number of columns
4941 , AlignmentFlag AF // Alignment flag
4942 , PaddingFlag PF // Padding flag
4943 , typename Tag > // Type tag
4944template< typename MT // Type of the right-hand side matrix
4945 , bool SO > // Storage order of the right-hand side matrix
4946inline StaticMatrix<Type,M,N,true,AF,PF,Tag>&
4947 StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator=( const Matrix<MT,SO>& rhs ) &
4948{
4949 using blaze::assign;
4950
4951 using TT = decltype( trans( *this ) );
4952 using CT = decltype( ctrans( *this ) );
4953 using IT = decltype( inv( *this ) );
4954
4955 BLAZE_CONSTRAINT_MUST_BE_SAME_TAG( Tag, TagType_t<MT> );
4956
4957 if( (*rhs).rows() != M || (*rhs).columns() != N ) {
4958 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to static matrix" );
4959 }
4960
4961 if( IsSame_v<MT,TT> && (*rhs).isAliased( this ) ) {
4962 transpose( typename IsSquare<This>::Type() );
4963 }
4964 else if( IsSame_v<MT,CT> && (*rhs).isAliased( this ) ) {
4965 ctranspose( typename IsSquare<This>::Type() );
4966 }
4967 else if( !IsSame_v<MT,IT> && (*rhs).canAlias( this ) ) {
4968 StaticMatrix tmp( *rhs );
4969 assign( *this, tmp );
4970 }
4971 else {
4972 if( IsSparseMatrix_v<MT> )
4973 reset();
4974 assign( *this, *rhs );
4975 }
4976
4977 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4978
4979 return *this;
4980}
4982//*************************************************************************************************
4983
4984
4985//*************************************************************************************************
4996template< typename Type // Data type of the matrix
4997 , size_t M // Number of rows
4998 , size_t N // Number of columns
4999 , AlignmentFlag AF // Alignment flag
5000 , PaddingFlag PF // Padding flag
5001 , typename Tag > // Type tag
5002template< typename MT // Type of the right-hand side matrix
5003 , bool SO > // Storage order of the right-hand side matrix
5004inline StaticMatrix<Type,M,N,true,AF,PF,Tag>&
5005 StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator+=( const Matrix<MT,SO>& rhs ) &
5006{
5007 using blaze::addAssign;
5008
5009 BLAZE_CONSTRAINT_MUST_BE_SAME_TAG( Tag, TagType_t<MT> );
5010
5011 if( (*rhs).rows() != M || (*rhs).columns() != N ) {
5012 BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
5013 }
5014
5015 if( (*rhs).canAlias( this ) ) {
5016 const ResultType_t<MT> tmp( *rhs );
5017 addAssign( *this, tmp );
5018 }
5019 else {
5020 addAssign( *this, *rhs );
5021 }
5022
5023 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
5024
5025 return *this;
5026}
5028//*************************************************************************************************
5029
5030
5031//*************************************************************************************************
5042template< typename Type // Data type of the matrix
5043 , size_t M // Number of rows
5044 , size_t N // Number of columns
5045 , AlignmentFlag AF // Alignment flag
5046 , PaddingFlag PF // Padding flag
5047 , typename Tag > // Type tag
5048template< typename MT // Type of the right-hand side matrix
5049 , bool SO > // Storage order of the right-hand side matrix
5050inline StaticMatrix<Type,M,N,true,AF,PF,Tag>&
5051 StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator-=( const Matrix<MT,SO>& rhs ) &
5052{
5053 using blaze::subAssign;
5054
5055 BLAZE_CONSTRAINT_MUST_BE_SAME_TAG( Tag, TagType_t<MT> );
5056
5057 if( (*rhs).rows() != M || (*rhs).columns() != N ) {
5058 BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
5059 }
5060
5061 if( (*rhs).canAlias( this ) ) {
5062 const ResultType_t<MT> tmp( *rhs );
5063 subAssign( *this, tmp );
5064 }
5065 else {
5066 subAssign( *this, *rhs );
5067 }
5068
5069 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
5070
5071 return *this;
5072}
5074//*************************************************************************************************
5075
5076
5077//*************************************************************************************************
5088template< typename Type // Data type of the matrix
5089 , size_t M // Number of rows
5090 , size_t N // Number of columns
5091 , AlignmentFlag AF // Alignment flag
5092 , PaddingFlag PF // Padding flag
5093 , typename Tag > // Type tag
5094template< typename MT // Type of the right-hand side matrix
5095 , bool SO > // Storage order of the right-hand side matrix
5096inline StaticMatrix<Type,M,N,true,AF,PF,Tag>&
5097 StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator%=( const Matrix<MT,SO>& rhs ) &
5098{
5099 using blaze::schurAssign;
5100
5101 BLAZE_CONSTRAINT_MUST_BE_SAME_TAG( Tag, TagType_t<MT> );
5102
5103 if( (*rhs).rows() != M || (*rhs).columns() != N ) {
5104 BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
5105 }
5106
5107 if( (*rhs).canAlias( this ) ) {
5108 const ResultType_t<MT> tmp( *rhs );
5109 schurAssign( *this, tmp );
5110 }
5111 else {
5112 schurAssign( *this, *rhs );
5113 }
5114
5115 BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
5116
5117 return *this;
5118}
5120//*************************************************************************************************
5121
5122
5123
5124
5125//=================================================================================================
5126//
5127// UTILITY FUNCTIONS
5128//
5129//=================================================================================================
5130
5131//*************************************************************************************************
5137template< typename Type // Data type of the matrix
5138 , size_t M // Number of rows
5139 , size_t N // Number of columns
5140 , AlignmentFlag AF // Alignment flag
5141 , PaddingFlag PF // Padding flag
5142 , typename Tag > // Type tag
5143constexpr size_t StaticMatrix<Type,M,N,true,AF,PF,Tag>::rows() noexcept
5144{
5145 return M;
5146}
5148//*************************************************************************************************
5149
5150
5151//*************************************************************************************************
5157template< typename Type // Data type of the matrix
5158 , size_t M // Number of rows
5159 , size_t N // Number of columns
5160 , AlignmentFlag AF // Alignment flag
5161 , PaddingFlag PF // Padding flag
5162 , typename Tag > // Type tag
5163constexpr size_t StaticMatrix<Type,M,N,true,AF,PF,Tag>::columns() noexcept
5164{
5165 return N;
5166}
5168//*************************************************************************************************
5169
5170
5171//*************************************************************************************************
5180template< typename Type // Data type of the matrix
5181 , size_t M // Number of rows
5182 , size_t N // Number of columns
5183 , AlignmentFlag AF // Alignment flag
5184 , PaddingFlag PF // Padding flag
5185 , typename Tag > // Type tag
5186constexpr size_t StaticMatrix<Type,M,N,true,AF,PF,Tag>::spacing() noexcept
5187{
5188 return MM;
5189}
5191//*************************************************************************************************
5192
5193
5194//*************************************************************************************************
5200template< typename Type // Data type of the matrix
5201 , size_t M // Number of rows
5202 , size_t N // Number of columns
5203 , AlignmentFlag AF // Alignment flag
5204 , PaddingFlag PF // Padding flag
5205 , typename Tag > // Type tag
5206constexpr size_t StaticMatrix<Type,M,N,true,AF,PF,Tag>::capacity() noexcept
5207{
5208 return MM*N;
5209}
5211//*************************************************************************************************
5212
5213
5214//*************************************************************************************************
5221template< typename Type // Data type of the matrix
5222 , size_t M // Number of rows
5223 , size_t N // Number of columns
5224 , AlignmentFlag AF // Alignment flag
5225 , PaddingFlag PF // Padding flag
5226 , typename Tag > // Type tag
5227inline size_t StaticMatrix<Type,M,N,true,AF,PF,Tag>::capacity( size_t j ) const noexcept
5228{
5229 MAYBE_UNUSED( j );
5230
5231 BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
5232
5233 return MM;
5234}
5236//*************************************************************************************************
5237
5238
5239//*************************************************************************************************
5249template< typename Type // Data type of the matrix
5250 , size_t M // Number of rows
5251 , size_t N // Number of columns
5252 , AlignmentFlag AF // Alignment flag
5253 , PaddingFlag PF // Padding flag
5254 , typename Tag > // Type tag
5256{
5257 size_t nonzeros( 0UL );
5258
5259 for( size_t j=0UL; j<N; ++j )
5260 for( size_t i=0UL; i<M; ++i )
5261 if( !isDefault<strict>( v_[i+j*MM] ) )
5262 ++nonzeros;
5263
5264 return nonzeros;
5265}
5267//*************************************************************************************************
5268
5269
5270//*************************************************************************************************
5280template< typename Type // Data type of the matrix
5281 , size_t M // Number of rows
5282 , size_t N // Number of columns
5283 , AlignmentFlag AF // Alignment flag
5284 , PaddingFlag PF // Padding flag
5285 , typename Tag > // Type tag
5286inline size_t StaticMatrix<Type,M,N,true,AF,PF,Tag>::nonZeros( size_t j ) const
5287{
5288 BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
5289
5290 const size_t iend( j*MM + M );
5291 size_t nonzeros( 0UL );
5292
5293 for( size_t i=j*MM; i<iend; ++i )
5294 if( !isDefault<strict>( v_[i] ) )
5295 ++nonzeros;
5296
5297 return nonzeros;
5298}
5300//*************************************************************************************************
5301
5302
5303//*************************************************************************************************
5309template< typename Type // Data type of the matrix
5310 , size_t M // Number of rows
5311 , size_t N // Number of columns
5312 , AlignmentFlag AF // Alignment flag
5313 , PaddingFlag PF // Padding flag
5314 , typename Tag > // Type tag
5316{
5317 using blaze::clear;
5318
5319 for( size_t j=0UL; j<N; ++j )
5320 for( size_t i=0UL; i<M; ++i )
5321 clear( v_[i+j*MM] );
5322}
5324//*************************************************************************************************
5325
5326
5327//*************************************************************************************************
5337template< typename Type // Data type of the matrix
5338 , size_t M // Number of rows
5339 , size_t N // Number of columns
5340 , AlignmentFlag AF // Alignment flag
5341 , PaddingFlag PF // Padding flag
5342 , typename Tag > // Type tag
5344{
5345 using blaze::clear;
5346
5347 BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
5348 for( size_t i=0UL; i<M; ++i )
5349 clear( v_[i+j*MM] );
5350}
5352//*************************************************************************************************
5353
5354
5355//*************************************************************************************************
5362template< typename Type // Data type of the matrix
5363 , size_t M // Number of rows
5364 , size_t N // Number of columns
5365 , AlignmentFlag AF // Alignment flag
5366 , PaddingFlag PF // Padding flag
5367 , typename Tag > // Type tag
5368inline void StaticMatrix<Type,M,N,true,AF,PF,Tag>::swap( StaticMatrix& m ) noexcept
5369{
5370 using std::swap;
5371
5372 for( size_t j=0UL; j<N; ++j ) {
5373 for( size_t i=0UL; i<M; ++i ) {
5374 swap( v_[i+j*MM], m(i,j) );
5375 }
5376 }
5377}
5379//*************************************************************************************************
5380
5381
5382
5383
5384//=================================================================================================
5385//
5386// NUMERIC FUNCTIONS
5387//
5388//=================================================================================================
5389
5390//*************************************************************************************************
5399template< typename Type // Data type of the matrix
5400 , size_t M // Number of rows
5401 , size_t N // Number of columns
5402 , AlignmentFlag AF // Alignment flag
5403 , PaddingFlag PF // Padding flag
5404 , typename Tag > // Type tag
5405inline StaticMatrix<Type,M,N,true,AF,PF,Tag>&
5407{
5408 using std::swap;
5409
5410 BLAZE_STATIC_ASSERT( M == N );
5411
5412 for( size_t j=1UL; j<N; ++j )
5413 for( size_t i=0UL; i<j; ++i )
5414 swap( v_[i+j*MM], v_[j+i*MM] );
5415
5416 return *this;
5417}
5419//*************************************************************************************************
5420
5421
5422//*************************************************************************************************
5436template< typename Type // Data type of the matrix
5437 , size_t M // Number of rows
5438 , size_t N // Number of columns
5439 , AlignmentFlag AF // Alignment flag
5440 , PaddingFlag PF // Padding flag
5441 , typename Tag > // Type tag
5443{
5444 transpose();
5445}
5447//*************************************************************************************************
5448
5449
5450//*************************************************************************************************
5464template< typename Type // Data type of the matrix
5465 , size_t M // Number of rows
5466 , size_t N // Number of columns
5467 , AlignmentFlag AF // Alignment flag
5468 , PaddingFlag PF // Padding flag
5469 , typename Tag > // Type tag
5471{}
5473//*************************************************************************************************
5474
5475
5476//*************************************************************************************************
5485template< typename Type // Data type of the matrix
5486 , size_t M // Number of rows
5487 , size_t N // Number of columns
5488 , AlignmentFlag AF // Alignment flag
5489 , PaddingFlag PF // Padding flag
5490 , typename Tag > // Type tag
5491inline StaticMatrix<Type,M,N,true,AF,PF,Tag>&
5493{
5494 BLAZE_STATIC_ASSERT( M == N );
5495
5496 for( size_t j=0UL; j<N; ++j ) {
5497 for( size_t i=0UL; i<j; ++i ) {
5498 cswap( v_[i+j*MM], v_[j+i*MM] );
5499 }
5500 conjugate( v_[j+j*MM] );
5501 }
5502
5503 return *this;
5504}
5506//*************************************************************************************************
5507
5508
5509//*************************************************************************************************
5523template< typename Type // Data type of the matrix
5524 , size_t M // Number of rows
5525 , size_t N // Number of columns
5526 , AlignmentFlag AF // Alignment flag
5527 , PaddingFlag PF // Padding flag
5528 , typename Tag > // Type tag
5530{
5531 ctranspose();
5532}
5534//*************************************************************************************************
5535
5536
5537//*************************************************************************************************
5551template< typename Type // Data type of the matrix
5552 , size_t M // Number of rows
5553 , size_t N // Number of columns
5554 , AlignmentFlag AF // Alignment flag
5555 , PaddingFlag PF // Padding flag
5556 , typename Tag > // Type tag
5558{}
5560//*************************************************************************************************
5561
5562
5563//*************************************************************************************************
5581template< typename Type // Data type of the matrix
5582 , size_t M // Number of rows
5583 , size_t N // Number of columns
5584 , AlignmentFlag AF // Alignment flag
5585 , PaddingFlag PF // Padding flag
5586 , typename Tag > // Type tag
5587template< typename Other > // Data type of the scalar value
5588inline StaticMatrix<Type,M,N,true,AF,PF,Tag>&
5589 StaticMatrix<Type,M,N,true,AF,PF,Tag>::scale( const Other& scalar )
5590{
5591 for( size_t j=0UL; j<N; ++j )
5592 for( size_t i=0UL; i<M; ++i )
5593 v_[i+j*MM] *= scalar;
5594
5595 return *this;
5596}
5598//*************************************************************************************************
5599
5600
5601
5602
5603//=================================================================================================
5604//
5605// MEMORY FUNCTIONS
5606//
5607//=================================================================================================
5608
5609//*************************************************************************************************
5620template< typename Type // Data type of the matrix
5621 , size_t M // Number of rows
5622 , size_t N // Number of columns
5623 , AlignmentFlag AF // Alignment flag
5624 , PaddingFlag PF // Padding flag
5625 , typename Tag > // Type tag
5626inline void* StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator new( std::size_t size )
5627{
5628 MAYBE_UNUSED( size );
5629
5630 BLAZE_INTERNAL_ASSERT( size == sizeof( StaticMatrix ), "Invalid number of bytes detected" );
5631
5632 return allocate<StaticMatrix>( 1UL );
5633}
5635//*************************************************************************************************
5636
5637
5638//*************************************************************************************************
5649template< typename Type // Data type of the matrix
5650 , size_t M // Number of rows
5651 , size_t N // Number of columns
5652 , AlignmentFlag AF // Alignment flag
5653 , PaddingFlag PF // Padding flag
5654 , typename Tag > // Type tag
5655inline void* StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator new[]( std::size_t size )
5656{
5657 BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticMatrix ) , "Invalid number of bytes detected" );
5658 BLAZE_INTERNAL_ASSERT( size % sizeof( StaticMatrix ) == 0UL, "Invalid number of bytes detected" );
5659
5660 return allocate<StaticMatrix>( size/sizeof(StaticMatrix) );
5661}
5663//*************************************************************************************************
5664
5665
5666//*************************************************************************************************
5677template< typename Type // Data type of the matrix
5678 , size_t M // Number of rows
5679 , size_t N // Number of columns
5680 , AlignmentFlag AF // Alignment flag
5681 , PaddingFlag PF // Padding flag
5682 , typename Tag > // Type tag
5683inline void* StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator new( std::size_t size, const std::nothrow_t& )
5684{
5685 MAYBE_UNUSED( size );
5686
5687 BLAZE_INTERNAL_ASSERT( size == sizeof( StaticMatrix ), "Invalid number of bytes detected" );
5688
5689 return allocate<StaticMatrix>( 1UL );
5690}
5692//*************************************************************************************************
5693
5694
5695//*************************************************************************************************
5706template< typename Type // Data type of the matrix
5707 , size_t M // Number of rows
5708 , size_t N // Number of columns
5709 , AlignmentFlag AF // Alignment flag
5710 , PaddingFlag PF // Padding flag
5711 , typename Tag > // Type tag
5712inline void* StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator new[]( std::size_t size, const std::nothrow_t& )
5713{
5714 BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticMatrix ) , "Invalid number of bytes detected" );
5715 BLAZE_INTERNAL_ASSERT( size % sizeof( StaticMatrix ) == 0UL, "Invalid number of bytes detected" );
5716
5717 return allocate<StaticMatrix>( size/sizeof(StaticMatrix) );
5718}
5720//*************************************************************************************************
5721
5722
5723//*************************************************************************************************
5730template< typename Type // Data type of the matrix
5731 , size_t M // Number of rows
5732 , size_t N // Number of columns
5733 , AlignmentFlag AF // Alignment flag
5734 , PaddingFlag PF // Padding flag
5735 , typename Tag > // Type tag
5736inline void StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator delete( void* ptr )
5737{
5738 deallocate( static_cast<StaticMatrix*>( ptr ) );
5739}
5741//*************************************************************************************************
5742
5743
5744//*************************************************************************************************
5751template< typename Type // Data type of the matrix
5752 , size_t M // Number of rows
5753 , size_t N // Number of columns
5754 , AlignmentFlag AF // Alignment flag
5755 , PaddingFlag PF // Padding flag
5756 , typename Tag > // Type tag
5757inline void StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator delete[]( void* ptr )
5758{
5759 deallocate( static_cast<StaticMatrix*>( ptr ) );
5760}
5762//*************************************************************************************************
5763
5764
5765//*************************************************************************************************
5772template< typename Type // Data type of the matrix
5773 , size_t M // Number of rows
5774 , size_t N // Number of columns
5775 , AlignmentFlag AF // Alignment flag
5776 , PaddingFlag PF // Padding flag
5777 , typename Tag > // Type tag
5778inline void StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator delete( void* ptr, const std::nothrow_t& )
5779{
5780 deallocate( static_cast<StaticMatrix*>( ptr ) );
5781}
5783//*************************************************************************************************
5784
5785
5786//*************************************************************************************************
5793template< typename Type // Data type of the matrix
5794 , size_t M // Number of rows
5795 , size_t N // Number of columns
5796 , AlignmentFlag AF // Alignment flag
5797 , PaddingFlag PF // Padding flag
5798 , typename Tag > // Type tag
5799inline void StaticMatrix<Type,M,N,true,AF,PF,Tag>::operator delete[]( void* ptr, const std::nothrow_t& )
5800{
5801 deallocate( static_cast<StaticMatrix*>( ptr ) );
5802}
5804//*************************************************************************************************
5805
5806
5807
5808
5809//=================================================================================================
5810//
5811// DEBUGGING FUNCTIONS
5812//
5813//=================================================================================================
5814
5815//*************************************************************************************************
5825template< typename Type // Data type of the matrix
5826 , size_t M // Number of rows
5827 , size_t N // Number of columns
5828 , AlignmentFlag AF // Alignment flag
5829 , PaddingFlag PF // Padding flag
5830 , typename Tag > // Type tag
5831constexpr bool StaticMatrix<Type,M,N,true,AF,PF,Tag>::isIntact() const noexcept
5832{
5833 if( IsNumeric_v<Type> ) {
5834 for( size_t j=0UL; j<N; ++j ) {
5835 for( size_t i=M; i<MM; ++i ) {
5836 if( !isDefault<strict>( v_[i+j*MM] ) )
5837 return false;
5838 }
5839 }
5840 }
5841
5842 return true;
5843}
5845//*************************************************************************************************
5846
5847
5848
5849
5850//=================================================================================================
5851//
5852// EXPRESSION TEMPLATE EVALUATION FUNCTIONS
5853//
5854//=================================================================================================
5855
5856//*************************************************************************************************
5867template< typename Type // Data type of the matrix
5868 , size_t M // Number of rows
5869 , size_t N // Number of columns
5870 , AlignmentFlag AF // Alignment flag
5871 , PaddingFlag PF // Padding flag
5872 , typename Tag > // Type tag
5873template< typename Other > // Data type of the foreign expression
5874inline bool StaticMatrix<Type,M,N,true,AF,PF,Tag>::canAlias( const Other* alias ) const noexcept
5875{
5876 return static_cast<const void*>( this ) == static_cast<const void*>( alias );
5877}
5879//*************************************************************************************************
5880
5881
5882//*************************************************************************************************
5893template< typename Type // Data type of the matrix
5894 , size_t M // Number of rows
5895 , size_t N // Number of columns
5896 , AlignmentFlag AF // Alignment flag
5897 , PaddingFlag PF // Padding flag
5898 , typename Tag > // Type tag
5899template< typename Other > // Data type of the foreign expression
5900inline bool StaticMatrix<Type,M,N,true,AF,PF,Tag>::isAliased( const Other* alias ) const noexcept
5901{
5902 return static_cast<const void*>( this ) == static_cast<const void*>( alias );
5903}
5905//*************************************************************************************************
5906
5907
5908//*************************************************************************************************
5918template< typename Type // Data type of the matrix
5919 , size_t M // Number of rows
5920 , size_t N // Number of columns
5921 , AlignmentFlag AF // Alignment flag
5922 , PaddingFlag PF // Padding flag
5923 , typename Tag > // Type tag
5925{
5926 return AF == aligned;
5927}
5929//*************************************************************************************************
5930
5931
5932//*************************************************************************************************
5947template< typename Type // Data type of the matrix
5948 , size_t M // Number of rows
5949 , size_t N // Number of columns
5950 , AlignmentFlag AF // Alignment flag
5951 , PaddingFlag PF // Padding flag
5952 , typename Tag > // Type tag
5954 StaticMatrix<Type,M,N,true,AF,PF,Tag>::load( size_t i, size_t j ) const noexcept
5955{
5956 if( AF == aligned )
5957 return loada( i, j );
5958 else
5959 return loadu( i, j );
5960}
5962//*************************************************************************************************
5963
5964
5965//*************************************************************************************************
5980template< typename Type // Data type of the matrix
5981 , size_t M // Number of rows
5982 , size_t N // Number of columns
5983 , AlignmentFlag AF // Alignment flag
5984 , PaddingFlag PF // Padding flag
5985 , typename Tag > // Type tag
5987 StaticMatrix<Type,M,N,true,AF,PF,Tag>::loada( size_t i, size_t j ) const noexcept
5988{
5989 using blaze::loada;
5990
5992
5993 BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
5994 BLAZE_INTERNAL_ASSERT( i + SIMDSIZE <= MM, "Invalid row access index" );
5995 BLAZE_INTERNAL_ASSERT( PF == unpadded || i % SIMDSIZE == 0UL, "Invalid row access index" );
5996 BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
5997 BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[i+j*MM] ), "Invalid alignment detected" );
5998
5999 return loada( &v_[i+j*MM] );
6000}
6002//*************************************************************************************************
6003
6004
6005//*************************************************************************************************
6020template< typename Type // Data type of the matrix
6021 , size_t M // Number of rows
6022 , size_t N // Number of columns
6023 , AlignmentFlag AF // Alignment flag
6024 , PaddingFlag PF // Padding flag
6025 , typename Tag > // Type tag
6027 StaticMatrix<Type,M,N,true,AF,PF,Tag>::loadu( size_t i, size_t j ) const noexcept
6028{
6029 using blaze::loadu;
6030
6032
6033 BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
6034 BLAZE_INTERNAL_ASSERT( i + SIMDSIZE <= MM, "Invalid row access index" );
6035 BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
6036
6037 return loadu( &v_[i+j*MM] );
6038}
6040//*************************************************************************************************
6041
6042
6043//*************************************************************************************************
6059template< typename Type // Data type of the matrix
6060 , size_t M // Number of rows
6061 , size_t N // Number of columns
6062 , AlignmentFlag AF // Alignment flag
6063 , PaddingFlag PF // Padding flag
6064 , typename Tag > // Type tag
6066 StaticMatrix<Type,M,N,true,AF,PF,Tag>::store( size_t i, size_t j, const SIMDType& value ) noexcept
6067{
6068 if( AF == aligned )
6069 storea( i, j, value );
6070 else
6071 storeu( i, j, value );
6072}
6074//*************************************************************************************************
6075
6076
6077//*************************************************************************************************
6093template< typename Type // Data type of the matrix
6094 , size_t M // Number of rows
6095 , size_t N // Number of columns
6096 , AlignmentFlag AF // Alignment flag
6097 , PaddingFlag PF // Padding flag
6098 , typename Tag > // Type tag
6100 StaticMatrix<Type,M,N,true,AF,PF,Tag>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
6101{
6102 using blaze::storea;
6103
6105
6106 BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
6107 BLAZE_INTERNAL_ASSERT( i + SIMDSIZE <= MM, "Invalid row access index" );
6108 BLAZE_INTERNAL_ASSERT( PF == unpadded || i % SIMDSIZE == 0UL, "Invalid row access index" );
6109 BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
6110 BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[i+j*MM] ), "Invalid alignment detected" );
6111
6112 storea( &v_[i+j*MM], value );
6113}
6115//*************************************************************************************************
6116
6117
6118//*************************************************************************************************
6134template< typename Type // Data type of the matrix
6135 , size_t M // Number of rows
6136 , size_t N // Number of columns
6137 , AlignmentFlag AF // Alignment flag
6138 , PaddingFlag PF // Padding flag
6139 , typename Tag > // Type tag
6141 StaticMatrix<Type,M,N,true,AF,PF,Tag>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
6142{
6143 using blaze::storeu;
6144
6146
6147 BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
6148 BLAZE_INTERNAL_ASSERT( i + SIMDSIZE <= MM, "Invalid row access index" );
6149 BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
6150
6151 storeu( &v_[i+j*MM], value );
6152}
6154//*************************************************************************************************
6155
6156
6157//*************************************************************************************************
6174template< typename Type // Data type of the matrix
6175 , size_t M // Number of rows
6176 , size_t N // Number of columns
6177 , AlignmentFlag AF // Alignment flag
6178 , PaddingFlag PF // Padding flag
6179 , typename Tag > // Type tag
6181 StaticMatrix<Type,M,N,true,AF,PF,Tag>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
6182{
6183 using blaze::stream;
6184
6186
6187 BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
6188 BLAZE_INTERNAL_ASSERT( i + SIMDSIZE <= MM, "Invalid row access index" );
6189 BLAZE_INTERNAL_ASSERT( PF == unpadded || i % SIMDSIZE == 0UL, "Invalid row access index" );
6190 BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
6191 BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[i+j*MM] ), "Invalid alignment detected" );
6192
6193 stream( &v_[i+j*MM], value );
6194}
6196//*************************************************************************************************
6197
6198
6199//*************************************************************************************************
6211template< typename Type // Data type of the matrix
6212 , size_t M // Number of rows
6213 , size_t N // Number of columns
6214 , AlignmentFlag AF // Alignment flag
6215 , PaddingFlag PF // Padding flag
6216 , typename Tag > // Type tag
6217template< typename MT // Type of the right-hand side dense matrix
6218 , bool SO > // Storage order of the right-hand side dense matrix
6219inline auto StaticMatrix<Type,M,N,true,AF,PF,Tag>::assign( const DenseMatrix<MT,SO>& rhs )
6220 -> DisableIf_t< VectorizedAssign_v<MT> >
6221{
6222 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6223
6224 for( size_t j=0UL; j<N; ++j ) {
6225 for( size_t i=0UL; i<M; ++i ) {
6226 v_[i+j*MM] = (*rhs)(i,j);
6227 }
6228 }
6229}
6231//*************************************************************************************************
6232
6233
6234//*************************************************************************************************
6246template< typename Type // Data type of the matrix
6247 , size_t M // Number of rows
6248 , size_t N // Number of columns
6249 , AlignmentFlag AF // Alignment flag
6250 , PaddingFlag PF // Padding flag
6251 , typename Tag > // Type tag
6252template< typename MT // Type of the right-hand side dense matrix
6253 , bool SO > // Storage order of the right-hand side dense matrix
6254inline auto StaticMatrix<Type,M,N,true,AF,PF,Tag>::assign( const DenseMatrix<MT,SO>& rhs )
6255 -> EnableIf_t< VectorizedAssign_v<MT> >
6256{
6258
6259 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6260
6261 constexpr bool remainder( PF == unpadded || !IsPadded_v<MT> );
6262
6263 constexpr size_t ipos( remainder ? prevMultiple( M, SIMDSIZE ) : M );
6264 BLAZE_INTERNAL_ASSERT( ipos <= M, "Invalid end calculation" );
6265
6266 for( size_t j=0UL; j<N; ++j )
6267 {
6268 size_t i( 0UL );
6269
6270 for( ; i<ipos; i+=SIMDSIZE ) {
6271 store( i, j, (*rhs).load(i,j) );
6272 }
6273 for( ; remainder && i<M; ++i ) {
6274 v_[i+j*MM] = (*rhs)(i,j);
6275 }
6276 }
6277}
6279//*************************************************************************************************
6280
6281
6282//*************************************************************************************************
6294template< typename Type // Data type of the matrix
6295 , size_t M // Number of rows
6296 , size_t N // Number of columns
6297 , AlignmentFlag AF // Alignment flag
6298 , PaddingFlag PF // Padding flag
6299 , typename Tag > // Type tag
6300template< typename MT > // Type of the right-hand side sparse matrix
6301inline void StaticMatrix<Type,M,N,true,AF,PF,Tag>::assign( const SparseMatrix<MT,true>& rhs )
6302{
6303 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6304
6305 for( size_t j=0UL; j<N; ++j )
6306 for( auto element=(*rhs).begin(j); element!=(*rhs).end(j); ++element )
6307 v_[element->index()+j*MM] = element->value();
6308}
6310//*************************************************************************************************
6311
6312
6313//*************************************************************************************************
6325template< typename Type // Data type of the matrix
6326 , size_t M // Number of rows
6327 , size_t N // Number of columns
6328 , AlignmentFlag AF // Alignment flag
6329 , PaddingFlag PF // Padding flag
6330 , typename Tag > // Type tag
6331template< typename MT > // Type of the right-hand side sparse matrix
6332inline void StaticMatrix<Type,M,N,true,AF,PF,Tag>::assign( const SparseMatrix<MT,false>& rhs )
6333{
6335
6336 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6337
6338 for( size_t i=0UL; i<M; ++i )
6339 for( auto element=(*rhs).begin(i); element!=(*rhs).end(i); ++element )
6340 v_[i+element->index()*MM] = element->value();
6341}
6343//*************************************************************************************************
6344
6345
6346//*************************************************************************************************
6358template< typename Type // Data type of the matrix
6359 , size_t M // Number of rows
6360 , size_t N // Number of columns
6361 , AlignmentFlag AF // Alignment flag
6362 , PaddingFlag PF // Padding flag
6363 , typename Tag > // Type tag
6364template< typename MT // Type of the right-hand side dense matrix
6365 , bool SO > // Storage order of the right-hand side dense matrix
6366inline auto StaticMatrix<Type,M,N,true,AF,PF,Tag>::addAssign( const DenseMatrix<MT,SO>& rhs )
6367 -> DisableIf_t< VectorizedAddAssign_v<MT> >
6368{
6369 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6370
6371 for( size_t j=0UL; j<N; ++j )
6372 {
6373 if( IsDiagonal_v<MT> )
6374 {
6375 v_[j+j*MM] += (*rhs)(j,j);
6376 }
6377 else
6378 {
6379 const size_t ibegin( ( IsLower_v<MT> )
6380 ?( IsStrictlyLower_v<MT> ? j+1UL : j )
6381 :( 0UL ) );
6382 const size_t iend ( ( IsUpper_v<MT> )
6383 ?( IsStrictlyUpper_v<MT> ? j : j+1UL )
6384 :( M ) );
6385 BLAZE_INTERNAL_ASSERT( ibegin <= iend, "Invalid loop indices detected" );
6386
6387 for( size_t i=ibegin; i<iend; ++i ) {
6388 v_[i+j*MM] += (*rhs)(i,j);
6389 }
6390 }
6391 }
6392}
6394//*************************************************************************************************
6395
6396
6397//*************************************************************************************************
6409template< typename Type // Data type of the matrix
6410 , size_t M // Number of rows
6411 , size_t N // Number of columns
6412 , AlignmentFlag AF // Alignment flag
6413 , PaddingFlag PF // Padding flag
6414 , typename Tag > // Type tag
6415template< typename MT // Type of the right-hand side dense matrix
6416 , bool SO > // Storage order of the right-hand side dense matrix
6417inline auto StaticMatrix<Type,M,N,true,AF,PF,Tag>::addAssign( const DenseMatrix<MT,SO>& rhs )
6418 -> EnableIf_t< VectorizedAddAssign_v<MT> >
6419{
6422
6423 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6424
6425 constexpr bool remainder( PF == unpadded || !IsPadded_v<MT> );
6426
6427 for( size_t j=0UL; j<N; ++j )
6428 {
6429 const size_t ibegin( ( IsLower_v<MT> )
6430 ?( prevMultiple( ( IsStrictlyLower_v<MT> ? j+1UL : j ), SIMDSIZE ) )
6431 :( 0UL ) );
6432 const size_t iend ( ( IsUpper_v<MT> )
6433 ?( IsStrictlyUpper_v<MT> ? j : j+1UL )
6434 :( M ) );
6435 BLAZE_INTERNAL_ASSERT( ibegin <= iend, "Invalid loop indices detected" );
6436
6437 const size_t ipos( remainder ? prevMultiple( iend, SIMDSIZE ) : iend );
6438 BLAZE_INTERNAL_ASSERT( ipos <= iend, "Invalid end calculation" );
6439
6440 size_t i( ibegin );
6441
6442 for( ; i<ipos; i+=SIMDSIZE ) {
6443 store( i, j, load(i,j) + (*rhs).load(i,j) );
6444 }
6445 for( ; remainder && i<iend; ++i ) {
6446 v_[i+j*MM] += (*rhs)(i,j);
6447 }
6448 }
6449}
6451//*************************************************************************************************
6452
6453
6454//*************************************************************************************************
6466template< typename Type // Data type of the matrix
6467 , size_t M // Number of rows
6468 , size_t N // Number of columns
6469 , AlignmentFlag AF // Alignment flag
6470 , PaddingFlag PF // Padding flag
6471 , typename Tag > // Type tag
6472template< typename MT > // Type of the right-hand side sparse matrix
6473inline void StaticMatrix<Type,M,N,true,AF,PF,Tag>::addAssign( const SparseMatrix<MT,true>& rhs )
6474{
6475 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6476
6477 for( size_t j=0UL; j<N; ++j )
6478 for( auto element=(*rhs).begin(j); element!=(*rhs).end(j); ++element )
6479 v_[element->index()+j*MM] += element->value();
6480}
6482//*************************************************************************************************
6483
6484
6485//*************************************************************************************************
6497template< typename Type // Data type of the matrix
6498 , size_t M // Number of rows
6499 , size_t N // Number of columns
6500 , AlignmentFlag AF // Alignment flag
6501 , PaddingFlag PF // Padding flag
6502 , typename Tag > // Type tag
6503template< typename MT > // Type of the right-hand side sparse matrix
6504inline void StaticMatrix<Type,M,N,true,AF,PF,Tag>::addAssign( const SparseMatrix<MT,false>& rhs )
6505{
6507
6508 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6509
6510 for( size_t i=0UL; i<M; ++i )
6511 for( auto element=(*rhs).begin(i); element!=(*rhs).end(i); ++element )
6512 v_[i+element->index()*MM] += element->value();
6513}
6515//*************************************************************************************************
6516
6517
6518//*************************************************************************************************
6530template< typename Type // Data type of the matrix
6531 , size_t M // Number of rows
6532 , size_t N // Number of columns
6533 , AlignmentFlag AF // Alignment flag
6534 , PaddingFlag PF // Padding flag
6535 , typename Tag > // Type tag
6536template< typename MT // Type of the right-hand side dense matrix
6537 , bool SO > // Storage order of the right-hand side dense matrix
6538inline auto StaticMatrix<Type,M,N,true,AF,PF,Tag>::subAssign( const DenseMatrix<MT,SO>& rhs )
6539 -> DisableIf_t< VectorizedSubAssign_v<MT> >
6540{
6541 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6542
6543 for( size_t j=0UL; j<N; ++j )
6544 {
6545 if( IsDiagonal_v<MT> )
6546 {
6547 v_[j+j*MM] -= (*rhs)(j,j);
6548 }
6549 else
6550 {
6551 const size_t ibegin( ( IsLower_v<MT> )
6552 ?( IsStrictlyLower_v<MT> ? j+1UL : j )
6553 :( 0UL ) );
6554 const size_t iend ( ( IsUpper_v<MT> )
6555 ?( IsStrictlyUpper_v<MT> ? j : j+1UL )
6556 :( M ) );
6557 BLAZE_INTERNAL_ASSERT( ibegin <= iend, "Invalid loop indices detected" );
6558
6559 for( size_t i=ibegin; i<iend; ++i ) {
6560 v_[i+j*MM] -= (*rhs)(i,j);
6561 }
6562 }
6563 }
6564}
6566//*************************************************************************************************
6567
6568
6569//*************************************************************************************************
6581template< typename Type // Data type of the matrix
6582 , size_t M // Number of rows
6583 , size_t N // Number of columns
6584 , AlignmentFlag AF // Alignment flag
6585 , PaddingFlag PF // Padding flag
6586 , typename Tag > // Type tag
6587template< typename MT // Type of the right-hand side dense matrix
6588 , bool SO > // Storage order of the right-hand side dense matrix
6589inline auto StaticMatrix<Type,M,N,true,AF,PF,Tag>::subAssign( const DenseMatrix<MT,SO>& rhs )
6590 -> EnableIf_t< VectorizedSubAssign_v<MT> >
6591{
6594
6595 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6596
6597 constexpr bool remainder( PF == unpadded || !IsPadded_v<MT> );
6598
6599 for( size_t j=0UL; j<N; ++j )
6600 {
6601 const size_t ibegin( ( IsLower_v<MT> )
6602 ?( prevMultiple( ( IsStrictlyLower_v<MT> ? j+1UL : j ), SIMDSIZE ) )
6603 :( 0UL ) );
6604 const size_t iend ( ( IsUpper_v<MT> )
6605 ?( IsStrictlyUpper_v<MT> ? j : j+1UL )
6606 :( M ) );
6607 BLAZE_INTERNAL_ASSERT( ibegin <= iend, "Invalid loop indices detected" );
6608
6609 const size_t ipos( remainder ? prevMultiple( iend, SIMDSIZE ) : iend );
6610 BLAZE_INTERNAL_ASSERT( ipos <= iend, "Invalid end calculation" );
6611
6612 size_t i( ibegin );
6613
6614 for( ; i<ipos; i+=SIMDSIZE ) {
6615 store( i, j, load(i,j) - (*rhs).load(i,j) );
6616 }
6617 for( ; remainder && i<iend; ++i ) {
6618 v_[i+j*MM] -= (*rhs)(i,j);
6619 }
6620 }
6621}
6623//*************************************************************************************************
6624
6625
6626//*************************************************************************************************
6638template< typename Type // Data type of the matrix
6639 , size_t M // Number of rows
6640 , size_t N // Number of columns
6641 , AlignmentFlag AF // Alignment flag
6642 , PaddingFlag PF // Padding flag
6643 , typename Tag > // Type tag
6644template< typename MT > // Type of the right-hand side sparse matrix
6645inline void StaticMatrix<Type,M,N,true,AF,PF,Tag>::subAssign( const SparseMatrix<MT,true>& rhs )
6646{
6647 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6648
6649 for( size_t j=0UL; j<N; ++j )
6650 for( auto element=(*rhs).begin(j); element!=(*rhs).end(j); ++element )
6651 v_[element->index()+j*MM] -= element->value();
6652}
6654//*************************************************************************************************
6655
6656
6657//*************************************************************************************************
6669template< typename Type // Data type of the matrix
6670 , size_t M // Number of rows
6671 , size_t N // Number of columns
6672 , AlignmentFlag AF // Alignment flag
6673 , PaddingFlag PF // Padding flag
6674 , typename Tag > // Type tag
6675template< typename MT > // Type of the right-hand side sparse matrix
6676inline void StaticMatrix<Type,M,N,true,AF,PF,Tag>::subAssign( const SparseMatrix<MT,false>& rhs )
6677{
6679
6680 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6681
6682 for( size_t i=0UL; i<M; ++i )
6683 for( auto element=(*rhs).begin(i); element!=(*rhs).end(i); ++element )
6684 v_[i+element->index()*MM] -= element->value();
6685}
6687//*************************************************************************************************
6688
6689
6690//*************************************************************************************************
6702template< typename Type // Data type of the matrix
6703 , size_t M // Number of rows
6704 , size_t N // Number of columns
6705 , AlignmentFlag AF // Alignment flag
6706 , PaddingFlag PF // Padding flag
6707 , typename Tag > // Type tag
6708template< typename MT // Type of the right-hand side dense matrix
6709 , bool SO > // Storage order of the right-hand side dense matrix
6710inline auto StaticMatrix<Type,M,N,true,AF,PF,Tag>::schurAssign( const DenseMatrix<MT,SO>& rhs )
6711 -> DisableIf_t< VectorizedSchurAssign_v<MT> >
6712{
6713 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6714
6715 for( size_t j=0UL; j<N; ++j ) {
6716 for( size_t i=0UL; i<M; ++i ) {
6717 v_[i+j*MM] *= (*rhs)(i,j);
6718 }
6719 }
6720}
6722//*************************************************************************************************
6723
6724
6725//*************************************************************************************************
6737template< typename Type // Data type of the matrix
6738 , size_t M // Number of rows
6739 , size_t N // Number of columns
6740 , AlignmentFlag AF // Alignment flag
6741 , PaddingFlag PF // Padding flag
6742 , typename Tag > // Type tag
6743template< typename MT // Type of the right-hand side dense matrix
6744 , bool SO > // Storage order of the right-hand side dense matrix
6745inline auto StaticMatrix<Type,M,N,true,AF,PF,Tag>::schurAssign( const DenseMatrix<MT,SO>& rhs )
6746 -> EnableIf_t< VectorizedSchurAssign_v<MT> >
6747{
6749
6750 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6751
6752 constexpr bool remainder( PF == unpadded || !IsPadded_v<MT> );
6753
6754 constexpr size_t ipos( remainder ? prevMultiple( M, SIMDSIZE ) : M );
6755 BLAZE_INTERNAL_ASSERT( ipos <= M, "Invalid end calculation" );
6756
6757 for( size_t j=0UL; j<N; ++j )
6758 {
6759 size_t i( 0UL );
6760
6761 for( ; i<ipos; i+=SIMDSIZE ) {
6762 store( i, j, load(i,j) * (*rhs).load(i,j) );
6763 }
6764 for( ; remainder && i<M; ++i ) {
6765 v_[i+j*MM] *= (*rhs)(i,j);
6766 }
6767 }
6768}
6770//*************************************************************************************************
6771
6772
6773//*************************************************************************************************
6785template< typename Type // Data type of the matrix
6786 , size_t M // Number of rows
6787 , size_t N // Number of columns
6788 , AlignmentFlag AF // Alignment flag
6789 , PaddingFlag PF // Padding flag
6790 , typename Tag > // Type tag
6791template< typename MT > // Type of the right-hand side sparse matrix
6792inline void StaticMatrix<Type,M,N,true,AF,PF,Tag>::schurAssign( const SparseMatrix<MT,true>& rhs )
6793{
6794 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6795
6796 const StaticMatrix tmp( serial( *this ) );
6797
6798 reset();
6799
6800 for( size_t j=0UL; j<N; ++j )
6801 for( auto element=(*rhs).begin(j); element!=(*rhs).end(j); ++element )
6802 v_[element->index()+j*MM] = tmp.v_[element->index()+j*MM] * element->value();
6803}
6805//*************************************************************************************************
6806
6807
6808//*************************************************************************************************
6820template< typename Type // Data type of the matrix
6821 , size_t M // Number of rows
6822 , size_t N // Number of columns
6823 , AlignmentFlag AF // Alignment flag
6824 , PaddingFlag PF // Padding flag
6825 , typename Tag > // Type tag
6826template< typename MT > // Type of the right-hand side sparse matrix
6827inline void StaticMatrix<Type,M,N,true,AF,PF,Tag>::schurAssign( const SparseMatrix<MT,false>& rhs )
6828{
6830
6831 BLAZE_INTERNAL_ASSERT( (*rhs).rows() == M && (*rhs).columns() == N, "Invalid matrix size" );
6832
6833 const StaticMatrix tmp( serial( *this ) );
6834
6835 reset();
6836
6837 for( size_t i=0UL; i<M; ++i )
6838 for( auto element=(*rhs).begin(i); element!=(*rhs).end(i); ++element )
6839 v_[i+element->index()*MM] = tmp.v_[i+element->index()*MM] * element->value();
6840}
6842//*************************************************************************************************
6843
6844
6845
6846
6847
6848
6849
6850
6851//=================================================================================================
6852//
6853// STATICMATRIX OPERATORS
6854//
6855//=================================================================================================
6856
6857//*************************************************************************************************
6860template< RelaxationFlag RF, typename Type, size_t M, size_t N, bool SO, AlignmentFlag AF, PaddingFlag PF, typename Tag >
6861bool isDefault( const StaticMatrix<Type,M,N,SO,AF,PF,Tag>& m );
6862
6863template< typename Type, size_t M, size_t N, bool SO, AlignmentFlag AF, PaddingFlag PF, typename Tag >
6864bool isIntact( const StaticMatrix<Type,M,N,SO,AF,PF,Tag>& m ) noexcept;
6865
6866template< typename Type, size_t M, size_t N, bool SO, AlignmentFlag AF, PaddingFlag PF, typename Tag >
6867void swap( StaticMatrix<Type,M,N,SO,AF,PF,Tag>& a, StaticMatrix<Type,M,N,SO,AF,PF,Tag>& b ) noexcept;
6869//*************************************************************************************************
6870
6871
6872//*************************************************************************************************
6896template< RelaxationFlag RF // Relaxation flag
6897 , typename Type // Data type of the matrix
6898 , size_t M // Number of rows
6899 , size_t N // Number of columns
6900 , bool SO // Storage order
6901 , AlignmentFlag AF // Alignment flag
6902 , PaddingFlag PF // Padding flag
6903 , typename Tag > // Type tag
6905{
6906 if( SO == rowMajor ) {
6907 for( size_t i=0UL; i<M; ++i )
6908 for( size_t j=0UL; j<N; ++j )
6909 if( !isDefault<RF>( m(i,j) ) ) return false;
6910 }
6911 else {
6912 for( size_t j=0UL; j<N; ++j )
6913 for( size_t i=0UL; i<M; ++i )
6914 if( !isDefault<RF>( m(i,j) ) ) return false;
6915 }
6916
6917 return true;
6918}
6919//*************************************************************************************************
6920
6921
6922//*************************************************************************************************
6940template< typename Type // Data type of the matrix
6941 , size_t M // Number of rows
6942 , size_t N // Number of columns
6943 , bool SO // Storage order
6944 , AlignmentFlag AF // Alignment flag
6945 , PaddingFlag PF // Padding flag
6946 , typename Tag > // Type tag
6947inline bool isIntact( const StaticMatrix<Type,M,N,SO,AF,PF,Tag>& m ) noexcept
6948{
6949 return m.isIntact();
6950}
6951//*************************************************************************************************
6952
6953
6954//*************************************************************************************************
6962template< typename Type // Data type of the matrix
6963 , size_t M // Number of rows
6964 , size_t N // Number of columns
6965 , bool SO // Storage order
6966 , AlignmentFlag AF // Alignment flag
6967 , PaddingFlag PF // Padding flag
6968 , typename Tag > // Type tag
6970{
6971 a.swap( b );
6972}
6973//*************************************************************************************************
6974
6975
6976
6977
6978//=================================================================================================
6979//
6980// SIZE SPECIALIZATIONS
6981//
6982//=================================================================================================
6983
6984//*************************************************************************************************
6986template< typename T, size_t M, size_t N, bool SO, AlignmentFlag AF, PaddingFlag PF, typename Tag >
6987struct Size< StaticMatrix<T,M,N,SO,AF,PF,Tag>, 0UL >
6988 : public Ptrdiff_t< static_cast<ptrdiff_t>(M) >
6989{};
6990
6991template< typename T, size_t M, size_t N, bool SO, AlignmentFlag AF, PaddingFlag PF, typename Tag >
6992struct Size< StaticMatrix<T,M,N,SO,AF,PF,Tag>, 1UL >
6993 : public Ptrdiff_t< static_cast<ptrdiff_t>(N) >
6994{};
6996//*************************************************************************************************
6997
6998
6999
7000
7001//=================================================================================================
7002//
7003// MAXSIZE SPECIALIZATIONS
7004//
7005//=================================================================================================
7006
7007//*************************************************************************************************
7009template< typename T, size_t M, size_t N, bool SO, AlignmentFlag AF, PaddingFlag PF, typename Tag >
7010struct MaxSize< StaticMatrix<T,M,N,SO,AF,PF,Tag>, 0UL >
7011 : public Ptrdiff_t< static_cast<ptrdiff_t>(M) >
7012{};
7013
7014template< typename T, size_t M, size_t N, bool SO, AlignmentFlag AF, PaddingFlag PF, typename Tag >
7015struct MaxSize< StaticMatrix<T,M,N,SO,AF,PF,Tag>, 1UL >
7016 : public Ptrdiff_t< static_cast<ptrdiff_t>(N) >
7017{};
7019//*************************************************************************************************
7020
7021
7022
7023
7024//=================================================================================================
7025//
7026// ISSQUARE SPECIALIZATIONS
7027//
7028//=================================================================================================
7029
7030//*************************************************************************************************
7032template< typename T, size_t N, bool SO, AlignmentFlag AF, PaddingFlag PF, typename Tag >
7033struct IsSquare< StaticMatrix<T,N,N,SO,AF,PF,Tag> >
7034 : public TrueType
7035{};
7037//*************************************************************************************************
7038
7039
7040
7041
7042//=================================================================================================
7043//
7044// HASCONSTDATAACCESS SPECIALIZATIONS
7045//
7046//=================================================================================================
7047
7048//*************************************************************************************************
7050template< typename T, size_t M, size_t N, bool SO, AlignmentFlag AF, PaddingFlag PF, typename Tag >
7051struct HasConstDataAccess< StaticMatrix<T,M,N,SO,AF,PF,Tag> >
7052 : public TrueType
7053{};
7055//*************************************************************************************************
7056
7057
7058
7059
7060//=================================================================================================
7061//
7062// HASMUTABLEDATAACCESS SPECIALIZATIONS
7063//
7064//=================================================================================================
7065
7066//*************************************************************************************************
7068template< typename T, size_t M, size_t N, bool SO, AlignmentFlag AF, PaddingFlag PF, typename Tag >
7069struct HasMutableDataAccess< StaticMatrix<T,M,N,SO,AF,PF,Tag> >
7070 : public TrueType
7071{};
7073//*************************************************************************************************
7074
7075
7076
7077
7078//=================================================================================================
7079//
7080// ISALIGNED SPECIALIZATIONS
7081//
7082//=================================================================================================
7083
7084//*************************************************************************************************
7086template< typename T, size_t M, size_t N, bool SO, AlignmentFlag AF, PaddingFlag PF, typename Tag >
7087struct IsAligned< StaticMatrix<T,M,N,SO,AF,PF,Tag> >
7088 : public BoolConstant< AF == aligned >
7089{};
7091//*************************************************************************************************
7092
7093
7094
7095
7096//=================================================================================================
7097//
7098// ISCONTIGUOUS SPECIALIZATIONS
7099//
7100//=================================================================================================
7101
7102//*************************************************************************************************
7104template< typename T, size_t M, size_t N, bool SO, AlignmentFlag AF, PaddingFlag PF, typename Tag >
7105struct IsContiguous< StaticMatrix<T,M,N,SO,AF,PF,Tag> >
7106 : public TrueType
7107{};
7109//*************************************************************************************************
7110
7111
7112
7113
7114//=================================================================================================
7115//
7116// ISPADDED SPECIALIZATIONS
7117//
7118//=================================================================================================
7119
7120//*************************************************************************************************
7122template< typename T, size_t M, size_t N, bool SO, AlignmentFlag AF, PaddingFlag PF, typename Tag >
7123struct IsPadded< StaticMatrix<T,M,N,SO,AF,PF,Tag> >
7124 : public BoolConstant< PF == padded >
7125{};
7127//*************************************************************************************************
7128
7129
7130
7131
7132//=================================================================================================
7133//
7134// ADDTRAIT SPECIALIZATIONS
7135//
7136//=================================================================================================
7137
7138//*************************************************************************************************
7140template< typename T1, typename T2 >
7141struct AddTraitEval2< T1, T2
7142 , EnableIf_t< IsMatrix_v<T1> &&
7143 IsMatrix_v<T2> &&
7144 ( Size_v<T1,0UL> != DefaultSize_v ||
7145 Size_v<T2,0UL> != DefaultSize_v ) &&
7146 ( Size_v<T1,1UL> != DefaultSize_v ||
7147 Size_v<T2,1UL> != DefaultSize_v ) > >
7148{
7149 static constexpr bool SO1 = StorageOrder_v<T1>;
7150 static constexpr bool SO2 = StorageOrder_v<T2>;
7151
7152 static constexpr bool SO = ( IsDenseMatrix_v<T1> && IsDenseMatrix_v<T2>
7153 ? ( IsSymmetric_v<T1> ^ IsSymmetric_v<T2>
7154 ? ( IsSymmetric_v<T1>
7155 ? SO2
7156 : SO1 )
7157 : SO1 && SO2 )
7158 : ( IsDenseMatrix_v<T1>
7159 ? SO1
7160 : SO2 ) );
7161
7162 using Type = StaticMatrix< AddTrait_t< ElementType_t<T1>, ElementType_t<T2> >
7163 , max( Size_v<T1,0UL>, Size_v<T2,0UL> )
7164 , max( Size_v<T1,1UL>, Size_v<T2,1UL> )
7165 , SO
7168 , AddTrait_t< TagType_t<T1>, TagType_t<T2> > >;
7169};
7171//*************************************************************************************************
7172
7173
7174
7175
7176//=================================================================================================
7177//
7178// SUBTRAIT SPECIALIZATIONS
7179//
7180//=================================================================================================
7181
7182//*************************************************************************************************
7184template< typename T1, typename T2 >
7185struct SubTraitEval2< T1, T2
7186 , EnableIf_t< IsMatrix_v<T1> &&
7187 IsMatrix_v<T2> &&
7188 ( Size_v<T1,0UL> != DefaultSize_v ||
7189 Size_v<T2,0UL> != DefaultSize_v ) &&
7190 ( Size_v<T1,1UL> != DefaultSize_v ||
7191 Size_v<T2,1UL> != DefaultSize_v ) > >
7192{
7193 static constexpr bool SO1 = StorageOrder_v<T1>;
7194 static constexpr bool SO2 = StorageOrder_v<T2>;
7195
7196 static constexpr bool SO = ( IsDenseMatrix_v<T1> && IsDenseMatrix_v<T2>
7197 ? ( IsSymmetric_v<T1> ^ IsSymmetric_v<T2>
7198 ? ( IsSymmetric_v<T1>
7199 ? SO2
7200 : SO1 )
7201 : SO1 && SO2 )
7202 : ( IsDenseMatrix_v<T1>
7203 ? SO1
7204 : SO2 ) );
7205
7206 using Type = StaticMatrix< SubTrait_t< ElementType_t<T1>, ElementType_t<T2> >
7207 , max( Size_v<T1,0UL>, Size_v<T2,0UL> )
7208 , max( Size_v<T1,1UL>, Size_v<T2,1UL> )
7209 , SO
7212 , SubTrait_t< TagType_t<T1>, TagType_t<T2> > >;
7213};
7215//*************************************************************************************************
7216
7217
7218
7219
7220//=================================================================================================
7221//
7222// SCHURTRAIT SPECIALIZATIONS
7223//
7224//=================================================================================================
7225
7226//*************************************************************************************************
7228template< typename T1, typename T2 >
7229struct SchurTraitEval2< T1, T2
7230 , EnableIf_t< IsDenseMatrix_v<T1> &&
7231 IsDenseMatrix_v<T2> &&
7232 ( Size_v<T1,0UL> != DefaultSize_v ||
7233 Size_v<T2,0UL> != DefaultSize_v ) &&
7234 ( Size_v<T1,1UL> != DefaultSize_v ||
7235 Size_v<T2,1UL> != DefaultSize_v ) > >
7236{
7237 static constexpr bool SO1 = StorageOrder_v<T1>;
7238 static constexpr bool SO2 = StorageOrder_v<T2>;
7239
7240 static constexpr bool SO = ( IsSymmetric_v<T1> ^ IsSymmetric_v<T2>
7241 ? ( IsSymmetric_v<T1>
7242 ? SO2
7243 : SO1 )
7244 : SO1 && SO2 );
7245
7246 using Type = StaticMatrix< MultTrait_t< ElementType_t<T1>, ElementType_t<T2> >
7247 , max( Size_v<T1,0UL>, Size_v<T2,0UL> )
7248 , max( Size_v<T1,1UL>, Size_v<T2,1UL> )
7249 , SO
7252 , MultTrait_t< TagType_t<T1>, TagType_t<T2> > >;
7253};
7255//*************************************************************************************************
7256
7257
7258
7259
7260//=================================================================================================
7261//
7262// MULTTRAIT SPECIALIZATIONS
7263//
7264//=================================================================================================
7265
7266//*************************************************************************************************
7268template< typename T1, typename T2 >
7269struct MultTraitEval2< T1, T2
7270 , EnableIf_t< IsMatrix_v<T1> &&
7271 IsScalar_v<T2> &&
7272 ( Size_v<T1,0UL> != DefaultSize_v ) &&
7273 ( Size_v<T1,1UL> != DefaultSize_v ) > >
7274{
7275 using Type = StaticMatrix< MultTrait_t< ElementType_t<T1>, T2 >
7276 , Size_v<T1,0UL>
7277 , Size_v<T1,1UL>
7278 , StorageOrder_v<T1>
7281 , MultTrait_t< TagType_t<T1>, T2 > >;
7282};
7283
7284template< typename T1, typename T2 >
7285struct MultTraitEval2< T1, T2
7286 , EnableIf_t< IsScalar_v<T1> &&
7287 IsMatrix_v<T2> &&
7288 ( Size_v<T2,0UL> != DefaultSize_v ) &&
7289 ( Size_v<T2,1UL> != DefaultSize_v ) > >
7290{
7291 using Type = StaticMatrix< MultTrait_t< T1, ElementType_t<T2> >
7292 , Size_v<T2,0UL>
7293 , Size_v<T2,1UL>
7294 , StorageOrder_v<T2>
7297 , MultTrait_t< T1, TagType_t<T2> > >;
7298};
7299
7300template< typename T1, typename T2 >
7301struct MultTraitEval2< T1, T2
7303 IsRowVector_v<T2> &&
7304 ( Size_v<T1,0UL> != DefaultSize_v ) &&
7305 ( Size_v<T2,0UL> != DefaultSize_v ) > >
7306{
7307 using Type = StaticMatrix< MultTrait_t< ElementType_t<T1>, ElementType_t<T2> >
7308 , Size_v<T1,0UL>
7309 , Size_v<T2,0UL>
7310 , false
7313 , MultTrait_t< TagType_t<T1>, TagType_t<T2> > >;
7314};
7315
7316template< typename T1, typename T2 >
7317struct MultTraitEval2< T1, T2
7318 , EnableIf_t< IsMatrix_v<T1> &&
7319 IsMatrix_v<T2> &&
7320 ( Size_v<T1,0UL> != DefaultSize_v ||
7321 ( IsSquare_v<T1> && Size_v<T2,0UL> != DefaultSize_v ) ) &&
7322 ( Size_v<T2,1UL> != DefaultSize_v ||
7323 ( IsSquare_v<T2> && Size_v<T1,1UL> != DefaultSize_v ) ) > >
7324{
7325 using MultType = MultTrait_t< ElementType_t<T1>, ElementType_t<T2> >;
7326 using MultTag = MultTrait_t< TagType_t<T1>, TagType_t<T2> >;
7327
7328 using Type = StaticMatrix< AddTrait_t<MultType,MultType>
7329 , ( Size_v<T1,0UL> != DefaultSize_v ? Size_v<T1,0UL> : Size_v<T2,0UL> )
7330 , ( Size_v<T2,1UL> != DefaultSize_v ? Size_v<T2,1UL> : Size_v<T1,1UL> )
7331 , ( IsSparseMatrix_v<T1> ? StorageOrder_v<T2> : StorageOrder_v<T1> )
7334 , AddTrait_t<MultTag,MultTag> >;
7335};
7337//*************************************************************************************************
7338
7339
7340
7341
7342//=================================================================================================
7343//
7344// KRONTRAIT SPECIALIZATIONS
7345//
7346//=================================================================================================
7347
7348//*************************************************************************************************
7350template< typename T1, typename T2 >
7351struct KronTraitEval2< T1, T2
7352 , EnableIf_t< IsDenseMatrix_v<T1> &&
7353 IsDenseMatrix_v<T2> &&
7354 ( Size_v<T1,0UL> != DefaultSize_v ) &&
7355 ( Size_v<T2,0UL> != DefaultSize_v ) &&
7356 ( Size_v<T1,1UL> != DefaultSize_v ) &&
7357 ( Size_v<T2,1UL> != DefaultSize_v ) > >
7358{
7359 using Type = StaticMatrix< MultTrait_t< ElementType_t<T1>, ElementType_t<T2> >
7360 , Size_v<T1,0UL> * Size_v<T2,0UL>
7361 , Size_v<T1,1UL> * Size_v<T2,1UL>
7362 , StorageOrder_v<T2>
7365 , MultTrait_t< TagType_t<T1>, TagType_t<T2> > >;
7366};
7368//*************************************************************************************************
7369
7370
7371
7372
7373//=================================================================================================
7374//
7375// DIVTRAIT SPECIALIZATIONS
7376//
7377//=================================================================================================
7378
7379//*************************************************************************************************
7381template< typename T1, typename T2 >
7382struct DivTraitEval2< T1, T2
7383 , EnableIf_t< IsMatrix_v<T1> &&
7384 IsScalar_v<T2> &&
7385 ( Size_v<T1,0UL> != DefaultSize_v ) &&
7386 ( Size_v<T1,1UL> != DefaultSize_v ) > >
7387{
7388 using Type = StaticMatrix< DivTrait_t< ElementType_t<T1>, T2 >
7389 , Size_v<T1,0UL>
7390 , Size_v<T1,1UL>
7391 , StorageOrder_v<T1>
7394 , DivTrait_t< TagType_t<T1>, T2 > >;
7395};
7397//*************************************************************************************************
7398
7399
7400
7401
7402//=================================================================================================
7403//
7404// MAPTRAIT SPECIALIZATIONS
7405//
7406//=================================================================================================
7407
7408//*************************************************************************************************
7410template< typename T, typename OP >
7411struct UnaryMapTraitEval2< T, OP
7412 , EnableIf_t< IsMatrix_v<T> &&
7413 Size_v<T,0UL> != DefaultSize_v &&
7414 Size_v<T,1UL> != DefaultSize_v > >
7415{
7416 using ElementType = decltype( std::declval<OP>()( std::declval< ElementType_t<T> >() ) );
7417
7418 using Type = StaticMatrix< EvaluateTrait_t<ElementType>
7419 , Size_v<T,0UL>
7420 , Size_v<T,1UL>
7421 , StorageOrder_v<T>
7424 , MapTrait_t< TagType_t<T>, OP > >;
7425};
7427//*************************************************************************************************
7428
7429
7430//*************************************************************************************************
7432template< typename T1, typename T2, typename OP >
7433struct BinaryMapTraitEval2< T1, T2, OP
7435 IsRowVector_v<T2> &&
7436 ( Size_v<T1,0UL> != DefaultSize_v ) &&
7437 ( Size_v<T2,0UL> != DefaultSize_v ) > >
7438{
7439 using ElementType = decltype( std::declval<OP>()( std::declval< ElementType_t<T1> >()
7440 , std::declval< ElementType_t<T2> >() ) );
7441
7442 using Type = StaticMatrix< EvaluateTrait_t<ElementType>
7443 , Size_v<T1,0UL>
7444 , Size_v<T2,0UL>
7445 , false
7448 , MapTrait_t< TagType_t<T1>, TagType_t<T2>, OP > >;
7449};
7450
7451template< typename T1, typename T2, typename OP >
7452struct BinaryMapTraitEval2< T1, T2, OP
7453 , EnableIf_t< IsMatrix_v<T1> &&
7454 IsMatrix_v<T2> &&
7455 ( Size_v<T1,0UL> != DefaultSize_v ||
7456 Size_v<T2,0UL> != DefaultSize_v ) &&
7457 ( Size_v<T1,1UL> != DefaultSize_v ||
7458 Size_v<T2,1UL> != DefaultSize_v ) > >
7459{
7460 using ElementType = decltype( std::declval<OP>()( std::declval< ElementType_t<T1> >()
7461 , std::declval< ElementType_t<T2> >() ) );
7462
7463 static constexpr bool SO1 = StorageOrder_v<T1>;
7464 static constexpr bool SO2 = StorageOrder_v<T2>;
7465
7466 static constexpr bool SO = ( IsDenseMatrix_v<T1> && IsDenseMatrix_v<T2>
7467 ? ( IsSymmetric_v<T1> ^ IsSymmetric_v<T2>
7468 ? ( IsSymmetric_v<T1>
7469 ? SO2
7470 : SO1 )
7471 : SO1 && SO2 )
7472 : ( IsDenseMatrix_v<T1>
7473 ? SO1
7474 : SO2 ) );
7475
7476 using Type = StaticMatrix< EvaluateTrait_t<ElementType>
7477 , max( Size_v<T1,0UL>, Size_v<T2,0UL> )
7478 , max( Size_v<T1,1UL>, Size_v<T2,1UL> )
7479 , SO
7482 , MapTrait_t< TagType_t<T1>, TagType_t<T2>, OP > >;
7483};
7485//*************************************************************************************************
7486
7487
7488
7489
7490//=================================================================================================
7491//
7492// EXPANDTRAIT SPECIALIZATIONS
7493//
7494//=================================================================================================
7495
7496//*************************************************************************************************
7498template< typename T, size_t E >
7499struct ExpandTraitEval2< T, E
7501 ( E != inf ) &&
7502 ( Size_v<T,0UL> != DefaultSize_v ) > >
7503{
7504 using Type = StaticMatrix< ElementType_t<T>
7505 , ( IsColumnVector_v<T> ? Size_v<T,0UL> : E )
7506 , ( IsColumnVector_v<T> ? E : Size_v<T,0UL> )
7507 , ( IsColumnVector_v<T> ? columnMajor : rowMajor )
7510 , TagType_t<T> >;
7511};
7513//*************************************************************************************************
7514
7515
7516
7517
7518//=================================================================================================
7519//
7520// REPEATTRAIT SPECIALIZATIONS
7521//
7522//=================================================================================================
7523
7524//*************************************************************************************************
7526template< typename T, size_t R0, size_t R1 >
7527struct RepeatTraitEval2< T, R0, R1, inf
7529 ( R0 != inf ) &&
7530 ( R1 != inf ) &&
7531 ( Size_v<T,0UL> != DefaultSize_v ) &&
7532 ( Size_v<T,1UL> != DefaultSize_v ) > >
7533{
7534 using Type = StaticMatrix< ElementType_t<T>
7535 , R0*Size_v<T,0UL>
7536 , R1*Size_v<T,1UL>
7537 , StorageOrder_v<T>
7540 , TagType_t<T> >;
7541};
7543//*************************************************************************************************
7544
7545
7546
7547
7548//=================================================================================================
7549//
7550// SOLVETRAIT SPECIALIZATIONS
7551//
7552//=================================================================================================
7553
7554//*************************************************************************************************
7556template< typename T1, typename T2 >
7557struct SolveTraitEval2< T1, T2
7558 , EnableIf_t< IsDenseMatrix_v<T1> &&
7559 IsDenseMatrix_v<T2> &&
7560 ( ( Size_v<T1,0UL> != DefaultSize_v ) ||
7561 ( Size_v<T1,1UL> != DefaultSize_v ) ||
7562 ( Size_v<T2,0UL> != DefaultSize_v ) ) &&
7563 ( Size_v<T2,1UL> != DefaultSize_v ) > >
7564{
7565 using Type = StaticMatrix< ElementType_t<T2>
7566 , max( Size_v<T1,0UL>, Size_v<T1,1UL>, Size_v<T2,0UL> )
7567 , Size_v<T2,1UL>
7568 , StorageOrder_v<T2>
7571 , TagType_t<T2> >;
7572};
7574//*************************************************************************************************
7575
7576
7577
7578
7579//=================================================================================================
7580//
7581// HIGHTYPE SPECIALIZATIONS
7582//
7583//=================================================================================================
7584
7585//*************************************************************************************************
7587template< typename T1, size_t M, size_t N, bool SO, AlignmentFlag AF, PaddingFlag PF, typename Tag, typename T2 >
7588struct HighType< StaticMatrix<T1,M,N,SO,AF,PF,Tag>, StaticMatrix<T2,M,N,SO,AF,PF,Tag> >
7589{
7590 using Type = StaticMatrix< typename HighType<T1,T2>::Type, M, N, SO, AF, PF, Tag >;
7591};
7593//*************************************************************************************************
7594
7595
7596
7597
7598//=================================================================================================
7599//
7600// LOWTYPE SPECIALIZATIONS
7601//
7602//=================================================================================================
7603
7604//*************************************************************************************************
7606template< typename T1, size_t M, size_t N, bool SO, AlignmentFlag AF, PaddingFlag PF, typename Tag, typename T2 >
7607struct LowType< StaticMatrix<T1,M,N,SO,AF,PF,Tag>, StaticMatrix<T2,M,N,SO,AF,PF,Tag> >
7608{
7609 using Type = StaticMatrix< typename LowType<T1,T2>::Type, M, N, SO, AF, PF, Tag >;
7610};
7612//*************************************************************************************************
7613
7614
7615
7616
7617//=================================================================================================
7618//
7619// SUBMATRIXTRAIT SPECIALIZATIONS
7620//
7621//=================================================================================================
7622
7623//*************************************************************************************************
7625template< typename MT, size_t I, size_t J, size_t M, size_t N >
7626struct SubmatrixTraitEval2< MT, I, J, M, N
7627 , EnableIf_t< I != inf && J != inf && M != inf && N != inf &&
7628 IsDenseMatrix_v<MT> > >
7629{
7630 using Type = StaticMatrix< RemoveConst_t< ElementType_t<MT> >
7631 , M
7632 , N
7633 , StorageOrder_v<MT>
7636 , TagType_t<MT> >;
7637};
7639//*************************************************************************************************
7640
7641
7642
7643
7644//=================================================================================================
7645//
7646// ROWSTRAIT SPECIALIZATIONS
7647//
7648//=================================================================================================
7649
7650//*************************************************************************************************
7652template< typename MT, size_t M >
7653struct RowsTraitEval2< MT, M
7654 , EnableIf_t< M != 0UL &&
7655 IsDenseMatrix_v<MT> &&
7656 Size_v<MT,1UL> != DefaultSize_v > >
7657{
7658 using Type = StaticMatrix< RemoveConst_t< ElementType_t<MT> >
7659 , M
7660 , Size_v<MT,1UL>
7661 , false
7664 , TagType_t<MT> >;
7665};
7667//*************************************************************************************************
7668
7669
7670
7671
7672//=================================================================================================
7673//
7674// COLUMNSTRAIT SPECIALIZATIONS
7675//
7676//=================================================================================================
7677
7678//***********************z**************************************************************************
7680template< typename MT, size_t N >
7681struct ColumnsTraitEval2< MT, N
7682 , EnableIf_t< N != 0UL &&
7683 IsDenseMatrix_v<MT> &&
7684 Size_v<MT,0UL> != DefaultSize_v > >
7685{
7686 using Type = StaticMatrix< RemoveConst_t< ElementType_t<MT> >
7687 , Size_v<MT,0UL>
7688 , N
7689 , true
7692 , TagType_t<MT> >;
7693};
7695//*************************************************************************************************
7696
7697} // namespace blaze
7698
7699#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::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
Header file for the AlignedArray implementation.
Header file for the alignment check function.
Header file for the alignment flag enumeration.
Header file for the AlignmentOf type trait.
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 DenseIterator class template.
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.
Constraint on the data type.
Header file for the HasConstDataAccess type trait.
Header file for the HasMutableDataAccess type trait.
Header file for the HasSIMDAdd type trait.
Header file for the HasSIMDMult type trait.
Header file for the HasSIMDSub type 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 IsColumnMajorMatrix type trait.
Header file for the IsColumnVector type trait.
Header file for the IsContiguous type trait.
Header file for the isDefault shim.
Header file for the IsDenseMatrix type trait.
Header file for the IsDenseVector type trait.
Header file for the IsDiagonal type trait.
Header file for the IsLower type trait.
Header file for the IsMatrix type trait.
Header file for the IsNumeric type trait.
Header file for the IsPadded type trait.
Header file for the IsRowMajorMatrix type trait.
Header file for the IsRowVector type trait.
Header file for the IsSIMDCombinable type trait.
Header file for the IsSame and IsStrictlySame type traits.
Header file for the IsScalar type trait.
Header file for the IsSparseMatrix type trait.
Header file for the IsSquare type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Header file for the IsUpper 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 MaxSize type trait.
Header file for the MAYBE_UNUSED function template.
Header file for memory allocation and deallocation functionality.
Header file for the multiplication trait.
Header file for the nextMultiple shim.
Constraint on the data type.
Header file for the prevMultiple shim.
Constraint on the data type.
Header file for the relaxation flag enumeration.
Header file for the RemoveCV 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 Solver trait.
Compile time assertion.
Header file for the subtraction trait.
Header file for the submatrix trait.
Constraint on the data type.
Constraint on the data type.
Constraint on the data type.
Implementation of a generic iterator for dense vectors and matrices.
Definition: DenseIterator.h:60
Base class for dense matrices.
Definition: DenseMatrix.h:82
Base class for matrices.
Definition: Matrix.h:85
SIMD characteristics of data types.
Definition: SIMDTrait.h:297
Base class for sparse matrices.
Definition: SparseMatrix.h:77
Efficient implementation of a fixed-sized matrix.
Definition: StaticMatrix.h:249
AlignedArray< Type, M *NN, Alignment > AlignedStorage
Type of the aligned storage.
Definition: StaticMatrix.h:564
DenseMatrix< This, SO > BaseType
Base type of this StaticMatrix instance.
Definition: StaticMatrix.h:255
StaticMatrix< Type, M, N,!SO, AF, PF, Tag > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: StaticMatrix.h:259
DenseIterator< Type, AF > Iterator
Iterator over non-constant elements.
Definition: StaticMatrix.h:275
StaticMatrix & transpose()
In-place transpose of the matrix.
Definition: StaticMatrix.h:2128
BLAZE_ALWAYS_INLINE void storeu(size_t i, size_t j, const SIMDType &value) noexcept
Unaligned store of a SIMD element of the matrix.
Definition: StaticMatrix.h:2852
static constexpr size_t SIMDSIZE
The number of elements packed within a single SIMD vector.
Definition: StaticMatrix.h:434
const Type & ReturnType
Return type for expression template evaluations.
Definition: StaticMatrix.h:267
const This & CompositeType
Data type for composite expression templates.
Definition: StaticMatrix.h:268
static constexpr bool isAligned() noexcept
Returns whether the matrix is properly aligned in memory.
Definition: StaticMatrix.h:2635
constexpr Iterator begin(size_t i) noexcept
Returns an iterator to the first element of row/column i.
Definition: StaticMatrix.h:1262
static constexpr size_t Alignment
Alignment of the data elements.
Definition: StaticMatrix.h:560
Tag TagType
Tag type of this StaticMatrix instance.
Definition: StaticMatrix.h:266
static constexpr size_t NN
Alignment adjustment.
Definition: StaticMatrix.h:437
auto addAssign(const DenseMatrix< MT, SO2 > &rhs) -> DisableIf_t< VectorizedAddAssign_v< MT > >
Default implementation of the addition assignment of a row-major dense matrix.
Definition: StaticMatrix.h:3072
const Type * ConstPointer
Pointer to a constant matrix value.
Definition: StaticMatrix.h:273
Type ElementType
Type of the matrix elements.
Definition: StaticMatrix.h:264
DenseIterator< const Type, AF > ConstIterator
Iterator over constant elements.
Definition: StaticMatrix.h:276
BLAZE_ALWAYS_INLINE SIMDType load(size_t i, size_t j) const noexcept
Load of a SIMD element of the matrix.
Definition: StaticMatrix.h:2665
constexpr StaticMatrix & operator=(const Type &set) &
Homogenous assignment to all matrix elements.
Definition: StaticMatrix.h:1427
StaticMatrix()
The default constructor for StaticMatrix.
Definition: StaticMatrix.h:648
bool isAliased(const Other *alias) const noexcept
Returns whether the matrix is aliased with the given address alias.
Definition: StaticMatrix.h:2612
constexpr Reference operator()(size_t i, size_t j) noexcept
2D-access to the matrix elements.
Definition: StaticMatrix.h:1041
constexpr ConstIterator cbegin(size_t i) const noexcept
Returns an iterator to the first element of row/column i.
Definition: StaticMatrix.h:1316
auto subAssign(const DenseMatrix< MT, SO2 > &rhs) -> DisableIf_t< VectorizedSubAssign_v< MT > >
Default implementation of the subtraction assignment of a dense matrix.
Definition: StaticMatrix.h:3240
void swap(StaticMatrix &m) noexcept
Swapping the contents of two static matrices.
Definition: StaticMatrix.h:2092
StaticMatrix & ctranspose()
In-place conjugate transpose of the matrix.
Definition: StaticMatrix.h:2214
BLAZE_ALWAYS_INLINE void store(size_t i, size_t j, const SIMDType &value) noexcept
Store of a SIMD element of the matrix.
Definition: StaticMatrix.h:2777
BLAZE_ALWAYS_INLINE SIMDType loadu(size_t i, size_t j) const noexcept
Unaligned load of a SIMD element of the matrix.
Definition: StaticMatrix.h:2738
constexpr Iterator end(size_t i) noexcept
Returns an iterator just past the last element of row/column i.
Definition: StaticMatrix.h:1343
StaticMatrix< Type, M, N, SO, AF, PF, Tag > This
Type of this StaticMatrix instance.
Definition: StaticMatrix.h:253
StaticMatrix< Type, N, M,!SO, AF, PF, Tag > TransposeType
Transpose type for expression template evaluations.
Definition: StaticMatrix.h:262
constexpr Pointer data() noexcept
Low-level data access to the matrix elements.
Definition: StaticMatrix.h:1161
static constexpr size_t columns() noexcept
Returns the current number of columns of the matrix.
Definition: StaticMatrix.h:1885
constexpr bool isIntact() const noexcept
Returns whether the invariants of the static matrix are intact.
Definition: StaticMatrix.h:2545
bool canAlias(const Other *alias) const noexcept
Returns whether the matrix can alias with the given address alias.
Definition: StaticMatrix.h:2587
Reference at(size_t i, size_t j)
Checked access to the matrix elements.
Definition: StaticMatrix.h:1096
Type * Pointer
Pointer to a non-constant matrix value.
Definition: StaticMatrix.h:272
static constexpr size_t rows() noexcept
Returns the current number of rows of the matrix.
Definition: StaticMatrix.h:1866
AlignedStorage v_
The statically allocated matrix elements.
Definition: StaticMatrix.h:570
BLAZE_ALWAYS_INLINE void storea(size_t i, size_t j, const SIMDType &value) noexcept
Aligned store of a SIMD element of the matrix.
Definition: StaticMatrix.h:2811
BLAZE_ALWAYS_INLINE SIMDType loada(size_t i, size_t j) const noexcept
Aligned load of a SIMD element of the matrix.
Definition: StaticMatrix.h:2698
auto assign(const DenseMatrix< MT, SO2 > &rhs) -> DisableIf_t< VectorizedAssign_v< MT > >
Default implementation of the assignment of a dense matrix.
Definition: StaticMatrix.h:2929
static constexpr size_t spacing() noexcept
Returns the spacing between the beginning of two rows.
Definition: StaticMatrix.h:1907
constexpr void reset()
Reset to the default initial values.
Definition: StaticMatrix.h:2039
auto schurAssign(const DenseMatrix< MT, SO2 > &rhs) -> DisableIf_t< VectorizedSchurAssign_v< MT > >
Default implementation of the Schur product assignment of a dense matrix.
Definition: StaticMatrix.h:3408
Type & Reference
Reference to a non-constant matrix value.
Definition: StaticMatrix.h:270
static constexpr size_t capacity() noexcept
Returns the maximum capacity of the matrix.
Definition: StaticMatrix.h:1926
static constexpr bool smpAssignable
Compilation flag for SMP assignments.
Definition: StaticMatrix.h:310
BLAZE_ALWAYS_INLINE void stream(size_t i, size_t j, const SIMDType &value) noexcept
Aligned, non-temporal store of a SIMD element of the matrix.
Definition: StaticMatrix.h:2892
size_t nonZeros() const
Returns the total number of non-zero elements in the matrix.
Definition: StaticMatrix.h:1978
static constexpr bool simdEnabled
Compilation flag for SIMD optimization.
Definition: StaticMatrix.h:304
This ResultType
Result type for expression template evaluations.
Definition: StaticMatrix.h:256
const Type & ConstReference
Reference to a constant matrix value.
Definition: StaticMatrix.h:271
SIMDTrait_t< ElementType > SIMDType
SIMD type of the matrix elements.
Definition: StaticMatrix.h:265
constexpr ConstIterator cend(size_t i) const noexcept
Returns an iterator just past the last element of row/column i.
Definition: StaticMatrix.h:1397
Initializer list type of the Blaze library.
Header file for the DenseMatrix base class.
Header file for the SparseMatrix 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) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1375
decltype(auto) ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatMapExpr.h:1501
decltype(auto) trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:766
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
decltype(auto) inv(const DenseMatrix< MT, SO > &dm)
Calculation of the inverse of the given dense matrix.
Definition: DMatInvExpr.h:405
bool isIntact(const StaticMatrix< Type, M, N, SO, AF, PF, Tag > &m) noexcept
Returns whether the invariants of the given static matrix are intact.
Definition: StaticMatrix.h:6947
void swap(StaticMatrix< Type, M, N, SO, AF, PF, Tag > &a, StaticMatrix< Type, M, N, SO, AF, PF, Tag > &b) noexcept
Swapping the contents of two static matrices.
Definition: StaticMatrix.h:6969
bool isDefault(const StaticMatrix< Type, M, N, SO, AF, PF, Tag > &m)
Returns whether the given dynamic matrix is in default state.
Definition: StaticMatrix.h:6904
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Symmetric.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_DIAGONAL_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Diagonal.h:79
BLAZE_ALWAYS_INLINE void cswap(T &a, T &b) noexcept(IsNumeric_v< T >)
Swapping two conjugated values/objects.
Definition: Conjugate.h:193
BLAZE_ALWAYS_INLINE void conjugate(T &a) noexcept(IsNumeric_v< T >)
In-place conjugation of the given value/object.
Definition: Conjugate.h:118
constexpr bool HasSIMDSub_v
Auxiliary variable template for the HasSIMDSub type trait.
Definition: HasSIMDSub.h:187
constexpr bool IsScalar_v
Auxiliary variable template for the IsScalar type trait.
Definition: IsScalar.h:104
constexpr bool IsRowMajorMatrix_v
Auxiliary variable template for the IsRowMajorMatrix type trait.
Definition: IsRowMajorMatrix.h:129
constexpr bool IsSIMDCombinable_v
Auxiliary variable template for the IsSIMDCombinable type trait.
Definition: IsSIMDCombinable.h:137
constexpr ptrdiff_t DefaultSize_v
Default size of the Size type trait.
Definition: Size.h:72
constexpr bool IsDiagonal_v
Auxiliary variable template for the IsDiagonal type trait.
Definition: IsDiagonal.h:148
constexpr bool IsColumnMajorMatrix_v
Auxiliary variable template for the IsColumnMajorMatrix type trait.
Definition: IsColumnMajorMatrix.h:129
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 HasSIMDAdd_v
Auxiliary variable template for the HasSIMDAdd type trait.
Definition: HasSIMDAdd.h:187
constexpr bool HasSIMDMult_v
Auxiliary variable template for the HasSIMDMult type trait.
Definition: HasSIMDMult.h:188
constexpr bool IsDenseMatrix_v
Auxiliary variable template for the IsDenseMatrix type trait.
Definition: IsDenseMatrix.h:124
constexpr bool IsDenseVector_v
Auxiliary variable template for the IsDenseVector type trait.
Definition: IsDenseVector.h:124
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition: RelaxationFlag.h:66
BLAZE_ALWAYS_INLINE constexpr auto prevMultiple(T1 value, T2 factor) noexcept
Rounds down an integral value to the previous multiple of a given factor.
Definition: PrevMultiple.h:68
constexpr Infinity inf
Global Infinity instance.
Definition: Infinity.h:1080
constexpr size_t determineColumns(initializer_list< initializer_list< Type > > list) noexcept
Determines the maximum number of columns specified by the given initializer list.
Definition: InitializerList.h:107
BLAZE_ALWAYS_INLINE constexpr auto nextMultiple(T1 value, T2 factor) noexcept
Rounds up an integral value to the next multiple of a given factor.
Definition: NextMultiple.h:68
PaddingFlag
Padding flag for (un-)padded vectors and matrices.
Definition: PaddingFlag.h:77
AlignmentFlag
Alignment flag for (un-)aligned vectors and matrices.
Definition: AlignmentFlag.h:63
@ padded
Flag for padded vectors and matrices.
Definition: PaddingFlag.h:79
@ unpadded
Flag for unpadded vectors and matrices.
Definition: PaddingFlag.h:78
@ unaligned
Flag for unaligned vectors and matrices.
Definition: AlignmentFlag.h:64
@ aligned
Flag for aligned vectors and matrices.
Definition: AlignmentFlag.h:65
constexpr void clear(Matrix< MT, SO > &matrix)
Clearing the given matrix.
Definition: Matrix.h:960
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:644
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition: Matrix.h:806
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:660
void ctranspose(Matrix< MT, SO > &matrix)
In-place conjugate transpose of the given matrix.
Definition: Matrix.h:1221
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:676
void transpose(Matrix< MT, SO > &matrix)
In-place transpose of the given matrix.
Definition: Matrix.h:1195
#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
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:78
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:75
BLAZE_ALWAYS_INLINE EnableIf_t< IsIntegral_v< T1 > &&HasSize_v< T1, 1UL > > stream(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned, non-temporal store of a vector of 1-byte integral values.
Definition: Stream.h:74
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:76
BLAZE_ALWAYS_INLINE const EnableIf_t< IsIntegral_v< T > &&HasSize_v< T, 1UL >, If_t< IsSigned_v< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:79
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.
Definition: StaticAssert.h:112
constexpr PaddingFlag defaultPaddingFlag
The default padding flag for all vectors and matrices of the Blaze library.
Definition: Padding.h:74
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
constexpr AlignmentFlag defaultAlignmentFlag
The default alignment for all vectors and matrices of the Blaze library.
Definition: Alignment.h:75
constexpr bool IsVectorizable_v
Auxiliary variable template for the IsVectorizable type trait.
Definition: IsVectorizable.h:157
constexpr size_t AlignmentOf_v
Auxiliary variable template for the AlignmentOf type trait.
Definition: AlignmentOf.h:239
BoolConstant< true > TrueType
Type traits base class.
Definition: IntegralConstant.h:132
void deallocate(T *address) noexcept
Deallocation of memory for built-in data types.
Definition: Memory.h:230
BoolConstant< false > FalseType
Type/value traits base class.
Definition: IntegralConstant.h:121
IntegralConstant< ptrdiff_t, N > Ptrdiff_t
Compile time integral constant wrapper for ptrdiff_t.
Definition: IntegralConstant.h:237
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.
Definition: IntegralConstant.h:110
#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
BLAZE_ALWAYS_INLINE bool checkAlignment(const T *address)
Checks the alignment of the given address.
Definition: AlignmentCheck.h:68
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:175
Header file for the exception macros of the math module.
Header file for all forward declarations of the math module.
Header file for the extended initializer_list functionality.
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 Size type trait.
Header file for the StorageOrder type trait.
Header file for the clear shim.
Header file for the serial shim.
Generic wrapper for a compile time constant integral value.
Definition: IntegralConstant.h:74
Compile time check for square matrices.
Definition: IsSquare.h:89
Rebind mechanism to obtain a StaticMatrix with different data/element type.
Definition: StaticMatrix.h:283
StaticMatrix< NewType, M, N, SO, AF, PF, Tag > Other
The type of the other StaticMatrix.
Definition: StaticMatrix.h:284
Resize mechanism to obtain a StaticMatrix with different fixed dimensions.
Definition: StaticMatrix.h:293
StaticMatrix< Type, NewM, NewN, SO, AF, PF, Tag > Other
The type of the other StaticMatrix.
Definition: StaticMatrix.h:294
System settings for the inline keywords.
System settings for performance optimizations.
Header file for basic type definitions.
Header file for the generic max algorithm.
Header file for the generic min algorithm.