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 <algorithm>
44 #include <utility>
45 #include <blaze/math/Aliases.h>
50 #include <blaze/math/Exception.h>
53 #include <blaze/math/Forward.h>
54 #include <blaze/math/Functions.h>
56 #include <blaze/math/shims/Clear.h>
59 #include <blaze/math/SIMD.h>
98 #include <blaze/system/Inline.h>
103 #include <blaze/util/AlignedArray.h>
105 #include <blaze/util/Assert.h>
112 #include <blaze/util/DisableIf.h>
113 #include <blaze/util/EnableIf.h>
114 #include <blaze/util/FalseType.h>
116 #include <blaze/util/Memory.h>
117 #include <blaze/util/mpl/PtrdiffT.h>
118 #include <blaze/util/StaticAssert.h>
119 #include <blaze/util/Template.h>
120 #include <blaze/util/TrueType.h>
121 #include <blaze/util/Types.h>
125 #include <blaze/util/Unused.h>
126 
127 
128 namespace blaze {
129 
130 //=================================================================================================
131 //
132 // CLASS DEFINITION
133 //
134 //=================================================================================================
135 
136 //*************************************************************************************************
218 template< typename Type // Data type of the matrix
219  , size_t M // Number of rows
220  , size_t N // Number of columns
221  , bool SO = defaultStorageOrder > // Storage order
222 class StaticMatrix
223  : public DenseMatrix< StaticMatrix<Type,M,N,SO>, SO >
224 {
225  public:
226  //**Type definitions****************************************************************************
229  using ResultType = This;
232  using ElementType = Type;
234  using ReturnType = const Type&;
235  using CompositeType = const This&;
236 
237  using Reference = Type&;
238  using ConstReference = const Type&;
239  using Pointer = Type*;
240  using ConstPointer = const Type*;
241 
244  //**********************************************************************************************
245 
246  //**Rebind struct definition********************************************************************
249  template< typename NewType > // Data type of the other matrix
250  struct Rebind {
252  };
253  //**********************************************************************************************
254 
255  //**Resize struct definition********************************************************************
258  template< size_t NewM // Number of rows of the other matrix
259  , size_t NewN > // Number of columns of the other matrix
260  struct Resize {
262  };
263  //**********************************************************************************************
264 
265  //**Compilation flags***************************************************************************
267 
271  enum : bool { simdEnabled = IsVectorizable<Type>::value };
272 
274 
277  enum : bool { smpAssignable = false };
278  //**********************************************************************************************
279 
280  //**Constructors********************************************************************************
283  explicit inline StaticMatrix();
284  explicit inline StaticMatrix( const Type& init );
285  explicit inline StaticMatrix( initializer_list< initializer_list<Type> > list );
286 
287  template< typename Other >
288  explicit inline StaticMatrix( size_t m, size_t n, const Other* array );
289 
290  template< typename Other, size_t Rows, size_t Cols >
291  explicit inline StaticMatrix( const Other (&array)[Rows][Cols] );
292 
293  inline StaticMatrix( const StaticMatrix& m );
294  template< typename Other, bool SO2 > inline StaticMatrix( const StaticMatrix<Other,M,N,SO2>& m );
295  template< typename MT , bool SO2 > inline StaticMatrix( const Matrix<MT,SO2>& m );
297  //**********************************************************************************************
298 
299  //**Destructor**********************************************************************************
300  // No explicitly declared destructor.
301  //**********************************************************************************************
302 
303  //**Data access functions***********************************************************************
306  inline Reference operator()( size_t i, size_t j ) noexcept;
307  inline ConstReference operator()( size_t i, size_t j ) const noexcept;
308  inline Reference at( size_t i, size_t j );
309  inline ConstReference at( size_t i, size_t j ) const;
310  inline Pointer data () noexcept;
311  inline ConstPointer data () const noexcept;
312  inline Pointer data ( size_t i ) noexcept;
313  inline ConstPointer data ( size_t i ) const noexcept;
314  inline Iterator begin ( size_t i ) noexcept;
315  inline ConstIterator begin ( size_t i ) const noexcept;
316  inline ConstIterator cbegin( size_t i ) const noexcept;
317  inline Iterator end ( size_t i ) noexcept;
318  inline ConstIterator end ( size_t i ) const noexcept;
319  inline ConstIterator cend ( size_t i ) const noexcept;
321  //**********************************************************************************************
322 
323  //**Assignment operators************************************************************************
326  inline StaticMatrix& operator=( const Type& set );
327  inline StaticMatrix& operator=( initializer_list< initializer_list<Type> > list );
328 
329  template< typename Other, size_t Rows, size_t Cols >
330  inline StaticMatrix& operator=( const Other (&array)[Rows][Cols] );
331 
332  inline StaticMatrix& operator= ( const StaticMatrix& rhs );
333  template< typename Other, bool SO2 > inline StaticMatrix& operator= ( const StaticMatrix<Other,M,N,SO2>& rhs );
334  template< typename MT , bool SO2 > inline StaticMatrix& operator= ( const Matrix<MT,SO2>& rhs );
335  template< typename MT , bool SO2 > inline StaticMatrix& operator+=( const Matrix<MT,SO2>& rhs );
336  template< typename MT , bool SO2 > inline StaticMatrix& operator-=( const Matrix<MT,SO2>& rhs );
337  template< typename MT , bool SO2 > inline StaticMatrix& operator%=( const Matrix<MT,SO2>& rhs );
339  //**********************************************************************************************
340 
341  //**Utility functions***************************************************************************
344  static inline constexpr size_t rows() noexcept;
345  static inline constexpr size_t columns() noexcept;
346  static inline constexpr size_t spacing() noexcept;
347  static inline constexpr size_t capacity() noexcept;
348  inline size_t capacity( size_t i ) const noexcept;
349  inline size_t nonZeros() const;
350  inline size_t nonZeros( size_t i ) const;
351  inline void reset();
352  inline void reset( size_t i );
353  inline void swap( StaticMatrix& m ) noexcept;
355  //**********************************************************************************************
356 
357  //**Numeric functions***************************************************************************
360  inline StaticMatrix& transpose();
361  inline StaticMatrix& ctranspose();
362 
363  template< typename Other > inline StaticMatrix& scale( const Other& scalar );
365  //**********************************************************************************************
366 
367  //**Memory functions****************************************************************************
370  static inline void* operator new ( std::size_t size );
371  static inline void* operator new[]( std::size_t size );
372  static inline void* operator new ( std::size_t size, const std::nothrow_t& );
373  static inline void* operator new[]( std::size_t size, const std::nothrow_t& );
374 
375  static inline void operator delete ( void* ptr );
376  static inline void operator delete[]( void* ptr );
377  static inline void operator delete ( void* ptr, const std::nothrow_t& );
378  static inline void operator delete[]( void* ptr, const std::nothrow_t& );
380  //**********************************************************************************************
381 
382  private:
383  //**********************************************************************************************
385  template< typename MT >
387  struct VectorizedAssign {
388  enum : bool { value = useOptimizedKernels &&
389  simdEnabled && MT::simdEnabled &&
392  };
394  //**********************************************************************************************
395 
396  //**********************************************************************************************
398  template< typename MT >
400  struct VectorizedAddAssign {
401  enum : bool { value = useOptimizedKernels &&
402  simdEnabled && MT::simdEnabled &&
407  };
409  //**********************************************************************************************
410 
411  //**********************************************************************************************
413  template< typename MT >
415  struct VectorizedSubAssign {
416  enum : bool { value = useOptimizedKernels &&
417  simdEnabled && MT::simdEnabled &&
422  };
424  //**********************************************************************************************
425 
426  //**********************************************************************************************
428  template< typename MT >
430  struct VectorizedSchurAssign {
431  enum : bool { value = useOptimizedKernels &&
432  simdEnabled && MT::simdEnabled &&
436  };
438  //**********************************************************************************************
439 
440  //**********************************************************************************************
442  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
443  //**********************************************************************************************
444 
445  public:
446  //**Debugging functions*************************************************************************
449  inline bool isIntact() const noexcept;
451  //**********************************************************************************************
452 
453  //**Expression template evaluation functions****************************************************
456  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
457  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
458 
459  inline bool isAligned() const noexcept;
460 
461  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
462  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
463  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
464 
465  BLAZE_ALWAYS_INLINE void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
466  BLAZE_ALWAYS_INLINE void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
467  BLAZE_ALWAYS_INLINE void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
468  BLAZE_ALWAYS_INLINE void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
469 
470  template< typename MT, bool SO2 >
471  inline DisableIf_<VectorizedAssign<MT> > assign( const DenseMatrix<MT,SO2>& rhs );
472 
473  template< typename MT, bool SO2 >
474  inline EnableIf_<VectorizedAssign<MT> > assign( const DenseMatrix<MT,SO2>& rhs );
475 
476  template< typename MT > inline void assign( const SparseMatrix<MT,SO>& rhs );
477  template< typename MT > inline void assign( const SparseMatrix<MT,!SO>& rhs );
478 
479  template< typename MT, bool SO2 >
480  inline DisableIf_<VectorizedAddAssign<MT> > addAssign( const DenseMatrix<MT,SO2>& rhs );
481 
482  template< typename MT, bool SO2 >
483  inline EnableIf_<VectorizedAddAssign<MT> > addAssign( const DenseMatrix<MT,SO2>& rhs );
484 
485  template< typename MT > inline void addAssign( const SparseMatrix<MT,SO>& rhs );
486  template< typename MT > inline void addAssign( const SparseMatrix<MT,!SO>& rhs );
487 
488  template< typename MT, bool SO2 >
489  inline DisableIf_<VectorizedSubAssign<MT> > subAssign( const DenseMatrix<MT,SO2>& rhs );
490 
491  template< typename MT, bool SO2 >
492  inline EnableIf_<VectorizedSubAssign<MT> > subAssign( const DenseMatrix<MT,SO2>& rhs );
493 
494  template< typename MT > inline void subAssign( const SparseMatrix<MT,SO>& rhs );
495  template< typename MT > inline void subAssign( const SparseMatrix<MT,!SO>& rhs );
496 
497  template< typename MT, bool SO2 >
498  inline DisableIf_<VectorizedSchurAssign<MT> > schurAssign( const DenseMatrix<MT,SO2>& rhs );
499 
500  template< typename MT, bool SO2 >
501  inline EnableIf_<VectorizedSchurAssign<MT> > schurAssign( const DenseMatrix<MT,SO2>& rhs );
502 
503  template< typename MT > inline void schurAssign( const SparseMatrix<MT,SO>& rhs );
504  template< typename MT > inline void schurAssign( const SparseMatrix<MT,!SO>& rhs );
506  //**********************************************************************************************
507 
508  private:
509  //**Utility functions***************************************************************************
511  inline void transpose ( TrueType );
512  inline void transpose ( FalseType );
513  inline void ctranspose( TrueType );
514  inline void ctranspose( FalseType );
516  //**********************************************************************************************
517 
518  //**********************************************************************************************
520  enum : size_t { NN = ( usePadding )?( nextMultiple( N, SIMDSIZE ) ):( N ) };
521  //**********************************************************************************************
522 
523  //**Member variables****************************************************************************
527 
537  //**********************************************************************************************
538 
539  //**Compile time checks*************************************************************************
545  BLAZE_STATIC_ASSERT( !usePadding || NN % SIMDSIZE == 0UL );
546  BLAZE_STATIC_ASSERT( NN >= N );
548  //**********************************************************************************************
549 };
550 //*************************************************************************************************
551 
552 
553 
554 
555 //=================================================================================================
556 //
557 // CONSTRUCTORS
558 //
559 //=================================================================================================
560 
561 //*************************************************************************************************
566 template< typename Type // Data type of the matrix
567  , size_t M // Number of rows
568  , size_t N // Number of columns
569  , bool SO > // Storage order
571  : v_() // The statically allocated matrix elements
572 {
574 
575  if( IsNumeric<Type>::value ) {
576  for( size_t i=0UL; i<M*NN; ++i )
577  v_[i] = Type();
578  }
579 
580  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
581 }
582 //*************************************************************************************************
583 
584 
585 //*************************************************************************************************
590 template< typename Type // Data type of the matrix
591  , size_t M // Number of rows
592  , size_t N // Number of columns
593  , bool SO > // Storage order
594 inline StaticMatrix<Type,M,N,SO>::StaticMatrix( const Type& init )
595  : v_() // The statically allocated matrix elements
596 {
598 
599  for( size_t i=0UL; i<M; ++i ) {
600  for( size_t j=0UL; j<N; ++j )
601  v_[i*NN+j] = init;
602 
603  for( size_t j=N; j<NN; ++j )
604  v_[i*NN+j] = Type();
605  }
606 
607  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
608 }
609 //*************************************************************************************************
610 
611 
612 //*************************************************************************************************
634 template< typename Type // Data type of the matrix
635  , size_t M // Number of rows
636  , size_t N // Number of columns
637  , bool SO > // Storage order
639  : v_() // The statically allocated matrix elements
640 {
642 
643  if( list.size() != M || determineColumns( list ) > N ) {
644  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static matrix" );
645  }
646 
647  size_t i( 0UL );
648 
649  for( const auto& rowList : list ) {
650  std::fill( std::copy( rowList.begin(), rowList.end(), v_+i*NN ), v_+(i+1UL)*NN, Type() );
651  ++i;
652  }
653 
654  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
655 }
656 //*************************************************************************************************
657 
658 
659 //*************************************************************************************************
685 template< typename Type // Data type of the matrix
686  , size_t M // Number of rows
687  , size_t N // Number of columns
688  , bool SO > // Storage order
689 template< typename Other > // Data type of the initialization array
690 inline StaticMatrix<Type,M,N,SO>::StaticMatrix( size_t m, size_t n, const Other* array )
691  : v_() // The statically allocated matrix elements
692 {
694 
695  if( m > M || n > N ) {
696  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static matrix" );
697  }
698 
699  for( size_t i=0UL; i<m; ++i ) {
700  for( size_t j=0UL; j<n; ++j )
701  v_[i*NN+j] = array[i*n+j];
702 
703  if( IsNumeric<Type>::value ) {
704  for( size_t j=n; j<NN; ++j )
705  v_[i*NN+j] = Type();
706  }
707  }
708 
709  if( IsNumeric<Type>::value ) {
710  for( size_t i=m; i<M; ++i ) {
711  for( size_t j=0UL; j<NN; ++j )
712  v_[i*NN+j] = Type();
713  }
714  }
715 
716  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
717 }
718 //*************************************************************************************************
719 
720 
721 //*************************************************************************************************
741 template< typename Type // Data type of the matrix
742  , size_t M // Number of rows
743  , size_t N // Number of columns
744  , bool SO > // Storage order
745 template< typename Other // Data type of the initialization array
746  , size_t Rows // Number of rows of the initialization array
747  , size_t Cols > // Number of columns of the initialization array
748 inline StaticMatrix<Type,M,N,SO>::StaticMatrix( const Other (&array)[Rows][Cols] )
749  : v_() // The statically allocated matrix elements
750 {
752  BLAZE_STATIC_ASSERT( Rows == M && Cols == N );
753 
754  for( size_t i=0UL; i<M; ++i ) {
755  for( size_t j=0UL; j<N; ++j )
756  v_[i*NN+j] = array[i][j];
757 
758  for( size_t j=N; j<NN; ++j )
759  v_[i*NN+j] = Type();
760  }
761 
762  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
763 }
764 //*************************************************************************************************
765 
766 
767 //*************************************************************************************************
774 template< typename Type // Data type of the matrix
775  , size_t M // Number of rows
776  , size_t N // Number of columns
777  , bool SO > // Storage order
779  : v_() // The statically allocated matrix elements
780 {
782 
783  for( size_t i=0UL; i<M*NN; ++i )
784  v_[i] = m.v_[i];
785 
786  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
787 }
788 //*************************************************************************************************
789 
790 
791 //*************************************************************************************************
796 template< typename Type // Data type of the matrix
797  , size_t M // Number of rows
798  , size_t N // Number of columns
799  , bool SO > // Storage order
800 template< typename Other // Data type of the foreign matrix
801  , bool SO2 > // Storage order of the foreign matrix
803  : v_() // The statically allocated matrix elements
804 {
806 
807  for( size_t i=0UL; i<M; ++i ) {
808  for( size_t j=0UL; j<N; ++j )
809  v_[i*NN+j] = m(i,j);
810 
811  for( size_t j=N; j<NN; ++j )
812  v_[i*NN+j] = Type();
813  }
814 
815  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
816 }
817 //*************************************************************************************************
818 
819 
820 //*************************************************************************************************
830 template< typename Type // Data type of the matrix
831  , size_t M // Number of rows
832  , size_t N // Number of columns
833  , bool SO > // Storage order
834 template< typename MT // Type of the foreign matrix
835  , bool SO2 > // Storage order of the foreign matrix
837  : v_() // The statically allocated matrix elements
838 {
839  using blaze::assign;
840 
842 
843  if( (~m).rows() != M || (~m).columns() != N ) {
844  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static matrix" );
845  }
846 
847  for( size_t i=0UL; i<M; ++i ) {
848  for( size_t j=( IsSparseMatrix<MT>::value ? 0UL : N ); j<NN; ++j ) {
849  v_[i*NN+j] = Type();
850  }
851  }
852 
853  assign( *this, ~m );
854 
855  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
856 }
857 //*************************************************************************************************
858 
859 
860 
861 
862 //=================================================================================================
863 //
864 // DATA ACCESS FUNCTIONS
865 //
866 //=================================================================================================
867 
868 //*************************************************************************************************
878 template< typename Type // Data type of the matrix
879  , size_t M // Number of rows
880  , size_t N // Number of columns
881  , bool SO > // Storage order
883  StaticMatrix<Type,M,N,SO>::operator()( size_t i, size_t j ) noexcept
884 {
885  BLAZE_USER_ASSERT( i<M, "Invalid row access index" );
886  BLAZE_USER_ASSERT( j<N, "Invalid column access index" );
887  return v_[i*NN+j];
888 }
889 //*************************************************************************************************
890 
891 
892 //*************************************************************************************************
902 template< typename Type // Data type of the matrix
903  , size_t M // Number of rows
904  , size_t N // Number of columns
905  , bool SO > // Storage order
907  StaticMatrix<Type,M,N,SO>::operator()( size_t i, size_t j ) const noexcept
908 {
909  BLAZE_USER_ASSERT( i<M, "Invalid row access index" );
910  BLAZE_USER_ASSERT( j<N, "Invalid column access index" );
911  return v_[i*NN+j];
912 }
913 //*************************************************************************************************
914 
915 
916 //*************************************************************************************************
927 template< typename Type // Data type of the matrix
928  , size_t M // Number of rows
929  , size_t N // Number of columns
930  , bool SO > // Storage order
932  StaticMatrix<Type,M,N,SO>::at( size_t i, size_t j )
933 {
934  if( i >= M ) {
935  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
936  }
937  if( j >= N ) {
938  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
939  }
940  return (*this)(i,j);
941 }
942 //*************************************************************************************************
943 
944 
945 //*************************************************************************************************
956 template< typename Type // Data type of the matrix
957  , size_t M // Number of rows
958  , size_t N // Number of columns
959  , bool SO > // Storage order
961  StaticMatrix<Type,M,N,SO>::at( size_t i, size_t j ) const
962 {
963  if( i >= M ) {
964  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
965  }
966  if( j >= N ) {
967  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
968  }
969  return (*this)(i,j);
970 }
971 //*************************************************************************************************
972 
973 
974 //*************************************************************************************************
986 template< typename Type // Data type of the matrix
987  , size_t M // Number of rows
988  , size_t N // Number of columns
989  , bool SO > // Storage order
992 {
993  return v_;
994 }
995 //*************************************************************************************************
996 
997 
998 //*************************************************************************************************
1010 template< typename Type // Data type of the matrix
1011  , size_t M // Number of rows
1012  , size_t N // Number of columns
1013  , bool SO > // Storage order
1016 {
1017  return v_;
1018 }
1019 //*************************************************************************************************
1020 
1021 
1022 //*************************************************************************************************
1030 template< typename Type // Data type of the matrix
1031  , size_t M // Number of rows
1032  , size_t N // Number of columns
1033  , bool SO > // Storage order
1034 inline typename StaticMatrix<Type,M,N,SO>::Pointer
1035  StaticMatrix<Type,M,N,SO>::data( size_t i ) noexcept
1036 {
1037  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1038  return v_ + i*NN;
1039 }
1040 //*************************************************************************************************
1041 
1042 
1043 //*************************************************************************************************
1051 template< typename Type // Data type of the matrix
1052  , size_t M // Number of rows
1053  , size_t N // Number of columns
1054  , bool SO > // Storage order
1056  StaticMatrix<Type,M,N,SO>::data( size_t i ) const noexcept
1057 {
1058  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1059  return v_ + i*NN;
1060 }
1061 //*************************************************************************************************
1062 
1063 
1064 //*************************************************************************************************
1075 template< typename Type // Data type of the matrix
1076  , size_t M // Number of rows
1077  , size_t N // Number of columns
1078  , bool SO > // Storage order
1081 {
1082  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1083  return Iterator( v_ + i*NN );
1084 }
1085 //*************************************************************************************************
1086 
1087 
1088 //*************************************************************************************************
1099 template< typename Type // Data type of the matrix
1100  , size_t M // Number of rows
1101  , size_t N // Number of columns
1102  , bool SO > // Storage order
1104  StaticMatrix<Type,M,N,SO>::begin( size_t i ) const noexcept
1105 {
1106  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1107  return ConstIterator( v_ + i*NN );
1108 }
1109 //*************************************************************************************************
1110 
1111 
1112 //*************************************************************************************************
1123 template< typename Type // Data type of the matrix
1124  , size_t M // Number of rows
1125  , size_t N // Number of columns
1126  , bool SO > // Storage order
1128  StaticMatrix<Type,M,N,SO>::cbegin( size_t i ) const noexcept
1129 {
1130  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1131  return ConstIterator( v_ + i*NN );
1132 }
1133 //*************************************************************************************************
1134 
1135 
1136 //*************************************************************************************************
1147 template< typename Type // Data type of the matrix
1148  , size_t M // Number of rows
1149  , size_t N // Number of columns
1150  , bool SO > // Storage order
1152  StaticMatrix<Type,M,N,SO>::end( size_t i ) noexcept
1153 {
1154  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1155  return Iterator( v_ + i*NN + N );
1156 }
1157 //*************************************************************************************************
1158 
1159 
1160 //*************************************************************************************************
1171 template< typename Type // Data type of the matrix
1172  , size_t M // Number of rows
1173  , size_t N // Number of columns
1174  , bool SO > // Storage order
1176  StaticMatrix<Type,M,N,SO>::end( size_t i ) const noexcept
1177 {
1178  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1179  return ConstIterator( v_ + i*NN + N );
1180 }
1181 //*************************************************************************************************
1182 
1183 
1184 //*************************************************************************************************
1195 template< typename Type // Data type of the matrix
1196  , size_t M // Number of rows
1197  , size_t N // Number of columns
1198  , bool SO > // Storage order
1200  StaticMatrix<Type,M,N,SO>::cend( size_t i ) const noexcept
1201 {
1202  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1203  return ConstIterator( v_ + i*NN + N );
1204 }
1205 //*************************************************************************************************
1206 
1207 
1208 
1209 
1210 //=================================================================================================
1211 //
1212 // ASSIGNMENT OPERATORS
1213 //
1214 //=================================================================================================
1215 
1216 //*************************************************************************************************
1222 template< typename Type // Data type of the matrix
1223  , size_t M // Number of rows
1224  , size_t N // Number of columns
1225  , bool SO > // Storage order
1227 {
1228  for( size_t i=0UL; i<M; ++i )
1229  for( size_t j=0UL; j<N; ++j )
1230  v_[i*NN+j] = set;
1231 
1232  return *this;
1233 }
1234 //*************************************************************************************************
1235 
1236 
1237 //*************************************************************************************************
1261 template< typename Type // Data type of the matrix
1262  , size_t M // Number of rows
1263  , size_t N // Number of columns
1264  , bool SO > // Storage order
1267 {
1268  if( list.size() != M || determineColumns( list ) > N ) {
1269  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to static matrix" );
1270  }
1271 
1272  size_t i( 0UL );
1273 
1274  for( const auto& rowList : list ) {
1275  std::fill( std::copy( rowList.begin(), rowList.end(), v_+i*NN ), v_+(i+1UL)*NN, Type() );
1276  ++i;
1277  }
1278 
1279  return *this;
1280 }
1281 //*************************************************************************************************
1282 
1283 
1284 //*************************************************************************************************
1305 template< typename Type // Data type of the matrix
1306  , size_t M // Number of rows
1307  , size_t N // Number of columns
1308  , bool SO > // Storage order
1309 template< typename Other // Data type of the initialization array
1310  , size_t Rows // Number of rows of the initialization array
1311  , size_t Cols > // Number of columns of the initialization array
1312 inline StaticMatrix<Type,M,N,SO>& StaticMatrix<Type,M,N,SO>::operator=( const Other (&array)[Rows][Cols] )
1313 {
1314  BLAZE_STATIC_ASSERT( Rows == M && Cols == N );
1315 
1316  for( size_t i=0UL; i<M; ++i )
1317  for( size_t j=0UL; j<N; ++j )
1318  v_[i*NN+j] = array[i][j];
1319 
1320  return *this;
1321 }
1322 //*************************************************************************************************
1323 
1324 
1325 //*************************************************************************************************
1333 template< typename Type // Data type of the matrix
1334  , size_t M // Number of rows
1335  , size_t N // Number of columns
1336  , bool SO > // Storage order
1338 {
1339  using blaze::assign;
1340 
1341  assign( *this, ~rhs );
1342 
1343  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1344 
1345  return *this;
1346 }
1347 //*************************************************************************************************
1348 
1349 
1350 //*************************************************************************************************
1356 template< typename Type // Data type of the matrix
1357  , size_t M // Number of rows
1358  , size_t N // Number of columns
1359  , bool SO > // Storage order
1360 template< typename Other // Data type of the foreign matrix
1361  , bool SO2 > // Storage order of the foreign matrix
1364 {
1365  using blaze::assign;
1366 
1367  assign( *this, ~rhs );
1368 
1369  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1370 
1371  return *this;
1372 }
1373 //*************************************************************************************************
1374 
1375 
1376 //*************************************************************************************************
1387 template< typename Type // Data type of the matrix
1388  , size_t M // Number of rows
1389  , size_t N // Number of columns
1390  , bool SO > // Storage order
1391 template< typename MT // Type of the right-hand side matrix
1392  , bool SO2 > // Storage order of the right-hand side matrix
1394 {
1395  using blaze::assign;
1396 
1397  using TT = TransExprTrait_<This>;
1398  using CT = CTransExprTrait_<This>;
1399  using IT = InvExprTrait_<This>;
1400 
1401  if( (~rhs).rows() != M || (~rhs).columns() != N ) {
1402  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to static matrix" );
1403  }
1404 
1405  if( IsSame<MT,TT>::value && (~rhs).isAliased( this ) ) {
1406  transpose( typename IsSquare<This>::Type() );
1407  }
1408  else if( IsSame<MT,CT>::value && (~rhs).isAliased( this ) ) {
1409  ctranspose( typename IsSquare<This>::Type() );
1410  }
1411  else if( !IsSame<MT,IT>::value && (~rhs).canAlias( this ) ) {
1412  StaticMatrix tmp( ~rhs );
1413  assign( *this, tmp );
1414  }
1415  else {
1417  reset();
1418  assign( *this, ~rhs );
1419  }
1420 
1421  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1422 
1423  return *this;
1424 }
1425 //*************************************************************************************************
1426 
1427 
1428 //*************************************************************************************************
1438 template< typename Type // Data type of the matrix
1439  , size_t M // Number of rows
1440  , size_t N // Number of columns
1441  , bool SO > // Storage order
1442 template< typename MT // Type of the right-hand side matrix
1443  , bool SO2 > // Storage order of the right-hand side matrix
1445 {
1446  using blaze::addAssign;
1447 
1448  if( (~rhs).rows() != M || (~rhs).columns() != N ) {
1449  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1450  }
1451 
1452  if( (~rhs).canAlias( this ) ) {
1453  const ResultType_<MT> tmp( ~rhs );
1454  addAssign( *this, tmp );
1455  }
1456  else {
1457  addAssign( *this, ~rhs );
1458  }
1459 
1460  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1461 
1462  return *this;
1463 }
1464 //*************************************************************************************************
1465 
1466 
1467 //*************************************************************************************************
1477 template< typename Type // Data type of the matrix
1478  , size_t M // Number of rows
1479  , size_t N // Number of columns
1480  , bool SO > // Storage order
1481 template< typename MT // Type of the right-hand side matrix
1482  , bool SO2 > // Storage order of the right-hand side matrix
1484 {
1485  using blaze::subAssign;
1486 
1487  if( (~rhs).rows() != M || (~rhs).columns() != N ) {
1488  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1489  }
1490 
1491  if( (~rhs).canAlias( this ) ) {
1492  const ResultType_<MT> tmp( ~rhs );
1493  subAssign( *this, tmp );
1494  }
1495  else {
1496  subAssign( *this, ~rhs );
1497  }
1498 
1499  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1500 
1501  return *this;
1502 }
1503 //*************************************************************************************************
1504 
1505 
1506 //*************************************************************************************************
1516 template< typename Type // Data type of the matrix
1517  , size_t M // Number of rows
1518  , size_t N // Number of columns
1519  , bool SO > // Storage order
1520 template< typename MT // Type of the right-hand side matrix
1521  , bool SO2 > // Storage order of the right-hand side matrix
1523 {
1524  using blaze::schurAssign;
1525 
1526  if( (~rhs).rows() != M || (~rhs).columns() != N ) {
1527  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
1528  }
1529 
1530  if( (~rhs).canAlias( this ) ) {
1531  const ResultType_<MT> tmp( ~rhs );
1532  schurAssign( *this, tmp );
1533  }
1534  else {
1535  schurAssign( *this, ~rhs );
1536  }
1537 
1538  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
1539 
1540  return *this;
1541 }
1542 //*************************************************************************************************
1543 
1544 
1545 
1546 
1547 //=================================================================================================
1548 //
1549 // UTILITY FUNCTIONS
1550 //
1551 //=================================================================================================
1552 
1553 //*************************************************************************************************
1558 template< typename Type // Data type of the matrix
1559  , size_t M // Number of rows
1560  , size_t N // Number of columns
1561  , bool SO > // Storage order
1562 inline constexpr size_t StaticMatrix<Type,M,N,SO>::rows() noexcept
1563 {
1564  return M;
1565 }
1566 //*************************************************************************************************
1567 
1568 
1569 //*************************************************************************************************
1574 template< typename Type // Data type of the matrix
1575  , size_t M // Number of rows
1576  , size_t N // Number of columns
1577  , bool SO > // Storage order
1578 inline constexpr size_t StaticMatrix<Type,M,N,SO>::columns() noexcept
1579 {
1580  return N;
1581 }
1582 //*************************************************************************************************
1583 
1584 
1585 //*************************************************************************************************
1593 template< typename Type // Data type of the matrix
1594  , size_t M // Number of rows
1595  , size_t N // Number of columns
1596  , bool SO > // Storage order
1597 inline constexpr size_t StaticMatrix<Type,M,N,SO>::spacing() noexcept
1598 {
1599  return NN;
1600 }
1601 //*************************************************************************************************
1602 
1603 
1604 //*************************************************************************************************
1609 template< typename Type // Data type of the matrix
1610  , size_t M // Number of rows
1611  , size_t N // Number of columns
1612  , bool SO > // Storage order
1613 inline constexpr size_t StaticMatrix<Type,M,N,SO>::capacity() noexcept
1614 {
1615  return M*NN;
1616 }
1617 //*************************************************************************************************
1618 
1619 
1620 //*************************************************************************************************
1631 template< typename Type // Data type of the matrix
1632  , size_t M // Number of rows
1633  , size_t N // Number of columns
1634  , bool SO > // Storage order
1635 inline size_t StaticMatrix<Type,M,N,SO>::capacity( size_t i ) const noexcept
1636 {
1637  UNUSED_PARAMETER( i );
1638 
1639  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
1640 
1641  return NN;
1642 }
1643 //*************************************************************************************************
1644 
1645 
1646 //*************************************************************************************************
1651 template< typename Type // Data type of the matrix
1652  , size_t M // Number of rows
1653  , size_t N // Number of columns
1654  , bool SO > // Storage order
1656 {
1657  size_t nonzeros( 0UL );
1658 
1659  for( size_t i=0UL; i<M; ++i )
1660  for( size_t j=0UL; j<N; ++j )
1661  if( !isDefault( v_[i*NN+j] ) )
1662  ++nonzeros;
1663 
1664  return nonzeros;
1665 }
1666 //*************************************************************************************************
1667 
1668 
1669 //*************************************************************************************************
1680 template< typename Type // Data type of the matrix
1681  , size_t M // Number of rows
1682  , size_t N // Number of columns
1683  , bool SO > // Storage order
1684 inline size_t StaticMatrix<Type,M,N,SO>::nonZeros( size_t i ) const
1685 {
1686  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
1687 
1688  const size_t jend( i*NN + N );
1689  size_t nonzeros( 0UL );
1690 
1691  for( size_t j=i*NN; j<jend; ++j )
1692  if( !isDefault( v_[j] ) )
1693  ++nonzeros;
1694 
1695  return nonzeros;
1696 }
1697 //*************************************************************************************************
1698 
1699 
1700 //*************************************************************************************************
1705 template< typename Type // Data type of the matrix
1706  , size_t M // Number of rows
1707  , size_t N // Number of columns
1708  , bool SO > // Storage order
1710 {
1711  using blaze::clear;
1712 
1713  for( size_t i=0UL; i<M; ++i )
1714  for( size_t j=0UL; j<N; ++j )
1715  clear( v_[i*NN+j] );
1716 }
1717 //*************************************************************************************************
1718 
1719 
1720 //*************************************************************************************************
1731 template< typename Type // Data type of the matrix
1732  , size_t M // Number of rows
1733  , size_t N // Number of columns
1734  , bool SO > // Storage order
1735 inline void StaticMatrix<Type,M,N,SO>::reset( size_t i )
1736 {
1737  using blaze::clear;
1738 
1739  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
1740  for( size_t j=0UL; j<N; ++j )
1741  clear( v_[i*NN+j] );
1742 }
1743 //*************************************************************************************************
1744 
1745 
1746 //*************************************************************************************************
1752 template< typename Type // Data type of the matrix
1753  , size_t M // Number of rows
1754  , size_t N // Number of columns
1755  , bool SO > // Storage order
1757 {
1758  using std::swap;
1759 
1760  for( size_t i=0UL; i<M; ++i ) {
1761  for( size_t j=0UL; j<N; ++j ) {
1762  swap( v_[i*NN+j], m(i,j) );
1763  }
1764  }
1765 }
1766 //*************************************************************************************************
1767 
1768 
1769 
1770 
1771 //=================================================================================================
1772 //
1773 // NUMERIC FUNCTIONS
1774 //
1775 //=================================================================================================
1776 
1777 //*************************************************************************************************
1785 template< typename Type // Data type of the matrix
1786  , size_t M // Number of rows
1787  , size_t N // Number of columns
1788  , bool SO > // Storage order
1790 {
1791  using std::swap;
1792 
1793  BLAZE_STATIC_ASSERT( M == N );
1794 
1795  for( size_t i=1UL; i<M; ++i )
1796  for( size_t j=0UL; j<i; ++j )
1797  swap( v_[i*NN+j], v_[j*NN+i] );
1798 
1799  return *this;
1800 }
1801 //*************************************************************************************************
1802 
1803 
1804 //*************************************************************************************************
1818 template< typename Type // Data type of the matrix
1819  , size_t M // Number of rows
1820  , size_t N // Number of columns
1821  , bool SO > // Storage order
1823 {
1824  transpose();
1825 }
1827 //*************************************************************************************************
1828 
1829 
1830 //*************************************************************************************************
1844 template< typename Type // Data type of the matrix
1845  , size_t M // Number of rows
1846  , size_t N // Number of columns
1847  , bool SO > // Storage order
1849 {}
1851 //*************************************************************************************************
1852 
1853 
1854 //*************************************************************************************************
1862 template< typename Type // Data type of the matrix
1863  , size_t M // Number of rows
1864  , size_t N // Number of columns
1865  , bool SO > // Storage order
1867 {
1868  BLAZE_STATIC_ASSERT( M == N );
1869 
1870  for( size_t i=0UL; i<M; ++i ) {
1871  for( size_t j=0UL; j<i; ++j ) {
1872  cswap( v_[i*NN+j], v_[j*NN+i] );
1873  }
1874  conjugate( v_[i*NN+i] );
1875  }
1876 
1877  return *this;
1878 }
1879 //*************************************************************************************************
1880 
1881 
1882 //*************************************************************************************************
1896 template< typename Type // Data type of the matrix
1897  , size_t M // Number of rows
1898  , size_t N // Number of columns
1899  , bool SO > // Storage order
1901 {
1902  ctranspose();
1903 }
1905 //*************************************************************************************************
1906 
1907 
1908 //*************************************************************************************************
1922 template< typename Type // Data type of the matrix
1923  , size_t M // Number of rows
1924  , size_t N // Number of columns
1925  , bool SO > // Storage order
1927 {}
1929 //*************************************************************************************************
1930 
1931 
1932 //*************************************************************************************************
1949 template< typename Type // Data type of the matrix
1950  , size_t M // Number of rows
1951  , size_t N // Number of columns
1952  , bool SO > // Storage order
1953 template< typename Other > // Data type of the scalar value
1955 {
1956  for( size_t i=0UL; i<M; ++i )
1957  for( size_t j=0UL; j<N; ++j )
1958  v_[i*NN+j] *= scalar;
1959 
1960  return *this;
1961 }
1962 //*************************************************************************************************
1963 
1964 
1965 
1966 
1967 //=================================================================================================
1968 //
1969 // MEMORY FUNCTIONS
1970 //
1971 //=================================================================================================
1972 
1973 //*************************************************************************************************
1983 template< typename Type // Data type of the matrix
1984  , size_t M // Number of rows
1985  , size_t N // Number of columns
1986  , bool SO > // Storage order
1987 inline void* StaticMatrix<Type,M,N,SO>::operator new( std::size_t size )
1988 {
1990 
1991  BLAZE_INTERNAL_ASSERT( size == sizeof( StaticMatrix ), "Invalid number of bytes detected" );
1992 
1993  return allocate<StaticMatrix>( 1UL );
1994 }
1995 //*************************************************************************************************
1996 
1997 
1998 //*************************************************************************************************
2008 template< typename Type // Data type of the matrix
2009  , size_t M // Number of rows
2010  , size_t N // Number of columns
2011  , bool SO > // Storage order
2012 inline void* StaticMatrix<Type,M,N,SO>::operator new[]( std::size_t size )
2013 {
2014  BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticMatrix ) , "Invalid number of bytes detected" );
2015  BLAZE_INTERNAL_ASSERT( size % sizeof( StaticMatrix ) == 0UL, "Invalid number of bytes detected" );
2016 
2017  return allocate<StaticMatrix>( size/sizeof(StaticMatrix) );
2018 }
2019 //*************************************************************************************************
2020 
2021 
2022 //*************************************************************************************************
2032 template< 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 inline void* StaticMatrix<Type,M,N,SO>::operator new( std::size_t size, const std::nothrow_t& )
2037 {
2038  UNUSED_PARAMETER( size );
2039 
2040  BLAZE_INTERNAL_ASSERT( size == sizeof( StaticMatrix ), "Invalid number of bytes detected" );
2041 
2042  return allocate<StaticMatrix>( 1UL );
2043 }
2044 //*************************************************************************************************
2045 
2046 
2047 //*************************************************************************************************
2057 template< typename Type // Data type of the matrix
2058  , size_t M // Number of rows
2059  , size_t N // Number of columns
2060  , bool SO > // Storage order
2061 inline void* StaticMatrix<Type,M,N,SO>::operator new[]( std::size_t size, const std::nothrow_t& )
2062 {
2063  BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticMatrix ) , "Invalid number of bytes detected" );
2064  BLAZE_INTERNAL_ASSERT( size % sizeof( StaticMatrix ) == 0UL, "Invalid number of bytes detected" );
2065 
2066  return allocate<StaticMatrix>( size/sizeof(StaticMatrix) );
2067 }
2068 //*************************************************************************************************
2069 
2070 
2071 //*************************************************************************************************
2077 template< typename Type // Data type of the matrix
2078  , size_t M // Number of rows
2079  , size_t N // Number of columns
2080  , bool SO > // Storage order
2081 inline void StaticMatrix<Type,M,N,SO>::operator delete( void* ptr )
2082 {
2083  deallocate( static_cast<StaticMatrix*>( ptr ) );
2084 }
2085 //*************************************************************************************************
2086 
2087 
2088 //*************************************************************************************************
2094 template< typename Type // Data type of the matrix
2095  , size_t M // Number of rows
2096  , size_t N // Number of columns
2097  , bool SO > // Storage order
2098 inline void StaticMatrix<Type,M,N,SO>::operator delete[]( void* ptr )
2099 {
2100  deallocate( static_cast<StaticMatrix*>( ptr ) );
2101 }
2102 //*************************************************************************************************
2103 
2104 
2105 //*************************************************************************************************
2111 template< typename Type // Data type of the matrix
2112  , size_t M // Number of rows
2113  , size_t N // Number of columns
2114  , bool SO > // Storage order
2115 inline void StaticMatrix<Type,M,N,SO>::operator delete( void* ptr, const std::nothrow_t& )
2116 {
2117  deallocate( static_cast<StaticMatrix*>( ptr ) );
2118 }
2119 //*************************************************************************************************
2120 
2121 
2122 //*************************************************************************************************
2128 template< typename Type // Data type of the matrix
2129  , size_t M // Number of rows
2130  , size_t N // Number of columns
2131  , bool SO > // Storage order
2132 inline void StaticMatrix<Type,M,N,SO>::operator delete[]( void* ptr, const std::nothrow_t& )
2133 {
2134  deallocate( static_cast<StaticMatrix*>( ptr ) );
2135 }
2136 //*************************************************************************************************
2137 
2138 
2139 
2140 
2141 //=================================================================================================
2142 //
2143 // DEBUGGING FUNCTIONS
2144 //
2145 //=================================================================================================
2146 
2147 //*************************************************************************************************
2156 template< typename Type // Data type of the matrix
2157  , size_t M // Number of rows
2158  , size_t N // Number of columns
2159  , bool SO > // Storage order
2160 inline bool StaticMatrix<Type,M,N,SO>::isIntact() const noexcept
2161 {
2162  if( IsNumeric<Type>::value ) {
2163  for( size_t i=0UL; i<M; ++i ) {
2164  for( size_t j=N; j<NN; ++j ) {
2165  if( v_[i*NN+j] != Type() )
2166  return false;
2167  }
2168  }
2169  }
2170 
2171  return true;
2172 }
2173 //*************************************************************************************************
2174 
2175 
2176 
2177 
2178 //=================================================================================================
2179 //
2180 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2181 //
2182 //=================================================================================================
2183 
2184 //*************************************************************************************************
2194 template< typename Type // Data type of the matrix
2195  , size_t M // Number of rows
2196  , size_t N // Number of columns
2197  , bool SO > // Storage order
2198 template< typename Other > // Data type of the foreign expression
2199 inline bool StaticMatrix<Type,M,N,SO>::canAlias( const Other* alias ) const noexcept
2200 {
2201  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
2202 }
2203 //*************************************************************************************************
2204 
2205 
2206 //*************************************************************************************************
2216 template< typename Type // Data type of the matrix
2217  , size_t M // Number of rows
2218  , size_t N // Number of columns
2219  , bool SO > // Storage order
2220 template< typename Other > // Data type of the foreign expression
2221 inline bool StaticMatrix<Type,M,N,SO>::isAliased( const Other* alias ) const noexcept
2222 {
2223  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
2224 }
2225 //*************************************************************************************************
2226 
2227 
2228 //*************************************************************************************************
2237 template< typename Type // Data type of the matrix
2238  , size_t M // Number of rows
2239  , size_t N // Number of columns
2240  , bool SO > // Storage order
2241 inline bool StaticMatrix<Type,M,N,SO>::isAligned() const noexcept
2242 {
2243  return ( usePadding || columns() % SIMDSIZE == 0UL );
2244 }
2245 //*************************************************************************************************
2246 
2247 
2248 //*************************************************************************************************
2263 template< typename Type // Data type of the matrix
2264  , size_t M // Number of rows
2265  , size_t N // Number of columns
2266  , bool SO > // Storage order
2268  StaticMatrix<Type,M,N,SO>::load( size_t i, size_t j ) const noexcept
2269 {
2270  if( usePadding )
2271  return loada( i, j );
2272  else
2273  return loadu( i, j );
2274 }
2275 //*************************************************************************************************
2276 
2277 
2278 //*************************************************************************************************
2293 template< typename Type // Data type of the matrix
2294  , size_t M // Number of rows
2295  , size_t N // Number of columns
2296  , bool SO > // Storage order
2298  StaticMatrix<Type,M,N,SO>::loada( size_t i, size_t j ) const noexcept
2299 {
2300  using blaze::loada;
2301 
2303 
2304  BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
2305  BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
2306  BLAZE_INTERNAL_ASSERT( j + SIMDSIZE <= NN, "Invalid column access index" );
2307  BLAZE_INTERNAL_ASSERT( !usePadding || j % SIMDSIZE == 0UL, "Invalid column access index" );
2308  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[i*NN+j] ), "Invalid alignment detected" );
2309 
2310  return loada( &v_[i*NN+j] );
2311 }
2312 //*************************************************************************************************
2313 
2314 
2315 //*************************************************************************************************
2330 template< typename Type // Data type of the matrix
2331  , size_t M // Number of rows
2332  , size_t N // Number of columns
2333  , bool SO > // Storage order
2335  StaticMatrix<Type,M,N,SO>::loadu( size_t i, size_t j ) const noexcept
2336 {
2337  using blaze::loadu;
2338 
2340 
2341  BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
2342  BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
2343  BLAZE_INTERNAL_ASSERT( j + SIMDSIZE <= NN, "Invalid column access index" );
2344 
2345  return loadu( &v_[i*NN+j] );
2346 }
2347 //*************************************************************************************************
2348 
2349 
2350 //*************************************************************************************************
2366 template< typename Type // Data type of the matrix
2367  , size_t M // Number of rows
2368  , size_t N // Number of columns
2369  , bool SO > // Storage order
2371  StaticMatrix<Type,M,N,SO>::store( size_t i, size_t j, const SIMDType& value ) noexcept
2372 {
2373  if( usePadding )
2374  storea( i, j, value );
2375  else
2376  storeu( i, j, value );
2377 }
2378 //*************************************************************************************************
2379 
2380 
2381 //*************************************************************************************************
2397 template< typename Type // Data type of the matrix
2398  , size_t M // Number of rows
2399  , size_t N // Number of columns
2400  , bool SO > // Storage order
2402  StaticMatrix<Type,M,N,SO>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
2403 {
2404  using blaze::storea;
2405 
2407 
2408  BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
2409  BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
2410  BLAZE_INTERNAL_ASSERT( j + SIMDSIZE <= NN, "Invalid column access index" );
2411  BLAZE_INTERNAL_ASSERT( !usePadding || j % SIMDSIZE == 0UL, "Invalid column access index" );
2412  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[i*NN+j] ), "Invalid alignment detected" );
2413 
2414  storea( &v_[i*NN+j], value );
2415 }
2416 //*************************************************************************************************
2417 
2418 
2419 //*************************************************************************************************
2435 template< typename Type // Data type of the matrix
2436  , size_t M // Number of rows
2437  , size_t N // Number of columns
2438  , bool SO > // Storage order
2440  StaticMatrix<Type,M,N,SO>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
2441 {
2442  using blaze::storeu;
2443 
2445 
2446  BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
2447  BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
2448  BLAZE_INTERNAL_ASSERT( j + SIMDSIZE <= NN, "Invalid column access index" );
2449 
2450  storeu( &v_[i*NN+j], value );
2451 }
2452 //*************************************************************************************************
2453 
2454 
2455 //*************************************************************************************************
2472 template< typename Type // Data type of the matrix
2473  , size_t M // Number of rows
2474  , size_t N // Number of columns
2475  , bool SO > // Storage order
2477  StaticMatrix<Type,M,N,SO>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
2478 {
2479  using blaze::stream;
2480 
2482 
2483  BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
2484  BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
2485  BLAZE_INTERNAL_ASSERT( j + SIMDSIZE <= NN, "Invalid column access index" );
2486  BLAZE_INTERNAL_ASSERT( !usePadding || j % SIMDSIZE == 0UL, "Invalid column access index" );
2487  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[i*NN+j] ), "Invalid alignment detected" );
2488 
2489  stream( &v_[i*NN+j], value );
2490 }
2491 //*************************************************************************************************
2492 
2493 
2494 //*************************************************************************************************
2505 template< typename Type // Data type of the matrix
2506  , size_t M // Number of rows
2507  , size_t N // Number of columns
2508  , bool SO > // Storage order
2509 template< typename MT // Type of the right-hand side dense matrix
2510  , bool SO2 > // Storage order of the right-hand side dense matrix
2513 {
2514  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2515 
2516  for( size_t i=0UL; i<M; ++i ) {
2517  for( size_t j=0UL; j<N; ++j ) {
2518  v_[i*NN+j] = (~rhs)(i,j);
2519  }
2520  }
2521 }
2522 //*************************************************************************************************
2523 
2524 
2525 //*************************************************************************************************
2536 template< typename Type // Data type of the matrix
2537  , size_t M // Number of rows
2538  , size_t N // Number of columns
2539  , bool SO > // Storage order
2540 template< typename MT // Type of the right-hand side dense matrix
2541  , bool SO2 > // Storage order of the right-hand side dense matrix
2544 {
2546 
2547  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2548 
2549  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
2550 
2551  const size_t jpos( ( remainder )?( N & size_t(-SIMDSIZE) ):( N ) );
2552  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
2553 
2554  for( size_t i=0UL; i<M; ++i )
2555  {
2556  size_t j( 0UL );
2557 
2558  for( ; j<jpos; j+=SIMDSIZE ) {
2559  store( i, j, (~rhs).load(i,j) );
2560  }
2561  for( ; remainder && j<N; ++j ) {
2562  v_[i*NN+j] = (~rhs)(i,j);
2563  }
2564  }
2565 }
2566 //*************************************************************************************************
2567 
2568 
2569 //*************************************************************************************************
2580 template< typename Type // Data type of the matrix
2581  , size_t M // Number of rows
2582  , size_t N // Number of columns
2583  , bool SO > // Storage order
2584 template< typename MT > // Type of the right-hand side sparse matrix
2586 {
2587  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2588 
2589  for( size_t i=0UL; i<M; ++i )
2590  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2591  v_[i*NN+element->index()] = element->value();
2592 }
2593 //*************************************************************************************************
2594 
2595 
2596 //*************************************************************************************************
2607 template< typename Type // Data type of the matrix
2608  , size_t M // Number of rows
2609  , size_t N // Number of columns
2610  , bool SO > // Storage order
2611 template< typename MT > // Type of the right-hand side sparse matrix
2613 {
2615 
2616  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2617 
2618  for( size_t j=0UL; j<N; ++j )
2619  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2620  v_[element->index()*NN+j] = element->value();
2621 }
2622 //*************************************************************************************************
2623 
2624 
2625 //*************************************************************************************************
2636 template< typename Type // Data type of the matrix
2637  , size_t M // Number of rows
2638  , size_t N // Number of columns
2639  , bool SO > // Storage order
2640 template< typename MT // Type of the right-hand side dense matrix
2641  , bool SO2 > // Storage order of the right-hand side dense matrix
2644 {
2645  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2646 
2647  for( size_t i=0UL; i<M; ++i )
2648  {
2649  if( IsDiagonal<MT>::value )
2650  {
2651  v_[i*NN+i] += (~rhs)(i,i);
2652  }
2653  else
2654  {
2655  const size_t jbegin( ( IsUpper<MT>::value )
2656  ?( IsStrictlyUpper<MT>::value ? i+1UL : i )
2657  :( 0UL ) );
2658  const size_t jend ( ( IsLower<MT>::value )
2659  ?( IsStrictlyLower<MT>::value ? i : i+1UL )
2660  :( N ) );
2661  BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
2662 
2663  for( size_t j=jbegin; j<jend; ++j ) {
2664  v_[i*NN+j] += (~rhs)(i,j);
2665  }
2666  }
2667  }
2668 }
2669 //*************************************************************************************************
2670 
2671 
2672 //*************************************************************************************************
2683 template< typename Type // Data type of the matrix
2684  , size_t M // Number of rows
2685  , size_t N // Number of columns
2686  , bool SO > // Storage order
2687 template< typename MT // Type of the right-hand side dense matrix
2688  , bool SO2 > // Storage order of the right-hand side dense matrix
2689 inline EnableIf_<typename StaticMatrix<Type,M,N,SO>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >
2691 {
2694 
2695  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2696 
2697  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
2698 
2699  for( size_t i=0UL; i<M; ++i )
2700  {
2701  const size_t jbegin( ( IsUpper<MT>::value )
2702  ?( ( IsStrictlyUpper<MT>::value ? i+1UL : i ) & size_t(-SIMDSIZE) )
2703  :( 0UL ) );
2704  const size_t jend ( ( IsLower<MT>::value )
2705  ?( IsStrictlyLower<MT>::value ? i : i+1UL )
2706  :( N ) );
2707  BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
2708 
2709  const size_t jpos( ( remainder )?( jend & size_t(-SIMDSIZE) ):( jend ) );
2710  BLAZE_INTERNAL_ASSERT( !remainder || ( jend - ( jend % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
2711 
2712  size_t j( jbegin );
2713 
2714  for( ; j<jpos; j+=SIMDSIZE ) {
2715  store( i, j, load(i,j) + (~rhs).load(i,j) );
2716  }
2717  for( ; remainder && j<jend; ++j ) {
2718  v_[i*NN+j] += (~rhs)(i,j);
2719  }
2720  }
2721 }
2722 //*************************************************************************************************
2723 
2724 
2725 //*************************************************************************************************
2736 template< typename Type // Data type of the matrix
2737  , size_t M // Number of rows
2738  , size_t N // Number of columns
2739  , bool SO > // Storage order
2740 template< typename MT > // Type of the right-hand side sparse matrix
2742 {
2743  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2744 
2745  for( size_t i=0UL; i<M; ++i )
2746  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2747  v_[i*NN+element->index()] += element->value();
2748 }
2749 //*************************************************************************************************
2750 
2751 
2752 //*************************************************************************************************
2763 template< typename Type // Data type of the matrix
2764  , size_t M // Number of rows
2765  , size_t N // Number of columns
2766  , bool SO > // Storage order
2767 template< typename MT > // Type of the right-hand side sparse matrix
2769 {
2771 
2772  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2773 
2774  for( size_t j=0UL; j<N; ++j )
2775  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2776  v_[element->index()*NN+j] += element->value();
2777 }
2778 //*************************************************************************************************
2779 
2780 
2781 //*************************************************************************************************
2792 template< typename Type // Data type of the matrix
2793  , size_t M // Number of rows
2794  , size_t N // Number of columns
2795  , bool SO > // Storage order
2796 template< typename MT // Type of the right-hand side dense matrix
2797  , bool SO2 > // Storage order of the right-hand side dense matrix
2800 {
2801  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2802 
2803  for( size_t i=0UL; i<M; ++i )
2804  {
2805  if( IsDiagonal<MT>::value )
2806  {
2807  v_[i*NN+i] -= (~rhs)(i,i);
2808  }
2809  else
2810  {
2811  const size_t jbegin( ( IsUpper<MT>::value )
2812  ?( IsStrictlyUpper<MT>::value ? i+1UL : i )
2813  :( 0UL ) );
2814  const size_t jend ( ( IsLower<MT>::value )
2815  ?( IsStrictlyLower<MT>::value ? i : i+1UL )
2816  :( N ) );
2817  BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
2818 
2819  for( size_t j=jbegin; j<jend; ++j ) {
2820  v_[i*NN+j] -= (~rhs)(i,j);
2821  }
2822  }
2823  }
2824 }
2825 //*************************************************************************************************
2826 
2827 
2828 //*************************************************************************************************
2839 template< typename Type // Data type of the matrix
2840  , size_t M // Number of rows
2841  , size_t N // Number of columns
2842  , bool SO > // Storage order
2843 template< typename MT // Type of the right-hand side dense matrix
2844  , bool SO2 > // Storage order of the right-hand side dense matrix
2845 inline EnableIf_<typename StaticMatrix<Type,M,N,SO>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >
2847 {
2850 
2851  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2852 
2853  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
2854 
2855  for( size_t i=0UL; i<M; ++i )
2856  {
2857  const size_t jbegin( ( IsUpper<MT>::value )
2858  ?( ( IsStrictlyUpper<MT>::value ? i+1UL : i ) & size_t(-SIMDSIZE) )
2859  :( 0UL ) );
2860  const size_t jend ( ( IsLower<MT>::value )
2861  ?( IsStrictlyLower<MT>::value ? i : i+1UL )
2862  :( N ) );
2863  BLAZE_INTERNAL_ASSERT( jbegin <= jend, "Invalid loop indices detected" );
2864 
2865  const size_t jpos( ( remainder )?( jend & size_t(-SIMDSIZE) ):( jend ) );
2866  BLAZE_INTERNAL_ASSERT( !remainder || ( jend - ( jend % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
2867 
2868  size_t j( jbegin );
2869 
2870  for( ; j<jpos; j+=SIMDSIZE ) {
2871  store( i, j, load(i,j) - (~rhs).load(i,j) );
2872  }
2873  for( ; remainder && j<jend; ++j ) {
2874  v_[i*NN+j] -= (~rhs)(i,j);
2875  }
2876  }
2877 }
2878 //*************************************************************************************************
2879 
2880 
2881 //*************************************************************************************************
2892 template< typename Type // Data type of the matrix
2893  , size_t M // Number of rows
2894  , size_t N // Number of columns
2895  , bool SO > // Storage order
2896 template< typename MT > // Type of the right-hand side sparse matrix
2898 {
2899  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2900 
2901  for( size_t i=0UL; i<M; ++i )
2902  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2903  v_[i*NN+element->index()] -= element->value();
2904 }
2905 //*************************************************************************************************
2906 
2907 
2908 //*************************************************************************************************
2919 template< typename Type // Data type of the matrix
2920  , size_t M // Number of rows
2921  , size_t N // Number of columns
2922  , bool SO > // Storage order
2923 template< typename MT > // Type of the right-hand side sparse matrix
2925 {
2927 
2928  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2929 
2930  for( size_t j=0UL; j<N; ++j )
2931  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2932  v_[element->index()*NN+j] -= element->value();
2933 }
2934 //*************************************************************************************************
2935 
2936 
2937 //*************************************************************************************************
2948 template< typename Type // Data type of the matrix
2949  , size_t M // Number of rows
2950  , size_t N // Number of columns
2951  , bool SO > // Storage order
2952 template< typename MT // Type of the right-hand side dense matrix
2953  , bool SO2 > // Storage order of the right-hand side dense matrix
2954 inline DisableIf_<typename StaticMatrix<Type,M,N,SO>::BLAZE_TEMPLATE VectorizedSchurAssign<MT> >
2956 {
2957  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2958 
2959  for( size_t i=0UL; i<M; ++i ) {
2960  for( size_t j=0UL; j<N; ++j ) {
2961  v_[i*NN+j] *= (~rhs)(i,j);
2962  }
2963  }
2964 }
2965 //*************************************************************************************************
2966 
2967 
2968 //*************************************************************************************************
2979 template< typename Type // Data type of the matrix
2980  , size_t M // Number of rows
2981  , size_t N // Number of columns
2982  , bool SO > // Storage order
2983 template< typename MT // Type of the right-hand side dense matrix
2984  , bool SO2 > // Storage order of the right-hand side dense matrix
2985 inline EnableIf_<typename StaticMatrix<Type,M,N,SO>::BLAZE_TEMPLATE VectorizedSchurAssign<MT> >
2987 {
2989 
2990  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2991 
2992  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
2993 
2994  for( size_t i=0UL; i<M; ++i )
2995  {
2996  const size_t jpos( ( remainder )?( N & size_t(-SIMDSIZE) ):( N ) );
2997  BLAZE_INTERNAL_ASSERT( !remainder || ( N - ( N % (SIMDSIZE) ) ) == jpos, "Invalid end calculation" );
2998 
2999  size_t j( 0UL );
3000 
3001  for( ; j<jpos; j+=SIMDSIZE ) {
3002  store( i, j, load(i,j) * (~rhs).load(i,j) );
3003  }
3004  for( ; remainder && j<N; ++j ) {
3005  v_[i*NN+j] *= (~rhs)(i,j);
3006  }
3007  }
3008 }
3009 //*************************************************************************************************
3010 
3011 
3012 //*************************************************************************************************
3023 template< typename Type // Data type of the matrix
3024  , size_t M // Number of rows
3025  , size_t N // Number of columns
3026  , bool SO > // Storage order
3027 template< typename MT > // Type of the right-hand side sparse matrix
3029 {
3030  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
3031 
3032  const StaticMatrix tmp( serial( *this ) );
3033 
3034  reset();
3035 
3036  for( size_t i=0UL; i<M; ++i )
3037  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
3038  v_[i*NN+element->index()] = tmp.v_[i*NN+element->index()] * element->value();
3039 }
3040 //*************************************************************************************************
3041 
3042 
3043 //*************************************************************************************************
3054 template< typename Type // Data type of the matrix
3055  , size_t M // Number of rows
3056  , size_t N // Number of columns
3057  , bool SO > // Storage order
3058 template< typename MT > // Type of the right-hand side sparse matrix
3060 {
3062 
3063  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
3064 
3065  const StaticMatrix tmp( serial( *this ) );
3066 
3067  reset();
3068 
3069  for( size_t j=0UL; j<N; ++j )
3070  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
3071  v_[element->index()*NN+j] = tmp.v_[element->index()*NN+j] * element->value();
3072 }
3073 //*************************************************************************************************
3074 
3075 
3076 
3077 
3078 
3079 
3080 
3081 
3082 //=================================================================================================
3083 //
3084 // CLASS TEMPLATE SPECIALIZATION FOR COLUMN-MAJOR MATRICES
3085 //
3086 //=================================================================================================
3087 
3088 //*************************************************************************************************
3096 template< typename Type // Data type of the matrix
3097  , size_t M // Number of rows
3098  , size_t N > // Number of columns
3099 class StaticMatrix<Type,M,N,true>
3100  : public DenseMatrix< StaticMatrix<Type,M,N,true>, true >
3101 {
3102  public:
3103  //**Type definitions****************************************************************************
3106  using ResultType = This;
3109  using ElementType = Type;
3111  using ReturnType = const Type&;
3112  using CompositeType = const This&;
3113 
3114  using Reference = Type&;
3115  using ConstReference = const Type&;
3116  using Pointer = Type*;
3117  using ConstPointer = const Type*;
3118 
3121  //**********************************************************************************************
3122 
3123  //**Rebind struct definition********************************************************************
3126  template< typename NewType > // Data type of the other matrix
3127  struct Rebind {
3128  using Other = StaticMatrix<NewType,M,N,true>;
3129  };
3130  //**********************************************************************************************
3131 
3132  //**Resize struct definition********************************************************************
3135  template< size_t NewM // Number of rows of the other matrix
3136  , size_t NewN > // Number of columns of the other matrix
3137  struct Resize {
3138  using Other = StaticMatrix<Type,NewM,NewN,true>;
3139  };
3140  //**********************************************************************************************
3141 
3142  //**Compilation flags***************************************************************************
3144 
3148  enum : bool { simdEnabled = IsVectorizable<Type>::value };
3149 
3151 
3154  enum : bool { smpAssignable = false };
3155  //**********************************************************************************************
3156 
3157  //**Constructors********************************************************************************
3160  explicit inline StaticMatrix();
3161  explicit inline StaticMatrix( const Type& init );
3162  explicit inline StaticMatrix( initializer_list< initializer_list<Type> > list );
3163 
3164  template< typename Other >
3165  explicit inline StaticMatrix( size_t m, size_t n, const Other* array );
3166 
3167  template< typename Other, size_t Rows, size_t Cols >
3168  explicit inline StaticMatrix( const Other (&array)[Rows][Cols] );
3169 
3170  inline StaticMatrix( const StaticMatrix& m );
3171  template< typename Other, bool SO > inline StaticMatrix( const StaticMatrix<Other,M,N,SO>& m );
3172  template< typename MT , bool SO > inline StaticMatrix( const Matrix<MT,SO>& m );
3174  //**********************************************************************************************
3175 
3176  //**Destructor**********************************************************************************
3177  // No explicitly declared destructor.
3178  //**********************************************************************************************
3179 
3180  //**Data access functions***********************************************************************
3183  inline Reference operator()( size_t i, size_t j ) noexcept;
3184  inline ConstReference operator()( size_t i, size_t j ) const noexcept;
3185  inline Reference at( size_t i, size_t j );
3186  inline ConstReference at( size_t i, size_t j ) const;
3187  inline Pointer data () noexcept;
3188  inline ConstPointer data () const noexcept;
3189  inline Pointer data ( size_t j ) noexcept;
3190  inline ConstPointer data ( size_t j ) const noexcept;
3191  inline Iterator begin ( size_t j ) noexcept;
3192  inline ConstIterator begin ( size_t j ) const noexcept;
3193  inline ConstIterator cbegin( size_t j ) const noexcept;
3194  inline Iterator end ( size_t j ) noexcept;
3195  inline ConstIterator end ( size_t j ) const noexcept;
3196  inline ConstIterator cend ( size_t j ) const noexcept;
3198  //**********************************************************************************************
3199 
3200  //**Assignment operators************************************************************************
3203  inline StaticMatrix& operator=( const Type& set );
3204  inline StaticMatrix& operator=( initializer_list< initializer_list<Type> > list );
3205 
3206  template< typename Other, size_t Rows, size_t Cols >
3207  inline StaticMatrix& operator=( const Other (&array)[Rows][Cols] );
3208 
3209  inline StaticMatrix& operator= ( const StaticMatrix& rhs );
3210  template< typename Other, bool SO > inline StaticMatrix& operator= ( const StaticMatrix<Other,M,N,SO>& rhs );
3211  template< typename MT , bool SO > inline StaticMatrix& operator= ( const Matrix<MT,SO>& rhs );
3212  template< typename MT , bool SO > inline StaticMatrix& operator+=( const Matrix<MT,SO>& rhs );
3213  template< typename MT , bool SO > inline StaticMatrix& operator-=( const Matrix<MT,SO>& rhs );
3214  template< typename MT , bool SO > inline StaticMatrix& operator%=( const Matrix<MT,SO>& rhs );
3216  //**********************************************************************************************
3217 
3218  //**Utility functions***************************************************************************
3221  static inline constexpr size_t rows() noexcept;
3222  static inline constexpr size_t columns() noexcept;
3223  static inline constexpr size_t spacing() noexcept;
3224  static inline constexpr size_t capacity() noexcept;
3225  inline size_t capacity( size_t j ) const noexcept;
3226  inline size_t nonZeros() const;
3227  inline size_t nonZeros( size_t j ) const;
3228  inline void reset();
3229  inline void reset( size_t i );
3230  inline void swap( StaticMatrix& m ) noexcept;
3232  //**********************************************************************************************
3233 
3234  //**Numeric functions***************************************************************************
3237  inline StaticMatrix& transpose();
3238  inline StaticMatrix& ctranspose();
3239 
3240  template< typename Other > inline StaticMatrix& scale( const Other& scalar );
3242  //**********************************************************************************************
3243 
3244  //**Memory functions****************************************************************************
3247  static inline void* operator new ( std::size_t size );
3248  static inline void* operator new[]( std::size_t size );
3249  static inline void* operator new ( std::size_t size, const std::nothrow_t& );
3250  static inline void* operator new[]( std::size_t size, const std::nothrow_t& );
3251 
3252  static inline void operator delete ( void* ptr );
3253  static inline void operator delete[]( void* ptr );
3254  static inline void operator delete ( void* ptr, const std::nothrow_t& );
3255  static inline void operator delete[]( void* ptr, const std::nothrow_t& );
3257  //**********************************************************************************************
3258 
3259  private:
3260  //**********************************************************************************************
3262  template< typename MT >
3263  struct VectorizedAssign {
3264  enum : bool { value = useOptimizedKernels &&
3265  simdEnabled && MT::simdEnabled &&
3268  };
3269  //**********************************************************************************************
3270 
3271  //**********************************************************************************************
3273  template< typename MT >
3274  struct VectorizedAddAssign {
3275  enum : bool { value = useOptimizedKernels &&
3276  simdEnabled && MT::simdEnabled &&
3281  };
3282  //**********************************************************************************************
3283 
3284  //**********************************************************************************************
3286  template< typename MT >
3287  struct VectorizedSubAssign {
3288  enum : bool { value = useOptimizedKernels &&
3289  simdEnabled && MT::simdEnabled &&
3294  };
3295  //**********************************************************************************************
3296 
3297  //**********************************************************************************************
3299  template< typename MT >
3300  struct VectorizedSchurAssign {
3301  enum : bool { value = useOptimizedKernels &&
3302  simdEnabled && MT::simdEnabled &&
3306  };
3307  //**********************************************************************************************
3308 
3309  //**********************************************************************************************
3311  enum : size_t { SIMDSIZE = SIMDTrait<ElementType>::size };
3312  //**********************************************************************************************
3313 
3314  public:
3315  //**Debugging functions*************************************************************************
3318  inline bool isIntact() const noexcept;
3320  //**********************************************************************************************
3321 
3322  //**Expression template evaluation functions****************************************************
3325  template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
3326  template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
3327 
3328  inline bool isAligned() const noexcept;
3329 
3330  BLAZE_ALWAYS_INLINE SIMDType load ( size_t i, size_t j ) const noexcept;
3331  BLAZE_ALWAYS_INLINE SIMDType loada( size_t i, size_t j ) const noexcept;
3332  BLAZE_ALWAYS_INLINE SIMDType loadu( size_t i, size_t j ) const noexcept;
3333 
3334  BLAZE_ALWAYS_INLINE void store ( size_t i, size_t j, const SIMDType& value ) noexcept;
3335  BLAZE_ALWAYS_INLINE void storea( size_t i, size_t j, const SIMDType& value ) noexcept;
3336  BLAZE_ALWAYS_INLINE void storeu( size_t i, size_t j, const SIMDType& value ) noexcept;
3337  BLAZE_ALWAYS_INLINE void stream( size_t i, size_t j, const SIMDType& value ) noexcept;
3338 
3339  template< typename MT, bool SO >
3340  inline DisableIf_<VectorizedAssign<MT> > assign( const DenseMatrix<MT,SO>& rhs );
3341 
3342  template< typename MT, bool SO >
3343  inline EnableIf_<VectorizedAssign<MT> > assign( const DenseMatrix<MT,SO>& rhs );
3344 
3345  template< typename MT > inline void assign( const SparseMatrix<MT,true>& rhs );
3346  template< typename MT > inline void assign( const SparseMatrix<MT,false>& rhs );
3347 
3348  template< typename MT, bool SO >
3349  inline DisableIf_<VectorizedAddAssign<MT> > addAssign( const DenseMatrix<MT,SO>& rhs );
3350 
3351  template< typename MT, bool SO >
3352  inline EnableIf_<VectorizedAddAssign<MT> > addAssign( const DenseMatrix<MT,SO>& rhs );
3353 
3354  template< typename MT > inline void addAssign( const SparseMatrix<MT,true>& rhs );
3355  template< typename MT > inline void addAssign( const SparseMatrix<MT,false>& rhs );
3356 
3357  template< typename MT, bool SO >
3358  inline DisableIf_<VectorizedSubAssign<MT> > subAssign( const DenseMatrix<MT,SO>& rhs );
3359 
3360  template< typename MT, bool SO >
3361  inline EnableIf_<VectorizedSubAssign<MT> > subAssign( const DenseMatrix<MT,SO>& rhs );
3362 
3363  template< typename MT > inline void subAssign( const SparseMatrix<MT,true>& rhs );
3364  template< typename MT > inline void subAssign( const SparseMatrix<MT,false>& rhs );
3365 
3366  template< typename MT, bool SO >
3367  inline DisableIf_<VectorizedSchurAssign<MT> > schurAssign( const DenseMatrix<MT,SO>& rhs );
3368 
3369  template< typename MT, bool SO >
3370  inline EnableIf_<VectorizedSchurAssign<MT> > schurAssign( const DenseMatrix<MT,SO>& rhs );
3371 
3372  template< typename MT > inline void schurAssign( const SparseMatrix<MT,true>& rhs );
3373  template< typename MT > inline void schurAssign( const SparseMatrix<MT,false>& rhs );
3375  //**********************************************************************************************
3376 
3377  private:
3378  //**Utility functions***************************************************************************
3379  inline void transpose ( TrueType );
3380  inline void transpose ( FalseType );
3381  inline void ctranspose( TrueType );
3382  inline void ctranspose( FalseType );
3383  //**********************************************************************************************
3384 
3385  //**********************************************************************************************
3387  enum : size_t { MM = ( usePadding )?( nextMultiple( M, SIMDSIZE ) ):( M ) };
3388  //**********************************************************************************************
3389 
3390  //**Member variables****************************************************************************
3394 
3397  //**********************************************************************************************
3398 
3399  //**Compile time checks*************************************************************************
3404  BLAZE_STATIC_ASSERT( !usePadding || MM % SIMDSIZE == 0UL );
3405  BLAZE_STATIC_ASSERT( MM >= M );
3406  //**********************************************************************************************
3407 };
3409 //*************************************************************************************************
3410 
3411 
3412 
3413 
3414 //=================================================================================================
3415 //
3416 // CONSTRUCTORS
3417 //
3418 //=================================================================================================
3419 
3420 //*************************************************************************************************
3426 template< typename Type // Data type of the matrix
3427  , size_t M // Number of rows
3428  , size_t N > // Number of columns
3430  : v_() // The statically allocated matrix elements
3431 {
3433 
3434  if( IsNumeric<Type>::value ) {
3435  for( size_t i=0UL; i<MM*N; ++i )
3436  v_[i] = Type();
3437  }
3438 
3439  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3440 }
3442 //*************************************************************************************************
3443 
3444 
3445 //*************************************************************************************************
3451 template< typename Type // Data type of the matrix
3452  , size_t M // Number of rows
3453  , size_t N > // Number of columns
3454 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const Type& init )
3455  : v_() // The statically allocated matrix elements
3456 {
3458 
3459  for( size_t j=0UL; j<N; ++j ) {
3460  for( size_t i=0UL; i<M; ++i )
3461  v_[i+j*MM] = init;
3462 
3463  for( size_t i=M; i<MM; ++i )
3464  v_[i+j*MM] = Type();
3465  }
3466 
3467  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3468 }
3470 //*************************************************************************************************
3471 
3472 
3473 //*************************************************************************************************
3496 template< typename Type // Data type of the matrix
3497  , size_t M // Number of rows
3498  , size_t N > // Number of columns
3500  : v_() // The statically allocated matrix elements
3501 {
3503 
3504  if( list.size() != M || determineColumns( list ) > N ) {
3505  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static matrix" );
3506  }
3507 
3508  size_t i( 0UL );
3509 
3510  for( const auto& rowList : list ) {
3511  size_t j( 0UL );
3512  for( const auto& element : rowList ) {
3513  v_[i+j*MM] = element;
3514  ++j;
3515  }
3516  for( ; j<N; ++j ) {
3517  v_[i+j*MM] = Type();
3518  }
3519  ++i;
3520  }
3521 
3522  BLAZE_INTERNAL_ASSERT( i == M, "Invalid number of elements detected" );
3523 
3524  if( IsNumeric<Type>::value ) {
3525  for( ; i<MM; ++i ) {
3526  for( size_t j=0UL; j<N; ++j ) {
3527  v_[i+j*MM] = Type();
3528  }
3529  }
3530  }
3531 
3532  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3533 }
3535 //*************************************************************************************************
3536 
3537 
3538 //*************************************************************************************************
3565 template< typename Type // Data type of the matrix
3566  , size_t M // Number of rows
3567  , size_t N > // Number of columns
3568 template< typename Other > // Data type of the initialization array
3569 inline StaticMatrix<Type,M,N,true>::StaticMatrix( size_t m, size_t n, const Other* array )
3570  : v_() // The statically allocated matrix elements
3571 {
3573 
3574  if( m > M || n > N ) {
3575  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static matrix" );
3576  }
3577 
3578  for( size_t j=0UL; j<n; ++j ) {
3579  for( size_t i=0UL; i<m; ++i )
3580  v_[i+j*MM] = array[i+j*m];
3581 
3582  if( IsNumeric<Type>::value ) {
3583  for( size_t i=m; i<MM; ++i )
3584  v_[i+j*MM] = Type();
3585  }
3586  }
3587 
3588  if( IsNumeric<Type>::value ) {
3589  for( size_t j=n; j<N; ++j ) {
3590  for( size_t i=0UL; i<MM; ++i )
3591  v_[i+j*MM] = Type();
3592  }
3593  }
3594 
3595  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3596 }
3598 //*************************************************************************************************
3599 
3600 
3601 //*************************************************************************************************
3622 template< typename Type // Data type of the matrix
3623  , size_t M // Number of rows
3624  , size_t N > // Number of columns
3625 template< typename Other // Data type of the initialization array
3626  , size_t Rows // Number of rows of the initialization array
3627  , size_t Cols > // Number of columns of the initialization array
3628 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const Other (&array)[Rows][Cols] )
3629  : v_() // The statically allocated matrix elements
3630 {
3632  BLAZE_STATIC_ASSERT( Rows == M && Cols == N );
3633 
3634  for( size_t j=0UL; j<N; ++j ) {
3635  for( size_t i=0UL; i<M; ++i )
3636  v_[i+j*MM] = array[i][j];
3637 
3638  for( size_t i=M; i<MM; ++i )
3639  v_[i+j*MM] = Type();
3640  }
3641 
3642  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3643 }
3645 //*************************************************************************************************
3646 
3647 
3648 //*************************************************************************************************
3656 template< typename Type // Data type of the matrix
3657  , size_t M // Number of rows
3658  , size_t N > // Number of columns
3660  : v_() // The statically allocated matrix elements
3661 {
3663 
3664  for( size_t i=0UL; i<MM*N; ++i )
3665  v_[i] = m.v_[i];
3666 
3667  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3668 }
3670 //*************************************************************************************************
3671 
3672 
3673 //*************************************************************************************************
3679 template< typename Type // Data type of the matrix
3680  , size_t M // Number of rows
3681  , size_t N > // Number of columns
3682 template< typename Other // Data type of the foreign matrix
3683  , bool SO > // Storage order of the foreign matrix
3685  : v_() // The statically allocated matrix elements
3686 {
3688 
3689  for( size_t j=0UL; j<N; ++j ) {
3690  for( size_t i=0UL; i<M; ++i )
3691  v_[i+j*MM] = m(i,j);
3692 
3693  for( size_t i=M; i<MM; ++i )
3694  v_[i+j*MM] = Type();
3695  }
3696 
3697  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3698 }
3700 //*************************************************************************************************
3701 
3702 
3703 //*************************************************************************************************
3714 template< typename Type // Data type of the matrix
3715  , size_t M // Number of rows
3716  , size_t N > // Number of columns
3717 template< typename MT // Type of the foreign matrix
3718  , bool SO > // Storage order of the foreign matrix
3720  : v_() // The statically allocated matrix elements
3721 {
3722  using blaze::assign;
3723 
3725 
3726  if( (~m).rows() != M || (~m).columns() != N ) {
3727  BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of static matrix" );
3728  }
3729 
3730  for( size_t j=0UL; j<N; ++j ) {
3731  for( size_t i=( IsSparseMatrix<MT>::value ? 0UL : M ); i<MM; ++i ) {
3732  v_[i+j*MM] = Type();
3733  }
3734  }
3735 
3736  assign( *this, ~m );
3737 
3738  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
3739 }
3741 //*************************************************************************************************
3742 
3743 
3744 
3745 
3746 //=================================================================================================
3747 //
3748 // DATA ACCESS FUNCTIONS
3749 //
3750 //=================================================================================================
3751 
3752 //*************************************************************************************************
3763 template< typename Type // Data type of the matrix
3764  , size_t M // Number of rows
3765  , size_t N > // Number of columns
3767  StaticMatrix<Type,M,N,true>::operator()( size_t i, size_t j ) noexcept
3768 {
3769  BLAZE_USER_ASSERT( i<M, "Invalid row access index" );
3770  BLAZE_USER_ASSERT( j<N, "Invalid column access index" );
3771  return v_[i+j*MM];
3772 }
3774 //*************************************************************************************************
3775 
3776 
3777 //*************************************************************************************************
3788 template< typename Type // Data type of the matrix
3789  , size_t M // Number of rows
3790  , size_t N > // Number of columns
3792  StaticMatrix<Type,M,N,true>::operator()( size_t i, size_t j ) const noexcept
3793 {
3794  BLAZE_USER_ASSERT( i<M, "Invalid row access index" );
3795  BLAZE_USER_ASSERT( j<N, "Invalid column access index" );
3796  return v_[i+j*MM];
3797 }
3799 //*************************************************************************************************
3800 
3801 
3802 //*************************************************************************************************
3814 template< typename Type // Data type of the matrix
3815  , size_t M // Number of rows
3816  , size_t N > // Number of columns
3818  StaticMatrix<Type,M,N,true>::at( size_t i, size_t j )
3819 {
3820  if( i >= M ) {
3821  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
3822  }
3823  if( j >= N ) {
3824  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
3825  }
3826  return (*this)(i,j);
3827 }
3829 //*************************************************************************************************
3830 
3831 
3832 //*************************************************************************************************
3844 template< typename Type // Data type of the matrix
3845  , size_t M // Number of rows
3846  , size_t N > // Number of columns
3848  StaticMatrix<Type,M,N,true>::at( size_t i, size_t j ) const
3849 {
3850  if( i >= M ) {
3851  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
3852  }
3853  if( j >= N ) {
3854  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
3855  }
3856  return (*this)(i,j);
3857 }
3859 //*************************************************************************************************
3860 
3861 
3862 //*************************************************************************************************
3874 template< typename Type // Data type of the matrix
3875  , size_t M // Number of rows
3876  , size_t N > // Number of columns
3879 {
3880  return v_;
3881 }
3883 //*************************************************************************************************
3884 
3885 
3886 //*************************************************************************************************
3898 template< typename Type // Data type of the matrix
3899  , size_t M // Number of rows
3900  , size_t N > // Number of columns
3902  StaticMatrix<Type,M,N,true>::data() const noexcept
3903 {
3904  return v_;
3905 }
3907 //*************************************************************************************************
3908 
3909 
3910 //*************************************************************************************************
3919 template< typename Type // Data type of the matrix
3920  , size_t M // Number of rows
3921  , size_t N > // Number of columns
3923  StaticMatrix<Type,M,N,true>::data( size_t j ) noexcept
3924 {
3925  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
3926  return v_ + j*MM;
3927 }
3929 //*************************************************************************************************
3930 
3931 
3932 //*************************************************************************************************
3941 template< typename Type // Data type of the matrix
3942  , size_t M // Number of rows
3943  , size_t N > // Number of columns
3945  StaticMatrix<Type,M,N,true>::data( size_t j ) const noexcept
3946 {
3947  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
3948  return v_ + j*MM;
3949 }
3951 //*************************************************************************************************
3952 
3953 
3954 //*************************************************************************************************
3961 template< typename Type // Data type of the matrix
3962  , size_t M // Number of rows
3963  , size_t N > // Number of columns
3965  StaticMatrix<Type,M,N,true>::begin( size_t j ) noexcept
3966 {
3967  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
3968  return Iterator( v_ + j*MM );
3969 }
3971 //*************************************************************************************************
3972 
3973 
3974 //*************************************************************************************************
3981 template< typename Type // Data type of the matrix
3982  , size_t M // Number of rows
3983  , size_t N > // Number of columns
3985  StaticMatrix<Type,M,N,true>::begin( size_t j ) const noexcept
3986 {
3987  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
3988  return ConstIterator( v_ + j*MM );
3989 }
3991 //*************************************************************************************************
3992 
3993 
3994 //*************************************************************************************************
4001 template< typename Type // Data type of the matrix
4002  , size_t M // Number of rows
4003  , size_t N > // Number of columns
4005  StaticMatrix<Type,M,N,true>::cbegin( size_t j ) const noexcept
4006 {
4007  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4008  return ConstIterator( v_ + j*MM );
4009 }
4011 //*************************************************************************************************
4012 
4013 
4014 //*************************************************************************************************
4021 template< typename Type // Data type of the matrix
4022  , size_t M // Number of rows
4023  , size_t N > // Number of columns
4025  StaticMatrix<Type,M,N,true>::end( size_t j ) noexcept
4026 {
4027  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4028  return Iterator( v_ + j*MM + M );
4029 }
4031 //*************************************************************************************************
4032 
4033 
4034 //*************************************************************************************************
4041 template< typename Type // Data type of the matrix
4042  , size_t M // Number of rows
4043  , size_t N > // Number of columns
4045  StaticMatrix<Type,M,N,true>::end( size_t j ) const noexcept
4046 {
4047  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4048  return ConstIterator( v_ + j*MM + M );
4049 }
4051 //*************************************************************************************************
4052 
4053 
4054 //*************************************************************************************************
4061 template< typename Type // Data type of the matrix
4062  , size_t M // Number of rows
4063  , size_t N > // Number of columns
4065  StaticMatrix<Type,M,N,true>::cend( size_t j ) const noexcept
4066 {
4067  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4068  return ConstIterator( v_ + j*MM + M );
4069 }
4071 //*************************************************************************************************
4072 
4073 
4074 
4075 
4076 //=================================================================================================
4077 //
4078 // ASSIGNMENT OPERATORS
4079 //
4080 //=================================================================================================
4081 
4082 //*************************************************************************************************
4089 template< typename Type // Data type of the matrix
4090  , size_t M // Number of rows
4091  , size_t N > // Number of columns
4093  StaticMatrix<Type,M,N,true>::operator=( const Type& set )
4094 {
4095  for( size_t j=0UL; j<N; ++j )
4096  for( size_t i=0UL; i<M; ++i )
4097  v_[i+j*MM] = set;
4098 
4099  return *this;
4100 }
4102 //*************************************************************************************************
4103 
4104 
4105 //*************************************************************************************************
4129 template< typename Type // Data type of the matrix
4130  , size_t M // Number of rows
4131  , size_t N > // Number of columns
4134 {
4135  if( list.size() != M || determineColumns( list ) > N ) {
4136  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to static matrix" );
4137  }
4138 
4139  size_t i( 0UL );
4140 
4141  for( const auto& rowList : list ) {
4142  size_t j( 0UL );
4143  for( const auto& element : rowList ) {
4144  v_[i+j*MM] = element;
4145  ++j;
4146  }
4147  for( ; j<N; ++j ) {
4148  v_[i+j*MM] = Type();
4149  }
4150  ++i;
4151  }
4152 
4153  return *this;
4154 }
4156 //*************************************************************************************************
4157 
4158 
4159 //*************************************************************************************************
4181 template< typename Type // Data type of the matrix
4182  , size_t M // Number of rows
4183  , size_t N > // Number of columns
4184 template< typename Other // Data type of the initialization array
4185  , size_t Rows // Number of rows of the initialization array
4186  , size_t Cols > // Number of columns of the initialization array
4188  StaticMatrix<Type,M,N,true>::operator=( const Other (&array)[Rows][Cols] )
4189 {
4190  BLAZE_STATIC_ASSERT( Rows == M && Cols == N );
4191 
4192  for( size_t j=0UL; j<N; ++j )
4193  for( size_t i=0UL; i<M; ++i )
4194  v_[i+j*MM] = array[i][j];
4195 
4196  return *this;
4197 }
4199 //*************************************************************************************************
4200 
4201 
4202 //*************************************************************************************************
4211 template< typename Type // Data type of the matrix
4212  , size_t M // Number of rows
4213  , size_t N > // Number of columns
4216 {
4217  using blaze::assign;
4218 
4219  assign( *this, ~rhs );
4220 
4221  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4222 
4223  return *this;
4224 }
4226 //*************************************************************************************************
4227 
4228 
4229 //*************************************************************************************************
4236 template< typename Type // Data type of the matrix
4237  , size_t M // Number of rows
4238  , size_t N > // Number of columns
4239 template< typename Other // Data type of the foreign matrix
4240  , bool SO > // Storage order of the foreign matrix
4243 {
4244  using blaze::assign;
4245 
4246  assign( *this, ~rhs );
4247 
4248  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4249 
4250  return *this;
4251 }
4253 //*************************************************************************************************
4254 
4255 
4256 //*************************************************************************************************
4268 template< typename Type // Data type of the matrix
4269  , size_t M // Number of rows
4270  , size_t N > // Number of columns
4271 template< typename MT // Type of the right-hand side matrix
4272  , bool SO > // Storage order of the right-hand side matrix
4274 {
4275  using blaze::assign;
4276 
4277  using TT = TransExprTrait_<This>;
4278  using CT = CTransExprTrait_<This>;
4279  using IT = InvExprTrait_<This>;
4280 
4281  if( (~rhs).rows() != M || (~rhs).columns() != N ) {
4282  BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment to static matrix" );
4283  }
4284 
4285  if( IsSame<MT,TT>::value && (~rhs).isAliased( this ) ) {
4286  transpose( typename IsSquare<This>::Type() );
4287  }
4288  else if( IsSame<MT,CT>::value && (~rhs).isAliased( this ) ) {
4289  ctranspose( typename IsSquare<This>::Type() );
4290  }
4291  else if( !IsSame<MT,IT>::value && (~rhs).canAlias( this ) ) {
4292  StaticMatrix tmp( ~rhs );
4293  assign( *this, tmp );
4294  }
4295  else {
4297  reset();
4298  assign( *this, ~rhs );
4299  }
4300 
4301  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4302 
4303  return *this;
4304 }
4306 //*************************************************************************************************
4307 
4308 
4309 //*************************************************************************************************
4320 template< typename Type // Data type of the matrix
4321  , size_t M // Number of rows
4322  , size_t N > // Number of columns
4323 template< typename MT // Type of the right-hand side matrix
4324  , bool SO > // Storage order of the right-hand side matrix
4326 {
4327  using blaze::addAssign;
4328 
4329  if( (~rhs).rows() != M || (~rhs).columns() != N ) {
4330  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
4331  }
4332 
4333  if( (~rhs).canAlias( this ) ) {
4334  const ResultType_<MT> tmp( ~rhs );
4335  addAssign( *this, tmp );
4336  }
4337  else {
4338  addAssign( *this, ~rhs );
4339  }
4340 
4341  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4342 
4343  return *this;
4344 }
4346 //*************************************************************************************************
4347 
4348 
4349 //*************************************************************************************************
4360 template< typename Type // Data type of the matrix
4361  , size_t M // Number of rows
4362  , size_t N > // Number of columns
4363 template< typename MT // Type of the right-hand side matrix
4364  , bool SO > // Storage order of the right-hand side matrix
4366 {
4367  using blaze::subAssign;
4368 
4369  if( (~rhs).rows() != M || (~rhs).columns() != N ) {
4370  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
4371  }
4372 
4373  if( (~rhs).canAlias( this ) ) {
4374  const ResultType_<MT> tmp( ~rhs );
4375  subAssign( *this, tmp );
4376  }
4377  else {
4378  subAssign( *this, ~rhs );
4379  }
4380 
4381  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4382 
4383  return *this;
4384 }
4386 //*************************************************************************************************
4387 
4388 
4389 //*************************************************************************************************
4400 template< typename Type // Data type of the matrix
4401  , size_t M // Number of rows
4402  , size_t N > // Number of columns
4403 template< typename MT // Type of the right-hand side matrix
4404  , bool SO > // Storage order of the right-hand side matrix
4406 {
4407  using blaze::schurAssign;
4408 
4409  if( (~rhs).rows() != M || (~rhs).columns() != N ) {
4410  BLAZE_THROW_INVALID_ARGUMENT( "Matrix sizes do not match" );
4411  }
4412 
4413  if( (~rhs).canAlias( this ) ) {
4414  const ResultType_<MT> tmp( ~rhs );
4415  schurAssign( *this, tmp );
4416  }
4417  else {
4418  schurAssign( *this, ~rhs );
4419  }
4420 
4421  BLAZE_INTERNAL_ASSERT( isIntact(), "Invariant violation detected" );
4422 
4423  return *this;
4424 }
4426 //*************************************************************************************************
4427 
4428 
4429 
4430 
4431 //=================================================================================================
4432 //
4433 // UTILITY FUNCTIONS
4434 //
4435 //=================================================================================================
4436 
4437 //*************************************************************************************************
4443 template< typename Type // Data type of the matrix
4444  , size_t M // Number of rows
4445  , size_t N > // Number of columns
4446 inline constexpr size_t StaticMatrix<Type,M,N,true>::rows() noexcept
4447 {
4448  return M;
4449 }
4451 //*************************************************************************************************
4452 
4453 
4454 //*************************************************************************************************
4460 template< typename Type // Data type of the matrix
4461  , size_t M // Number of rows
4462  , size_t N > // Number of columns
4463 inline constexpr size_t StaticMatrix<Type,M,N,true>::columns() noexcept
4464 {
4465  return N;
4466 }
4468 //*************************************************************************************************
4469 
4470 
4471 //*************************************************************************************************
4480 template< typename Type // Data type of the matrix
4481  , size_t M // Number of rows
4482  , size_t N > // Number of columns
4483 inline constexpr size_t StaticMatrix<Type,M,N,true>::spacing() noexcept
4484 {
4485  return MM;
4486 }
4488 //*************************************************************************************************
4489 
4490 
4491 //*************************************************************************************************
4497 template< typename Type // Data type of the matrix
4498  , size_t M // Number of rows
4499  , size_t N > // Number of columns
4500 inline constexpr size_t StaticMatrix<Type,M,N,true>::capacity() noexcept
4501 {
4502  return MM*N;
4503 }
4505 //*************************************************************************************************
4506 
4507 
4508 //*************************************************************************************************
4515 template< typename Type // Data type of the matrix
4516  , size_t M // Number of rows
4517  , size_t N > // Number of columns
4518 inline size_t StaticMatrix<Type,M,N,true>::capacity( size_t j ) const noexcept
4519 {
4520  UNUSED_PARAMETER( j );
4521 
4522  BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
4523 
4524  return MM;
4525 }
4527 //*************************************************************************************************
4528 
4529 
4530 //*************************************************************************************************
4536 template< typename Type // Data type of the matrix
4537  , size_t M // Number of rows
4538  , size_t N > // Number of columns
4539 inline size_t StaticMatrix<Type,M,N,true>::nonZeros() const
4540 {
4541  size_t nonzeros( 0UL );
4542 
4543  for( size_t j=0UL; j<N; ++j )
4544  for( size_t i=0UL; i<M; ++i )
4545  if( !isDefault( v_[i+j*MM] ) )
4546  ++nonzeros;
4547 
4548  return nonzeros;
4549 }
4551 //*************************************************************************************************
4552 
4553 
4554 //*************************************************************************************************
4561 template< typename Type // Data type of the matrix
4562  , size_t M // Number of rows
4563  , size_t N > // Number of columns
4564 inline size_t StaticMatrix<Type,M,N,true>::nonZeros( size_t j ) const
4565 {
4566  BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
4567 
4568  const size_t iend( j*MM + M );
4569  size_t nonzeros( 0UL );
4570 
4571  for( size_t i=j*MM; i<iend; ++i )
4572  if( !isDefault( v_[i] ) )
4573  ++nonzeros;
4574 
4575  return nonzeros;
4576 }
4578 //*************************************************************************************************
4579 
4580 
4581 //*************************************************************************************************
4587 template< typename Type // Data type of the matrix
4588  , size_t M // Number of rows
4589  , size_t N > // Number of columns
4591 {
4592  using blaze::clear;
4593 
4594  for( size_t j=0UL; j<N; ++j )
4595  for( size_t i=0UL; i<M; ++i )
4596  clear( v_[i+j*MM] );
4597 }
4599 //*************************************************************************************************
4600 
4601 
4602 //*************************************************************************************************
4612 template< typename Type // Data type of the matrix
4613  , size_t M // Number of rows
4614  , size_t N > // Number of columns
4615 inline void StaticMatrix<Type,M,N,true>::reset( size_t j )
4616 {
4617  using blaze::clear;
4618 
4619  BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
4620  for( size_t i=0UL; i<M; ++i )
4621  clear( v_[i+j*MM] );
4622 }
4624 //*************************************************************************************************
4625 
4626 
4627 //*************************************************************************************************
4634 template< typename Type // Data type of the matrix
4635  , size_t M // Number of rows
4636  , size_t N > // Number of columns
4637 inline void StaticMatrix<Type,M,N,true>::swap( StaticMatrix& m ) noexcept
4638 {
4639  using std::swap;
4640 
4641  for( size_t j=0UL; j<N; ++j ) {
4642  for( size_t i=0UL; i<M; ++i ) {
4643  swap( v_[i+j*MM], m(i,j) );
4644  }
4645  }
4646 }
4648 //*************************************************************************************************
4649 
4650 
4651 
4652 
4653 //=================================================================================================
4654 //
4655 // NUMERIC FUNCTIONS
4656 //
4657 //=================================================================================================
4658 
4659 //*************************************************************************************************
4668 template< typename Type // Data type of the matrix
4669  , size_t M // Number of rows
4670  , size_t N > // Number of columns
4672 {
4673  using std::swap;
4674 
4675  BLAZE_STATIC_ASSERT( M == N );
4676 
4677  for( size_t j=1UL; j<N; ++j )
4678  for( size_t i=0UL; i<j; ++i )
4679  swap( v_[i+j*MM], v_[j+i*MM] );
4680 
4681  return *this;
4682 }
4684 //*************************************************************************************************
4685 
4686 
4687 //*************************************************************************************************
4701 template< typename Type // Data type of the matrix
4702  , size_t M // Number of rows
4703  , size_t N > // Number of columns
4705 {
4706  transpose();
4707 }
4709 //*************************************************************************************************
4710 
4711 
4712 //*************************************************************************************************
4726 template< typename Type // Data type of the matrix
4727  , size_t M // Number of rows
4728  , size_t N > // Number of columns
4730 {}
4732 //*************************************************************************************************
4733 
4734 
4735 //*************************************************************************************************
4744 template< typename Type // Data type of the matrix
4745  , size_t M // Number of rows
4746  , size_t N > // Number of columns
4748 {
4749  BLAZE_STATIC_ASSERT( M == N );
4750 
4751  for( size_t j=0UL; j<N; ++j ) {
4752  for( size_t i=0UL; i<j; ++i ) {
4753  cswap( v_[i+j*MM], v_[j+i*MM] );
4754  }
4755  conjugate( v_[j+j*MM] );
4756  }
4757 
4758  return *this;
4759 }
4761 //*************************************************************************************************
4762 
4763 
4764 //*************************************************************************************************
4778 template< typename Type // Data type of the matrix
4779  , size_t M // Number of rows
4780  , size_t N > // Number of columns
4782 {
4783  ctranspose();
4784 }
4786 //*************************************************************************************************
4787 
4788 
4789 //*************************************************************************************************
4803 template< typename Type // Data type of the matrix
4804  , size_t M // Number of rows
4805  , size_t N > // Number of columns
4807 {}
4809 //*************************************************************************************************
4810 
4811 
4812 //*************************************************************************************************
4830 template< typename Type // Data type of the matrix
4831  , size_t M // Number of rows
4832  , size_t N > // Number of columns
4833 template< typename Other > // Data type of the scalar value
4835  StaticMatrix<Type,M,N,true>::scale( const Other& scalar )
4836 {
4837  for( size_t j=0UL; j<N; ++j )
4838  for( size_t i=0UL; i<M; ++i )
4839  v_[i+j*MM] *= scalar;
4840 
4841  return *this;
4842 }
4844 //*************************************************************************************************
4845 
4846 
4847 
4848 
4849 //=================================================================================================
4850 //
4851 // MEMORY FUNCTIONS
4852 //
4853 //=================================================================================================
4854 
4855 //*************************************************************************************************
4866 template< typename Type // Data type of the matrix
4867  , size_t M // Number of rows
4868  , size_t N > // Number of columns
4869 inline void* StaticMatrix<Type,M,N,true>::operator new( std::size_t size )
4870 {
4871  UNUSED_PARAMETER( size );
4872 
4873  BLAZE_INTERNAL_ASSERT( size == sizeof( StaticMatrix ), "Invalid number of bytes detected" );
4874 
4875  return allocate<StaticMatrix>( 1UL );
4876 }
4878 //*************************************************************************************************
4879 
4880 
4881 //*************************************************************************************************
4892 template< typename Type // Data type of the matrix
4893  , size_t M // Number of rows
4894  , size_t N > // Number of columns
4895 inline void* StaticMatrix<Type,M,N,true>::operator new[]( std::size_t size )
4896 {
4897  BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticMatrix ) , "Invalid number of bytes detected" );
4898  BLAZE_INTERNAL_ASSERT( size % sizeof( StaticMatrix ) == 0UL, "Invalid number of bytes detected" );
4899 
4900  return allocate<StaticMatrix>( size/sizeof(StaticMatrix) );
4901 }
4903 //*************************************************************************************************
4904 
4905 
4906 //*************************************************************************************************
4917 template< typename Type // Data type of the matrix
4918  , size_t M // Number of rows
4919  , size_t N > // Number of columns
4920 inline void* StaticMatrix<Type,M,N,true>::operator new( std::size_t size, const std::nothrow_t& )
4921 {
4922  UNUSED_PARAMETER( size );
4923 
4924  BLAZE_INTERNAL_ASSERT( size == sizeof( StaticMatrix ), "Invalid number of bytes detected" );
4925 
4926  return allocate<StaticMatrix>( 1UL );
4927 }
4929 //*************************************************************************************************
4930 
4931 
4932 //*************************************************************************************************
4943 template< typename Type // Data type of the matrix
4944  , size_t M // Number of rows
4945  , size_t N > // Number of columns
4946 inline void* StaticMatrix<Type,M,N,true>::operator new[]( std::size_t size, const std::nothrow_t& )
4947 {
4948  BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticMatrix ) , "Invalid number of bytes detected" );
4949  BLAZE_INTERNAL_ASSERT( size % sizeof( StaticMatrix ) == 0UL, "Invalid number of bytes detected" );
4950 
4951  return allocate<StaticMatrix>( size/sizeof(StaticMatrix) );
4952 }
4954 //*************************************************************************************************
4955 
4956 
4957 //*************************************************************************************************
4964 template< typename Type // Data type of the matrix
4965  , size_t M // Number of rows
4966  , size_t N > // Number of columns
4967 inline void StaticMatrix<Type,M,N,true>::operator delete( void* ptr )
4968 {
4969  deallocate( static_cast<StaticMatrix*>( ptr ) );
4970 }
4972 //*************************************************************************************************
4973 
4974 
4975 //*************************************************************************************************
4982 template< typename Type // Data type of the matrix
4983  , size_t M // Number of rows
4984  , size_t N > // Number of columns
4985 inline void StaticMatrix<Type,M,N,true>::operator delete[]( void* ptr )
4986 {
4987  deallocate( static_cast<StaticMatrix*>( ptr ) );
4988 }
4990 //*************************************************************************************************
4991 
4992 
4993 //*************************************************************************************************
5000 template< typename Type // Data type of the matrix
5001  , size_t M // Number of rows
5002  , size_t N > // Number of columns
5003 inline void StaticMatrix<Type,M,N,true>::operator delete( void* ptr, const std::nothrow_t& )
5004 {
5005  deallocate( static_cast<StaticMatrix*>( ptr ) );
5006 }
5008 //*************************************************************************************************
5009 
5010 
5011 //*************************************************************************************************
5018 template< typename Type // Data type of the matrix
5019  , size_t M // Number of rows
5020  , size_t N > // Number of columns
5021 inline void StaticMatrix<Type,M,N,true>::operator delete[]( void* ptr, const std::nothrow_t& )
5022 {
5023  deallocate( static_cast<StaticMatrix*>( ptr ) );
5024 }
5026 //*************************************************************************************************
5027 
5028 
5029 
5030 
5031 //=================================================================================================
5032 //
5033 // DEBUGGING FUNCTIONS
5034 //
5035 //=================================================================================================
5036 
5037 //*************************************************************************************************
5047 template< typename Type // Data type of the matrix
5048  , size_t M // Number of rows
5049  , size_t N > // Number of columns
5050 inline bool StaticMatrix<Type,M,N,true>::isIntact() const noexcept
5051 {
5052  if( IsNumeric<Type>::value ) {
5053  for( size_t j=0UL; j<N; ++j ) {
5054  for( size_t i=M; i<MM; ++i ) {
5055  if( v_[i+j*MM] != Type() )
5056  return false;
5057  }
5058  }
5059  }
5060 
5061  return true;
5062 }
5064 //*************************************************************************************************
5065 
5066 
5067 
5068 
5069 //=================================================================================================
5070 //
5071 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
5072 //
5073 //=================================================================================================
5074 
5075 //*************************************************************************************************
5086 template< typename Type // Data type of the matrix
5087  , size_t M // Number of rows
5088  , size_t N > // Number of columns
5089 template< typename Other > // Data type of the foreign expression
5090 inline bool StaticMatrix<Type,M,N,true>::canAlias( const Other* alias ) const noexcept
5091 {
5092  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
5093 }
5095 //*************************************************************************************************
5096 
5097 
5098 //*************************************************************************************************
5109 template< typename Type // Data type of the matrix
5110  , size_t M // Number of rows
5111  , size_t N > // Number of columns
5112 template< typename Other > // Data type of the foreign expression
5113 inline bool StaticMatrix<Type,M,N,true>::isAliased( const Other* alias ) const noexcept
5114 {
5115  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
5116 }
5118 //*************************************************************************************************
5119 
5120 
5121 //*************************************************************************************************
5131 template< typename Type // Data type of the matrix
5132  , size_t M // Number of rows
5133  , size_t N > // Number of columns
5134 inline bool StaticMatrix<Type,M,N,true>::isAligned() const noexcept
5135 {
5136  return ( usePadding || rows() % SIMDSIZE == 0UL );
5137 }
5139 //*************************************************************************************************
5140 
5141 
5142 //*************************************************************************************************
5157 template< typename Type // Data type of the matrix
5158  , size_t M // Number of rows
5159  , size_t N > // Number of columns
5161  StaticMatrix<Type,M,N,true>::load( size_t i, size_t j ) const noexcept
5162 {
5163  if( usePadding )
5164  return loada( i, j );
5165  else
5166  return loadu( i, j );
5167 }
5169 //*************************************************************************************************
5170 
5171 
5172 //*************************************************************************************************
5187 template< typename Type // Data type of the matrix
5188  , size_t M // Number of rows
5189  , size_t N > // Number of columns
5191  StaticMatrix<Type,M,N,true>::loada( size_t i, size_t j ) const noexcept
5192 {
5193  using blaze::loada;
5194 
5196 
5197  BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
5198  BLAZE_INTERNAL_ASSERT( i + SIMDSIZE <= MM, "Invalid row access index" );
5199  BLAZE_INTERNAL_ASSERT( !usePadding || i % SIMDSIZE == 0UL, "Invalid row access index" );
5200  BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
5201  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[i+j*MM] ), "Invalid alignment detected" );
5202 
5203  return loada( &v_[i+j*MM] );
5204 }
5206 //*************************************************************************************************
5207 
5208 
5209 //*************************************************************************************************
5224 template< typename Type // Data type of the matrix
5225  , size_t M // Number of rows
5226  , size_t N > // Number of columns
5228  StaticMatrix<Type,M,N,true>::loadu( size_t i, size_t j ) const noexcept
5229 {
5230  using blaze::loadu;
5231 
5233 
5234  BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
5235  BLAZE_INTERNAL_ASSERT( i + SIMDSIZE <= MM, "Invalid row access index" );
5236  BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
5237 
5238  return loadu( &v_[i+j*MM] );
5239 }
5241 //*************************************************************************************************
5242 
5243 
5244 //*************************************************************************************************
5260 template< typename Type // Data type of the matrix
5261  , size_t M // Number of rows
5262  , size_t N > // Number of columns
5264  StaticMatrix<Type,M,N,true>::store( size_t i, size_t j, const SIMDType& value ) noexcept
5265 {
5266  if( usePadding )
5267  storea( i, j, value );
5268  else
5269  storeu( i, j, value );
5270 }
5272 //*************************************************************************************************
5273 
5274 
5275 //*************************************************************************************************
5291 template< typename Type // Data type of the matrix
5292  , size_t M // Number of rows
5293  , size_t N > // Number of columns
5295  StaticMatrix<Type,M,N,true>::storea( size_t i, size_t j, const SIMDType& value ) noexcept
5296 {
5297  using blaze::storea;
5298 
5300 
5301  BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
5302  BLAZE_INTERNAL_ASSERT( i + SIMDSIZE <= MM, "Invalid row access index" );
5303  BLAZE_INTERNAL_ASSERT( !usePadding || i % SIMDSIZE == 0UL, "Invalid row access index" );
5304  BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
5305  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[i+j*MM] ), "Invalid alignment detected" );
5306 
5307  storea( &v_[i+j*MM], value );
5308 }
5310 //*************************************************************************************************
5311 
5312 
5313 //*************************************************************************************************
5329 template< typename Type // Data type of the matrix
5330  , size_t M // Number of rows
5331  , size_t N > // Number of columns
5333  StaticMatrix<Type,M,N,true>::storeu( size_t i, size_t j, const SIMDType& value ) noexcept
5334 {
5335  using blaze::storeu;
5336 
5338 
5339  BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
5340  BLAZE_INTERNAL_ASSERT( i + SIMDSIZE <= MM, "Invalid row access index" );
5341  BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
5342 
5343  storeu( &v_[i+j*MM], value );
5344 }
5346 //*************************************************************************************************
5347 
5348 
5349 //*************************************************************************************************
5366 template< typename Type // Data type of the matrix
5367  , size_t M // Number of rows
5368  , size_t N > // Number of columns
5370  StaticMatrix<Type,M,N,true>::stream( size_t i, size_t j, const SIMDType& value ) noexcept
5371 {
5372  using blaze::stream;
5373 
5375 
5376  BLAZE_INTERNAL_ASSERT( i < M, "Invalid row access index" );
5377  BLAZE_INTERNAL_ASSERT( i + SIMDSIZE <= MM, "Invalid row access index" );
5378  BLAZE_INTERNAL_ASSERT( !usePadding || i % SIMDSIZE == 0UL, "Invalid row access index" );
5379  BLAZE_INTERNAL_ASSERT( j < N, "Invalid column access index" );
5380  BLAZE_INTERNAL_ASSERT( checkAlignment( &v_[i+j*MM] ), "Invalid alignment detected" );
5381 
5382  stream( &v_[i+j*MM], value );
5383 }
5385 //*************************************************************************************************
5386 
5387 
5388 //*************************************************************************************************
5400 template< typename Type // Data type of the matrix
5401  , size_t M // Number of rows
5402  , size_t N > // Number of columns
5403 template< typename MT // Type of the right-hand side dense matrix
5404  , bool SO > // Storage order of the right-hand side dense matrix
5407 {
5408  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5409 
5410  for( size_t j=0UL; j<N; ++j ) {
5411  for( size_t i=0UL; i<M; ++i ) {
5412  v_[i+j*MM] = (~rhs)(i,j);
5413  }
5414  }
5415 }
5417 //*************************************************************************************************
5418 
5419 
5420 //*************************************************************************************************
5432 template< typename Type // Data type of the matrix
5433  , size_t M // Number of rows
5434  , size_t N > // Number of columns
5435 template< typename MT // Type of the right-hand side dense matrix
5436  , bool SO > // Storage order of the right-hand side dense matrix
5439 {
5441 
5442  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5443 
5444  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
5445 
5446  const size_t ipos( ( remainder )?( M & size_t(-SIMDSIZE) ):( M ) );
5447  BLAZE_INTERNAL_ASSERT( !remainder || ( M - ( M % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
5448 
5449  for( size_t j=0UL; j<N; ++j )
5450  {
5451  size_t i( 0UL );
5452 
5453  for( ; i<ipos; i+=SIMDSIZE ) {
5454  store( i, j, (~rhs).load(i,j) );
5455  }
5456  for( ; remainder && i<M; ++i ) {
5457  v_[i+j*MM] = (~rhs)(i,j);
5458  }
5459  }
5460 }
5462 //*************************************************************************************************
5463 
5464 
5465 //*************************************************************************************************
5477 template< typename Type // Data type of the matrix
5478  , size_t M // Number of rows
5479  , size_t N > // Number of columns
5480 template< typename MT > // Type of the right-hand side sparse matrix
5482 {
5483  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5484 
5485  for( size_t j=0UL; j<N; ++j )
5486  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5487  v_[element->index()+j*MM] = element->value();
5488 }
5490 //*************************************************************************************************
5491 
5492 
5493 //*************************************************************************************************
5505 template< typename Type // Data type of the matrix
5506  , size_t M // Number of rows
5507  , size_t N > // Number of columns
5508 template< typename MT > // Type of the right-hand side sparse matrix
5510 {
5512 
5513  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5514 
5515  for( size_t i=0UL; i<M; ++i )
5516  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5517  v_[i+element->index()*MM] = element->value();
5518 }
5520 //*************************************************************************************************
5521 
5522 
5523 //*************************************************************************************************
5535 template< typename Type // Data type of the matrix
5536  , size_t M // Number of rows
5537  , size_t N > // Number of columns
5538 template< typename MT // Type of the right-hand side dense matrix
5539  , bool SO > // Storage order of the right-hand side dense matrix
5542 {
5543  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5544 
5545  for( size_t j=0UL; j<N; ++j )
5546  {
5547  if( IsDiagonal<MT>::value )
5548  {
5549  v_[j+j*MM] += (~rhs)(j,j);
5550  }
5551  else
5552  {
5553  const size_t ibegin( ( IsLower<MT>::value )
5554  ?( IsStrictlyLower<MT>::value ? j+1UL : j )
5555  :( 0UL ) );
5556  const size_t iend ( ( IsUpper<MT>::value )
5557  ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5558  :( M ) );
5559  BLAZE_INTERNAL_ASSERT( ibegin <= iend, "Invalid loop indices detected" );
5560 
5561  for( size_t i=ibegin; i<iend; ++i ) {
5562  v_[i+j*MM] += (~rhs)(i,j);
5563  }
5564  }
5565  }
5566 }
5568 //*************************************************************************************************
5569 
5570 
5571 //*************************************************************************************************
5583 template< typename Type // Data type of the matrix
5584  , size_t M // Number of rows
5585  , size_t N > // Number of columns
5586 template< typename MT // Type of the right-hand side dense matrix
5587  , bool SO > // Storage order of the right-hand side dense matrix
5590 {
5593 
5594  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5595 
5596  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
5597 
5598  for( size_t j=0UL; j<N; ++j )
5599  {
5600  const size_t ibegin( ( IsLower<MT>::value )
5601  ?( ( IsStrictlyLower<MT>::value ? j+1UL : j ) & size_t(-SIMDSIZE) )
5602  :( 0UL ) );
5603  const size_t iend ( ( IsUpper<MT>::value )
5604  ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5605  :( M ) );
5606  BLAZE_INTERNAL_ASSERT( ibegin <= iend, "Invalid loop indices detected" );
5607 
5608  const size_t ipos( ( remainder )?( iend & size_t(-SIMDSIZE) ):( iend ) );
5609  BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
5610 
5611  size_t i( ibegin );
5612 
5613  for( ; i<ipos; i+=SIMDSIZE ) {
5614  store( i, j, load(i,j) + (~rhs).load(i,j) );
5615  }
5616  for( ; remainder && i<iend; ++i ) {
5617  v_[i+j*MM] += (~rhs)(i,j);
5618  }
5619  }
5620 }
5622 //*************************************************************************************************
5623 
5624 
5625 //*************************************************************************************************
5637 template< typename Type // Data type of the matrix
5638  , size_t M // Number of rows
5639  , size_t N > // Number of columns
5640 template< typename MT > // Type of the right-hand side sparse matrix
5642 {
5643  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5644 
5645  for( size_t j=0UL; j<N; ++j )
5646  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5647  v_[element->index()+j*MM] += element->value();
5648 }
5650 //*************************************************************************************************
5651 
5652 
5653 //*************************************************************************************************
5665 template< typename Type // Data type of the matrix
5666  , size_t M // Number of rows
5667  , size_t N > // Number of columns
5668 template< typename MT > // Type of the right-hand side sparse matrix
5670 {
5672 
5673  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5674 
5675  for( size_t i=0UL; i<M; ++i )
5676  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5677  v_[i+element->index()*MM] += element->value();
5678 }
5680 //*************************************************************************************************
5681 
5682 
5683 //*************************************************************************************************
5695 template< typename Type // Data type of the matrix
5696  , size_t M // Number of rows
5697  , size_t N > // Number of columns
5698 template< typename MT // Type of the right-hand side dense matrix
5699  , bool SO > // Storage order of the right-hand side dense matrix
5702 {
5703  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5704 
5705  for( size_t j=0UL; j<N; ++j )
5706  {
5707  if( IsDiagonal<MT>::value )
5708  {
5709  v_[j+j*MM] -= (~rhs)(j,j);
5710  }
5711  else
5712  {
5713  const size_t ibegin( ( IsLower<MT>::value )
5714  ?( IsStrictlyLower<MT>::value ? j+1UL : j )
5715  :( 0UL ) );
5716  const size_t iend ( ( IsUpper<MT>::value )
5717  ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5718  :( M ) );
5719  BLAZE_INTERNAL_ASSERT( ibegin <= iend, "Invalid loop indices detected" );
5720 
5721  for( size_t i=ibegin; i<iend; ++i ) {
5722  v_[i+j*MM] -= (~rhs)(i,j);
5723  }
5724  }
5725  }
5726 }
5728 //*************************************************************************************************
5729 
5730 
5731 //*************************************************************************************************
5743 template< typename Type // Data type of the matrix
5744  , size_t M // Number of rows
5745  , size_t N > // Number of columns
5746 template< typename MT // Type of the right-hand side dense matrix
5747  , bool SO > // Storage order of the right-hand side dense matrix
5750 {
5753 
5754  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5755 
5756  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
5757 
5758  for( size_t j=0UL; j<N; ++j )
5759  {
5760  const size_t ibegin( ( IsLower<MT>::value )
5761  ?( ( IsStrictlyLower<MT>::value ? j+1UL : j ) & size_t(-SIMDSIZE) )
5762  :( 0UL ) );
5763  const size_t iend ( ( IsUpper<MT>::value )
5764  ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5765  :( M ) );
5766  BLAZE_INTERNAL_ASSERT( ibegin <= iend, "Invalid loop indices detected" );
5767 
5768  const size_t ipos( ( remainder )?( iend & size_t(-SIMDSIZE) ):( iend ) );
5769  BLAZE_INTERNAL_ASSERT( !remainder || ( iend - ( iend % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
5770 
5771  size_t i( ibegin );
5772 
5773  for( ; i<ipos; i+=SIMDSIZE ) {
5774  store( i, j, load(i,j) - (~rhs).load(i,j) );
5775  }
5776  for( ; remainder && i<iend; ++i ) {
5777  v_[i+j*MM] -= (~rhs)(i,j);
5778  }
5779  }
5780 }
5782 //*************************************************************************************************
5783 
5784 
5785 //*************************************************************************************************
5797 template< typename Type // Data type of the matrix
5798  , size_t M // Number of rows
5799  , size_t N > // Number of columns
5800 template< typename MT > // Type of the right-hand side sparse matrix
5802 {
5803  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5804 
5805  for( size_t j=0UL; j<N; ++j )
5806  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5807  v_[element->index()+j*MM] -= element->value();
5808 }
5810 //*************************************************************************************************
5811 
5812 
5813 //*************************************************************************************************
5825 template< typename Type // Data type of the matrix
5826  , size_t M // Number of rows
5827  , size_t N > // Number of columns
5828 template< typename MT > // Type of the right-hand side sparse matrix
5830 {
5832 
5833  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5834 
5835  for( size_t i=0UL; i<M; ++i )
5836  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5837  v_[i+element->index()*MM] -= element->value();
5838 }
5840 //*************************************************************************************************
5841 
5842 
5843 //*************************************************************************************************
5855 template< typename Type // Data type of the matrix
5856  , size_t M // Number of rows
5857  , size_t N > // Number of columns
5858 template< typename MT // Type of the right-hand side dense matrix
5859  , bool SO > // Storage order of the right-hand side dense matrix
5860 inline DisableIf_<typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedSchurAssign<MT> >
5862 {
5863  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5864 
5865  for( size_t j=0UL; j<N; ++j ) {
5866  for( size_t i=0UL; i<M; ++i ) {
5867  v_[i+j*MM] *= (~rhs)(i,j);
5868  }
5869  }
5870 }
5872 //*************************************************************************************************
5873 
5874 
5875 //*************************************************************************************************
5887 template< typename Type // Data type of the matrix
5888  , size_t M // Number of rows
5889  , size_t N > // Number of columns
5890 template< typename MT // Type of the right-hand side dense matrix
5891  , bool SO > // Storage order of the right-hand side dense matrix
5892 inline EnableIf_<typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedSchurAssign<MT> >
5894 {
5896 
5897  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5898 
5899  constexpr bool remainder( !usePadding || !IsPadded<MT>::value );
5900 
5901  for( size_t j=0UL; j<N; ++j )
5902  {
5903  const size_t ipos( ( remainder )?( M & size_t(-SIMDSIZE) ):( M ) );
5904  BLAZE_INTERNAL_ASSERT( !remainder || ( M - ( M % (SIMDSIZE) ) ) == ipos, "Invalid end calculation" );
5905 
5906  size_t i( 0UL );
5907 
5908  for( ; i<ipos; i+=SIMDSIZE ) {
5909  store( i, j, load(i,j) * (~rhs).load(i,j) );
5910  }
5911  for( ; remainder && i<M; ++i ) {
5912  v_[i+j*MM] *= (~rhs)(i,j);
5913  }
5914  }
5915 }
5917 //*************************************************************************************************
5918 
5919 
5920 //*************************************************************************************************
5932 template< typename Type // Data type of the matrix
5933  , size_t M // Number of rows
5934  , size_t N > // Number of columns
5935 template< typename MT > // Type of the right-hand side sparse matrix
5937 {
5938  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5939 
5940  const StaticMatrix tmp( serial( *this ) );
5941 
5942  reset();
5943 
5944  for( size_t j=0UL; j<N; ++j )
5945  for( ConstIterator_<MT> element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5946  v_[element->index()+j*MM] = tmp.v_[element->index()+j*MM] * element->value();
5947 }
5949 //*************************************************************************************************
5950 
5951 
5952 //*************************************************************************************************
5964 template< typename Type // Data type of the matrix
5965  , size_t M // Number of rows
5966  , size_t N > // Number of columns
5967 template< typename MT > // Type of the right-hand side sparse matrix
5969 {
5971 
5972  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5973 
5974  const StaticMatrix tmp( serial( *this ) );
5975 
5976  reset();
5977 
5978  for( size_t i=0UL; i<M; ++i )
5979  for( ConstIterator_<MT> element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5980  v_[i+element->index()*MM] = tmp.v_[i+element->index()*MM] * element->value();
5981 }
5983 //*************************************************************************************************
5984 
5985 
5986 
5987 
5988 
5989 
5990 
5991 
5992 //=================================================================================================
5993 //
5994 // STATICMATRIX OPERATORS
5995 //
5996 //=================================================================================================
5997 
5998 //*************************************************************************************************
6001 template< typename Type, size_t M, size_t N, bool SO >
6002 inline void reset( StaticMatrix<Type,M,N,SO>& m );
6003 
6004 template< typename Type, size_t M, size_t N, bool SO >
6005 inline void reset( StaticMatrix<Type,M,N,SO>& m, size_t i );
6006 
6007 template< typename Type, size_t M, size_t N, bool SO >
6008 inline void clear( StaticMatrix<Type,M,N,SO>& m );
6009 
6010 template< bool RF, typename Type, size_t M, size_t N, bool SO >
6011 inline bool isDefault( const StaticMatrix<Type,M,N,SO>& m );
6012 
6013 template< typename Type, size_t M, size_t N, bool SO >
6014 inline bool isIntact( const StaticMatrix<Type,M,N,SO>& m ) noexcept;
6015 
6016 template< typename Type, size_t M, size_t N, bool SO >
6017 inline void swap( StaticMatrix<Type,M,N,SO>& a, StaticMatrix<Type,M,N,SO>& b ) noexcept;
6019 //*************************************************************************************************
6020 
6021 
6022 //*************************************************************************************************
6029 template< typename Type // Data type of the matrix
6030  , size_t M // Number of rows
6031  , size_t N // Number of columns
6032  , bool SO > // Storage order
6034 {
6035  m.reset();
6036 }
6037 //*************************************************************************************************
6038 
6039 
6040 //*************************************************************************************************
6053 template< typename Type // Data type of the matrix
6054  , size_t M // Number of rows
6055  , size_t N // Number of columns
6056  , bool SO > // Storage order
6057 inline void reset( StaticMatrix<Type,M,N,SO>& m, size_t i )
6058 {
6059  m.reset( i );
6060 }
6061 //*************************************************************************************************
6062 
6063 
6064 //*************************************************************************************************
6073 template< typename Type // Data type of the matrix
6074  , size_t M // Number of rows
6075  , size_t N // Number of columns
6076  , bool SO > // Storage order
6078 {
6079  m.reset();
6080 }
6081 //*************************************************************************************************
6082 
6083 
6084 //*************************************************************************************************
6108 template< bool RF // Relaxation flag
6109  , typename Type // Data type of the matrix
6110  , size_t M // Number of rows
6111  , size_t N // Number of columns
6112  , bool SO > // Storage order
6113 inline bool isDefault( const StaticMatrix<Type,M,N,SO>& m )
6114 {
6115  if( SO == rowMajor ) {
6116  for( size_t i=0UL; i<M; ++i )
6117  for( size_t j=0UL; j<N; ++j )
6118  if( !isDefault<RF>( m(i,j) ) ) return false;
6119  }
6120  else {
6121  for( size_t j=0UL; j<N; ++j )
6122  for( size_t i=0UL; i<M; ++i )
6123  if( !isDefault<RF>( m(i,j) ) ) return false;
6124  }
6125 
6126  return true;
6127 }
6128 //*************************************************************************************************
6129 
6130 
6131 //*************************************************************************************************
6149 template< typename Type // Data type of the matrix
6150  , size_t M // Number of rows
6151  , size_t N // Number of columns
6152  , bool SO > // Storage order
6153 inline bool isIntact( const StaticMatrix<Type,M,N,SO>& m ) noexcept
6154 {
6155  return m.isIntact();
6156 }
6157 //*************************************************************************************************
6158 
6159 
6160 //*************************************************************************************************
6168 template< typename Type // Data type of the matrix
6169  , size_t M // Number of rows
6170  , size_t N // Number of columns
6171  , bool SO > // Storage order
6173 {
6174  a.swap( b );
6175 }
6176 //*************************************************************************************************
6177 
6178 
6179 
6180 
6181 //=================================================================================================
6182 //
6183 // SIZE SPECIALIZATIONS
6184 //
6185 //=================================================================================================
6186 
6187 //*************************************************************************************************
6189 template< typename T, size_t M, size_t N, bool SO >
6190 struct Size< StaticMatrix<T,M,N,SO>, 0UL >
6191  : public PtrdiffT<M>
6192 {};
6193 
6194 template< typename T, size_t M, size_t N, bool SO >
6195 struct Size< StaticMatrix<T,M,N,SO>, 1UL >
6196  : public PtrdiffT<N>
6197 {};
6199 //*************************************************************************************************
6200 
6201 
6202 
6203 
6204 //=================================================================================================
6205 //
6206 // ISSQUARE SPECIALIZATIONS
6207 //
6208 //=================================================================================================
6209 
6210 //*************************************************************************************************
6212 template< typename T, size_t N, bool SO >
6213 struct IsSquare< StaticMatrix<T,N,N,SO> >
6214  : public TrueType
6215 {};
6217 //*************************************************************************************************
6218 
6219 
6220 
6221 
6222 //=================================================================================================
6223 //
6224 // HASCONSTDATAACCESS SPECIALIZATIONS
6225 //
6226 //=================================================================================================
6227 
6228 //*************************************************************************************************
6230 template< typename T, size_t M, size_t N, bool SO >
6231 struct HasConstDataAccess< StaticMatrix<T,M,N,SO> >
6232  : public TrueType
6233 {};
6235 //*************************************************************************************************
6236 
6237 
6238 
6239 
6240 //=================================================================================================
6241 //
6242 // HASMUTABLEDATAACCESS SPECIALIZATIONS
6243 //
6244 //=================================================================================================
6245 
6246 //*************************************************************************************************
6248 template< typename T, size_t M, size_t N, bool SO >
6249 struct HasMutableDataAccess< StaticMatrix<T,M,N,SO> >
6250  : public TrueType
6251 {};
6253 //*************************************************************************************************
6254 
6255 
6256 
6257 
6258 //=================================================================================================
6259 //
6260 // ISSTATIC SPECIALIZATIONS
6261 //
6262 //=================================================================================================
6263 
6264 //*************************************************************************************************
6266 template< typename T, size_t M, size_t N, bool SO >
6267 struct IsStatic< StaticMatrix<T,M,N,SO> >
6268  : public TrueType
6269 {};
6271 //*************************************************************************************************
6272 
6273 
6274 
6275 
6276 //=================================================================================================
6277 //
6278 // ISALIGNED SPECIALIZATIONS
6279 //
6280 //=================================================================================================
6281 
6282 //*************************************************************************************************
6284 template< typename T, size_t M, size_t N, bool SO >
6285 struct IsAligned< StaticMatrix<T,M,N,SO> >
6286  : public BoolConstant<usePadding>
6287 {};
6289 //*************************************************************************************************
6290 
6291 
6292 
6293 
6294 //=================================================================================================
6295 //
6296 // ISCONTIGUOUS SPECIALIZATIONS
6297 //
6298 //=================================================================================================
6299 
6300 //*************************************************************************************************
6302 template< typename T, size_t M, size_t N, bool SO >
6303 struct IsContiguous< StaticMatrix<T,M,N,SO> >
6304  : public TrueType
6305 {};
6307 //*************************************************************************************************
6308 
6309 
6310 
6311 
6312 //=================================================================================================
6313 //
6314 // ISPADDED SPECIALIZATIONS
6315 //
6316 //=================================================================================================
6317 
6318 //*************************************************************************************************
6320 template< typename T, size_t M, size_t N, bool SO >
6321 struct IsPadded< StaticMatrix<T,M,N,SO> >
6322  : public BoolConstant<usePadding>
6323 {};
6325 //*************************************************************************************************
6326 
6327 
6328 
6329 
6330 //=================================================================================================
6331 //
6332 // ADDTRAIT SPECIALIZATIONS
6333 //
6334 //=================================================================================================
6335 
6336 //*************************************************************************************************
6338 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6339 struct AddTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
6340 {
6341  using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, SO >;
6342 };
6343 
6344 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
6345 struct AddTrait< StaticMatrix<T1,M,N,SO1>, StaticMatrix<T2,M,N,SO2> >
6346 {
6347  using Type = StaticMatrix< AddTrait_<T1,T2>, M, N, false >;
6348 };
6350 //*************************************************************************************************
6351 
6352 
6353 
6354 
6355 //=================================================================================================
6356 //
6357 // SUBTRAIT SPECIALIZATIONS
6358 //
6359 //=================================================================================================
6360 
6361 //*************************************************************************************************
6363 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6364 struct SubTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
6365 {
6366  using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, SO >;
6367 };
6368 
6369 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
6370 struct SubTrait< StaticMatrix<T1,M,N,SO1>, StaticMatrix<T2,M,N,SO2> >
6371 {
6372  using Type = StaticMatrix< SubTrait_<T1,T2>, M, N, false >;
6373 };
6375 //*************************************************************************************************
6376 
6377 
6378 
6379 
6380 //=================================================================================================
6381 //
6382 // SCHURTRAIT SPECIALIZATIONS
6383 //
6384 //=================================================================================================
6385 
6386 //*************************************************************************************************
6388 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6389 struct SchurTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
6390 {
6391  using Type = StaticMatrix< MultTrait_<T1,T2>, M, N, SO >;
6392 };
6393 
6394 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
6395 struct SchurTrait< StaticMatrix<T1,M,N,SO1>, StaticMatrix<T2,M,N,SO2> >
6396 {
6397  using Type = StaticMatrix< MultTrait_<T1,T2>, M, N, false >;
6398 };
6400 //*************************************************************************************************
6401 
6402 
6403 
6404 
6405 //=================================================================================================
6406 //
6407 // MULTTRAIT SPECIALIZATIONS
6408 //
6409 //=================================================================================================
6410 
6411 //*************************************************************************************************
6413 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6414 struct MultTrait< StaticMatrix<T1,M,N,SO>, T2, EnableIf_<IsNumeric<T2> > >
6415 {
6416  using Type = StaticMatrix< MultTrait_<T1,T2>, M, N, SO >;
6417 };
6418 
6419 template< typename T1, typename T2, size_t M, size_t N, bool SO >
6420 struct MultTrait< T1, StaticMatrix<T2,M,N,SO>, EnableIf_<IsNumeric<T1> > >
6421 {
6422  using Type = StaticMatrix< MultTrait_<T1,T2>, M, N, SO >;
6423 };
6424 
6425 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6426 struct MultTrait< StaticMatrix<T1,M,N,SO>, StaticVector<T2,N,false> >
6427 {
6428  using Type = StaticVector< MultTrait_<T1,T2>, M, false >;
6429 };
6430 
6431 template< typename T1, size_t M, typename T2, size_t N, bool SO >
6432 struct MultTrait< StaticVector<T1,M,true>, StaticMatrix<T2,M,N,SO> >
6433 {
6434  using Type = StaticVector< MultTrait_<T1,T2>, N, true >;
6435 };
6436 
6437 template< typename T1, size_t M, size_t N, bool SO, typename T2, size_t L >
6438 struct MultTrait< StaticMatrix<T1,M,N,SO>, HybridVector<T2,L,false> >
6439 {
6440  using Type = StaticVector< MultTrait_<T1,T2>, M, false >;
6441 };
6442 
6443 template< typename T1, size_t L, typename T2, size_t M, size_t N, bool SO >
6444 struct MultTrait< HybridVector<T1,L,true>, StaticMatrix<T2,M,N,SO> >
6445 {
6446  using Type = StaticVector< MultTrait_<T1,T2>, N, true >;
6447 };
6448 
6449 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6450 struct MultTrait< StaticMatrix<T1,M,N,SO>, DynamicVector<T2,false> >
6451 {
6452  using Type = StaticVector< MultTrait_<T1,T2>, M, false >;
6453 };
6454 
6455 template< typename T1, typename T2, size_t M, size_t N, bool SO >
6456 struct MultTrait< DynamicVector<T1,true>, StaticMatrix<T2,M,N,SO> >
6457 {
6458  using Type = StaticVector< MultTrait_<T1,T2>, N, true >;
6459 };
6460 
6461 template< typename T1, size_t M, size_t N, bool SO, typename T2, bool AF, bool PF >
6462 struct MultTrait< StaticMatrix<T1,M,N,SO>, CustomVector<T2,AF,PF,false> >
6463 {
6464  using Type = StaticVector< MultTrait_<T1,T2>, M, false >;
6465 };
6466 
6467 template< typename T1, bool AF, bool PF, typename T2, size_t M, size_t N, bool SO >
6468 struct MultTrait< CustomVector<T1,AF,PF,true>, StaticMatrix<T2,M,N,SO> >
6469 {
6470  using Type = StaticVector< MultTrait_<T1,T2>, N, true >;
6471 };
6472 
6473 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6474 struct MultTrait< StaticMatrix<T1,M,N,SO>, CompressedVector<T2,false> >
6475 {
6476  using Type = StaticVector< MultTrait_<T1,T2>, M, false >;
6477 };
6478 
6479 template< typename T1, typename T2, size_t M, size_t N, bool SO >
6480 struct MultTrait< CompressedVector<T1,true>, StaticMatrix<T2,M,N,SO> >
6481 {
6482  using Type = StaticVector< MultTrait_<T1,T2>, N, true >;
6483 };
6484 
6485 template< typename T1, size_t M, size_t K, bool SO1, typename T2, size_t N, bool SO2 >
6486 struct MultTrait< StaticMatrix<T1,M,K,SO1>, StaticMatrix<T2,K,N,SO2> >
6487 {
6488  using Type = StaticMatrix< MultTrait_<T1,T2>, M, N, SO1 >;
6489 };
6491 //*************************************************************************************************
6492 
6493 
6494 
6495 
6496 //=================================================================================================
6497 //
6498 // DIVTRAIT SPECIALIZATIONS
6499 //
6500 //=================================================================================================
6501 
6502 //*************************************************************************************************
6504 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6505 struct DivTrait< StaticMatrix<T1,M,N,SO>, T2, EnableIf_<IsNumeric<T2> > >
6506 {
6507  using Type = StaticMatrix< DivTrait_<T1,T2>, M, N, SO >;
6508 };
6510 //*************************************************************************************************
6511 
6512 
6513 
6514 
6515 //=================================================================================================
6516 //
6517 // UNARYMAPTRAIT SPECIALIZATIONS
6518 //
6519 //=================================================================================================
6520 
6521 //*************************************************************************************************
6523 template< typename T, size_t M, size_t N, bool SO, typename OP >
6524 struct UnaryMapTrait< StaticMatrix<T,M,N,SO>, OP >
6525 {
6526  using Type = StaticMatrix< UnaryMapTrait_<T,OP>, M, N, SO >;
6527 };
6529 //*************************************************************************************************
6530 
6531 
6532 
6533 
6534 //=================================================================================================
6535 //
6536 // BINARYMAPTRAIT SPECIALIZATIONS
6537 //
6538 //=================================================================================================
6539 
6540 //*************************************************************************************************
6542 template< typename T1, size_t M, size_t N, bool SO, typename T2, typename OP >
6543 struct BinaryMapTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO>, OP >
6544 {
6545  using Type = StaticMatrix< BinaryMapTrait_<T1,T2,OP>, M, N, SO >;
6546 };
6547 
6548 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2, typename OP >
6549 struct BinaryMapTrait< StaticMatrix<T1,M,N,SO1>, StaticMatrix<T2,M,N,SO2>, OP >
6550 {
6551  using Type = StaticMatrix< BinaryMapTrait_<T1,T2,OP>, M, N, false >;
6552 };
6554 //*************************************************************************************************
6555 
6556 
6557 
6558 
6559 //=================================================================================================
6560 //
6561 // HIGHTYPE SPECIALIZATIONS
6562 //
6563 //=================================================================================================
6564 
6565 //*************************************************************************************************
6567 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6568 struct HighType< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
6569 {
6570  using Type = StaticMatrix< typename HighType<T1,T2>::Type, M, N, SO >;
6571 };
6573 //*************************************************************************************************
6574 
6575 
6576 
6577 
6578 //=================================================================================================
6579 //
6580 // LOWTYPE SPECIALIZATIONS
6581 //
6582 //=================================================================================================
6583 
6584 //*************************************************************************************************
6586 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6587 struct LowType< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
6588 {
6589  using Type = StaticMatrix< typename LowType<T1,T2>::Type, M, N, SO >;
6590 };
6592 //*************************************************************************************************
6593 
6594 
6595 
6596 
6597 //=================================================================================================
6598 //
6599 // SUBMATRIXTRAIT SPECIALIZATIONS
6600 //
6601 //=================================================================================================
6602 
6603 //*************************************************************************************************
6605 template< typename T, size_t M1, size_t N1, bool SO, size_t I, size_t J, size_t M2, size_t N2 >
6606 struct SubmatrixTrait< StaticMatrix<T,M1,N1,SO>, I, J, M2, N2 >
6607 {
6608  using Type = StaticMatrix<T,M2,N2,SO>;
6609 };
6610 
6611 template< typename T, size_t M, size_t N, bool SO >
6612 struct SubmatrixTrait< StaticMatrix<T,M,N,SO> >
6613 {
6614  using Type = HybridMatrix<T,M,N,SO>;
6615 };
6617 //*************************************************************************************************
6618 
6619 
6620 
6621 
6622 //=================================================================================================
6623 //
6624 // ROWTRAIT SPECIALIZATIONS
6625 //
6626 //=================================================================================================
6627 
6628 //*************************************************************************************************
6630 template< typename T, size_t M, size_t N, bool SO, size_t... CRAs >
6631 struct RowTrait< StaticMatrix<T,M,N,SO>, CRAs... >
6632 {
6633  using Type = StaticVector<T,N,true>;
6634 };
6636 //*************************************************************************************************
6637 
6638 
6639 
6640 
6641 //=================================================================================================
6642 //
6643 // ROWSTRAIT SPECIALIZATIONS
6644 //
6645 //=================================================================================================
6646 
6647 //*************************************************************************************************
6649 template< typename T, size_t M, size_t N, bool SO, size_t... CRAs >
6650 struct RowsTrait< StaticMatrix<T,M,N,SO>, CRAs... >
6651 {
6652  using Type = StaticMatrix<T,sizeof...(CRAs),N,false>;
6653 };
6654 
6655 template< typename T, size_t M, size_t N, bool SO >
6656 struct RowsTrait< StaticMatrix<T,M,N,SO> >
6657 {
6658  using Type = HybridMatrix<T,M,N,false>;
6659 };
6661 //*************************************************************************************************
6662 
6663 
6664 
6665 
6666 //=================================================================================================
6667 //
6668 // COLUMNTRAIT SPECIALIZATIONS
6669 //
6670 //=================================================================================================
6671 
6672 //*************************************************************************************************
6674 template< typename T, size_t M, size_t N, bool SO, size_t... CCAs >
6675 struct ColumnTrait< StaticMatrix<T,M,N,SO>, CCAs... >
6676 {
6677  using Type = StaticVector<T,M,false>;
6678 };
6680 //*************************************************************************************************
6681 
6682 
6683 
6684 
6685 //=================================================================================================
6686 //
6687 // COLUMNSTRAIT SPECIALIZATIONS
6688 //
6689 //=================================================================================================
6690 
6691 //*************************************************************************************************
6693 template< typename T, size_t M, size_t N, bool SO, size_t... CCAs >
6694 struct ColumnsTrait< StaticMatrix<T,M,N,SO>, CCAs... >
6695 {
6696  using Type = StaticMatrix<T,M,sizeof...(CCAs),true>;
6697 };
6698 
6699 template< typename T, size_t M, size_t N, bool SO >
6700 struct ColumnsTrait< StaticMatrix<T,M,N,SO> >
6701 {
6702  using Type = HybridMatrix<T,M,N,true>;
6703 };
6705 //*************************************************************************************************
6706 
6707 
6708 
6709 
6710 //=================================================================================================
6711 //
6712 // BANDTRAIT SPECIALIZATIONS
6713 //
6714 //=================================================================================================
6715 
6716 //*************************************************************************************************
6718 template< typename T, size_t M, size_t N, bool SO >
6719 struct BandTrait< StaticMatrix<T,M,N,SO> >
6720 {
6721  enum : size_t { Min = min( M, N ) };
6723 };
6724 
6725 template< typename T, size_t M, size_t N, bool SO, ptrdiff_t I >
6726 struct BandTrait< StaticMatrix<T,M,N,SO>, I >
6727 {
6728  enum : size_t { Min = min( M - ( I >= 0L ? 0UL : -I ), N - ( I >= 0L ? I : 0UL ) ) };
6730 };
6732 //*************************************************************************************************
6733 
6734 } // namespace blaze
6735 
6736 #endif
Compile time check for vectorizable types.Depending on the available instruction set (SSE...
Definition: IsVectorizable.h:135
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.In case the given data type is a const-qualified type, a compilation error is created.
Definition: Const.h:79
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Header file for auxiliary alias declarations.
Headerfile for the generic min algorithm.
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:79
Availability of a SIMD subtraction for the given data types.Depending on the available instruction se...
Definition: HasSIMDSub.h:171
Header file for mathematical functions.
Header file for the Schur product trait.
Compile time check for low-level access to constant data.This type trait tests whether the given data...
Definition: HasConstDataAccess.h:75
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the alignment flag values.
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
Header file for basic type definitions.
Header file for the row trait.
Base template for the SubmatrixTrait class.
Definition: SubmatrixTrait.h:109
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:108
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storea(T1 *address, const SIMDi8< T2 > &value) noexcept
Aligned store of a vector of 1-byte integral values.
Definition: Storea.h:79
Header file for the IsSparseMatrix type trait.
Header file for the FalseType type/value trait base class.
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:2477
Header file for the IsDiagonal type trait.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:265
StaticMatrix()
The default constructor for StaticMatrix.
Definition: StaticMatrix.h:570
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
Header file for the IsSame and IsStrictlySame type traits.
Base template for the SchurTrait class.
Definition: SchurTrait.h:112
Availability of a SIMD multiplication for the given data types.Depending on the available instruction...
Definition: HasSIMDMult.h:172
typename SIMDTrait< T >::Type SIMDTrait_
Auxiliary alias declaration for the SIMDTrait class template.The SIMDTrait_ alias declaration provide...
Definition: SIMDTrait.h:316
Header file for the IsColumnMajorMatrix type trait.
SIMDTrait_< ElementType > SIMDType
SIMD type of the matrix elements.
Definition: StaticMatrix.h:233
Resize mechanism to obtain a StaticMatrix with different fixed dimensions.
Definition: StaticMatrix.h:260
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:224
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:2335
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1903
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:87
Availability of a SIMD addition for the given data types.Depending on the available instruction set (...
Definition: HasSIMDAdd.h:171
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:2371
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.In case the given data type is a volatile-qualified type, a compilation error is created.
Definition: Volatile.h:79
Type ElementType
Type of the matrix elements.
Definition: StaticMatrix.h:232
Type relationship analysis.This class tests if the two data types A and B are equal. For this type comparison, the cv-qualifiers of both data types are ignored. If A and B are the same data type (ignoring the cv-qualifiers), then the value member constant is set to true, the nested type definition Type is TrueType, and the class derives from TrueType. Otherwise value is set to false, Type is FalseType, and the class derives from FalseType.
Definition: IsSame.h:140
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:87
Header file for memory allocation and deallocation functionality.
const Type & ConstReference
Reference to a constant matrix value.
Definition: StaticMatrix.h:238
Type & Reference
Reference to a non-constant matrix value.
Definition: StaticMatrix.h:237
Header file for the extended initializer_list functionality.
System settings for performance optimizations.
Compile time check for data types.This type trait tests whether or not the given types can be combine...
Definition: IsSIMDCombinable.h:120
DenseIterator< Type, usePadding > Iterator
Iterator over non-constant elements.
Definition: StaticMatrix.h:242
Compile time check for static data types.This type trait tests whether the given data type is a stati...
Definition: IsStatic.h:85
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loadu(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loadu.h:77
DenseIterator< const Type, usePadding > ConstIterator
Iterator over constant elements.
Definition: StaticMatrix.h:243
Reference operator()(size_t i, size_t j) noexcept
2D-access to the matrix elements.
Definition: StaticMatrix.h:883
typename T::ResultType ResultType_
Alias declaration for nested ResultType type definitions.The ResultType_ alias declaration provides a...
Definition: Aliases.h:343
static constexpr size_t columns() noexcept
Returns the current number of columns of the matrix.
Definition: StaticMatrix.h:1578
Base template for the RowsTrait class.
Definition: RowsTrait.h:109
AlignedArray< Type, M *NN > v_
The statically allocated matrix elements.
Definition: StaticMatrix.h:526
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:80
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:129
Header file for the band trait.
ConstIterator cend(size_t i) const noexcept
Returns an iterator just past the last element of row/column i.
Definition: StaticMatrix.h:1200
bool isAliased(const Other *alias) const noexcept
Returns whether the matrix is aliased with the given address alias.
Definition: StaticMatrix.h:2221
Constraint on the data type.
Efficient implementation of a fixed-sized vector.The StaticVector class template is the representatio...
Definition: Forward.h:61
Header file for the SparseMatrix base class.
Efficient implementation of a dynamically sized vector with static memory.The HybridVector class temp...
Definition: Forward.h:59
Pointer data() noexcept
Low-level data access to the matrix elements.
Definition: StaticMatrix.h:991
Compile time check for low-level access to mutable data.This type trait tests whether the given data ...
Definition: HasMutableDataAccess.h:75
bool isIntact() const noexcept
Returns whether the invariants of the static matrix are intact.
Definition: StaticMatrix.h:2160
Header file for the IsSquare type trait.
Compile time check for the alignment of data types.This type trait tests whether the given data type ...
Definition: IsAligned.h:87
Base template for the RowTrait class.
Definition: RowTrait.h:109
Compile time check for the memory layout of data types.This type trait tests whether the given data t...
Definition: IsContiguous.h:86
typename TransExprTrait< T >::Type TransExprTrait_
Auxiliary alias declaration for the TransExprTrait class template.The TransExprTrait_ alias declarati...
Definition: TransExprTrait.h:112
Header file for the DisableIf class template.
Header file for the LowType type trait.
Base template for the HighType type trait.
Definition: HighType.h:133
StaticMatrix & transpose()
In-place transpose of the matrix.
Definition: StaticMatrix.h:1789
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the unary map trait.
typename CTransExprTrait< T >::Type CTransExprTrait_
Auxiliary alias declaration for the CTransExprTrait class template.The CTransExprTrait_ alias declara...
Definition: CTransExprTrait.h:112
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for nested template disabiguation.
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b) noexcept
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:5908
Compile time assertion.
Compile time check for row-major matrix types.This type trait tests whether or not the given template...
Definition: IsRowMajorMatrix.h:110
bool canAlias(const Other *alias) const noexcept
Returns whether the matrix can alias with the given address alias.
Definition: StaticMatrix.h:2199
Header file for all forward declarations of the math module.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.In case the given data type T is not a pointer type, a compilation error ...
Definition: Pointer.h:79
Compile time check for data types with padding.This type trait tests whether the given data type empl...
Definition: IsPadded.h:76
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
Header file for the HasSIMDAdd type trait.
Efficient implementation of a fixed-sized matrix.The StaticMatrix class template is the representatio...
Definition: Forward.h:60
Header file for the DenseMatrix base class.
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:2402
Header file for the DenseIterator class template.
void reset()
Reset to the default initial values.
Definition: StaticMatrix.h:1709
Header file for all SIMD functionality.
Constraint on the data type.
StaticMatrix & ctranspose()
In-place conjugate transpose of the matrix.
Definition: StaticMatrix.h:1866
#define BLAZE_CONSTRAINT_MUST_NOT_BE_DIAGONAL_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a diagonal matrix type, a compilation error is created.
Definition: Diagonal.h:79
Header file for the IsLower type trait.
Compile time check for square matrices.This type trait tests whether or not the given template parame...
Definition: IsSquare.h:88
Header file for the IsAligned type trait.
Compile time check for diagonal matrices.This type trait tests whether or not the given template para...
Definition: IsDiagonal.h:89
BLAZE_ALWAYS_INLINE const EnableIf_< And< IsIntegral< T >, HasSize< T, 1UL > >, If_< IsSigned< T >, SIMDint8, SIMDuint8 > > loada(const T *address) noexcept
Loads a vector of 1-byte integral values.
Definition: Loada.h:80
ConstIterator cbegin(size_t i) const noexcept
Returns an iterator to the first element of row/column i.
Definition: StaticMatrix.h:1128
Reference at(size_t i, size_t j)
Checked access to the matrix elements.
Definition: StaticMatrix.h:932
Header file for the default storage order for all vectors of the Blaze library.
void swap(StaticMatrix &m) noexcept
Swapping the contents of two static matrices.
Definition: StaticMatrix.h:1756
#define BLAZE_CONSTRAINT_MUST_BE_VECTORIZABLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a vectorizable data type...
Definition: Vectorizable.h:61
Header file for the exception macros of the math module.
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
Iterator end(size_t i) noexcept
Returns an iterator just past the last element of row/column i.
Definition: StaticMatrix.h:1152
const Type & ReturnType
Return type for expression template evaluations.
Definition: StaticMatrix.h:234
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:608
Header file for the IsPadded type trait.
bool isAligned() const noexcept
Returns whether the matrix is properly aligned in memory.
Definition: StaticMatrix.h:2241
Header file for the IsVectorizable type trait.
Header file for the conjugate shim.
Header file for the IsNumeric type trait.
Base template for the LowType type trait.
Definition: LowType.h:133
Header file for the HasConstDataAccess type trait.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< 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:75
Header file for the IsSIMDCombinable type trait.
StaticMatrix & operator=(const Type &set)
Homogenous assignment to all matrix elements.
Definition: StaticMatrix.h:1226
Header file for the PtrdiffT class template.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:79
Header file for the HasSIMDMult type trait.
Header file for the binary map trait.
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: Functions.h:156
BLAZE_ALWAYS_INLINE T1 & operator+=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Addition assignment operator for the addition of two SIMD packs.
Definition: BasicTypes.h:1357
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
Header file for run time assertion macros.
Base template for the AddTrait class.
Definition: AddTrait.h:119
Compile time check for column-major matrix types.This type trait tests whether or not the given templ...
Definition: IsColumnMajorMatrix.h:110
Base template for the MultTrait class.
Definition: MultTrait.h:119
Header file for the addition trait.
Header file for the division trait.
Header file for the InvExprTrait class template.
Header file for the submatrix trait.
Constraint on the data type.
Header file for the IsContiguous type trait.
Header file for the columns trait.
Constraint on the data type.
Compile time integral constant wrapper for ptrdiff_t.The PtrdiffT class template represents an integr...
Definition: PtrdiffT.h:72
size_t nonZeros() const
Returns the total number of non-zero elements in the matrix.
Definition: StaticMatrix.h:1655
Iterator begin(size_t i) noexcept
Returns an iterator to the first element of row/column i.
Definition: StaticMatrix.h:1080
Header file for the AlignedArray implementation.
SIMD characteristics of data types.The SIMDTrait class template provides the SIMD characteristics of ...
Definition: SIMDTrait.h:296
Header file for the IsStatic type trait.
Efficient implementation of a dynamically sized matrix with static memory.The HybridMatrix class temp...
Definition: Forward.h:58
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:2440
BLAZE_ALWAYS_INLINE SIMDType load(size_t i, size_t j) const noexcept
Load of a SIMD element of the matrix.
Definition: StaticMatrix.h:2268
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:79
Header file for the column trait.
Header file for the isDefault shim.
Header file for the TransExprTrait class template.
Constraint on the data type.
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:101
Constraint on the data type.
Constraint on the data type.
Header file for the HasSIMDSub type trait.
BLAZE_ALWAYS_INLINE void conjugate(T &a) noexcept(IsNumeric< T >::value)
In-place conjugation of the given value/object.
Definition: Conjugate.h:120
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:816
Header file for the HasMutableDataAccess type trait.
EnableIf_< IsBuiltin< T > > deallocate(T *address) noexcept
Deallocation of memory for built-in data types.
Definition: Memory.h:230
static constexpr size_t rows() noexcept
Returns the current number of rows of the matrix.
Definition: StaticMatrix.h:1562
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:224
Base template for the DivTrait class.
Definition: DivTrait.h:120
Implementation of a generic iterator for dense vectors and matrices.The DenseIterator represents a ge...
Definition: DenseIterator.h:58
Header file for the rows trait.
BLAZE_ALWAYS_INLINE EnableIf_< And< IsIntegral< T1 >, HasSize< T1, 1UL > > > storeu(T1 *address, const SIMDi8< T2 > &value) noexcept
Unaligned store of a vector of 1-byte integral values.
Definition: Storeu.h:76
BLAZE_ALWAYS_INLINE void cswap(T &a, T &b) noexcept(IsNumeric< T >::value)
Swapping two conjugated values/objects.
Definition: Conjugate.h:195
Generic wrapper for the min() function.
Definition: Min.h:62
BLAZE_ALWAYS_INLINE bool checkAlignment(const T *address)
Checks the alignment of the given address.
Definition: AlignmentCheck.h:68
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
static constexpr size_t spacing() noexcept
Returns the spacing between the beginning of two rows.
Definition: StaticMatrix.h:1597
typename T::ConstIterator ConstIterator_
Alias declaration for nested ConstIterator type definitions.The ConstIterator_ alias declaration prov...
Definition: Aliases.h:103
Header file for the IsRowMajorMatrix type trait.
const Type * ConstPointer
Pointer to a constant matrix value.
Definition: StaticMatrix.h:240
Base template for the ColumnsTrait class.
Definition: ColumnsTrait.h:109
const bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
Header file for the default transpose flag for all vectors of the Blaze library.
Initializer list type of the Blaze library.
Header file for the alignment check function.
typename InvExprTrait< T >::Type InvExprTrait_
Auxiliary alias declaration for the InvExprTrait class template.The InvExprTrait_ alias declaration p...
Definition: InvExprTrait.h:123
Compile time evaluation of the size of vectors and matrices.The Size type trait evaluates the size of...
Definition: Size.h:80
Rebind mechanism to obtain a StaticMatrix with different data/element type.
Definition: StaticMatrix.h:250
Header file for the IntegralConstant class template.
Compile time check for sparse matrix types.This type trait tests whether or not the given template pa...
Definition: IsSparseMatrix.h:103
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:628
static constexpr size_t capacity() noexcept
Returns the maximum capacity of the matrix.
Definition: StaticMatrix.h:1613
Base template for the SubTrait class.
Definition: SubTrait.h:119
BLAZE_ALWAYS_INLINE T1 & operator-=(SIMDPack< T1 > &lhs, const SIMDPack< T2 > &rhs)
Subtraction assignment operator for the subtraction of two SIMD packs.
Definition: BasicTypes.h:1375
Type * Pointer
Pointer to a non-constant matrix value.
Definition: StaticMatrix.h:239
Header file for the IsUpper type trait.
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Header file for the CTransExprTrait class template.
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.In case of an invalid compile time expression, a compilation error is cr...
Definition: StaticAssert.h:112
Base template for the BinaryMapTrait class.
Definition: BinaryMapTrait.h:97
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:2298
StaticMatrix< Type, M, N, SO > This
Type of this StaticMatrix instance.
Definition: StaticMatrix.h:227
Base template for the UnaryMapTrait class.
Definition: UnaryMapTrait.h:95
System settings for the inline keywords.
Header file for the Size type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the HighType type trait.
Header file for the TrueType type/value trait base class.
Base template for the BandTrait class.
Definition: BandTrait.h:109