All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 <cmath>
45 #include <stdexcept>
50 #include <blaze/math/Forward.h>
51 #include <blaze/math/Intrinsics.h>
52 #include <blaze/math/shims/Clear.h>
70 #include <blaze/util/Assert.h>
78 #include <blaze/util/DisableIf.h>
79 #include <blaze/util/EnableIf.h>
80 #include <blaze/util/Memory.h>
82 #include <blaze/util/Template.h>
83 #include <blaze/util/Types.h>
87 #include <blaze/util/Unused.h>
88 
89 
90 namespace blaze {
91 
92 //=================================================================================================
93 //
94 // CLASS DEFINITION
95 //
96 //=================================================================================================
97 
98 //*************************************************************************************************
180 template< typename Type // Data type of the matrix
181  , size_t M // Number of rows
182  , size_t N // Number of columns
183  , bool SO = defaultStorageOrder > // Storage order
184 class StaticMatrix : public DenseMatrix< StaticMatrix<Type,M,N,SO>, SO >
185 {
186  private:
187  //**Type definitions****************************************************************************
189  //**********************************************************************************************
190 
191  //**********************************************************************************************
193  static const size_t NN = N + ( IT::size - ( N % IT::size ) ) % IT::size;
194  //**********************************************************************************************
195 
196  public:
197  //**Type definitions****************************************************************************
199  typedef This ResultType;
202  typedef Type ElementType;
203  typedef typename IT::Type IntrinsicType;
204  typedef const Type& ReturnType;
205  typedef const This& CompositeType;
206  typedef Type& Reference;
207  typedef const Type& ConstReference;
208  typedef Type* Pointer;
209  typedef const Type* ConstPointer;
212  //**********************************************************************************************
213 
214  //**Rebind struct definition********************************************************************
217  template< typename ET > // Data type of the other matrix
218  struct Rebind {
220  };
221  //**********************************************************************************************
222 
223  //**Compilation flags***************************************************************************
225 
229  enum { vectorizable = IsVectorizable<Type>::value };
230 
232 
235  enum { smpAssignable = 0 };
236  //**********************************************************************************************
237 
238  //**Constructors********************************************************************************
241  explicit inline StaticMatrix();
242  explicit inline StaticMatrix( const Type& init );
243 
244  template< typename Other > explicit inline StaticMatrix( size_t m, size_t n, const Other* array );
245  template< typename Other > explicit inline StaticMatrix( const Other (&array)[M][N] );
246 
247  inline StaticMatrix( const StaticMatrix& m );
248  template< typename Other, bool SO2 > inline StaticMatrix( const StaticMatrix<Other,M,N,SO2>& m );
249  template< typename MT , bool SO2 > inline StaticMatrix( const Matrix<MT,SO2>& m );
250 
251  inline StaticMatrix( const Type& v1, const Type& v2 );
252  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3 );
253  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3, const Type& v4 );
254  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3, const Type& v4, const Type& v5 );
255  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3, const Type& v4, const Type& v5,
256  const Type& v6 );
257  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3, const Type& v4, const Type& v5,
258  const Type& v6, const Type& v7 );
259  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3, const Type& v4, const Type& v5,
260  const Type& v6, const Type& v7, const Type& v8 );
261  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3, const Type& v4, const Type& v5,
262  const Type& v6, const Type& v7, const Type& v8, const Type& v9 );
263  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3, const Type& v4, const Type& v5,
264  const Type& v6, const Type& v7, const Type& v8, const Type& v9, const Type& v10 );
266  //**********************************************************************************************
267 
268  //**Destructor**********************************************************************************
269  // No explicitly declared destructor.
270  //**********************************************************************************************
271 
272  //**Data access functions***********************************************************************
275  inline Reference operator()( size_t i, size_t j );
276  inline ConstReference operator()( size_t i, size_t j ) const;
277  inline Pointer data ();
278  inline ConstPointer data () const;
279  inline Pointer data ( size_t i );
280  inline ConstPointer data ( size_t i ) const;
281  inline Iterator begin ( size_t i );
282  inline ConstIterator begin ( size_t i ) const;
283  inline ConstIterator cbegin( size_t i ) const;
284  inline Iterator end ( size_t i );
285  inline ConstIterator end ( size_t i ) const;
286  inline ConstIterator cend ( size_t i ) const;
288  //**********************************************************************************************
289 
290  //**Assignment operators************************************************************************
293  template< typename Other >
294  inline StaticMatrix& operator=( const Other (&array)[M][N] );
295 
296  inline StaticMatrix& operator= ( const Type& set );
297  inline StaticMatrix& operator= ( const StaticMatrix& rhs );
298  template< typename Other, bool SO2 > inline StaticMatrix& operator= ( const StaticMatrix<Other,M,N,SO2>& rhs );
299  template< typename MT , bool SO2 > inline StaticMatrix& operator= ( const Matrix<MT,SO2>& rhs );
300  template< typename MT , bool SO2 > inline StaticMatrix& operator+=( const Matrix<MT,SO2>& rhs );
301  template< typename MT , bool SO2 > inline StaticMatrix& operator-=( const Matrix<MT,SO2>& rhs );
302  template< typename MT , bool SO2 > inline StaticMatrix& operator*=( const Matrix<MT,SO2>& rhs );
303 
304  template< typename Other >
305  inline typename EnableIf< IsNumeric<Other>, StaticMatrix >::Type&
306  operator*=( Other rhs );
307 
308  template< typename Other >
309  inline typename EnableIf< IsNumeric<Other>, StaticMatrix >::Type&
310  operator/=( Other rhs );
312  //**********************************************************************************************
313 
314  //**Utility functions***************************************************************************
317  inline size_t rows() const;
318  inline size_t columns() const;
319  inline size_t spacing() const;
320  inline size_t capacity() const;
321  inline size_t capacity( size_t i ) const;
322  inline size_t nonZeros() const;
323  inline size_t nonZeros( size_t i ) const;
324  inline void reset();
325  inline void reset( size_t i );
326  inline StaticMatrix& transpose();
327  template< typename Other > inline StaticMatrix& scale( const Other& scalar );
328  inline void swap( StaticMatrix& m ) /* throw() */;
330  //**********************************************************************************************
331 
332  //**Memory functions****************************************************************************
335  static inline void* operator new ( std::size_t size );
336  static inline void* operator new[]( std::size_t size );
337  static inline void* operator new ( std::size_t size, const std::nothrow_t& );
338  static inline void* operator new[]( std::size_t size, const std::nothrow_t& );
339 
340  static inline void operator delete ( void* ptr );
341  static inline void operator delete[]( void* ptr );
342  static inline void operator delete ( void* ptr, const std::nothrow_t& );
343  static inline void operator delete[]( void* ptr, const std::nothrow_t& );
345  //**********************************************************************************************
346 
347  private:
348  //**********************************************************************************************
350  template< typename MT >
352  struct VectorizedAssign {
353  enum { value = vectorizable && MT::vectorizable &&
354  IsSame<Type,typename MT::ElementType>::value &&
355  IsRowMajorMatrix<MT>::value };
356  };
358  //**********************************************************************************************
359 
360  //**********************************************************************************************
362  template< typename MT >
364  struct VectorizedAddAssign {
365  enum { value = vectorizable && MT::vectorizable &&
366  IsSame<Type,typename MT::ElementType>::value &&
367  IntrinsicTrait<Type>::addition &&
368  IsRowMajorMatrix<MT>::value };
369  };
371  //**********************************************************************************************
372 
373  //**********************************************************************************************
375  template< typename MT >
377  struct VectorizedSubAssign {
378  enum { value = vectorizable && MT::vectorizable &&
379  IsSame<Type,typename MT::ElementType>::value &&
380  IntrinsicTrait<Type>::subtraction &&
381  IsRowMajorMatrix<MT>::value };
382  };
384  //**********************************************************************************************
385 
386  public:
387  //**Expression template evaluation functions****************************************************
390  template< typename Other > inline bool canAlias ( const Other* alias ) const;
391  template< typename Other > inline bool isAliased( const Other* alias ) const;
392 
393  inline bool isAligned() const;
394 
395  inline IntrinsicType load ( size_t i, size_t j ) const;
396  inline IntrinsicType loadu ( size_t i, size_t j ) const;
397  inline void store ( size_t i, size_t j, const IntrinsicType& value );
398  inline void storeu( size_t i, size_t j, const IntrinsicType& value );
399  inline void stream( size_t i, size_t j, const IntrinsicType& value );
400 
401  template< typename MT, bool SO2 >
402  inline typename DisableIf< VectorizedAssign<MT> >::Type
403  assign( const DenseMatrix<MT,SO2>& rhs );
404 
405  template< typename MT, bool SO2 >
406  inline typename EnableIf< VectorizedAssign<MT> >::Type
407  assign( const DenseMatrix<MT,SO2>& rhs );
408 
409  template< typename MT > inline void assign( const SparseMatrix<MT,SO>& rhs );
410  template< typename MT > inline void assign( const SparseMatrix<MT,!SO>& rhs );
411 
412  template< typename MT, bool SO2 >
413  inline typename DisableIf< VectorizedAddAssign<MT> >::Type
414  addAssign( const DenseMatrix<MT,SO2>& rhs );
415 
416  template< typename MT, bool SO2 >
417  inline typename EnableIf< VectorizedAddAssign<MT> >::Type
418  addAssign( const DenseMatrix<MT,SO2>& rhs );
419 
420  template< typename MT > inline void addAssign( const SparseMatrix<MT,SO>& rhs );
421  template< typename MT > inline void addAssign( const SparseMatrix<MT,!SO>& rhs );
422 
423  template< typename MT, bool SO2 >
424  inline typename DisableIf< VectorizedSubAssign<MT> >::Type
425  subAssign( const DenseMatrix<MT,SO2>& rhs );
426 
427  template< typename MT, bool SO2 >
428  inline typename EnableIf< VectorizedSubAssign<MT> >::Type
429  subAssign( const DenseMatrix<MT,SO2>& rhs );
430 
431  template< typename MT > inline void subAssign( const SparseMatrix<MT,SO>& rhs );
432  template< typename MT > inline void subAssign( const SparseMatrix<MT,!SO>& rhs );
434  //**********************************************************************************************
435 
436  private:
437  //**Member variables****************************************************************************
441 
451  //**********************************************************************************************
452 
453  //**Compile time checks*************************************************************************
459  BLAZE_STATIC_ASSERT( NN % IT::size == 0UL );
460  BLAZE_STATIC_ASSERT( NN >= N );
462  //**********************************************************************************************
463 };
464 //*************************************************************************************************
465 
466 
467 
468 
469 //=================================================================================================
470 //
471 // CONSTRUCTORS
472 //
473 //=================================================================================================
474 
475 //*************************************************************************************************
480 template< typename Type // Data type of the matrix
481  , size_t M // Number of rows
482  , size_t N // Number of columns
483  , bool SO > // Storage order
485  : v_() // The statically allocated matrix elements
486 {
488 
489  if( IsNumeric<Type>::value ) {
490  for( size_t i=0UL; i<M*NN; ++i )
491  v_[i] = Type();
492  }
493 }
494 //*************************************************************************************************
495 
496 
497 //*************************************************************************************************
502 template< typename Type // Data type of the matrix
503  , size_t M // Number of rows
504  , size_t N // Number of columns
505  , bool SO > // Storage order
506 inline StaticMatrix<Type,M,N,SO>::StaticMatrix( const Type& init )
507  : v_() // The statically allocated matrix elements
508 {
510 
511  for( size_t i=0UL; i<M; ++i ) {
512  for( size_t j=0UL; j<N; ++j )
513  v_[i*NN+j] = init;
514 
515  for( size_t j=N; j<NN; ++j )
516  v_[i*NN+j] = Type();
517  }
518 }
519 //*************************************************************************************************
520 
521 
522 //*************************************************************************************************
548 template< typename Type // Data type of the matrix
549  , size_t M // Number of rows
550  , size_t N // Number of columns
551  , bool SO > // Storage order
552 template< typename Other > // Data type of the initialization array
553 inline StaticMatrix<Type,M,N,SO>::StaticMatrix( size_t m, size_t n, const Other* array )
554  : v_() // The statically allocated matrix elements
555 {
557 
558  if( m > M || n > N )
559  throw std::invalid_argument( "Invalid setup of static matrix" );
560 
561  for( size_t i=0UL; i<m; ++i ) {
562  for( size_t j=0UL; j<n; ++j )
563  v_[i*NN+j] = array[i*n+j];
564 
565  if( IsNumeric<Type>::value ) {
566  for( size_t j=n; j<NN; ++j )
567  v_[i*NN+j] = Type();
568  }
569  }
570 
571  if( IsNumeric<Type>::value ) {
572  for( size_t i=m; i<M; ++i ) {
573  for( size_t j=0UL; j<NN; ++j )
574  v_[i*NN+j] = Type();
575  }
576  }
577 }
578 //*************************************************************************************************
579 
580 
581 //*************************************************************************************************
601 template< typename Type // Data type of the matrix
602  , size_t M // Number of rows
603  , size_t N // Number of columns
604  , bool SO > // Storage order
605 template< typename Other > // Data type of the initialization array
606 inline StaticMatrix<Type,M,N,SO>::StaticMatrix( const Other (&array)[M][N] )
607  : v_() // The statically allocated matrix elements
608 {
610 
611  for( size_t i=0UL; i<M; ++i ) {
612  for( size_t j=0UL; j<N; ++j )
613  v_[i*NN+j] = array[i][j];
614 
615  for( size_t j=N; j<NN; ++j )
616  v_[i*NN+j] = Type();
617  }
618 }
619 //*************************************************************************************************
620 
621 
622 //*************************************************************************************************
629 template< typename Type // Data type of the matrix
630  , size_t M // Number of rows
631  , size_t N // Number of columns
632  , bool SO > // Storage order
634  : v_() // The statically allocated matrix elements
635 {
637 
638  for( size_t i=0UL; i<M*NN; ++i )
639  v_[i] = m.v_[i];
640 }
641 //*************************************************************************************************
642 
643 
644 //*************************************************************************************************
649 template< typename Type // Data type of the matrix
650  , size_t M // Number of rows
651  , size_t N // Number of columns
652  , bool SO > // Storage order
653 template< typename Other // Data type of the foreign matrix
654  , bool SO2 > // Storage order of the foreign matrix
656  : v_() // The statically allocated matrix elements
657 {
659 
660  for( size_t i=0UL; i<M; ++i ) {
661  for( size_t j=0UL; j<N; ++j )
662  v_[i*NN+j] = m(i,j);
663 
664  for( size_t j=N; j<NN; ++j )
665  v_[i*NN+j] = Type();
666  }
667 }
668 //*************************************************************************************************
669 
670 
671 //*************************************************************************************************
681 template< typename Type // Data type of the matrix
682  , size_t M // Number of rows
683  , size_t N // Number of columns
684  , bool SO > // Storage order
685 template< typename MT // Type of the foreign matrix
686  , bool SO2 > // Storage order of the foreign matrix
688  : v_() // The statically allocated matrix elements
689 {
690  using blaze::assign;
691 
693 
694  if( (~m).rows() != M || (~m).columns() != N )
695  throw std::invalid_argument( "Invalid setup of static matrix" );
696 
697  for( size_t i=0UL; i<M; ++i ) {
698  for( size_t j=( IsSparseMatrix<MT>::value ? 0UL : N ); j<NN; ++j ) {
699  v_[i*NN+j] = Type();
700  }
701  }
702 
703  assign( *this, ~m );
704 }
705 //*************************************************************************************************
706 
707 
708 //*************************************************************************************************
725 template< typename Type // Data type of the matrix
726  , size_t M // Number of rows
727  , size_t N // Number of columns
728  , bool SO > // Storage order
729 inline StaticMatrix<Type,M,N,SO>::StaticMatrix( const Type& v1, const Type& v2 )
730  : v_() // The statically allocated matrix elements
731 {
732  BLAZE_STATIC_ASSERT( M*N == 2UL );
734 
735  // Initialization of a 1x2 matrix
736  if( M == 1UL ) {
737  v_[0UL] = v1;
738  v_[1UL] = v2;
739  }
740 
741  // Initialization of a 2x1 matrix
742  else {
743  v_[0UL] = v1;
744  v_[ NN] = v2;
745  }
746 
747  for( size_t i=0UL; i<M; ++i ) {
748  for( size_t j=N; j<NN; ++j )
749  v_[i*NN+j] = Type();
750  }
751 }
752 //*************************************************************************************************
753 
754 
755 //*************************************************************************************************
773 template< typename Type // Data type of the matrix
774  , size_t M // Number of rows
775  , size_t N // Number of columns
776  , bool SO > // Storage order
777 inline StaticMatrix<Type,M,N,SO>::StaticMatrix( const Type& v1, const Type& v2, const Type& v3 )
778  : v_() // The statically allocated matrix elements
779 {
780  BLAZE_STATIC_ASSERT( M*N == 3UL );
782 
783  // Initialization of a 1x3 matrix
784  if( M == 1UL ) {
785  v_[0UL] = v1;
786  v_[1UL] = v2;
787  v_[2UL] = v3;
788  }
789 
790  // Initialization of a 3x1 matrix
791  else {
792  v_[ 0UL] = v1;
793  v_[ NN] = v2;
794  v_[2UL*NN] = v3;
795  }
796 
797  for( size_t i=0UL; i<M; ++i ) {
798  for( size_t j=N; j<NN; ++j )
799  v_[i*NN+j] = Type();
800  }
801 }
802 //*************************************************************************************************
803 
804 
805 //*************************************************************************************************
826 template< typename Type // Data type of the matrix
827  , size_t M // Number of rows
828  , size_t N // Number of columns
829  , bool SO > // Storage order
830 inline StaticMatrix<Type,M,N,SO>::StaticMatrix( const Type& v1, const Type& v2,
831  const Type& v3, const Type& v4 )
832  : v_() // The statically allocated matrix elements
833 {
834  BLAZE_STATIC_ASSERT( M*N == 4UL );
836 
837  // Initialization of a 1x4 matrix
838  if( M == 1UL ) {
839  v_[0UL] = v1;
840  v_[1UL] = v2;
841  v_[2UL] = v3;
842  v_[3UL] = v4;
843  }
844 
845  // Initialization of a 2x2 matrix
846  else if( M == 2UL ) {
847  v_[ 0UL] = v1;
848  v_[ 1UL] = v2;
849  v_[NN ] = v3;
850  v_[NN+1UL] = v4;
851  }
852 
853  // Initialization of a 4x1 matrix
854  else {
855  v_[ 0UL] = v1;
856  v_[ NN] = v2;
857  v_[2UL*NN] = v3;
858  v_[3UL*NN] = v4;
859  }
860 
861  for( size_t i=0UL; i<M; ++i ) {
862  for( size_t j=N; j<NN; ++j )
863  v_[i*NN+j] = Type();
864  }
865 }
866 //*************************************************************************************************
867 
868 
869 //*************************************************************************************************
889 template< typename Type // Data type of the matrix
890  , size_t M // Number of rows
891  , size_t N // Number of columns
892  , bool SO > // Storage order
893 inline StaticMatrix<Type,M,N,SO>::StaticMatrix( const Type& v1, const Type& v2, const Type& v3,
894  const Type& v4, const Type& v5 )
895  : v_() // The statically allocated matrix elements
896 {
897  BLAZE_STATIC_ASSERT( M*N == 5UL );
899 
900  // Initialization of a 1x5 matrix
901  if( M == 1UL ) {
902  v_[0UL] = v1;
903  v_[1UL] = v2;
904  v_[2UL] = v3;
905  v_[3UL] = v4;
906  v_[4UL] = v5;
907  }
908 
909  // Initialization of a 5x1 matrix
910  else {
911  v_[ 0UL] = v1;
912  v_[ NN] = v2;
913  v_[2UL*NN] = v3;
914  v_[3UL*NN] = v4;
915  v_[4UL*NN] = v5;
916  }
917 
918  for( size_t i=0UL; i<M; ++i ) {
919  for( size_t j=N; j<NN; ++j )
920  v_[i*NN+j] = Type();
921  }
922 }
923 //*************************************************************************************************
924 
925 
926 //*************************************************************************************************
950 template< typename Type // Data type of the matrix
951  , size_t M // Number of rows
952  , size_t N // Number of columns
953  , bool SO > // Storage order
954 inline StaticMatrix<Type,M,N,SO>::StaticMatrix( const Type& v1, const Type& v2, const Type& v3,
955  const Type& v4, const Type& v5, const Type& v6 )
956  : v_() // The statically allocated matrix elements
957 {
958  BLAZE_STATIC_ASSERT( M*N == 6UL );
960 
961  // Initialization of a 1x6 matrix
962  if( M == 1UL ) {
963  v_[0UL] = v1;
964  v_[1UL] = v2;
965  v_[2UL] = v3;
966  v_[3UL] = v4;
967  v_[4UL] = v5;
968  v_[5UL] = v6;
969  }
970 
971  // Initialization of a 2x3 matrix
972  else if( M == 2UL ) {
973  v_[ 0UL] = v1;
974  v_[ 1UL] = v2;
975  v_[ 2UL] = v3;
976  v_[NN ] = v4;
977  v_[NN+1UL] = v5;
978  v_[NN+2UL] = v6;
979  }
980 
981  // Initialization of a 3x2 matrix
982  else if( M == 3UL ) {
983  v_[ 0UL] = v1;
984  v_[ 1UL] = v2;
985  v_[ NN ] = v3;
986  v_[ NN+1UL] = v4;
987  v_[2UL*NN ] = v5;
988  v_[2UL*NN+1UL] = v6;
989  }
990 
991  // Initialization of a 6x1 matrix
992  else {
993  v_[ 0UL] = v1;
994  v_[ NN] = v2;
995  v_[2UL*NN] = v3;
996  v_[3UL*NN] = v4;
997  v_[4UL*NN] = v5;
998  v_[5UL*NN] = v6;
999  }
1000 
1001  for( size_t i=0UL; i<M; ++i ) {
1002  for( size_t j=N; j<NN; ++j )
1003  v_[i*NN+j] = Type();
1004  }
1005 }
1006 //*************************************************************************************************
1007 
1008 
1009 //*************************************************************************************************
1031 template< typename Type // Data type of the matrix
1032  , size_t M // Number of rows
1033  , size_t N // Number of columns
1034  , bool SO > // Storage order
1035 inline StaticMatrix<Type,M,N,SO>::StaticMatrix( const Type& v1, const Type& v2, const Type& v3,
1036  const Type& v4, const Type& v5, const Type& v6,
1037  const Type& v7 )
1038  : v_() // The statically allocated matrix elements
1039 {
1040  BLAZE_STATIC_ASSERT( M*N == 7UL );
1042 
1043  // Initialization of a 1x7 matrix
1044  if( M == 1UL ) {
1045  v_[0UL] = v1;
1046  v_[1UL] = v2;
1047  v_[2UL] = v3;
1048  v_[3UL] = v4;
1049  v_[4UL] = v5;
1050  v_[5UL] = v6;
1051  v_[6UL] = v7;
1052  }
1053 
1054  // Initialization of a 7x1 matrix
1055  else {
1056  v_[ 0UL] = v1;
1057  v_[ NN] = v2;
1058  v_[2UL*NN] = v3;
1059  v_[3UL*NN] = v4;
1060  v_[4UL*NN] = v5;
1061  v_[5UL*NN] = v6;
1062  v_[6UL*NN] = v7;
1063  }
1064 
1065  for( size_t i=0UL; i<M; ++i ) {
1066  for( size_t j=N; j<NN; ++j )
1067  v_[i*NN+j] = Type();
1068  }
1069 }
1070 //*************************************************************************************************
1071 
1072 
1073 //*************************************************************************************************
1098 template< typename Type // Data type of the matrix
1099  , size_t M // Number of rows
1100  , size_t N // Number of columns
1101  , bool SO > // Storage order
1102 inline StaticMatrix<Type,M,N,SO>::StaticMatrix( const Type& v1, const Type& v2, const Type& v3,
1103  const Type& v4, const Type& v5, const Type& v6,
1104  const Type& v7, const Type& v8 )
1105  : v_() // The statically allocated matrix elements
1106 {
1107  BLAZE_STATIC_ASSERT( M*N == 8UL );
1109 
1110  // Initialization of a 1x8 matrix
1111  if( M == 1UL ) {
1112  v_[0UL] = v1;
1113  v_[1UL] = v2;
1114  v_[2UL] = v3;
1115  v_[3UL] = v4;
1116  v_[4UL] = v5;
1117  v_[5UL] = v6;
1118  v_[6UL] = v7;
1119  v_[7UL] = v8;
1120  }
1121 
1122  // Initialization of a 2x4 matrix
1123  else if( M == 2UL ) {
1124  v_[ 0UL] = v1;
1125  v_[ 1UL] = v2;
1126  v_[ 2UL] = v3;
1127  v_[ 3UL] = v4;
1128  v_[NN ] = v5;
1129  v_[NN+1UL] = v6;
1130  v_[NN+2UL] = v7;
1131  v_[NN+3UL] = v8;
1132  }
1133 
1134  // Initialization of a 4x2 matrix
1135  else if( M == 4UL ) {
1136  v_[ 0UL] = v1;
1137  v_[ 1UL] = v2;
1138  v_[ NN ] = v3;
1139  v_[ NN+1UL] = v4;
1140  v_[2UL*NN ] = v5;
1141  v_[2UL*NN+1UL] = v6;
1142  v_[3UL*NN ] = v7;
1143  v_[3UL*NN+1UL] = v8;
1144  }
1145 
1146  // Initialization of a 8x1 matrix
1147  else {
1148  v_[ 0UL] = v1;
1149  v_[ NN] = v2;
1150  v_[2UL*NN] = v3;
1151  v_[3UL*NN] = v4;
1152  v_[4UL*NN] = v5;
1153  v_[5UL*NN] = v6;
1154  v_[6UL*NN] = v7;
1155  v_[7UL*NN] = v8;
1156  }
1157 
1158  for( size_t i=0UL; i<M; ++i ) {
1159  for( size_t j=N; j<NN; ++j )
1160  v_[i*NN+j] = Type();
1161  }
1162 }
1163 //*************************************************************************************************
1164 
1165 
1166 //*************************************************************************************************
1193 template< typename Type // Data type of the matrix
1194  , size_t M // Number of rows
1195  , size_t N // Number of columns
1196  , bool SO > // Storage order
1197 inline StaticMatrix<Type,M,N,SO>::StaticMatrix( const Type& v1, const Type& v2, const Type& v3,
1198  const Type& v4, const Type& v5, const Type& v6,
1199  const Type& v7, const Type& v8, const Type& v9 )
1200  : v_() // The statically allocated matrix elements
1201 {
1202  BLAZE_STATIC_ASSERT( M*N == 9UL );
1204 
1205  // Initialization of a 1x9 matrix
1206  if( M == 1UL ) {
1207  v_[0UL] = v1;
1208  v_[1UL] = v2;
1209  v_[2UL] = v3;
1210  v_[3UL] = v4;
1211  v_[4UL] = v5;
1212  v_[5UL] = v6;
1213  v_[6UL] = v7;
1214  v_[7UL] = v8;
1215  v_[8UL] = v9;
1216  }
1217 
1218  // Initialization of a 3x3 matrix
1219  else if( M == 3UL ) {
1220  v_[ 0UL] = v1;
1221  v_[ 1UL] = v2;
1222  v_[ 2UL] = v3;
1223  v_[ NN ] = v4;
1224  v_[ NN+1UL] = v5;
1225  v_[ NN+2UL] = v6;
1226  v_[2UL*NN ] = v7;
1227  v_[2UL*NN+1UL] = v8;
1228  v_[2UL*NN+2UL] = v9;
1229  }
1230 
1231  // Initialization of a 9x1 matrix
1232  else {
1233  v_[ 0UL] = v1;
1234  v_[ NN] = v2;
1235  v_[2UL*NN] = v3;
1236  v_[3UL*NN] = v4;
1237  v_[4UL*NN] = v5;
1238  v_[5UL*NN] = v6;
1239  v_[6UL*NN] = v7;
1240  v_[7UL*NN] = v8;
1241  v_[8UL*NN] = v9;
1242  }
1243 
1244  for( size_t i=0UL; i<M; ++i ) {
1245  for( size_t j=N; j<NN; ++j )
1246  v_[i*NN+j] = Type();
1247  }
1248 }
1249 //*************************************************************************************************
1250 
1251 
1252 //*************************************************************************************************
1280 template< typename Type // Data type of the matrix
1281  , size_t M // Number of rows
1282  , size_t N // Number of columns
1283  , bool SO > // Storage order
1284 inline StaticMatrix<Type,M,N,SO>::StaticMatrix( const Type& v1, const Type& v2, const Type& v3,
1285  const Type& v4, const Type& v5, const Type& v6,
1286  const Type& v7, const Type& v8, const Type& v9,
1287  const Type& v10 )
1288  : v_() // The statically allocated matrix elements
1289 {
1290  BLAZE_STATIC_ASSERT( M*N == 10UL );
1292 
1293  // Initialization of a 1x10 matrix
1294  if( M == 1UL ) {
1295  v_[0UL] = v1;
1296  v_[1UL] = v2;
1297  v_[2UL] = v3;
1298  v_[3UL] = v4;
1299  v_[4UL] = v5;
1300  v_[5UL] = v6;
1301  v_[6UL] = v7;
1302  v_[7UL] = v8;
1303  v_[8UL] = v9;
1304  v_[9UL] = v10;
1305  }
1306 
1307  // Initialization of a 2x5 matrix
1308  else if( M == 2UL ) {
1309  v_[ 0UL] = v1;
1310  v_[ 1UL] = v2;
1311  v_[ 2UL] = v3;
1312  v_[ 3UL] = v4;
1313  v_[ 4UL] = v5;
1314  v_[NN ] = v6;
1315  v_[NN+1UL] = v7;
1316  v_[NN+2UL] = v8;
1317  v_[NN+3UL] = v9;
1318  v_[NN+4UL] = v10;
1319  }
1320 
1321  // Initialization of a 5x2 matrix
1322  else if( M == 5UL ) {
1323  v_[ 0UL] = v1;
1324  v_[ 1UL] = v2;
1325  v_[ NN ] = v3;
1326  v_[ NN+1UL] = v4;
1327  v_[2UL*NN ] = v5;
1328  v_[2UL*NN+1UL] = v6;
1329  v_[3UL*NN ] = v7;
1330  v_[3UL*NN+1UL] = v8;
1331  v_[4UL*NN ] = v9;
1332  v_[4UL*NN+1UL] = v10;
1333  }
1334 
1335  // Initialization of a 10x1 matrix
1336  else {
1337  v_[ 0UL] = v1;
1338  v_[ NN] = v2;
1339  v_[2UL*NN] = v3;
1340  v_[3UL*NN] = v4;
1341  v_[4UL*NN] = v5;
1342  v_[5UL*NN] = v6;
1343  v_[6UL*NN] = v7;
1344  v_[7UL*NN] = v8;
1345  v_[8UL*NN] = v9;
1346  v_[9UL*NN] = v10;
1347  }
1348 
1349  for( size_t i=0UL; i<M; ++i ) {
1350  for( size_t j=N; j<NN; ++j )
1351  v_[i*NN+j] = Type();
1352  }
1353 }
1354 //*************************************************************************************************
1355 
1356 
1357 
1358 
1359 //=================================================================================================
1360 //
1361 // DATA ACCESS FUNCTIONS
1362 //
1363 //=================================================================================================
1364 
1365 //*************************************************************************************************
1372 template< typename Type // Data type of the matrix
1373  , size_t M // Number of rows
1374  , size_t N // Number of columns
1375  , bool SO > // Storage order
1378 {
1379  BLAZE_USER_ASSERT( i<M, "Invalid row access index" );
1380  BLAZE_USER_ASSERT( j<N, "Invalid column access index" );
1381  return v_[i*NN+j];
1382 }
1383 //*************************************************************************************************
1384 
1385 
1386 //*************************************************************************************************
1393 template< typename Type // Data type of the matrix
1394  , size_t M // Number of rows
1395  , size_t N // Number of columns
1396  , bool SO > // Storage order
1398  StaticMatrix<Type,M,N,SO>::operator()( size_t i, size_t j ) const
1399 {
1400  BLAZE_USER_ASSERT( i<M, "Invalid row access index" );
1401  BLAZE_USER_ASSERT( j<N, "Invalid column access index" );
1402  return v_[i*NN+j];
1403 }
1404 //*************************************************************************************************
1405 
1406 
1407 //*************************************************************************************************
1419 template< typename Type // Data type of the matrix
1420  , size_t M // Number of rows
1421  , size_t N // Number of columns
1422  , bool SO > // Storage order
1423 inline typename StaticMatrix<Type,M,N,SO>::Pointer
1425 {
1426  return v_;
1427 }
1428 //*************************************************************************************************
1429 
1430 
1431 //*************************************************************************************************
1443 template< typename Type // Data type of the matrix
1444  , size_t M // Number of rows
1445  , size_t N // Number of columns
1446  , bool SO > // Storage order
1449 {
1450  return v_;
1451 }
1452 //*************************************************************************************************
1453 
1454 
1455 //*************************************************************************************************
1463 template< typename Type // Data type of the matrix
1464  , size_t M // Number of rows
1465  , size_t N // Number of columns
1466  , bool SO > // Storage order
1467 inline typename StaticMatrix<Type,M,N,SO>::Pointer
1469 {
1470  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1471  return v_ + i*NN;
1472 }
1473 //*************************************************************************************************
1474 
1475 
1476 //*************************************************************************************************
1484 template< typename Type // Data type of the matrix
1485  , size_t M // Number of rows
1486  , size_t N // Number of columns
1487  , bool SO > // Storage order
1490 {
1491  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1492  return v_ + i*NN;
1493 }
1494 //*************************************************************************************************
1495 
1496 
1497 //*************************************************************************************************
1508 template< typename Type // Data type of the matrix
1509  , size_t M // Number of rows
1510  , size_t N // Number of columns
1511  , bool SO > // Storage order
1514 {
1515  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1516  return Iterator( v_ + i*NN );
1517 }
1518 //*************************************************************************************************
1519 
1520 
1521 //*************************************************************************************************
1532 template< typename Type // Data type of the matrix
1533  , size_t M // Number of rows
1534  , size_t N // Number of columns
1535  , bool SO > // Storage order
1538 {
1539  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1540  return ConstIterator( v_ + i*NN );
1541 }
1542 //*************************************************************************************************
1543 
1544 
1545 //*************************************************************************************************
1556 template< typename Type // Data type of the matrix
1557  , size_t M // Number of rows
1558  , size_t N // Number of columns
1559  , bool SO > // Storage order
1562 {
1563  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1564  return ConstIterator( v_ + i*NN );
1565 }
1566 //*************************************************************************************************
1567 
1568 
1569 //*************************************************************************************************
1580 template< typename Type // Data type of the matrix
1581  , size_t M // Number of rows
1582  , size_t N // Number of columns
1583  , bool SO > // Storage order
1586 {
1587  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1588  return Iterator( v_ + i*NN + N );
1589 }
1590 //*************************************************************************************************
1591 
1592 
1593 //*************************************************************************************************
1604 template< typename Type // Data type of the matrix
1605  , size_t M // Number of rows
1606  , size_t N // Number of columns
1607  , bool SO > // Storage order
1610 {
1611  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1612  return ConstIterator( v_ + i*NN + N );
1613 }
1614 //*************************************************************************************************
1615 
1616 
1617 //*************************************************************************************************
1628 template< typename Type // Data type of the matrix
1629  , size_t M // Number of rows
1630  , size_t N // Number of columns
1631  , bool SO > // Storage order
1634 {
1635  BLAZE_USER_ASSERT( i < M, "Invalid dense matrix row access index" );
1636  return ConstIterator( v_ + i*NN + N );
1637 }
1638 //*************************************************************************************************
1639 
1640 
1641 
1642 
1643 //=================================================================================================
1644 //
1645 // ASSIGNMENT OPERATORS
1646 //
1647 //=================================================================================================
1648 
1649 //*************************************************************************************************
1670 template< typename Type // Data type of the matrix
1671  , size_t M // Number of rows
1672  , size_t N // Number of columns
1673  , bool SO > // Storage order
1674 template< typename Other > // Data type of the initialization array
1676 {
1677  for( size_t i=0UL; i<M; ++i )
1678  for( size_t j=0UL; j<N; ++j )
1679  v_[i*NN+j] = array[i][j];
1680 
1681  return *this;
1682 }
1683 //*************************************************************************************************
1684 
1685 
1686 //*************************************************************************************************
1692 template< typename Type // Data type of the matrix
1693  , size_t M // Number of rows
1694  , size_t N // Number of columns
1695  , bool SO > // Storage order
1697 {
1698  for( size_t i=0UL; i<M; ++i )
1699  for( size_t j=0UL; j<N; ++j )
1700  v_[i*NN+j] = set;
1701 
1702  return *this;
1703 }
1704 //*************************************************************************************************
1705 
1706 
1707 //*************************************************************************************************
1715 template< typename Type // Data type of the matrix
1716  , size_t M // Number of rows
1717  , size_t N // Number of columns
1718  , bool SO > // Storage order
1720 {
1721  using blaze::assign;
1722 
1723  assign( *this, ~rhs );
1724  return *this;
1725 }
1726 //*************************************************************************************************
1727 
1728 
1729 //*************************************************************************************************
1735 template< typename Type // Data type of the matrix
1736  , size_t M // Number of rows
1737  , size_t N // Number of columns
1738  , bool SO > // Storage order
1739 template< typename Other // Data type of the foreign matrix
1740  , bool SO2 > // Storage order of the foreign matrix
1743 {
1744  using blaze::assign;
1745 
1746  assign( *this, ~rhs );
1747  return *this;
1748 }
1749 //*************************************************************************************************
1750 
1751 
1752 //*************************************************************************************************
1763 template< typename Type // Data type of the matrix
1764  , size_t M // Number of rows
1765  , size_t N // Number of columns
1766  , bool SO > // Storage order
1767 template< typename MT // Type of the right-hand side matrix
1768  , bool SO2 > // Storage order of the right-hand side matrix
1770 {
1771  using blaze::assign;
1772 
1773  if( (~rhs).rows() != M || (~rhs).columns() != N )
1774  throw std::invalid_argument( "Invalid assignment to static matrix" );
1775 
1776  if( (~rhs).canAlias( this ) ) {
1777  StaticMatrix tmp( ~rhs );
1778  swap( tmp );
1779  }
1780  else {
1782  reset();
1783  assign( *this, ~rhs );
1784  }
1785 
1786  return *this;
1787 }
1788 //*************************************************************************************************
1789 
1790 
1791 //*************************************************************************************************
1801 template< typename Type // Data type of the matrix
1802  , size_t M // Number of rows
1803  , size_t N // Number of columns
1804  , bool SO > // Storage order
1805 template< typename MT // Type of the right-hand side matrix
1806  , bool SO2 > // Storage order of the right-hand side matrix
1808 {
1809  using blaze::addAssign;
1810 
1811  if( (~rhs).rows() != M || (~rhs).columns() != N )
1812  throw std::invalid_argument( "Matrix sizes do not match" );
1813 
1814  if( (~rhs).canAlias( this ) ) {
1815  typename MT::ResultType tmp( ~rhs );
1816  addAssign( *this, tmp );
1817  }
1818  else {
1819  addAssign( *this, ~rhs );
1820  }
1821 
1822  return *this;
1823 }
1824 //*************************************************************************************************
1825 
1826 
1827 //*************************************************************************************************
1837 template< typename Type // Data type of the matrix
1838  , size_t M // Number of rows
1839  , size_t N // Number of columns
1840  , bool SO > // Storage order
1841 template< typename MT // Type of the right-hand side matrix
1842  , bool SO2 > // Storage order of the right-hand side matrix
1844 {
1845  using blaze::subAssign;
1846 
1847  if( (~rhs).rows() != M || (~rhs).columns() != N )
1848  throw std::invalid_argument( "Matrix sizes do not match" );
1849 
1850  if( (~rhs).canAlias( this ) ) {
1851  typename MT::ResultType tmp( ~rhs );
1852  subAssign( *this, tmp );
1853  }
1854  else {
1855  subAssign( *this, ~rhs );
1856  }
1857 
1858  return *this;
1859 }
1860 //*************************************************************************************************
1861 
1862 
1863 //*************************************************************************************************
1873 template< typename Type // Data type of the matrix
1874  , size_t M // Number of rows
1875  , size_t N // Number of columns
1876  , bool SO > // Storage order
1877 template< typename MT // Type of the right-hand side matrix
1878  , bool SO2 > // Storage order of the right-hand side matrix
1880 {
1881  if( M != N || (~rhs).rows() != M || (~rhs).columns() != M )
1882  throw std::invalid_argument( "Matrix sizes do not match" );
1883 
1884  StaticMatrix tmp( *this * (~rhs) );
1885  return this->operator=( tmp );
1886 }
1887 //*************************************************************************************************
1888 
1889 
1890 //*************************************************************************************************
1897 template< typename Type // Data type of the matrix
1898  , size_t M // Number of rows
1899  , size_t N // Number of columns
1900  , bool SO > // Storage order
1901 template< typename Other > // Data type of the right-hand side scalar
1902 inline typename EnableIf< IsNumeric<Other>, StaticMatrix<Type,M,N,SO> >::Type&
1904 {
1905  using blaze::assign;
1906 
1907  assign( *this, (*this) * rhs );
1908  return *this;
1909 }
1910 //*************************************************************************************************
1911 
1912 
1913 //*************************************************************************************************
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
1926 template< typename Other > // Data type of the right-hand side scalar
1927 inline typename EnableIf< IsNumeric<Other>, StaticMatrix<Type,M,N,SO> >::Type&
1929 {
1930  using blaze::assign;
1931 
1932  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
1933 
1934  assign( *this, (*this) / rhs );
1935  return *this;
1936 }
1937 //*************************************************************************************************
1938 
1939 
1940 
1941 
1942 //=================================================================================================
1943 //
1944 // UTILITY FUNCTIONS
1945 //
1946 //=================================================================================================
1947 
1948 //*************************************************************************************************
1953 template< typename Type // Data type of the matrix
1954  , size_t M // Number of rows
1955  , size_t N // Number of columns
1956  , bool SO > // Storage order
1957 inline size_t StaticMatrix<Type,M,N,SO>::rows() const
1958 {
1959  return M;
1960 }
1961 //*************************************************************************************************
1962 
1963 
1964 //*************************************************************************************************
1969 template< typename Type // Data type of the matrix
1970  , size_t M // Number of rows
1971  , size_t N // Number of columns
1972  , bool SO > // Storage order
1974 {
1975  return N;
1976 }
1977 //*************************************************************************************************
1978 
1979 
1980 //*************************************************************************************************
1988 template< typename Type // Data type of the matrix
1989  , size_t M // Number of rows
1990  , size_t N // Number of columns
1991  , bool SO > // Storage order
1993 {
1994  return NN;
1995 }
1996 //*************************************************************************************************
1997 
1998 
1999 //*************************************************************************************************
2004 template< typename Type // Data type of the matrix
2005  , size_t M // Number of rows
2006  , size_t N // Number of columns
2007  , bool SO > // Storage order
2009 {
2010  return M*NN;
2011 }
2012 //*************************************************************************************************
2013 
2014 
2015 //*************************************************************************************************
2026 template< typename Type // Data type of the matrix
2027  , size_t M // Number of rows
2028  , size_t N // Number of columns
2029  , bool SO > // Storage order
2030 inline size_t StaticMatrix<Type,M,N,SO>::capacity( size_t i ) const
2031 {
2032  UNUSED_PARAMETER( i );
2033 
2034  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
2035 
2036  return NN;
2037 }
2038 //*************************************************************************************************
2039 
2040 
2041 //*************************************************************************************************
2046 template< typename Type // Data type of the matrix
2047  , size_t M // Number of rows
2048  , size_t N // Number of columns
2049  , bool SO > // Storage order
2051 {
2052  size_t nonzeros( 0UL );
2053 
2054  for( size_t i=0UL; i<M; ++i )
2055  for( size_t j=0UL; j<N; ++j )
2056  if( !isDefault( v_[i*NN+j] ) )
2057  ++nonzeros;
2058 
2059  return nonzeros;
2060 }
2061 //*************************************************************************************************
2062 
2063 
2064 //*************************************************************************************************
2075 template< typename Type // Data type of the matrix
2076  , size_t M // Number of rows
2077  , size_t N // Number of columns
2078  , bool SO > // Storage order
2079 inline size_t StaticMatrix<Type,M,N,SO>::nonZeros( size_t i ) const
2080 {
2081  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
2082 
2083  const size_t jend( (i+1UL)*NN );
2084  size_t nonzeros( 0UL );
2085 
2086  for( size_t j=i*NN; j<jend; ++j )
2087  if( !isDefault( v_[j] ) )
2088  ++nonzeros;
2089 
2090  return nonzeros;
2091 }
2092 //*************************************************************************************************
2093 
2094 
2095 //*************************************************************************************************
2100 template< typename Type // Data type of the matrix
2101  , size_t M // Number of rows
2102  , size_t N // Number of columns
2103  , bool SO > // Storage order
2105 {
2106  using blaze::clear;
2107 
2108  for( size_t i=0UL; i<M; ++i )
2109  for( size_t j=0UL; j<N; ++j )
2110  clear( v_[i*NN+j] );
2111 }
2112 //*************************************************************************************************
2113 
2114 
2115 //*************************************************************************************************
2126 template< typename Type // Data type of the matrix
2127  , size_t M // Number of rows
2128  , size_t N // Number of columns
2129  , bool SO > // Storage order
2130 inline void StaticMatrix<Type,M,N,SO>::reset( size_t i )
2131 {
2132  using blaze::clear;
2133 
2134  BLAZE_USER_ASSERT( i < rows(), "Invalid row access index" );
2135  for( size_t j=0UL; j<N; ++j )
2136  clear( v_[i*NN+j] );
2137 }
2138 //*************************************************************************************************
2139 
2140 
2141 //*************************************************************************************************
2149 template< typename Type // Data type of the matrix
2150  , size_t M // Number of rows
2151  , size_t N // Number of columns
2152  , bool SO > // Storage order
2154 {
2155  using std::swap;
2156 
2157  BLAZE_STATIC_ASSERT( M == N );
2158 
2159  for( size_t i=1UL; i<M; ++i )
2160  for( size_t j=0UL; j<i; ++j )
2161  swap( v_[i*NN+j], v_[j*NN+i] );
2162 
2163  return *this;
2164 }
2165 //*************************************************************************************************
2166 
2167 
2168 //*************************************************************************************************
2174 template< typename Type // Data type of the matrix
2175  , size_t M // Number of rows
2176  , size_t N // Number of columns
2177  , bool SO > // Storage order
2178 template< typename Other > // Data type of the scalar value
2180 {
2181  for( size_t i=0UL; i<M; ++i )
2182  for( size_t j=0UL; j<N; ++j )
2183  v_[i*NN+j] *= scalar;
2184 
2185  return *this;
2186 }
2187 //*************************************************************************************************
2188 
2189 
2190 //*************************************************************************************************
2197 template< typename Type // Data type of the matrix
2198  , size_t M // Number of rows
2199  , size_t N // Number of columns
2200  , bool SO > // Storage order
2201 inline void StaticMatrix<Type,M,N,SO>::swap( StaticMatrix& m ) /* throw() */
2202 {
2203  using std::swap;
2204 
2205  for( size_t i=0UL; i<M; ++i ) {
2206  for( size_t j=0UL; j<N; ++j ) {
2207  swap( v_[i*NN+j], m(i,j) );
2208  }
2209  }
2210 }
2211 //*************************************************************************************************
2212 
2213 
2214 
2215 
2216 //=================================================================================================
2217 //
2218 // MEMORY FUNCTIONS
2219 //
2220 //=================================================================================================
2221 
2222 //*************************************************************************************************
2232 template< typename Type // Data type of the matrix
2233  , size_t M // Number of rows
2234  , size_t N // Number of columns
2235  , bool SO > // Storage order
2236 inline void* StaticMatrix<Type,M,N,SO>::operator new( std::size_t size )
2237 {
2239 
2240  BLAZE_INTERNAL_ASSERT( size == sizeof( StaticMatrix ), "Invalid number of bytes detected" );
2241 
2242  return allocate<StaticMatrix>( 1UL );
2243 }
2244 //*************************************************************************************************
2245 
2246 
2247 //*************************************************************************************************
2257 template< typename Type // Data type of the matrix
2258  , size_t M // Number of rows
2259  , size_t N // Number of columns
2260  , bool SO > // Storage order
2261 inline void* StaticMatrix<Type,M,N,SO>::operator new[]( std::size_t size )
2262 {
2263  BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticMatrix ) , "Invalid number of bytes detected" );
2264  BLAZE_INTERNAL_ASSERT( size % sizeof( StaticMatrix ) == 0UL, "Invalid number of bytes detected" );
2265 
2266  return allocate<StaticMatrix>( size/sizeof(StaticMatrix) );
2267 }
2268 //*************************************************************************************************
2269 
2270 
2271 //*************************************************************************************************
2281 template< typename Type // Data type of the matrix
2282  , size_t M // Number of rows
2283  , size_t N // Number of columns
2284  , bool SO > // Storage order
2285 inline void* StaticMatrix<Type,M,N,SO>::operator new( std::size_t size, const std::nothrow_t& )
2286 {
2288 
2289  BLAZE_INTERNAL_ASSERT( size == sizeof( StaticMatrix ), "Invalid number of bytes detected" );
2290 
2291  return allocate<StaticMatrix>( 1UL );
2292 }
2293 //*************************************************************************************************
2294 
2295 
2296 //*************************************************************************************************
2306 template< typename Type // Data type of the matrix
2307  , size_t M // Number of rows
2308  , size_t N // Number of columns
2309  , bool SO > // Storage order
2310 inline void* StaticMatrix<Type,M,N,SO>::operator new[]( std::size_t size, const std::nothrow_t& )
2311 {
2312  BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticMatrix ) , "Invalid number of bytes detected" );
2313  BLAZE_INTERNAL_ASSERT( size % sizeof( StaticMatrix ) == 0UL, "Invalid number of bytes detected" );
2314 
2315  return allocate<StaticMatrix>( size/sizeof(StaticMatrix) );
2316 }
2317 //*************************************************************************************************
2318 
2319 
2320 //*************************************************************************************************
2326 template< typename Type // Data type of the matrix
2327  , size_t M // Number of rows
2328  , size_t N // Number of columns
2329  , bool SO > // Storage order
2330 inline void StaticMatrix<Type,M,N,SO>::operator delete( void* ptr )
2331 {
2332  deallocate( static_cast<StaticMatrix*>( ptr ) );
2333 }
2334 //*************************************************************************************************
2335 
2336 
2337 //*************************************************************************************************
2343 template< typename Type // Data type of the matrix
2344  , size_t M // Number of rows
2345  , size_t N // Number of columns
2346  , bool SO > // Storage order
2347 inline void StaticMatrix<Type,M,N,SO>::operator delete[]( void* ptr )
2348 {
2349  deallocate( static_cast<StaticMatrix*>( ptr ) );
2350 }
2351 //*************************************************************************************************
2352 
2353 
2354 //*************************************************************************************************
2360 template< typename Type // Data type of the matrix
2361  , size_t M // Number of rows
2362  , size_t N // Number of columns
2363  , bool SO > // Storage order
2364 inline void StaticMatrix<Type,M,N,SO>::operator delete( void* ptr, const std::nothrow_t& )
2365 {
2366  deallocate( static_cast<StaticMatrix*>( ptr ) );
2367 }
2368 //*************************************************************************************************
2369 
2370 
2371 //*************************************************************************************************
2377 template< typename Type // Data type of the matrix
2378  , size_t M // Number of rows
2379  , size_t N // Number of columns
2380  , bool SO > // Storage order
2381 inline void StaticMatrix<Type,M,N,SO>::operator delete[]( void* ptr, const std::nothrow_t& )
2382 {
2383  deallocate( static_cast<StaticMatrix*>( ptr ) );
2384 }
2385 //*************************************************************************************************
2386 
2387 
2388 
2389 
2390 //=================================================================================================
2391 //
2392 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
2393 //
2394 //=================================================================================================
2395 
2396 //*************************************************************************************************
2406 template< typename Type // Data type of the matrix
2407  , size_t M // Number of rows
2408  , size_t N // Number of columns
2409  , bool SO > // Storage order
2410 template< typename Other > // Data type of the foreign expression
2411 inline bool StaticMatrix<Type,M,N,SO>::canAlias( const Other* alias ) const
2412 {
2413  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
2414 }
2415 //*************************************************************************************************
2416 
2417 
2418 //*************************************************************************************************
2428 template< typename Type // Data type of the matrix
2429  , size_t M // Number of rows
2430  , size_t N // Number of columns
2431  , bool SO > // Storage order
2432 template< typename Other > // Data type of the foreign expression
2433 inline bool StaticMatrix<Type,M,N,SO>::isAliased( const Other* alias ) const
2434 {
2435  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
2436 }
2437 //*************************************************************************************************
2438 
2439 
2440 //*************************************************************************************************
2449 template< typename Type // Data type of the matrix
2450  , size_t M // Number of rows
2451  , size_t N // Number of columns
2452  , bool SO > // Storage order
2454 {
2455  return true;
2456 }
2457 //*************************************************************************************************
2458 
2459 
2460 //*************************************************************************************************
2475 template< typename Type // Data type of the matrix
2476  , size_t M // Number of rows
2477  , size_t N // Number of columns
2478  , bool SO > // Storage order
2480  StaticMatrix<Type,M,N,SO>::load( size_t i, size_t j ) const
2481 {
2482  using blaze::load;
2483 
2485 
2486  BLAZE_INTERNAL_ASSERT( i < M , "Invalid row access index" );
2487  BLAZE_INTERNAL_ASSERT( j < N , "Invalid column access index" );
2488  BLAZE_INTERNAL_ASSERT( j + IT::size <= NN , "Invalid column access index" );
2489  BLAZE_INTERNAL_ASSERT( j % IT::size == 0UL, "Invalid column access index" );
2490 
2491  return load( &v_[i*NN+j] );
2492 }
2493 //*************************************************************************************************
2494 
2495 
2496 //*************************************************************************************************
2511 template< typename Type // Data type of the matrix
2512  , size_t M // Number of rows
2513  , size_t N // Number of columns
2514  , bool SO > // Storage order
2516  StaticMatrix<Type,M,N,SO>::loadu( size_t i, size_t j ) const
2517 {
2518  using blaze::loadu;
2519 
2521 
2522  BLAZE_INTERNAL_ASSERT( i < M , "Invalid row access index" );
2523  BLAZE_INTERNAL_ASSERT( j < N , "Invalid column access index" );
2524  BLAZE_INTERNAL_ASSERT( j + IT::size <= NN , "Invalid column access index" );
2525 
2526  return loadu( &v_[i*NN+j] );
2527 }
2528 //*************************************************************************************************
2529 
2530 
2531 //*************************************************************************************************
2547 template< typename Type // Data type of the matrix
2548  , size_t M // Number of rows
2549  , size_t N // Number of columns
2550  , bool SO > // Storage order
2551 inline void StaticMatrix<Type,M,N,SO>::store( size_t i, size_t j, const IntrinsicType& value )
2552 {
2553  using blaze::store;
2554 
2556 
2557  BLAZE_INTERNAL_ASSERT( i < M , "Invalid row access index" );
2558  BLAZE_INTERNAL_ASSERT( j < N , "Invalid column access index" );
2559  BLAZE_INTERNAL_ASSERT( j + IT::size <= NN , "Invalid column access index" );
2560  BLAZE_INTERNAL_ASSERT( j % IT::size == 0UL, "Invalid column access index" );
2561 
2562  store( &v_[i*NN+j], value );
2563 }
2564 //*************************************************************************************************
2565 
2566 
2567 //*************************************************************************************************
2583 template< typename Type // Data type of the matrix
2584  , size_t M // Number of rows
2585  , size_t N // Number of columns
2586  , bool SO > // Storage order
2587 inline void StaticMatrix<Type,M,N,SO>::storeu( size_t i, size_t j, const IntrinsicType& value )
2588 {
2589  using blaze::storeu;
2590 
2592 
2593  BLAZE_INTERNAL_ASSERT( i < M , "Invalid row access index" );
2594  BLAZE_INTERNAL_ASSERT( j < N , "Invalid column access index" );
2595  BLAZE_INTERNAL_ASSERT( j + IT::size <= NN, "Invalid column access index" );
2596 
2597  storeu( &v_[i*NN+j], value );
2598 }
2599 //*************************************************************************************************
2600 
2601 
2602 //*************************************************************************************************
2618 template< typename Type // Data type of the matrix
2619  , size_t M // Number of rows
2620  , size_t N // Number of columns
2621  , bool SO > // Storage order
2622 inline void StaticMatrix<Type,M,N,SO>::stream( size_t i, size_t j, const IntrinsicType& value )
2623 {
2624  using blaze::stream;
2625 
2627 
2628  BLAZE_INTERNAL_ASSERT( i < M , "Invalid row access index" );
2629  BLAZE_INTERNAL_ASSERT( j < N , "Invalid column access index" );
2630  BLAZE_INTERNAL_ASSERT( j + IT::size <= NN , "Invalid column access index" );
2631  BLAZE_INTERNAL_ASSERT( j % IT::size == 0UL, "Invalid column access index" );
2632 
2633  stream( &v_[i*NN+j], value );
2634 }
2635 //*************************************************************************************************
2636 
2637 
2638 //*************************************************************************************************
2649 template< typename Type // Data type of the matrix
2650  , size_t M // Number of rows
2651  , size_t N // Number of columns
2652  , bool SO > // Storage order
2653 template< typename MT // Type of the right-hand side dense matrix
2654  , bool SO2 > // Storage order of the right-hand side dense matrix
2655 inline typename DisableIf< typename StaticMatrix<Type,M,N,SO>::BLAZE_TEMPLATE VectorizedAssign<MT> >::Type
2657 {
2658  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2659 
2660  for( size_t i=0UL; i<M; ++i ) {
2661  for( size_t j=0UL; j<N; ++j ) {
2662  v_[i*NN+j] = (~rhs)(i,j);
2663  }
2664  }
2665 }
2666 //*************************************************************************************************
2667 
2668 
2669 //*************************************************************************************************
2680 template< typename Type // Data type of the matrix
2681  , size_t M // Number of rows
2682  , size_t N // Number of columns
2683  , bool SO > // Storage order
2684 template< typename MT // Type of the right-hand side dense matrix
2685  , bool SO2 > // Storage order of the right-hand side dense matrix
2686 inline typename EnableIf< typename StaticMatrix<Type,M,N,SO>::BLAZE_TEMPLATE VectorizedAssign<MT> >::Type
2688 {
2689  using blaze::store;
2690 
2691  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2692 
2694 
2695  for( size_t i=0UL; i<M; ++i ) {
2696  for( size_t j=0UL; j<N; j+=IT::size ) {
2697  store( &v_[i*NN+j], (~rhs).load(i,j) );
2698  }
2699  }
2700 }
2701 //*************************************************************************************************
2702 
2703 
2704 //*************************************************************************************************
2715 template< typename Type // Data type of the matrix
2716  , size_t M // Number of rows
2717  , size_t N // Number of columns
2718  , bool SO > // Storage order
2719 template< typename MT > // Type of the right-hand side sparse matrix
2721 {
2722  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2723 
2724  typedef typename MT::ConstIterator RhsConstIterator;
2725 
2726  for( size_t i=0UL; i<M; ++i )
2727  for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2728  v_[i*NN+element->index()] = element->value();
2729 }
2730 //*************************************************************************************************
2731 
2732 
2733 //*************************************************************************************************
2744 template< typename Type // Data type of the matrix
2745  , size_t M // Number of rows
2746  , size_t N // Number of columns
2747  , bool SO > // Storage order
2748 template< typename MT > // Type of the right-hand side sparse matrix
2750 {
2752 
2753  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2754 
2755  typedef typename MT::ConstIterator RhsConstIterator;
2756 
2757  for( size_t j=0UL; j<N; ++j )
2758  for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2759  v_[element->index()*NN+j] = element->value();
2760 }
2761 //*************************************************************************************************
2762 
2763 
2764 //*************************************************************************************************
2775 template< typename Type // Data type of the matrix
2776  , size_t M // Number of rows
2777  , size_t N // Number of columns
2778  , bool SO > // Storage order
2779 template< typename MT // Type of the right-hand side dense matrix
2780  , bool SO2 > // Storage order of the right-hand side dense matrix
2781 inline typename DisableIf< typename StaticMatrix<Type,M,N,SO>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >::Type
2783 {
2784  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2785 
2786  for( size_t i=0UL; i<M; ++i ) {
2787  for( size_t j=0UL; j<N; ++j ) {
2788  v_[i*NN+j] += (~rhs)(i,j);
2789  }
2790  }
2791 }
2792 //*************************************************************************************************
2793 
2794 
2795 //*************************************************************************************************
2806 template< typename Type // Data type of the matrix
2807  , size_t M // Number of rows
2808  , size_t N // Number of columns
2809  , bool SO > // Storage order
2810 template< typename MT // Type of the right-hand side dense matrix
2811  , bool SO2 > // Storage order of the right-hand side dense matrix
2812 inline typename EnableIf< typename StaticMatrix<Type,M,N,SO>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >::Type
2814 {
2815  using blaze::load;
2816  using blaze::store;
2817 
2818  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2819 
2821 
2822  for( size_t i=0UL; i<M; ++i ) {
2823  for( size_t j=0UL; j<N; j+=IT::size ) {
2824  store( &v_[i*NN+j], load( &v_[i*NN+j] ) + (~rhs).load(i,j) );
2825  }
2826  }
2827 }
2828 //*************************************************************************************************
2829 
2830 
2831 //*************************************************************************************************
2842 template< typename Type // Data type of the matrix
2843  , size_t M // Number of rows
2844  , size_t N // Number of columns
2845  , bool SO > // Storage order
2846 template< typename MT > // Type of the right-hand side sparse matrix
2848 {
2849  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2850 
2851  typedef typename MT::ConstIterator RhsConstIterator;
2852 
2853  for( size_t i=0UL; i<M; ++i )
2854  for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2855  v_[i*NN+element->index()] += element->value();
2856 }
2857 //*************************************************************************************************
2858 
2859 
2860 //*************************************************************************************************
2871 template< typename Type // Data type of the matrix
2872  , size_t M // Number of rows
2873  , size_t N // Number of columns
2874  , bool SO > // Storage order
2875 template< typename MT > // Type of the right-hand side sparse matrix
2877 {
2879 
2880  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2881 
2882  typedef typename MT::ConstIterator RhsConstIterator;
2883 
2884  for( size_t j=0UL; j<N; ++j )
2885  for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2886  v_[element->index()*NN+j] += element->value();
2887 }
2888 //*************************************************************************************************
2889 
2890 
2891 //*************************************************************************************************
2902 template< typename Type // Data type of the matrix
2903  , size_t M // Number of rows
2904  , size_t N // Number of columns
2905  , bool SO > // Storage order
2906 template< typename MT // Type of the right-hand side dense matrix
2907  , bool SO2 > // Storage order of the right-hand side dense matrix
2908 inline typename DisableIf< typename StaticMatrix<Type,M,N,SO>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >::Type
2910 {
2911  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2912 
2913  for( size_t i=0UL; i<M; ++i ) {
2914  for( size_t j=0UL; j<N; ++j ) {
2915  v_[i*NN+j] -= (~rhs)(i,j);
2916  }
2917  }
2918 }
2919 //*************************************************************************************************
2920 
2921 
2922 //*************************************************************************************************
2933 template< typename Type // Data type of the matrix
2934  , size_t M // Number of rows
2935  , size_t N // Number of columns
2936  , bool SO > // Storage order
2937 template< typename MT // Type of the right-hand side dense matrix
2938  , bool SO2 > // Storage order of the right-hand side dense matrix
2939 inline typename EnableIf< typename StaticMatrix<Type,M,N,SO>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >::Type
2941 {
2942  using blaze::load;
2943  using blaze::store;
2944 
2945  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2946 
2948 
2949  for( size_t i=0UL; i<M; ++i ) {
2950  for( size_t j=0UL; j<N; j+=IT::size ) {
2951  store( &v_[i*NN+j], load( &v_[i*NN+j] ) - (~rhs).load(i,j) );
2952  }
2953  }
2954 }
2955 //*************************************************************************************************
2956 
2957 
2958 //*************************************************************************************************
2969 template< typename Type // Data type of the matrix
2970  , size_t M // Number of rows
2971  , size_t N // Number of columns
2972  , bool SO > // Storage order
2973 template< typename MT > // Type of the right-hand side sparse matrix
2975 {
2976  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
2977 
2978  typedef typename MT::ConstIterator RhsConstIterator;
2979 
2980  for( size_t i=0UL; i<M; ++i )
2981  for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2982  v_[i*NN+element->index()] -= element->value();
2983 }
2984 //*************************************************************************************************
2985 
2986 
2987 //*************************************************************************************************
2998 template< typename Type // Data type of the matrix
2999  , size_t M // Number of rows
3000  , size_t N // Number of columns
3001  , bool SO > // Storage order
3002 template< typename MT > // Type of the right-hand side sparse matrix
3004 {
3006 
3007  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
3008 
3009  typedef typename MT::ConstIterator RhsConstIterator;
3010 
3011  for( size_t j=0UL; j<N; ++j )
3012  for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
3013  v_[element->index()*NN+j] -= element->value();
3014 }
3015 //*************************************************************************************************
3016 
3017 
3018 
3019 
3020 
3021 
3022 
3023 
3024 //=================================================================================================
3025 //
3026 // CLASS TEMPLATE SPECIALIZATION FOR COLUMN-MAJOR MATRICES
3027 //
3028 //=================================================================================================
3029 
3030 //*************************************************************************************************
3038 template< typename Type // Data type of the matrix
3039  , size_t M // Number of rows
3040  , size_t N > // Number of columns
3041 class StaticMatrix<Type,M,N,true> : public DenseMatrix< StaticMatrix<Type,M,N,true>, true >
3042 {
3043  private:
3044  //**Type definitions****************************************************************************
3045  typedef IntrinsicTrait<Type> IT;
3046  //**********************************************************************************************
3047 
3048  //**********************************************************************************************
3050  static const size_t MM = M + ( IT::size - ( M % IT::size ) ) % IT::size;
3051  //**********************************************************************************************
3052 
3053  public:
3054  //**Type definitions****************************************************************************
3056  typedef This ResultType;
3059  typedef Type ElementType;
3060  typedef typename IT::Type IntrinsicType;
3061  typedef const Type& ReturnType;
3062  typedef const This& CompositeType;
3063  typedef Type& Reference;
3064  typedef const Type& ConstReference;
3065  typedef Type* Pointer;
3066  typedef const Type* ConstPointer;
3067  typedef DenseIterator<Type> Iterator;
3069  //**********************************************************************************************
3070 
3071  //**Rebind struct definition********************************************************************
3074  template< typename ET > // Data type of the other matrix
3075  struct Rebind {
3077  };
3078  //**********************************************************************************************
3079 
3080  //**Compilation flags***************************************************************************
3082 
3086  enum { vectorizable = IsVectorizable<Type>::value };
3087 
3089 
3092  enum { smpAssignable = 0 };
3093  //**********************************************************************************************
3094 
3095  //**Constructors********************************************************************************
3098  explicit inline StaticMatrix();
3099  explicit inline StaticMatrix( const Type& init );
3100 
3101  template< typename Other > explicit inline StaticMatrix( size_t m, size_t n, const Other* array );
3102  template< typename Other > explicit inline StaticMatrix( const Other (&array)[M][N] );
3103 
3104  inline StaticMatrix( const StaticMatrix& m );
3105  template< typename Other, bool SO > inline StaticMatrix( const StaticMatrix<Other,M,N,SO>& m );
3106  template< typename MT , bool SO > inline StaticMatrix( const Matrix<MT,SO>& m );
3107 
3108  inline StaticMatrix( const Type& v1, const Type& v2 );
3109  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3 );
3110  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3, const Type& v4 );
3111  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3, const Type& v4, const Type& v5 );
3112  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3, const Type& v4, const Type& v5,
3113  const Type& v6 );
3114  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3, const Type& v4, const Type& v5,
3115  const Type& v6, const Type& v7 );
3116  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3, const Type& v4, const Type& v5,
3117  const Type& v6, const Type& v7, const Type& v8 );
3118  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3, const Type& v4, const Type& v5,
3119  const Type& v6, const Type& v7, const Type& v8, const Type& v9 );
3120  inline StaticMatrix( const Type& v1, const Type& v2, const Type& v3, const Type& v4, const Type& v5,
3121  const Type& v6, const Type& v7, const Type& v8, const Type& v9, const Type& v10 );
3123  //**********************************************************************************************
3124 
3125  //**Destructor**********************************************************************************
3126  // No explicitly declared destructor.
3127  //**********************************************************************************************
3128 
3129  //**Data access functions***********************************************************************
3132  inline Reference operator()( size_t i, size_t j );
3133  inline ConstReference operator()( size_t i, size_t j ) const;
3134  inline Pointer data ();
3135  inline ConstPointer data () const;
3136  inline Pointer data ( size_t j );
3137  inline ConstPointer data ( size_t j ) const;
3138  inline Iterator begin ( size_t j );
3139  inline ConstIterator begin ( size_t j ) const;
3140  inline ConstIterator cbegin( size_t j ) const;
3141  inline Iterator end ( size_t j );
3142  inline ConstIterator end ( size_t j ) const;
3143  inline ConstIterator cend ( size_t j ) const;
3145  //**********************************************************************************************
3146 
3147  //**Assignment operators************************************************************************
3150  template< typename Other >
3151  inline StaticMatrix& operator=( const Other (&array)[M][N] );
3152 
3153  inline StaticMatrix& operator= ( const Type& set );
3154  inline StaticMatrix& operator= ( const StaticMatrix& rhs );
3155  template< typename Other, bool SO > inline StaticMatrix& operator= ( const StaticMatrix<Other,M,N,SO>& rhs );
3156  template< typename MT , bool SO > inline StaticMatrix& operator= ( const Matrix<MT,SO>& rhs );
3157  template< typename MT , bool SO > inline StaticMatrix& operator+=( const Matrix<MT,SO>& rhs );
3158  template< typename MT , bool SO > inline StaticMatrix& operator-=( const Matrix<MT,SO>& rhs );
3159  template< typename MT , bool SO > inline StaticMatrix& operator*=( const Matrix<MT,SO>& rhs );
3160 
3161  template< typename Other >
3162  inline typename EnableIf< IsNumeric<Other>, StaticMatrix >::Type&
3163  operator*=( Other rhs );
3164 
3165  template< typename Other >
3166  inline typename EnableIf< IsNumeric<Other>, StaticMatrix >::Type&
3167  operator/=( Other rhs );
3169  //**********************************************************************************************
3170 
3171  //**Utility functions***************************************************************************
3174  inline size_t rows() const;
3175  inline size_t columns() const;
3176  inline size_t spacing() const;
3177  inline size_t capacity() const;
3178  inline size_t capacity( size_t j ) const;
3179  inline size_t nonZeros() const;
3180  inline size_t nonZeros( size_t j ) const;
3181  inline void reset();
3182  inline void reset( size_t i );
3183  inline StaticMatrix& transpose();
3184  template< typename Other > inline StaticMatrix& scale( const Other& scalar );
3185  inline void swap( StaticMatrix& m ) /* throw() */;
3187  //**********************************************************************************************
3188 
3189  //**Memory functions****************************************************************************
3192  static inline void* operator new ( std::size_t size );
3193  static inline void* operator new[]( std::size_t size );
3194  static inline void* operator new ( std::size_t size, const std::nothrow_t& );
3195  static inline void* operator new[]( std::size_t size, const std::nothrow_t& );
3196 
3197  static inline void operator delete ( void* ptr );
3198  static inline void operator delete[]( void* ptr );
3199  static inline void operator delete ( void* ptr, const std::nothrow_t& );
3200  static inline void operator delete[]( void* ptr, const std::nothrow_t& );
3202  //**********************************************************************************************
3203 
3204  private:
3205  //**********************************************************************************************
3207  template< typename MT >
3208  struct VectorizedAssign {
3209  enum { value = vectorizable && MT::vectorizable &&
3210  IsSame<Type,typename MT::ElementType>::value &&
3211  IsColumnMajorMatrix<MT>::value };
3212  };
3213  //**********************************************************************************************
3214 
3215  //**********************************************************************************************
3217  template< typename MT >
3218  struct VectorizedAddAssign {
3219  enum { value = vectorizable && MT::vectorizable &&
3220  IsSame<Type,typename MT::ElementType>::value &&
3221  IntrinsicTrait<Type>::addition &&
3222  IsColumnMajorMatrix<MT>::value };
3223  };
3224  //**********************************************************************************************
3225 
3226  //**********************************************************************************************
3228  template< typename MT >
3229  struct VectorizedSubAssign {
3230  enum { value = vectorizable && MT::vectorizable &&
3231  IsSame<Type,typename MT::ElementType>::value &&
3232  IntrinsicTrait<Type>::subtraction &&
3233  IsColumnMajorMatrix<MT>::value };
3234  };
3235  //**********************************************************************************************
3236 
3237  public:
3238  //**Expression template evaluation functions****************************************************
3241  template< typename Other > inline bool canAlias ( const Other* alias ) const;
3242  template< typename Other > inline bool isAliased( const Other* alias ) const;
3243 
3244  inline bool isAligned() const;
3245 
3246  inline IntrinsicType load ( size_t i, size_t j ) const;
3247  inline IntrinsicType loadu ( size_t i, size_t j ) const;
3248  inline void store ( size_t i, size_t j, const IntrinsicType& value );
3249  inline void storeu( size_t i, size_t j, const IntrinsicType& value );
3250  inline void stream( size_t i, size_t j, const IntrinsicType& value );
3251 
3252  template< typename MT, bool SO >
3253  inline typename DisableIf< VectorizedAssign<MT> >::Type
3254  assign( const DenseMatrix<MT,SO>& rhs );
3255 
3256  template< typename MT, bool SO >
3257  inline typename EnableIf< VectorizedAssign<MT> >::Type
3258  assign( const DenseMatrix<MT,SO>& rhs );
3259 
3260  template< typename MT > inline void assign( const SparseMatrix<MT,true>& rhs );
3261  template< typename MT > inline void assign( const SparseMatrix<MT,false>& rhs );
3262 
3263  template< typename MT, bool SO >
3264  inline typename DisableIf< VectorizedAddAssign<MT> >::Type
3265  addAssign( const DenseMatrix<MT,SO>& rhs );
3266 
3267  template< typename MT, bool SO >
3268  inline typename EnableIf< VectorizedAddAssign<MT> >::Type
3269  addAssign( const DenseMatrix<MT,SO>& rhs );
3270 
3271  template< typename MT > inline void addAssign( const SparseMatrix<MT,true>& rhs );
3272  template< typename MT > inline void addAssign( const SparseMatrix<MT,false>& rhs );
3273 
3274  template< typename MT, bool SO >
3275  inline typename DisableIf< VectorizedSubAssign<MT> >::Type
3276  subAssign( const DenseMatrix<MT,SO>& rhs );
3277 
3278  template< typename MT, bool SO >
3279  inline typename EnableIf< VectorizedSubAssign<MT> >::Type
3280  subAssign( const DenseMatrix<MT,SO>& rhs );
3281 
3282  template< typename MT > inline void subAssign( const SparseMatrix<MT,true>& rhs );
3283  template< typename MT > inline void subAssign( const SparseMatrix<MT,false>& rhs );
3285  //**********************************************************************************************
3286 
3287  private:
3288  //**Member variables****************************************************************************
3291  AlignedArray<Type,MM*N> v_;
3292 
3295  //**********************************************************************************************
3296 
3297  //**Compile time checks*************************************************************************
3302  BLAZE_STATIC_ASSERT( MM % IT::size == 0UL );
3303  BLAZE_STATIC_ASSERT( MM >= M );
3304  //**********************************************************************************************
3305 };
3307 //*************************************************************************************************
3308 
3309 
3310 
3311 
3312 //=================================================================================================
3313 //
3314 // CONSTRUCTORS
3315 //
3316 //=================================================================================================
3317 
3318 //*************************************************************************************************
3324 template< typename Type // Data type of the matrix
3325  , size_t M // Number of rows
3326  , size_t N > // Number of columns
3328  : v_() // The statically allocated matrix elements
3329 {
3330  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
3331 
3332  if( IsNumeric<Type>::value ) {
3333  for( size_t i=0UL; i<MM*N; ++i )
3334  v_[i] = Type();
3335  }
3336 }
3338 //*************************************************************************************************
3339 
3340 
3341 //*************************************************************************************************
3347 template< typename Type // Data type of the matrix
3348  , size_t M // Number of rows
3349  , size_t N > // Number of columns
3350 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const Type& init )
3351  : v_() // The statically allocated matrix elements
3352 {
3353  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
3354 
3355  for( size_t j=0UL; j<N; ++j ) {
3356  for( size_t i=0UL; i<M; ++i )
3357  v_[i+j*MM] = init;
3358 
3359  for( size_t i=M; i<MM; ++i )
3360  v_[i+j*MM] = Type();
3361  }
3362 }
3364 //*************************************************************************************************
3365 
3366 
3367 //*************************************************************************************************
3394 template< typename Type // Data type of the matrix
3395  , size_t M // Number of rows
3396  , size_t N > // Number of columns
3397 template< typename Other > // Data type of the initialization array
3398 inline StaticMatrix<Type,M,N,true>::StaticMatrix( size_t m, size_t n, const Other* array )
3399  : v_() // The statically allocated matrix elements
3400 {
3401  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
3402 
3403  if( m > M || n > N )
3404  throw std::invalid_argument( "Invalid setup of static matrix" );
3405 
3406  for( size_t j=0UL; j<n; ++j ) {
3407  for( size_t i=0UL; i<m; ++i )
3408  v_[i+j*MM] = array[i+j*m];
3409 
3410  if( IsNumeric<Type>::value ) {
3411  for( size_t i=m; i<MM; ++i )
3412  v_[i+j*MM] = Type();
3413  }
3414  }
3415 
3416  if( IsNumeric<Type>::value ) {
3417  for( size_t j=n; j<N; ++j ) {
3418  for( size_t i=0UL; i<M; ++i )
3419  v_[i+j*MM] = Type();
3420  }
3421  }
3422 }
3424 //*************************************************************************************************
3425 
3426 
3427 //*************************************************************************************************
3448 template< typename Type // Data type of the matrix
3449  , size_t M // Number of rows
3450  , size_t N > // Number of columns
3451 template< typename Other > // Data type of the initialization array
3452 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const Other (&array)[M][N] )
3453  : v_() // The statically allocated matrix elements
3454 {
3455  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
3456 
3457  for( size_t j=0UL; j<N; ++j ) {
3458  for( size_t i=0UL; i<M; ++i )
3459  v_[i+j*MM] = array[i][j];
3460 
3461  for( size_t i=M; i<MM; ++i )
3462  v_[i+j*MM] = Type();
3463  }
3464 }
3466 //*************************************************************************************************
3467 
3468 
3469 //*************************************************************************************************
3477 template< typename Type // Data type of the matrix
3478  , size_t M // Number of rows
3479  , size_t N > // Number of columns
3480 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const StaticMatrix& m )
3481  : v_() // The statically allocated matrix elements
3482 {
3483  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
3484 
3485  for( size_t i=0UL; i<MM*N; ++i )
3486  v_[i] = m.v_[i];
3487 }
3489 //*************************************************************************************************
3490 
3491 
3492 //*************************************************************************************************
3498 template< typename Type // Data type of the matrix
3499  , size_t M // Number of rows
3500  , size_t N > // Number of columns
3501 template< typename Other // Data type of the foreign matrix
3502  , bool SO > // Storage order of the foreign matrix
3503 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const StaticMatrix<Other,M,N,SO>& m )
3504  : v_() // The statically allocated matrix elements
3505 {
3506  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
3507 
3508  for( size_t j=0UL; j<N; ++j ) {
3509  for( size_t i=0UL; i<M; ++i )
3510  v_[i+j*MM] = m(i,j);
3511 
3512  for( size_t i=M; i<MM; ++i )
3513  v_[i+j*MM] = Type();
3514  }
3515 }
3517 //*************************************************************************************************
3518 
3519 
3520 //*************************************************************************************************
3531 template< typename Type // Data type of the matrix
3532  , size_t M // Number of rows
3533  , size_t N > // Number of columns
3534 template< typename MT // Type of the foreign matrix
3535  , bool SO > // Storage order of the foreign matrix
3536 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const Matrix<MT,SO>& m )
3537  : v_() // The statically allocated matrix elements
3538 {
3539  using blaze::assign;
3540 
3541  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
3542 
3543  if( (~m).rows() != M || (~m).columns() != N )
3544  throw std::invalid_argument( "Invalid setup of static matrix" );
3545 
3546  for( size_t j=0UL; j<N; ++j ) {
3547  for( size_t i=( IsSparseMatrix<MT>::value ? 0UL : M ); i<MM; ++i ) {
3548  v_[i+j*MM] = Type();
3549  }
3550  }
3551 
3552  assign( *this, ~m );
3553 }
3555 //*************************************************************************************************
3556 
3557 
3558 //*************************************************************************************************
3576 template< typename Type // Data type of the matrix
3577  , size_t M // Number of rows
3578  , size_t N > // Number of columns
3579 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const Type& v1, const Type& v2 )
3580  : v_() // The statically allocated matrix elements
3581 {
3582  BLAZE_STATIC_ASSERT( M*N == 2UL );
3583  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
3584 
3585  // Initialization of a 2x1 matrix
3586  if( N == 1UL ) {
3587  v_[0UL] = v1;
3588  v_[1UL] = v2;
3589  }
3590 
3591  // Initialization of a 1x2 matrix
3592  else {
3593  v_[0UL] = v1;
3594  v_[ MM] = v2;
3595  }
3596 
3597  for( size_t j=0UL; j<N; ++j )
3598  for( size_t i=M; i<MM; ++i ) {
3599  v_[i+j*MM] = Type();
3600  }
3601 }
3603 //*************************************************************************************************
3604 
3605 
3606 //*************************************************************************************************
3625 template< typename Type // Data type of the matrix
3626  , size_t M // Number of rows
3627  , size_t N > // Number of columns
3628 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const Type& v1, const Type& v2, const Type& v3 )
3629  : v_() // The statically allocated matrix elements
3630 {
3631  BLAZE_STATIC_ASSERT( M*N == 3UL );
3632  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
3633 
3634  // Initialization of a 3x1 matrix
3635  if( N == 1UL ) {
3636  v_[0UL] = v1;
3637  v_[1UL] = v2;
3638  v_[2UL] = v3;
3639  }
3640 
3641  // Initialization of a 1x3 matrix
3642  else {
3643  v_[ 0UL] = v1;
3644  v_[ MM] = v2;
3645  v_[2UL*MM] = v3;
3646  }
3647 
3648  for( size_t j=0UL; j<N; ++j )
3649  for( size_t i=M; i<MM; ++i ) {
3650  v_[i+j*MM] = Type();
3651  }
3652 }
3654 //*************************************************************************************************
3655 
3656 
3657 //*************************************************************************************************
3679 template< typename Type // Data type of the matrix
3680  , size_t M // Number of rows
3681  , size_t N > // Number of columns
3682 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const Type& v1, const Type& v2, const Type& v3,
3683  const Type& v4 )
3684  : v_() // The statically allocated matrix elements
3685 {
3686  BLAZE_STATIC_ASSERT( M*N == 4UL );
3687  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
3688 
3689  // Initialization of a 4x1 matrix
3690  if( N == 1UL ) {
3691  v_[0UL] = v1;
3692  v_[1UL] = v2;
3693  v_[2UL] = v3;
3694  v_[3UL] = v4;
3695  }
3696 
3697  // Initialization of a 2x2 matrix
3698  else if( N == 2UL ) {
3699  v_[ 0UL] = v1;
3700  v_[ 1UL] = v2;
3701  v_[MM ] = v3;
3702  v_[MM+1UL] = v4;
3703  }
3704 
3705  // Initialization of a 1x4 matrix
3706  else {
3707  v_[ 0UL] = v1;
3708  v_[ MM] = v2;
3709  v_[2UL*MM] = v3;
3710  v_[3UL*MM] = v4;
3711  }
3712 
3713  for( size_t j=0UL; j<N; ++j )
3714  for( size_t i=M; i<MM; ++i ) {
3715  v_[i+j*MM] = Type();
3716  }
3717 }
3719 //*************************************************************************************************
3720 
3721 
3722 //*************************************************************************************************
3743 template< typename Type // Data type of the matrix
3744  , size_t M // Number of rows
3745  , size_t N > // Number of columns
3746 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const Type& v1, const Type& v2, const Type& v3,
3747  const Type& v4, const Type& v5 )
3748  : v_() // The statically allocated matrix elements
3749 {
3750  BLAZE_STATIC_ASSERT( M*N == 5UL );
3751  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
3752 
3753  // Initialization of a 5x1 matrix
3754  if( N == 1UL ) {
3755  v_[0UL] = v1;
3756  v_[1UL] = v2;
3757  v_[2UL] = v3;
3758  v_[3UL] = v4;
3759  v_[4UL] = v5;
3760  }
3761 
3762  // Initialization of a 1x5 matrix
3763  else {
3764  v_[ 0UL] = v1;
3765  v_[ MM] = v2;
3766  v_[2UL*MM] = v3;
3767  v_[3UL*MM] = v4;
3768  v_[4UL*MM] = v5;
3769  }
3770 
3771  for( size_t j=0UL; j<N; ++j )
3772  for( size_t i=M; i<MM; ++i ) {
3773  v_[i+j*MM] = Type();
3774  }
3775 }
3777 //*************************************************************************************************
3778 
3779 
3780 //*************************************************************************************************
3805 template< typename Type // Data type of the matrix
3806  , size_t M // Number of rows
3807  , size_t N > // Number of columns
3808 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const Type& v1, const Type& v2, const Type& v3,
3809  const Type& v4, const Type& v5, const Type& v6 )
3810  : v_() // The statically allocated matrix elements
3811 {
3812  BLAZE_STATIC_ASSERT( M*N == 6UL );
3813  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
3814 
3815  // Initialization of a 6x1 matrix
3816  if( N == 1UL ) {
3817  v_[0UL] = v1;
3818  v_[1UL] = v2;
3819  v_[2UL] = v3;
3820  v_[3UL] = v4;
3821  v_[4UL] = v5;
3822  v_[5UL] = v6;
3823  }
3824 
3825  // Initialization of a 3x2 matrix
3826  else if( N == 2UL ) {
3827  v_[ 0UL] = v1;
3828  v_[ 1UL] = v2;
3829  v_[ 2UL] = v3;
3830  v_[MM ] = v4;
3831  v_[MM+1UL] = v5;
3832  v_[MM+2UL] = v6;
3833  }
3834 
3835  // Initialization of a 2x3 matrix
3836  else if( N == 3UL ) {
3837  v_[ 0UL] = v1;
3838  v_[ 1UL] = v2;
3839  v_[ MM ] = v3;
3840  v_[ MM+1UL] = v4;
3841  v_[2UL*MM ] = v5;
3842  v_[2UL*MM+1UL] = v6;
3843  }
3844 
3845  // Initialization of a 1x6 matrix
3846  else {
3847  v_[ 0UL] = v1;
3848  v_[ MM] = v2;
3849  v_[2UL*MM] = v3;
3850  v_[3UL*MM] = v4;
3851  v_[4UL*MM] = v5;
3852  v_[5UL*MM] = v6;
3853  }
3854 
3855  for( size_t j=0UL; j<N; ++j )
3856  for( size_t i=M; i<MM; ++i ) {
3857  v_[i+j*MM] = Type();
3858  }
3859 }
3861 //*************************************************************************************************
3862 
3863 
3864 //*************************************************************************************************
3887 template< typename Type // Data type of the matrix
3888  , size_t M // Number of rows
3889  , size_t N > // Number of columns
3890 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const Type& v1, const Type& v2, const Type& v3,
3891  const Type& v4, const Type& v5, const Type& v6,
3892  const Type& v7 )
3893  : v_() // The statically allocated matrix elements
3894 {
3895  BLAZE_STATIC_ASSERT( M*N == 7UL );
3896  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
3897 
3898  // Initialization of a 7x1 matrix
3899  if( N == 1UL ) {
3900  v_[0UL] = v1;
3901  v_[1UL] = v2;
3902  v_[2UL] = v3;
3903  v_[3UL] = v4;
3904  v_[4UL] = v5;
3905  v_[5UL] = v6;
3906  v_[6UL] = v7;
3907  }
3908 
3909  // Initialization of a 1x7 matrix
3910  else {
3911  v_[ 0UL] = v1;
3912  v_[ MM] = v2;
3913  v_[2UL*MM] = v3;
3914  v_[3UL*MM] = v4;
3915  v_[4UL*MM] = v5;
3916  v_[5UL*MM] = v6;
3917  v_[6UL*MM] = v7;
3918  }
3919 
3920  for( size_t j=0UL; j<N; ++j )
3921  for( size_t i=M; i<MM; ++i ) {
3922  v_[i+j*MM] = Type();
3923  }
3924 }
3926 //*************************************************************************************************
3927 
3928 
3929 //*************************************************************************************************
3956 template< typename Type // Data type of the matrix
3957  , size_t M // Number of rows
3958  , size_t N > // Number of columns
3959 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const Type& v1, const Type& v2, const Type& v3,
3960  const Type& v4, const Type& v5, const Type& v6,
3961  const Type& v7, const Type& v8 )
3962  : v_() // The statically allocated matrix elements
3963 {
3964  BLAZE_STATIC_ASSERT( M*N == 8UL );
3965  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
3966 
3967  // Initialization of a 8x1 matrix
3968  if( N == 1UL ) {
3969  v_[0UL] = v1;
3970  v_[1UL] = v2;
3971  v_[2UL] = v3;
3972  v_[3UL] = v4;
3973  v_[4UL] = v5;
3974  v_[5UL] = v6;
3975  v_[6UL] = v7;
3976  v_[7UL] = v8;
3977  }
3978 
3979  // Initialization of a 4x2 matrix
3980  else if( N == 2UL ) {
3981  v_[ 0UL] = v1;
3982  v_[ 1UL] = v2;
3983  v_[ 2UL] = v3;
3984  v_[ 3UL] = v4;
3985  v_[MM ] = v5;
3986  v_[MM+1UL] = v6;
3987  v_[MM+2UL] = v7;
3988  v_[MM+3UL] = v8;
3989  }
3990 
3991  // Initialization of a 2x4 matrix
3992  else if( N == 4UL ) {
3993  v_[ 0UL] = v1;
3994  v_[ 1UL] = v2;
3995  v_[ MM ] = v3;
3996  v_[ MM+1UL] = v4;
3997  v_[2UL*MM ] = v5;
3998  v_[2UL*MM+1UL] = v6;
3999  v_[3UL*MM ] = v7;
4000  v_[3UL*MM+1UL] = v8;
4001  }
4002 
4003  // Initialization of a 1x8 matrix
4004  else {
4005  v_[ 0UL] = v1;
4006  v_[ MM] = v2;
4007  v_[2UL*MM] = v3;
4008  v_[3UL*MM] = v4;
4009  v_[4UL*MM] = v5;
4010  v_[5UL*MM] = v6;
4011  v_[6UL*MM] = v7;
4012  v_[7UL*MM] = v8;
4013  }
4014 
4015  for( size_t j=0UL; j<N; ++j )
4016  for( size_t i=M; i<MM; ++i ) {
4017  v_[i+j*MM] = Type();
4018  }
4019 }
4021 //*************************************************************************************************
4022 
4023 
4024 //*************************************************************************************************
4052 template< typename Type // Data type of the matrix
4053  , size_t M // Number of rows
4054  , size_t N > // Number of columns
4055 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const Type& v1, const Type& v2, const Type& v3,
4056  const Type& v4, const Type& v5, const Type& v6,
4057  const Type& v7, const Type& v8, const Type& v9 )
4058  : v_() // The statically allocated matrix elements
4059 {
4060  BLAZE_STATIC_ASSERT( M*N == 9UL );
4061  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
4062 
4063  // Initialization of a 9x1 matrix
4064  if( N == 1 ) {
4065  v_[0UL] = v1;
4066  v_[1UL] = v2;
4067  v_[2UL] = v3;
4068  v_[3UL] = v4;
4069  v_[4UL] = v5;
4070  v_[5UL] = v6;
4071  v_[6UL] = v7;
4072  v_[7UL] = v8;
4073  v_[8UL] = v9;
4074  }
4075 
4076  // Initialization of a 3x3 matrix
4077  else if( N == 3UL ) {
4078  v_[ 0UL] = v1;
4079  v_[ 1UL] = v2;
4080  v_[ 2UL] = v3;
4081  v_[ MM ] = v4;
4082  v_[ MM+1UL] = v5;
4083  v_[ MM+2UL] = v6;
4084  v_[2UL*MM ] = v7;
4085  v_[2UL*MM+1UL] = v8;
4086  v_[2UL*MM+2UL] = v9;
4087  }
4088 
4089  // Initialization of a 1x9 matrix
4090  else {
4091  v_[ 0UL] = v1;
4092  v_[ MM] = v2;
4093  v_[2UL*MM] = v3;
4094  v_[3UL*MM] = v4;
4095  v_[4UL*MM] = v5;
4096  v_[5UL*MM] = v6;
4097  v_[6UL*MM] = v7;
4098  v_[7UL*MM] = v8;
4099  v_[8UL*MM] = v9;
4100  }
4101 
4102  for( size_t j=0UL; j<N; ++j )
4103  for( size_t i=M; i<MM; ++i ) {
4104  v_[i+j*MM] = Type();
4105  }
4106 }
4108 //*************************************************************************************************
4109 
4110 
4111 //*************************************************************************************************
4140 template< typename Type // Data type of the matrix
4141  , size_t M // Number of rows
4142  , size_t N > // Number of columns
4143 inline StaticMatrix<Type,M,N,true>::StaticMatrix( const Type& v1, const Type& v2, const Type& v3,
4144  const Type& v4, const Type& v5, const Type& v6,
4145  const Type& v7, const Type& v8, const Type& v9,
4146  const Type& v10 )
4147  : v_() // The statically allocated matrix elements
4148 {
4149  BLAZE_STATIC_ASSERT( M*N == 10UL );
4150  BLAZE_STATIC_ASSERT( IsVectorizable<Type>::value || MM == M );
4151 
4152  // Initialization of a 10x1 matrix
4153  if( N == 1UL ) {
4154  v_[0UL] = v1;
4155  v_[1UL] = v2;
4156  v_[2UL] = v3;
4157  v_[3UL] = v4;
4158  v_[4UL] = v5;
4159  v_[5UL] = v6;
4160  v_[6UL] = v7;
4161  v_[7UL] = v8;
4162  v_[8UL] = v9;
4163  v_[9UL] = v10;
4164  }
4165 
4166  // Initialization of a 5x2 matrix
4167  else if( N == 2UL ) {
4168  v_[ 0UL] = v1;
4169  v_[ 1UL] = v2;
4170  v_[ 2UL] = v3;
4171  v_[ 3UL] = v4;
4172  v_[ 4UL] = v5;
4173  v_[MM ] = v6;
4174  v_[MM+1UL] = v7;
4175  v_[MM+2UL] = v8;
4176  v_[MM+3UL] = v9;
4177  v_[MM+4UL] = v10;
4178  }
4179 
4180  // Initialization of a 2x5 matrix
4181  else if( N == 5UL ) {
4182  v_[ 0UL] = v1;
4183  v_[ 1UL] = v2;
4184  v_[ MM ] = v3;
4185  v_[ MM+1UL] = v4;
4186  v_[2UL*MM ] = v5;
4187  v_[2UL*MM+1UL] = v6;
4188  v_[3UL*MM ] = v7;
4189  v_[3UL*MM+1UL] = v8;
4190  v_[4UL*MM ] = v9;
4191  v_[4UL*MM+1UL] = v10;
4192  }
4193 
4194  // Initialization of a 1x10 matrix
4195  else {
4196  v_[ 0UL] = v1;
4197  v_[ MM] = v2;
4198  v_[2UL*MM] = v3;
4199  v_[3UL*MM] = v4;
4200  v_[4UL*MM] = v5;
4201  v_[5UL*MM] = v6;
4202  v_[6UL*MM] = v7;
4203  v_[7UL*MM] = v8;
4204  v_[8UL*MM] = v9;
4205  v_[9UL*MM] = v10;
4206  }
4207 
4208  for( size_t j=0UL; j<N; ++j )
4209  for( size_t i=M; i<MM; ++i ) {
4210  v_[i+j*MM] = Type();
4211  }
4212 }
4214 //*************************************************************************************************
4215 
4216 
4217 
4218 
4219 //=================================================================================================
4220 //
4221 // DATA ACCESS FUNCTIONS
4222 //
4223 //=================================================================================================
4224 
4225 //*************************************************************************************************
4233 template< typename Type // Data type of the matrix
4234  , size_t M // Number of rows
4235  , size_t N > // Number of columns
4237  StaticMatrix<Type,M,N,true>::operator()( size_t i, size_t j )
4238 {
4239  BLAZE_USER_ASSERT( i<M, "Invalid row access index" );
4240  BLAZE_USER_ASSERT( j<N, "Invalid column access index" );
4241  return v_[i+j*MM];
4242 }
4244 //*************************************************************************************************
4245 
4246 
4247 //*************************************************************************************************
4255 template< typename Type // Data type of the matrix
4256  , size_t M // Number of rows
4257  , size_t N > // Number of columns
4259  StaticMatrix<Type,M,N,true>::operator()( size_t i, size_t j ) const
4260 {
4261  BLAZE_USER_ASSERT( i<M, "Invalid row access index" );
4262  BLAZE_USER_ASSERT( j<N, "Invalid column access index" );
4263  return v_[i+j*MM];
4264 }
4266 //*************************************************************************************************
4267 
4268 
4269 //*************************************************************************************************
4281 template< typename Type // Data type of the matrix
4282  , size_t M // Number of rows
4283  , size_t N > // Number of columns
4284 inline typename StaticMatrix<Type,M,N,true>::Pointer
4286 {
4287  return v_;
4288 }
4290 //*************************************************************************************************
4291 
4292 
4293 //*************************************************************************************************
4305 template< typename Type // Data type of the matrix
4306  , size_t M // Number of rows
4307  , size_t N > // Number of columns
4308 inline typename StaticMatrix<Type,M,N,true>::ConstPointer
4310 {
4311  return v_;
4312 }
4314 //*************************************************************************************************
4315 
4316 
4317 //*************************************************************************************************
4326 template< typename Type // Data type of the matrix
4327  , size_t M // Number of rows
4328  , size_t N > // Number of columns
4329 inline typename StaticMatrix<Type,M,N,true>::Pointer
4331 {
4332  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4333  return v_ + j*MM;
4334 }
4336 //*************************************************************************************************
4337 
4338 
4339 //*************************************************************************************************
4348 template< typename Type // Data type of the matrix
4349  , size_t M // Number of rows
4350  , size_t N > // Number of columns
4351 inline typename StaticMatrix<Type,M,N,true>::ConstPointer
4352  StaticMatrix<Type,M,N,true>::data( size_t j ) const
4353 {
4354  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4355  return v_ + j*MM;
4356 }
4358 //*************************************************************************************************
4359 
4360 
4361 //*************************************************************************************************
4368 template< typename Type // Data type of the matrix
4369  , size_t M // Number of rows
4370  , size_t N > // Number of columns
4373 {
4374  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4375  return Iterator( v_ + j*MM );
4376 }
4378 //*************************************************************************************************
4379 
4380 
4381 //*************************************************************************************************
4388 template< typename Type // Data type of the matrix
4389  , size_t M // Number of rows
4390  , size_t N > // Number of columns
4392  StaticMatrix<Type,M,N,true>::begin( size_t j ) const
4393 {
4394  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4395  return ConstIterator( v_ + j*MM );
4396 }
4398 //*************************************************************************************************
4399 
4400 
4401 //*************************************************************************************************
4408 template< typename Type // Data type of the matrix
4409  , size_t M // Number of rows
4410  , size_t N > // Number of columns
4412  StaticMatrix<Type,M,N,true>::cbegin( size_t j ) const
4413 {
4414  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4415  return ConstIterator( v_ + j*MM );
4416 }
4418 //*************************************************************************************************
4419 
4420 
4421 //*************************************************************************************************
4428 template< typename Type // Data type of the matrix
4429  , size_t M // Number of rows
4430  , size_t N > // Number of columns
4433 {
4434  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4435  return Iterator( v_ + j*MM + M );
4436 }
4438 //*************************************************************************************************
4439 
4440 
4441 //*************************************************************************************************
4448 template< typename Type // Data type of the matrix
4449  , size_t M // Number of rows
4450  , size_t N > // Number of columns
4452  StaticMatrix<Type,M,N,true>::end( size_t j ) const
4453 {
4454  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4455  return ConstIterator( v_ + j*MM + M );
4456 }
4458 //*************************************************************************************************
4459 
4460 
4461 //*************************************************************************************************
4468 template< typename Type // Data type of the matrix
4469  , size_t M // Number of rows
4470  , size_t N > // Number of columns
4472  StaticMatrix<Type,M,N,true>::cend( size_t j ) const
4473 {
4474  BLAZE_USER_ASSERT( j < N, "Invalid dense matrix column access index" );
4475  return ConstIterator( v_ + j*MM + M );
4476 }
4478 //*************************************************************************************************
4479 
4480 
4481 
4482 
4483 //=================================================================================================
4484 //
4485 // ASSIGNMENT OPERATORS
4486 //
4487 //=================================================================================================
4488 
4489 //*************************************************************************************************
4511 template< typename Type // Data type of the matrix
4512  , size_t M // Number of rows
4513  , size_t N > // Number of columns
4514 template< typename Other > // Data type of the initialization array
4515 inline StaticMatrix<Type,M,N,true>&
4516  StaticMatrix<Type,M,N,true>::operator=( const Other (&array)[M][N] )
4517 {
4518  for( size_t j=0UL; j<N; ++j )
4519  for( size_t i=0UL; i<M; ++i )
4520  v_[i+j*MM] = array[i][j];
4521 
4522  return *this;
4523 }
4525 //*************************************************************************************************
4526 
4527 
4528 //*************************************************************************************************
4535 template< typename Type // Data type of the matrix
4536  , size_t M // Number of rows
4537  , size_t N > // Number of columns
4538 inline StaticMatrix<Type,M,N,true>&
4539  StaticMatrix<Type,M,N,true>::operator=( const Type& set )
4540 {
4541  for( size_t j=0UL; j<N; ++j )
4542  for( size_t i=0UL; i<M; ++i )
4543  v_[i+j*MM] = set;
4544 
4545  return *this;
4546 }
4548 //*************************************************************************************************
4549 
4550 
4551 //*************************************************************************************************
4560 template< typename Type // Data type of the matrix
4561  , size_t M // Number of rows
4562  , size_t N > // Number of columns
4563 inline StaticMatrix<Type,M,N,true>&
4564  StaticMatrix<Type,M,N,true>::operator=( const StaticMatrix& rhs )
4565 {
4566  using blaze::assign;
4567 
4568  assign( *this, ~rhs );
4569  return *this;
4570 }
4572 //*************************************************************************************************
4573 
4574 
4575 //*************************************************************************************************
4582 template< typename Type // Data type of the matrix
4583  , size_t M // Number of rows
4584  , size_t N > // Number of columns
4585 template< typename Other // Data type of the foreign matrix
4586  , bool SO > // Storage order of the foreign matrix
4587 inline StaticMatrix<Type,M,N,true>&
4588  StaticMatrix<Type,M,N,true>::operator=( const StaticMatrix<Other,M,N,SO>& rhs )
4589 {
4590  using blaze::assign;
4591 
4592  assign( *this, ~rhs );
4593  return *this;
4594 }
4596 //*************************************************************************************************
4597 
4598 
4599 //*************************************************************************************************
4611 template< typename Type // Data type of the matrix
4612  , size_t M // Number of rows
4613  , size_t N > // Number of columns
4614 template< typename MT // Type of the right-hand side matrix
4615  , bool SO > // Storage order of the right-hand side matrix
4616 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator=( const Matrix<MT,SO>& rhs )
4617 {
4618  using blaze::assign;
4619 
4620  if( (~rhs).rows() != M || (~rhs).columns() != N )
4621  throw std::invalid_argument( "Invalid assignment to static matrix" );
4622 
4623  if( (~rhs).canAlias( this ) ) {
4624  StaticMatrix tmp( ~rhs );
4625  swap( tmp );
4626  }
4627  else {
4628  if( IsSparseMatrix<MT>::value )
4629  reset();
4630  assign( *this, ~rhs );
4631  }
4632 
4633  return *this;
4634 }
4636 //*************************************************************************************************
4637 
4638 
4639 //*************************************************************************************************
4650 template< typename Type // Data type of the matrix
4651  , size_t M // Number of rows
4652  , size_t N > // Number of columns
4653 template< typename MT // Type of the right-hand side matrix
4654  , bool SO > // Storage order of the right-hand side matrix
4655 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator+=( const Matrix<MT,SO>& rhs )
4656 {
4657  using blaze::addAssign;
4658 
4659  if( (~rhs).rows() != M || (~rhs).columns() != N )
4660  throw std::invalid_argument( "Matrix sizes do not match" );
4661 
4662  if( (~rhs).canAlias( this ) ) {
4663  typename MT::ResultType tmp( ~rhs );
4664  addAssign( *this, tmp );
4665  }
4666  else {
4667  addAssign( *this, ~rhs );
4668  }
4669 
4670  return *this;
4671 }
4673 //*************************************************************************************************
4674 
4675 
4676 //*************************************************************************************************
4687 template< typename Type // Data type of the matrix
4688  , size_t M // Number of rows
4689  , size_t N > // Number of columns
4690 template< typename MT // Type of the right-hand side matrix
4691  , bool SO > // Storage order of the right-hand side matrix
4692 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator-=( const Matrix<MT,SO>& rhs )
4693 {
4694  using blaze::subAssign;
4695 
4696  if( (~rhs).rows() != M || (~rhs).columns() != N )
4697  throw std::invalid_argument( "Matrix sizes do not match" );
4698 
4699  if( (~rhs).canAlias( this ) ) {
4700  typename MT::ResultType tmp( ~rhs );
4701  subAssign( *this, tmp );
4702  }
4703  else {
4704  subAssign( *this, ~rhs );
4705  }
4706 
4707  return *this;
4708 }
4710 //*************************************************************************************************
4711 
4712 
4713 //*************************************************************************************************
4724 template< typename Type // Data type of the matrix
4725  , size_t M // Number of rows
4726  , size_t N > // Number of columns
4727 template< typename MT // Type of the right-hand side matrix
4728  , bool SO > // Storage order of the right-hand side matrix
4729 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator*=( const Matrix<MT,SO>& rhs )
4730 {
4731  if( M != N || (~rhs).rows() != M || (~rhs).columns() != M )
4732  throw std::invalid_argument( "Matrix sizes do not match" );
4733 
4734  StaticMatrix tmp( *this * (~rhs) );
4735  return this->operator=( tmp );
4736 }
4738 //*************************************************************************************************
4739 
4740 
4741 //*************************************************************************************************
4749 template< typename Type // Data type of the matrix
4750  , size_t M // Number of rows
4751  , size_t N > // Number of columns
4752 template< typename Other > // Data type of the right-hand side scalar
4753 inline typename EnableIf< IsNumeric<Other>, StaticMatrix<Type,M,N,true> >::Type&
4754  StaticMatrix<Type,M,N,true>::operator*=( Other rhs )
4755 {
4756  using blaze::assign;
4757 
4758  assign( *this, (*this) * rhs );
4759  return *this;
4760 }
4762 //*************************************************************************************************
4763 
4764 
4765 //*************************************************************************************************
4775 template< typename Type // Data type of the matrix
4776  , size_t M // Number of rows
4777  , size_t N > // Number of columns
4778 template< typename Other > // Data type of the right-hand side scalar
4779 inline typename EnableIf< IsNumeric<Other>, StaticMatrix<Type,M,N,true> >::Type&
4780  StaticMatrix<Type,M,N,true>::operator/=( Other rhs )
4781 {
4782  using blaze::assign;
4783 
4784  BLAZE_USER_ASSERT( rhs != Other(0), "Division by zero detected" );
4785 
4786  assign( *this, (*this) / rhs );
4787  return *this;
4788 }
4790 //*************************************************************************************************
4791 
4792 
4793 
4794 
4795 //=================================================================================================
4796 //
4797 // UTILITY FUNCTIONS
4798 //
4799 //=================================================================================================
4800 
4801 //*************************************************************************************************
4807 template< typename Type // Data type of the matrix
4808  , size_t M // Number of rows
4809  , size_t N > // Number of columns
4810 inline size_t StaticMatrix<Type,M,N,true>::rows() const
4811 {
4812  return M;
4813 }
4815 //*************************************************************************************************
4816 
4817 
4818 //*************************************************************************************************
4824 template< typename Type // Data type of the matrix
4825  , size_t M // Number of rows
4826  , size_t N > // Number of columns
4827 inline size_t StaticMatrix<Type,M,N,true>::columns() const
4828 {
4829  return N;
4830 }
4832 //*************************************************************************************************
4833 
4834 
4835 //*************************************************************************************************
4844 template< typename Type // Data type of the matrix
4845  , size_t M // Number of rows
4846  , size_t N > // Number of columns
4847 inline size_t StaticMatrix<Type,M,N,true>::spacing() const
4848 {
4849  return MM;
4850 }
4852 //*************************************************************************************************
4853 
4854 
4855 //*************************************************************************************************
4861 template< typename Type // Data type of the matrix
4862  , size_t M // Number of rows
4863  , size_t N > // Number of columns
4864 inline size_t StaticMatrix<Type,M,N,true>::capacity() const
4865 {
4866  return MM*N;
4867 }
4869 //*************************************************************************************************
4870 
4871 
4872 //*************************************************************************************************
4879 template< typename Type // Data type of the matrix
4880  , size_t M // Number of rows
4881  , size_t N > // Number of columns
4882 inline size_t StaticMatrix<Type,M,N,true>::capacity( size_t j ) const
4883 {
4884  UNUSED_PARAMETER( j );
4885 
4886  BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
4887 
4888  return MM;
4889 }
4891 //*************************************************************************************************
4892 
4893 
4894 //*************************************************************************************************
4900 template< typename Type // Data type of the matrix
4901  , size_t M // Number of rows
4902  , size_t N > // Number of columns
4903 inline size_t StaticMatrix<Type,M,N,true>::nonZeros() const
4904 {
4905  size_t nonzeros( 0UL );
4906 
4907  for( size_t j=0UL; j<N; ++j )
4908  for( size_t i=0UL; i<M; ++i )
4909  if( !isDefault( v_[i+j*MM] ) )
4910  ++nonzeros;
4911 
4912  return nonzeros;
4913 }
4915 //*************************************************************************************************
4916 
4917 
4918 //*************************************************************************************************
4925 template< typename Type // Data type of the matrix
4926  , size_t M // Number of rows
4927  , size_t N > // Number of columns
4928 inline size_t StaticMatrix<Type,M,N,true>::nonZeros( size_t j ) const
4929 {
4930  BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
4931 
4932  const size_t iend( (j+1UL)*MM );
4933  size_t nonzeros( 0UL );
4934 
4935  for( size_t i=j*MM; i<iend; ++i )
4936  if( !isDefault( v_[i] ) )
4937  ++nonzeros;
4938 
4939  return nonzeros;
4940 }
4942 //*************************************************************************************************
4943 
4944 
4945 //*************************************************************************************************
4951 template< typename Type // Data type of the matrix
4952  , size_t M // Number of rows
4953  , size_t N > // Number of columns
4955 {
4956  using blaze::clear;
4957 
4958  for( size_t j=0UL; j<N; ++j )
4959  for( size_t i=0UL; i<M; ++i )
4960  clear( v_[i+j*MM] );
4961 }
4963 //*************************************************************************************************
4964 
4965 
4966 //*************************************************************************************************
4976 template< typename Type // Data type of the matrix
4977  , size_t M // Number of rows
4978  , size_t N > // Number of columns
4979 inline void StaticMatrix<Type,M,N,true>::reset( size_t j )
4980 {
4981  using blaze::clear;
4982 
4983  BLAZE_USER_ASSERT( j < columns(), "Invalid column access index" );
4984  for( size_t i=0UL; i<M; ++i )
4985  clear( v_[i+j*MM] );
4986 }
4988 //*************************************************************************************************
4989 
4990 
4991 //*************************************************************************************************
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 StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::transpose()
5004 {
5005  using std::swap;
5006 
5007  BLAZE_STATIC_ASSERT( M == N );
5008 
5009  for( size_t j=1UL; j<N; ++j )
5010  for( size_t i=0UL; i<j; ++i )
5011  swap( v_[i+j*MM], v_[j+i*MM] );
5012 
5013  return *this;
5014 }
5016 //*************************************************************************************************
5017 
5018 
5019 //*************************************************************************************************
5026 template< typename Type // Data type of the matrix
5027  , size_t M // Number of rows
5028  , size_t N > // Number of columns
5029 template< typename Other > // Data type of the scalar value
5030 inline StaticMatrix<Type,M,N,true>&
5031  StaticMatrix<Type,M,N,true>::scale( const Other& scalar )
5032 {
5033  for( size_t j=0UL; j<N; ++j )
5034  for( size_t i=0UL; i<M; ++i )
5035  v_[i+j*MM] *= scalar;
5036 
5037  return *this;
5038 }
5040 //*************************************************************************************************
5041 
5042 
5043 //*************************************************************************************************
5051 template< typename Type // Data type of the matrix
5052  , size_t M // Number of rows
5053  , size_t N > // Number of columns
5054 inline void StaticMatrix<Type,M,N,true>::swap( StaticMatrix& m ) /* throw() */
5055 {
5056  using std::swap;
5057 
5058  for( size_t j=0UL; j<N; ++j ) {
5059  for( size_t i=0UL; i<M; ++i ) {
5060  swap( v_[i+j*MM], m(i,j) );
5061  }
5062  }
5063 }
5065 //*************************************************************************************************
5066 
5067 
5068 
5069 
5070 //=================================================================================================
5071 //
5072 // MEMORY FUNCTIONS
5073 //
5074 //=================================================================================================
5075 
5076 //*************************************************************************************************
5087 template< typename Type // Data type of the matrix
5088  , size_t M // Number of rows
5089  , size_t N > // Number of columns
5090 inline void* StaticMatrix<Type,M,N,true>::operator new( std::size_t size )
5091 {
5093 
5094  BLAZE_INTERNAL_ASSERT( size == sizeof( StaticMatrix ), "Invalid number of bytes detected" );
5095 
5096  return allocate<StaticMatrix>( 1UL );
5097 }
5099 //*************************************************************************************************
5100 
5101 
5102 //*************************************************************************************************
5113 template< typename Type // Data type of the matrix
5114  , size_t M // Number of rows
5115  , size_t N > // Number of columns
5116 inline void* StaticMatrix<Type,M,N,true>::operator new[]( std::size_t size )
5117 {
5118  BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticMatrix ) , "Invalid number of bytes detected" );
5119  BLAZE_INTERNAL_ASSERT( size % sizeof( StaticMatrix ) == 0UL, "Invalid number of bytes detected" );
5120 
5121  return allocate<StaticMatrix>( size/sizeof(StaticMatrix) );
5122 }
5124 //*************************************************************************************************
5125 
5126 
5127 //*************************************************************************************************
5138 template< typename Type // Data type of the matrix
5139  , size_t M // Number of rows
5140  , size_t N > // Number of columns
5141 inline void* StaticMatrix<Type,M,N,true>::operator new( std::size_t size, const std::nothrow_t& )
5142 {
5144 
5145  BLAZE_INTERNAL_ASSERT( size == sizeof( StaticMatrix ), "Invalid number of bytes detected" );
5146 
5147  return allocate<StaticMatrix>( 1UL );
5148 }
5150 //*************************************************************************************************
5151 
5152 
5153 //*************************************************************************************************
5164 template< typename Type // Data type of the matrix
5165  , size_t M // Number of rows
5166  , size_t N > // Number of columns
5167 inline void* StaticMatrix<Type,M,N,true>::operator new[]( std::size_t size, const std::nothrow_t& )
5168 {
5169  BLAZE_INTERNAL_ASSERT( size >= sizeof( StaticMatrix ) , "Invalid number of bytes detected" );
5170  BLAZE_INTERNAL_ASSERT( size % sizeof( StaticMatrix ) == 0UL, "Invalid number of bytes detected" );
5171 
5172  return allocate<StaticMatrix>( size/sizeof(StaticMatrix) );
5173 }
5175 //*************************************************************************************************
5176 
5177 
5178 //*************************************************************************************************
5185 template< typename Type // Data type of the matrix
5186  , size_t M // Number of rows
5187  , size_t N > // Number of columns
5188 inline void StaticMatrix<Type,M,N,true>::operator delete( void* ptr )
5189 {
5190  deallocate( static_cast<StaticMatrix*>( ptr ) );
5191 }
5193 //*************************************************************************************************
5194 
5195 
5196 //*************************************************************************************************
5203 template< typename Type // Data type of the matrix
5204  , size_t M // Number of rows
5205  , size_t N > // Number of columns
5206 inline void StaticMatrix<Type,M,N,true>::operator delete[]( void* ptr )
5207 {
5208  deallocate( static_cast<StaticMatrix*>( ptr ) );
5209 }
5211 //*************************************************************************************************
5212 
5213 
5214 //*************************************************************************************************
5221 template< typename Type // Data type of the matrix
5222  , size_t M // Number of rows
5223  , size_t N > // Number of columns
5224 inline void StaticMatrix<Type,M,N,true>::operator delete( void* ptr, const std::nothrow_t& )
5225 {
5226  deallocate( static_cast<StaticMatrix*>( ptr ) );
5227 }
5229 //*************************************************************************************************
5230 
5231 
5232 //*************************************************************************************************
5239 template< typename Type // Data type of the matrix
5240  , size_t M // Number of rows
5241  , size_t N > // Number of columns
5242 inline void StaticMatrix<Type,M,N,true>::operator delete[]( void* ptr, const std::nothrow_t& )
5243 {
5244  deallocate( static_cast<StaticMatrix*>( ptr ) );
5245 }
5247 //*************************************************************************************************
5248 
5249 
5250 
5251 
5252 //=================================================================================================
5253 //
5254 // EXPRESSION TEMPLATE EVALUATION FUNCTIONS
5255 //
5256 //=================================================================================================
5257 
5258 //*************************************************************************************************
5269 template< typename Type // Data type of the matrix
5270  , size_t M // Number of rows
5271  , size_t N > // Number of columns
5272 template< typename Other > // Data type of the foreign expression
5273 inline bool StaticMatrix<Type,M,N,true>::canAlias( const Other* alias ) const
5274 {
5275  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
5276 }
5278 //*************************************************************************************************
5279 
5280 
5281 //*************************************************************************************************
5292 template< typename Type // Data type of the matrix
5293  , size_t M // Number of rows
5294  , size_t N > // Number of columns
5295 template< typename Other > // Data type of the foreign expression
5296 inline bool StaticMatrix<Type,M,N,true>::isAliased( const Other* alias ) const
5297 {
5298  return static_cast<const void*>( this ) == static_cast<const void*>( alias );
5299 }
5301 //*************************************************************************************************
5302 
5303 
5304 //*************************************************************************************************
5314 template< typename Type // Data type of the matrix
5315  , size_t M // Number of rows
5316  , size_t N > // Number of columns
5317 inline bool StaticMatrix<Type,M,N,true>::isAligned() const
5318 {
5319  return true;
5320 }
5322 //*************************************************************************************************
5323 
5324 
5325 //*************************************************************************************************
5340 template< typename Type // Data type of the matrix
5341  , size_t M // Number of rows
5342  , size_t N > // Number of columns
5343 inline typename StaticMatrix<Type,M,N,true>::IntrinsicType
5344  StaticMatrix<Type,M,N,true>::load( size_t i, size_t j ) const
5345 {
5346  using blaze::load;
5347 
5349 
5350  BLAZE_INTERNAL_ASSERT( i < M , "Invalid row access index" );
5351  BLAZE_INTERNAL_ASSERT( i + IT::size <= MM , "Invalid row access index" );
5352  BLAZE_INTERNAL_ASSERT( i % IT::size == 0UL, "Invalid row access index" );
5353  BLAZE_INTERNAL_ASSERT( j < N , "Invalid column access index" );
5354 
5355  return load( &v_[i+j*MM] );
5356 }
5358 //*************************************************************************************************
5359 
5360 
5361 //*************************************************************************************************
5376 template< typename Type // Data type of the matrix
5377  , size_t M // Number of rows
5378  , size_t N > // Number of columns
5379 inline typename StaticMatrix<Type,M,N,true>::IntrinsicType
5380  StaticMatrix<Type,M,N,true>::loadu( size_t i, size_t j ) const
5381 {
5382  using blaze::loadu;
5383 
5385 
5386  BLAZE_INTERNAL_ASSERT( i < M , "Invalid row access index" );
5387  BLAZE_INTERNAL_ASSERT( i + IT::size <= MM , "Invalid row access index" );
5388  BLAZE_INTERNAL_ASSERT( j < N , "Invalid column access index" );
5389 
5390  return loadu( &v_[i+j*MM] );
5391 }
5393 //*************************************************************************************************
5394 
5395 
5396 //*************************************************************************************************
5412 template< typename Type // Data type of the matrix
5413  , size_t M // Number of rows
5414  , size_t N > // Number of columns
5415 inline void StaticMatrix<Type,M,N,true>::store( size_t i, size_t j, const IntrinsicType& value )
5416 {
5417  using blaze::store;
5418 
5420 
5421  BLAZE_INTERNAL_ASSERT( i < M , "Invalid row access index" );
5422  BLAZE_INTERNAL_ASSERT( i + IT::size <= MM , "Invalid row access index" );
5423  BLAZE_INTERNAL_ASSERT( i % IT::size == 0UL, "Invalid row access index" );
5424  BLAZE_INTERNAL_ASSERT( j < N , "Invalid column access index" );
5425 
5426  store( &v_[i+j*MM], value );
5427 }
5429 //*************************************************************************************************
5430 
5431 
5432 //*************************************************************************************************
5448 template< typename Type // Data type of the matrix
5449  , size_t M // Number of rows
5450  , size_t N > // Number of columns
5451 inline void StaticMatrix<Type,M,N,true>::storeu( size_t i, size_t j, const IntrinsicType& value )
5452 {
5453  using blaze::storeu;
5454 
5456 
5457  BLAZE_INTERNAL_ASSERT( i < M , "Invalid row access index" );
5458  BLAZE_INTERNAL_ASSERT( i + IT::size <= MM, "Invalid row access index" );
5459  BLAZE_INTERNAL_ASSERT( j < N , "Invalid column access index" );
5460 
5461  storeu( &v_[i+j*MM], value );
5462 }
5464 //*************************************************************************************************
5465 
5466 
5467 //*************************************************************************************************
5484 template< typename Type // Data type of the matrix
5485  , size_t M // Number of rows
5486  , size_t N > // Number of columns
5487 inline void StaticMatrix<Type,M,N,true>::stream( size_t i, size_t j, const IntrinsicType& value )
5488 {
5489  using blaze::stream;
5490 
5492 
5493  BLAZE_INTERNAL_ASSERT( i < M , "Invalid row access index" );
5494  BLAZE_INTERNAL_ASSERT( i + IT::size <= MM , "Invalid row access index" );
5495  BLAZE_INTERNAL_ASSERT( i % IT::size == 0UL, "Invalid row access index" );
5496  BLAZE_INTERNAL_ASSERT( j < N , "Invalid column access index" );
5497 
5498  stream( &v_[i+j*MM], value );
5499 }
5501 //*************************************************************************************************
5502 
5503 
5504 //*************************************************************************************************
5516 template< typename Type // Data type of the matrix
5517  , size_t M // Number of rows
5518  , size_t N > // Number of columns
5519 template< typename MT // Type of the right-hand side dense matrix
5520  , bool SO > // Storage order of the right-hand side dense matrix
5521 inline typename DisableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAssign<MT> >::Type
5522  StaticMatrix<Type,M,N,true>::assign( const DenseMatrix<MT,SO>& rhs )
5523 {
5524  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5525 
5526  for( size_t j=0UL; j<N; ++j ) {
5527  for( size_t i=0UL; i<M; ++i ) {
5528  v_[i+j*MM] = (~rhs)(i,j);
5529  }
5530  }
5531 }
5533 //*************************************************************************************************
5534 
5535 
5536 //*************************************************************************************************
5548 template< typename Type // Data type of the matrix
5549  , size_t M // Number of rows
5550  , size_t N > // Number of columns
5551 template< typename MT // Type of the right-hand side dense matrix
5552  , bool SO > // Storage order of the right-hand side dense matrix
5553 inline typename EnableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAssign<MT> >::Type
5554  StaticMatrix<Type,M,N,true>::assign( const DenseMatrix<MT,SO>& rhs )
5555 {
5556  using blaze::store;
5557 
5558  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5559 
5561 
5562  for( size_t j=0UL; j<N; ++j ) {
5563  for( size_t i=0UL; i<M; i+=IT::size ) {
5564  store( &v_[i+j*MM], (~rhs).load(i,j) );
5565  }
5566  }
5567 }
5569 //*************************************************************************************************
5570 
5571 
5572 //*************************************************************************************************
5584 template< typename Type // Data type of the matrix
5585  , size_t M // Number of rows
5586  , size_t N > // Number of columns
5587 template< typename MT > // Type of the right-hand side sparse matrix
5588 inline void StaticMatrix<Type,M,N,true>::assign( const SparseMatrix<MT,true>& rhs )
5589 {
5590  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5591 
5592  typedef typename MT::ConstIterator RhsConstIterator;
5593 
5594  for( size_t j=0UL; j<N; ++j )
5595  for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5596  v_[element->index()+j*MM] = element->value();
5597 }
5599 //*************************************************************************************************
5600 
5601 
5602 //*************************************************************************************************
5614 template< typename Type // Data type of the matrix
5615  , size_t M // Number of rows
5616  , size_t N > // Number of columns
5617 template< typename MT > // Type of the right-hand side sparse matrix
5618 inline void StaticMatrix<Type,M,N,true>::assign( const SparseMatrix<MT,false>& rhs )
5619 {
5621 
5622  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5623 
5624  typedef typename MT::ConstIterator RhsConstIterator;
5625 
5626  for( size_t i=0UL; i<M; ++i )
5627  for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5628  v_[i+element->index()*MM] = element->value();
5629 }
5631 //*************************************************************************************************
5632 
5633 
5634 //*************************************************************************************************
5646 template< typename Type // Data type of the matrix
5647  , size_t M // Number of rows
5648  , size_t N > // Number of columns
5649 template< typename MT // Type of the right-hand side dense matrix
5650  , bool SO > // Storage order of the right-hand side dense matrix
5651 inline typename DisableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >::Type
5652  StaticMatrix<Type,M,N,true>::addAssign( const DenseMatrix<MT,SO>& rhs )
5653 {
5654  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5655 
5656  for( size_t j=0UL; j<N; ++j ) {
5657  for( size_t i=0UL; i<M; ++i ) {
5658  v_[i+j*MM] += (~rhs)(i,j);
5659  }
5660  }
5661 }
5663 //*************************************************************************************************
5664 
5665 
5666 //*************************************************************************************************
5678 template< typename Type // Data type of the matrix
5679  , size_t M // Number of rows
5680  , size_t N > // Number of columns
5681 template< typename MT // Type of the right-hand side dense matrix
5682  , bool SO > // Storage order of the right-hand side dense matrix
5683 inline typename EnableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >::Type
5684  StaticMatrix<Type,M,N,true>::addAssign( const DenseMatrix<MT,SO>& rhs )
5685 {
5686  using blaze::load;
5687  using blaze::store;
5688 
5689  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5690 
5692 
5693  for( size_t j=0UL; j<N; ++j ) {
5694  for( size_t i=0UL; i<M; i+=IT::size ) {
5695  store( &v_[i+j*MM], load( &v_[i+j*MM] ) + (~rhs).load(i,j) );
5696  }
5697  }
5698 }
5700 //*************************************************************************************************
5701 
5702 
5703 //*************************************************************************************************
5715 template< typename Type // Data type of the matrix
5716  , size_t M // Number of rows
5717  , size_t N > // Number of columns
5718 template< typename MT > // Type of the right-hand side sparse matrix
5719 inline void StaticMatrix<Type,M,N,true>::addAssign( const SparseMatrix<MT,true>& rhs )
5720 {
5721  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5722 
5723  typedef typename MT::ConstIterator RhsConstIterator;
5724 
5725  for( size_t j=0UL; j<N; ++j )
5726  for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5727  v_[element->index()+j*MM] += element->value();
5728 }
5730 //*************************************************************************************************
5731 
5732 
5733 //*************************************************************************************************
5745 template< typename Type // Data type of the matrix
5746  , size_t M // Number of rows
5747  , size_t N > // Number of columns
5748 template< typename MT > // Type of the right-hand side sparse matrix
5749 inline void StaticMatrix<Type,M,N,true>::addAssign( const SparseMatrix<MT,false>& rhs )
5750 {
5752 
5753  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5754 
5755  typedef typename MT::ConstIterator RhsConstIterator;
5756 
5757  for( size_t i=0UL; i<M; ++i )
5758  for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5759  v_[i+element->index()*MM] += element->value();
5760 }
5762 //*************************************************************************************************
5763 
5764 
5765 //*************************************************************************************************
5777 template< typename Type // Data type of the matrix
5778  , size_t M // Number of rows
5779  , size_t N > // Number of columns
5780 template< typename MT // Type of the right-hand side dense matrix
5781  , bool SO > // Storage order of the right-hand side dense matrix
5782 inline typename DisableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >::Type
5783  StaticMatrix<Type,M,N,true>::subAssign( const DenseMatrix<MT,SO>& rhs )
5784 {
5785  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5786 
5787  for( size_t j=0UL; j<N; ++j ) {
5788  for( size_t i=0UL; i<M; ++i ) {
5789  v_[i+j*MM] -= (~rhs)(i,j);
5790  }
5791  }
5792 }
5794 //*************************************************************************************************
5795 
5796 
5797 //*************************************************************************************************
5809 template< typename Type // Data type of the matrix
5810  , size_t M // Number of rows
5811  , size_t N > // Number of columns
5812 template< typename MT // Type of the right-hand side dense matrix
5813  , bool SO > // Storage order of the right-hand side dense matrix
5814 inline typename EnableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >::Type
5815  StaticMatrix<Type,M,N,true>::subAssign( const DenseMatrix<MT,SO>& rhs )
5816 {
5817  using blaze::load;
5818  using blaze::store;
5819 
5820  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5821 
5823 
5824  for( size_t j=0UL; j<N; ++j ) {
5825  for( size_t i=0UL; i<M; i+=IT::size ) {
5826  store( &v_[i+j*MM], load( &v_[i+j*MM] ) - (~rhs).load(i,j) );
5827  }
5828  }
5829 }
5831 //*************************************************************************************************
5832 
5833 
5834 //*************************************************************************************************
5846 template< typename Type // Data type of the matrix
5847  , size_t M // Number of rows
5848  , size_t N > // Number of columns
5849 template< typename MT > // Type of the right-hand side sparse matrix
5850 inline void StaticMatrix<Type,M,N,true>::subAssign( const SparseMatrix<MT,true>& rhs )
5851 {
5852  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5853 
5854  typedef typename MT::ConstIterator RhsConstIterator;
5855 
5856  for( size_t j=0UL; j<N; ++j )
5857  for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5858  v_[element->index()+j*MM] -= element->value();
5859 }
5861 //*************************************************************************************************
5862 
5863 
5864 //*************************************************************************************************
5876 template< typename Type // Data type of the matrix
5877  , size_t M // Number of rows
5878  , size_t N > // Number of columns
5879 template< typename MT > // Type of the right-hand side sparse matrix
5880 inline void StaticMatrix<Type,M,N,true>::subAssign( const SparseMatrix<MT,false>& rhs )
5881 {
5883 
5884  BLAZE_INTERNAL_ASSERT( (~rhs).rows() == M && (~rhs).columns() == N, "Invalid matrix size" );
5885 
5886  typedef typename MT::ConstIterator RhsConstIterator;
5887 
5888  for( size_t i=0UL; i<M; ++i )
5889  for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5890  v_[i+element->index()*MM] -= element->value();
5891 }
5893 //*************************************************************************************************
5894 
5895 
5896 
5897 
5898 
5899 
5900 
5901 
5902 //=================================================================================================
5903 //
5904 // UNDEFINED CLASS TEMPLATE SPECIALIZATIONS
5905 //
5906 //=================================================================================================
5907 
5908 //*************************************************************************************************
5916 template< typename Type // Data type of the matrix
5917  , size_t M // Number of rows
5918  , bool SO > // Storage order
5919 class StaticMatrix<Type,M,0UL,SO>;
5921 //*************************************************************************************************
5922 
5923 
5924 //*************************************************************************************************
5932 template< typename Type // Data type of the matrix
5933  , size_t N // Number of columns
5934  , bool SO > // Storage order
5935 class StaticMatrix<Type,0UL,N,SO>;
5937 //*************************************************************************************************
5938 
5939 
5940 //*************************************************************************************************
5948 template< typename Type // Data type of the matrix
5949  , bool SO > // Storage order
5950 class StaticMatrix<Type,0UL,0UL,SO>;
5952 //*************************************************************************************************
5953 
5954 
5955 
5956 
5957 
5958 
5959 
5960 
5961 //=================================================================================================
5962 //
5963 // STATICMATRIX OPERATORS
5964 //
5965 //=================================================================================================
5966 
5967 //*************************************************************************************************
5970 template< typename Type, size_t M, size_t N, bool SO >
5971 inline void reset( StaticMatrix<Type,M,N,SO>& m );
5972 
5973 template< typename Type, size_t M, size_t N, bool SO >
5974 inline void reset( StaticMatrix<Type,M,N,SO>& m, size_t i );
5975 
5976 template< typename Type, size_t M, size_t N, bool SO >
5977 inline void clear( StaticMatrix<Type,M,N,SO>& m );
5978 
5979 template< typename Type, size_t M, size_t N, bool SO >
5980 inline bool isDefault( const StaticMatrix<Type,M,N,SO>& m );
5981 
5982 template< typename Type, size_t M, size_t N, bool SO >
5983 inline void swap( StaticMatrix<Type,M,N,SO>& a, StaticMatrix<Type,M,N,SO>& b ) /* throw() */;
5984 
5985 template< typename Type, size_t M, size_t N, bool SO >
5986 inline void move( StaticMatrix<Type,M,N,SO>& dst, StaticMatrix<Type,M,N,SO>& src ) /* throw() */;
5988 //*************************************************************************************************
5989 
5990 
5991 //*************************************************************************************************
5998 template< typename Type // Data type of the matrix
5999  , size_t M // Number of rows
6000  , size_t N // Number of columns
6001  , bool SO > // Storage order
6003 {
6004  m.reset();
6005 }
6006 //*************************************************************************************************
6007 
6008 
6009 //*************************************************************************************************
6022 template< typename Type // Data type of the matrix
6023  , size_t M // Number of rows
6024  , size_t N // Number of columns
6025  , bool SO > // Storage order
6026 inline void reset( StaticMatrix<Type,M,N,SO>& m, size_t i )
6027 {
6028  m.reset( i );
6029 }
6030 //*************************************************************************************************
6031 
6032 
6033 //*************************************************************************************************
6042 template< typename Type // Data type of the matrix
6043  , size_t M // Number of rows
6044  , size_t N // Number of columns
6045  , bool SO > // Storage order
6047 {
6048  m.reset();
6049 }
6050 //*************************************************************************************************
6051 
6052 
6053 //*************************************************************************************************
6060 template< typename Type // Data type of the matrix
6061  , size_t M // Number of rows
6062  , size_t N // Number of columns
6063  , bool SO > // Storage order
6064 inline bool isDefault( const StaticMatrix<Type,M,N,SO>& m )
6065 {
6066  if( SO == rowMajor ) {
6067  for( size_t i=0UL; i<M; ++i )
6068  for( size_t j=0UL; j<N; ++j )
6069  if( !isDefault( m(i,j) ) ) return false;
6070  }
6071  else {
6072  for( size_t j=0UL; j<N; ++j )
6073  for( size_t i=0UL; i<M; ++i )
6074  if( !isDefault( m(i,j) ) ) return false;
6075  }
6076 
6077  return true;
6078 }
6079 //*************************************************************************************************
6080 
6081 
6082 //*************************************************************************************************
6091 template< typename Type // Data type of the matrix
6092  , size_t M // Number of rows
6093  , size_t N // Number of columns
6094  , bool SO > // Storage order
6095 inline void swap( StaticMatrix<Type,M,N,SO>& a, StaticMatrix<Type,M,N,SO>& b ) /* throw() */
6096 {
6097  a.swap( b );
6098 }
6099 //*************************************************************************************************
6100 
6101 
6102 //*************************************************************************************************
6111 template< typename Type // Data type of the matrix
6112  , size_t M // Number of rows
6113  , size_t N // Number of columns
6114  , bool SO > // Storage order
6115 inline void move( StaticMatrix<Type,M,N,SO>& dst, StaticMatrix<Type,M,N,SO>& src ) /* throw() */
6116 {
6117  dst = src;
6118 }
6119 //*************************************************************************************************
6120 
6121 
6122 
6123 
6124 //=================================================================================================
6125 //
6126 // ISSQUARE SPECIALIZATIONS
6127 //
6128 //=================================================================================================
6129 
6130 //*************************************************************************************************
6132 template< typename T, size_t N, bool SO >
6133 struct IsSquare< StaticMatrix<T,N,N,SO> > : public TrueType
6134 {
6135  enum { value = 1 };
6136  typedef TrueType Type;
6137 };
6139 //*************************************************************************************************
6140 
6141 
6142 
6143 
6144 //=================================================================================================
6145 //
6146 // ROWS SPECIALIZATIONS
6147 //
6148 //=================================================================================================
6149 
6150 //*************************************************************************************************
6152 template< typename T, size_t M, size_t N, bool SO >
6153 struct Rows< StaticMatrix<T,M,N,SO> >
6154 {
6155  static const size_t value = M;
6156 };
6158 //*************************************************************************************************
6159 
6160 
6161 
6162 
6163 //=================================================================================================
6164 //
6165 // COLUMNS SPECIALIZATIONS
6166 //
6167 //=================================================================================================
6168 
6169 //*************************************************************************************************
6171 template< typename T, size_t M, size_t N, bool SO >
6172 struct Columns< StaticMatrix<T,M,N,SO> >
6173 {
6174  static const size_t value = N;
6175 };
6177 //*************************************************************************************************
6178 
6179 
6180 
6181 
6182 //=================================================================================================
6183 //
6184 // ADDTRAIT SPECIALIZATIONS
6185 //
6186 //=================================================================================================
6187 
6188 //*************************************************************************************************
6190 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6191 struct AddTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
6192 {
6193  typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N, SO > Type;
6194 };
6195 
6196 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
6197 struct AddTrait< StaticMatrix<T1,M,N,SO1>, StaticMatrix<T2,M,N,SO2> >
6198 {
6199  typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N, false > Type;
6200 };
6202 //*************************************************************************************************
6203 
6204 
6205 
6206 
6207 //=================================================================================================
6208 //
6209 // SUBTRAIT SPECIALIZATIONS
6210 //
6211 //=================================================================================================
6212 
6213 //*************************************************************************************************
6215 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6216 struct SubTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
6217 {
6218  typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N, SO > Type;
6219 };
6220 
6221 template< typename T1, size_t M, size_t N, bool SO1, typename T2, bool SO2 >
6222 struct SubTrait< StaticMatrix<T1,M,N,SO1>, StaticMatrix<T2,M,N,SO2> >
6223 {
6224  typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N, false > Type;
6225 };
6227 //*************************************************************************************************
6228 
6229 
6230 
6231 
6232 //=================================================================================================
6233 //
6234 // MULTTRAIT SPECIALIZATIONS
6235 //
6236 //=================================================================================================
6237 
6238 //*************************************************************************************************
6240 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6241 struct MultTrait< StaticMatrix<T1,M,N,SO>, T2 >
6242 {
6243  typedef StaticMatrix< typename MultTrait<T1,T2>::Type, M, N, SO > Type;
6245 };
6246 
6247 template< typename T1, typename T2, size_t M, size_t N, bool SO >
6248 struct MultTrait< T1, StaticMatrix<T2,M,N,SO> >
6249 {
6250  typedef StaticMatrix< typename MultTrait<T1,T2>::Type, M, N, SO > Type;
6252 };
6253 
6254 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6255 struct MultTrait< StaticMatrix<T1,M,N,SO>, StaticVector<T2,N,false> >
6256 {
6257  typedef StaticVector< typename MultTrait<T1,T2>::Type, M, false > Type;
6258 };
6259 
6260 template< typename T1, size_t M, typename T2, size_t N, bool SO >
6261 struct MultTrait< StaticVector<T1,M,true>, StaticMatrix<T2,M,N,SO> >
6262 {
6263  typedef StaticVector< typename MultTrait<T1,T2>::Type, N, true > Type;
6264 };
6265 
6266 template< typename T1, size_t M, size_t N, bool SO, typename T2, size_t L >
6267 struct MultTrait< StaticMatrix<T1,M,N,SO>, HybridVector<T2,L,false> >
6268 {
6269  typedef StaticVector< typename MultTrait<T1,T2>::Type, M, false > Type;
6270 };
6271 
6272 template< typename T1, size_t L, typename T2, size_t M, size_t N, bool SO >
6273 struct MultTrait< HybridVector<T1,L,true>, StaticMatrix<T2,M,N,SO> >
6274 {
6275  typedef StaticVector< typename MultTrait<T1,T2>::Type, N, true > Type;
6276 };
6277 
6278 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6279 struct MultTrait< StaticMatrix<T1,M,N,SO>, DynamicVector<T2,false> >
6280 {
6281  typedef StaticVector< typename MultTrait<T1,T2>::Type, M, false > Type;
6282 };
6283 
6284 template< typename T1, typename T2, size_t M, size_t N, bool SO >
6285 struct MultTrait< DynamicVector<T1,true>, StaticMatrix<T2,M,N,SO> >
6286 {
6287  typedef StaticVector< typename MultTrait<T1,T2>::Type, N, true > Type;
6288 };
6289 
6290 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6291 struct MultTrait< StaticMatrix<T1,M,N,SO>, CompressedVector<T2,false> >
6292 {
6293  typedef StaticVector< typename MultTrait<T1,T2>::Type, M, false > Type;
6294 };
6295 
6296 template< typename T1, typename T2, size_t M, size_t N, bool SO >
6297 struct MultTrait< CompressedVector<T1,true>, StaticMatrix<T2,M,N,SO> >
6298 {
6299  typedef StaticVector< typename MultTrait<T1,T2>::Type, N, true > Type;
6300 };
6301 
6302 template< typename T1, size_t M, size_t K, bool SO1, typename T2, size_t N, bool SO2 >
6303 struct MultTrait< StaticMatrix<T1,M,K,SO1>, StaticMatrix<T2,K,N,SO2> >
6304 {
6305  typedef StaticMatrix< typename MultTrait<T1,T2>::Type, M, N, SO1 > Type;
6306 };
6308 //*************************************************************************************************
6309 
6310 
6311 
6312 
6313 //=================================================================================================
6314 //
6315 // DIVTRAIT SPECIALIZATIONS
6316 //
6317 //=================================================================================================
6318 
6319 //*************************************************************************************************
6321 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6322 struct DivTrait< StaticMatrix<T1,M,N,SO>, T2 >
6323 {
6324  typedef StaticMatrix< typename DivTrait<T1,T2>::Type, M, N, SO > Type;
6326 };
6328 //*************************************************************************************************
6329 
6330 
6331 
6332 
6333 //=================================================================================================
6334 //
6335 // MATHTRAIT SPECIALIZATIONS
6336 //
6337 //=================================================================================================
6338 
6339 //*************************************************************************************************
6341 template< typename T1, size_t M, size_t N, bool SO, typename T2 >
6342 struct MathTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
6343 {
6344  typedef StaticMatrix< typename MathTrait<T1,T2>::HighType, M, N, SO > HighType;
6345  typedef StaticMatrix< typename MathTrait<T1,T2>::LowType , M, N, SO > LowType;
6346 };
6348 //*************************************************************************************************
6349 
6350 
6351 
6352 
6353 //=================================================================================================
6354 //
6355 // SUBMATRIXTRAIT SPECIALIZATIONS
6356 //
6357 //=================================================================================================
6358 
6359 //*************************************************************************************************
6361 template< typename T1, size_t M, size_t N, bool SO >
6362 struct SubmatrixTrait< StaticMatrix<T1,M,N,SO> >
6363 {
6364  typedef HybridMatrix<T1,M,N,SO> Type;
6365 };
6367 //*************************************************************************************************
6368 
6369 
6370 
6371 
6372 //=================================================================================================
6373 //
6374 // ROWTRAIT SPECIALIZATIONS
6375 //
6376 //=================================================================================================
6377 
6378 //*************************************************************************************************
6380 template< typename T1, size_t M, size_t N, bool SO >
6381 struct RowTrait< StaticMatrix<T1,M,N,SO> >
6382 {
6383  typedef StaticVector<T1,N,true> Type;
6384 };
6386 //*************************************************************************************************
6387 
6388 
6389 
6390 
6391 //=================================================================================================
6392 //
6393 // COLUMNTRAIT SPECIALIZATIONS
6394 //
6395 //=================================================================================================
6396 
6397 //*************************************************************************************************
6399 template< typename T1, size_t M, size_t N, bool SO >
6400 struct ColumnTrait< StaticMatrix<T1,M,N,SO> >
6401 {
6402  typedef StaticVector<T1,M,false> Type;
6403 };
6405 //*************************************************************************************************
6406 
6407 } // namespace blaze
6408 
6409 #endif
Compile time check for vectorizable types.Depending on the available instruction set (SSE...
Definition: IsVectorizable.h:108
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:116
This ResultType
Result type for expression template evaluations.
Definition: StaticMatrix.h:199
Compile time check for numeric types.This type trait tests whether or not the given template paramete...
Definition: IsNumeric.h:98
Constraint on the data type.
void swap(SymmetricMatrix< MT, SO, DF, NF > &a, SymmetricMatrix< MT, SO, DF, NF > &b)
Swapping the contents of two matrices.
Definition: SymmetricMatrix.h:195
#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 Rows type trait.
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
size_t nonZeros() const
Returns the total number of non-zero elements in the matrix.
Definition: StaticMatrix.h:2050
const bool defaultStorageOrder
The default storage order for all matrices of the Blaze library.This value specifies the default stor...
Definition: StorageOrder.h:56
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:258
Header file for the row trait.
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:258
bool canAlias(const Other *alias) const
Returns whether the matrix can alias with the given address alias.
Definition: StaticMatrix.h:2411
Header file for the IsSparseMatrix type trait.
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:205
const Type & ConstReference
Reference to a constant matrix value.
Definition: StaticMatrix.h:207
StaticMatrix()
The default constructor for StaticMatrix.
Definition: StaticMatrix.h:484
BLAZE_ALWAYS_INLINE EnableIf< IsIntegral< T > >::Type stream(T *address, const typename Stream< T, sizeof(T)>::Type &value)
Aligned, non-temporal store of a vector of integral values.
Definition: Stream.h:220
Header file for the IsSame and IsStrictlySame type traits.
void storeu(size_t i, size_t j, const IntrinsicType &value)
Unaligned store of an intrinsic element of the matrix.
Definition: StaticMatrix.h:2587
Header file for the IsColumnMajorMatrix type trait.
StaticMatrix< Type, N, M,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: StaticMatrix.h:201
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:316
BLAZE_ALWAYS_INLINE EnableIf< IsIntegral< T >, Load< T, sizeof(T)> >::Type::Type load(const T *address)
Loads a vector of integral values.
Definition: Load.h:224
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
static const size_t NN
Alignment adjustment.
Definition: StaticMatrix.h:193
Type ElementType
Type of the matrix elements.
Definition: StaticMatrix.h:202
AlignedArray< Type, M *NN > v_
The statically allocated matrix elements.
Definition: StaticMatrix.h:440
#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:116
Type * Pointer
Pointer to a non-constant matrix value.
Definition: StaticMatrix.h:208
Iterator end(size_t i)
Returns an iterator just past the last element of row/column i.
Definition: StaticMatrix.h:1585
Header file for memory allocation and deallocation functionality.
const Type * ConstPointer
Pointer to a constant matrix value.
Definition: StaticMatrix.h:209
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:107
Constraint on the data type.
bool isAligned() const
Returns whether the matrix is properly aligned in memory.
Definition: StaticMatrix.h:2453
Header file for the SparseMatrix base class.
Header file for the IsSquare type trait.
ConstIterator cend(size_t i) const
Returns an iterator just past the last element of row/column i.
Definition: StaticMatrix.h:1633
Header file for the DisableIf class template.
StaticMatrix & transpose()
Transposing the matrix.
Definition: StaticMatrix.h:2153
void swap(StaticMatrix &m)
Swapping the contents of two static matrices.
Definition: StaticMatrix.h:2201
Header file for the multiplication trait.
Header file for the clear shim.
Header file for nested template disabiguation.
Compile time assertion.
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4754
DenseIterator< Type > Iterator
Iterator over non-constant elements.
Definition: StaticMatrix.h:210
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2482
#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:116
Efficient implementation of a fixed-sized matrix.The StaticMatrix class template is the representatio...
Definition: Forward.h:58
Header file for the DenseMatrix base class.
BLAZE_ALWAYS_INLINE void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:635
Header file for the Columns type trait.
EnableIf< IsBuiltin< T > >::Type deallocate(T *address)
Deallocation of memory for built-in data types.
Definition: Memory.h:226
Header file for the DenseIterator class template.
BLAZE_ALWAYS_INLINE void clear(const NonNumericProxy< MT > &proxy)
Clearing the represented element.
Definition: NonNumericProxy.h:854
void reset()
Reset to the default initial values.
Definition: StaticMatrix.h:2104
Constraint on the data type.
size_t columns() const
Returns the current number of columns of the matrix.
Definition: StaticMatrix.h:1973
BLAZE_ALWAYS_INLINE EnableIf< IsIntegral< T >, Loadu< T, sizeof(T)> >::Type::Type loadu(const T *address)
Loads a vector of integral values.
Definition: Loadu.h:221
IntrinsicType loadu(size_t i, size_t j) const
Unaligned load of an intrinsic element of the matrix.
Definition: StaticMatrix.h:2516
const This & CompositeType
Data type for composite expression templates.
Definition: StaticMatrix.h:205
Header file for the default storage order for all vectors of the Blaze library.
#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:79
size_t capacity() const
Returns the maximum capacity of the matrix.
Definition: StaticMatrix.h:2008
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:195
StaticMatrix< ET, M, N, SO > Other
The type of the other StaticMatrix.
Definition: StaticMatrix.h:219
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2480
Header file for the EnableIf class template.
bool isAliased(const Other *alias) const
Returns whether the matrix is aliased with the given address alias.
Definition: StaticMatrix.h:2433
ConstIterator cbegin(size_t i) const
Returns an iterator to the first element of row/column i.
Definition: StaticMatrix.h:1561
Iterator begin(size_t i)
Returns an iterator to the first element of row/column i.
Definition: StaticMatrix.h:1513
Reference operator()(size_t i, size_t j)
2D-access to the matrix elements.
Definition: StaticMatrix.h:1377
Header file for the IsVectorizable type trait.
StaticMatrix< Type, M, N, SO > This
Type of this StaticMatrix instance.
Definition: StaticMatrix.h:198
Header file for the IsNumeric type trait.
IntrinsicTrait< Type > IT
Intrinsic trait for the matrix element type.
Definition: StaticMatrix.h:188
IT::Type IntrinsicType
Intrinsic type of the matrix elements.
Definition: StaticMatrix.h:203
BLAZE_ALWAYS_INLINE EnableIf< IsIntegral< T >, Set< T, sizeof(T)> >::Type::Type set(T value)
Sets all values in the vector to the given integral value.
Definition: Set.h:211
#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:116
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:749
Header file for run time assertion macros.
Pointer data()
Low-level data access to the matrix elements.
Definition: StaticMatrix.h:1424
Header file for the addition trait.
BLAZE_ALWAYS_INLINE void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:742
Header file for the division trait.
Header file for the submatrix trait.
Constraint on the data type.
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_NUMERIC_TYPE(T)
Constraint on the data type.In case the given data type T is not a numeric (integral or floating poin...
Definition: Numeric.h:79
void move(DynamicMatrix< Type, SO > &dst, DynamicMatrix< Type, SO > &src)
Moving the contents of one dynamic matrix to another.
Definition: DynamicMatrix.h:4769
Header file for the AlignedArray implementation.
#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:116
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2481
Header file for the column trait.
Header file for the isDefault shim.
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:87
BLAZE_ALWAYS_INLINE bool isDefault(const NonNumericProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: NonNumericProxy.h:874
Constraint on the data type.
Constraint on the data type.
BLAZE_ALWAYS_INLINE void reset(const NonNumericProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: NonNumericProxy.h:833
Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool...
Definition: DisableIf.h:184
void store(size_t i, size_t j, const IntrinsicType &value)
Aligned store of an intrinsic element of the matrix.
Definition: StaticMatrix.h:2551
Implementation of a generic iterator for dense vectors and matrices.The DenseIterator represents a ge...
Definition: DenseIterator.h:58
Header file for all intrinsic functionality.
Header file for the mathematical trait.
Header file for the IsRowMajorMatrix type trait.
size_t spacing() const
Returns the spacing between the beginning of two rows.
Definition: StaticMatrix.h:1992
const bool rowMajor
Storage order flag for row-major matrices.
Definition: StorageOrder.h:71
size_t rows() const
Returns the current number of rows of the matrix.
Definition: StaticMatrix.h:1957
const Type & ReturnType
Return type for expression template evaluations.
Definition: StaticMatrix.h:204
DenseIterator< const Type > ConstIterator
Iterator over constant elements.
Definition: StaticMatrix.h:211
Type & Reference
Reference to a non-constant matrix value.
Definition: StaticMatrix.h:206
Rebind mechanism to obtain a StaticMatrix with different data/element type.
Definition: StaticMatrix.h:218
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2473
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE EnableIf< IsIntegral< T > >::Type storeu(T *address, const typename Storeu< T, sizeof(T)>::Type &value)
Unaligned store of a vector of integral values.
Definition: Storeu.h:218
Compile time check for sparse matrix types.This type trait tests whether or not the given template pa...
Definition: IsSparseMatrix.h:103
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2479
Rebind mechanism to obtain a CompressedMatrix with different data/element type.
Definition: CompressedMatrix.h:2489
void stream(size_t i, size_t j, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the matrix.
Definition: StaticMatrix.h:2622
boost::true_type TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
#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:143
BLAZE_ALWAYS_INLINE EnableIf< IsIntegral< T > >::Type store(T *address, const typename Store< T, sizeof(T)>::Type &value)
Aligned store of a vector of integral values.
Definition: Store.h:225
StaticMatrix< Type, M, N,!SO > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: StaticMatrix.h:200
#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
IntrinsicType load(size_t i, size_t j) const
Aligned load of an intrinsic element of the matrix.
Definition: StaticMatrix.h:2480
BLAZE_ALWAYS_INLINE void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:849