35 #ifndef _BLAZE_MATH_DENSE_STATICMATRIX_H_
36 #define _BLAZE_MATH_DENSE_STATICMATRIX_H_
197 template<
typename Type
201 class StaticMatrix :
public DenseMatrix< StaticMatrix<Type,M,N,SO>, SO >
210 enum { NN = N + ( IT::size - ( N % IT::size ) ) % IT::size };
241 enum { smpAssignable = 0 };
250 template<
typename Other >
explicit inline StaticMatrix(
size_t m,
size_t n,
const Other* array );
251 template<
typename Other >
explicit inline StaticMatrix(
const Other (&array)[M][N] );
254 template<
typename Other,
bool SO2 >
inline StaticMatrix(
const StaticMatrix<Other,M,N,SO2>& m );
255 template<
typename MT ,
bool SO2 >
inline StaticMatrix(
const Matrix<MT,SO2>& m );
258 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3 );
259 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4 );
260 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5 );
261 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
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 );
265 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
266 const Type& v6,
const Type& v7,
const Type& v8 );
267 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
268 const Type& v6,
const Type& v7,
const Type& v8,
const Type& v9 );
269 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
270 const Type& v6,
const Type& v7,
const Type& v8,
const Type& v9,
const Type& v10 );
283 inline Type*
data ();
284 inline const Type*
data ()
const;
285 inline Type*
data (
size_t i );
286 inline const Type*
data (
size_t i )
const;
299 template<
typename Other >
300 inline StaticMatrix& operator=(
const Other (&array)[M][N] );
304 template<
typename Other,
bool SO2 >
inline StaticMatrix& operator= (
const StaticMatrix<Other,M,N,SO2>& rhs );
305 template<
typename MT ,
bool SO2 >
inline StaticMatrix& operator= (
const Matrix<MT,SO2>& rhs );
306 template<
typename MT ,
bool SO2 >
inline StaticMatrix& operator+=(
const Matrix<MT,SO2>& rhs );
307 template<
typename MT ,
bool SO2 >
inline StaticMatrix& operator-=(
const Matrix<MT,SO2>& rhs );
308 template<
typename MT ,
bool SO2 >
inline StaticMatrix& operator*=(
const Matrix<MT,SO2>& rhs );
310 template<
typename Other >
311 inline typename EnableIf< IsNumeric<Other>,
StaticMatrix >::Type&
312 operator*=( Other rhs );
314 template<
typename Other >
315 inline typename EnableIf< IsNumeric<Other>,
StaticMatrix >::Type&
316 operator/=( Other rhs );
323 inline size_t rows()
const;
327 inline size_t capacity(
size_t i )
const;
329 inline size_t nonZeros(
size_t i )
const;
331 inline void reset(
size_t i );
333 template<
typename Other >
inline StaticMatrix& scale(
const Other& scalar );
341 template<
typename MT >
343 struct VectorizedAssign {
344 enum { value = vectorizable && MT::vectorizable &&
345 IsSame<Type,typename MT::ElementType>::value &&
346 IsRowMajorMatrix<MT>::value };
353 template<
typename MT >
355 struct VectorizedAddAssign {
356 enum { value = vectorizable && MT::vectorizable &&
357 IsSame<Type,typename MT::ElementType>::value &&
358 IntrinsicTrait<Type>::addition &&
359 IsRowMajorMatrix<MT>::value };
366 template<
typename MT >
368 struct VectorizedSubAssign {
369 enum { value = vectorizable && MT::vectorizable &&
370 IsSame<Type,typename MT::ElementType>::value &&
371 IntrinsicTrait<Type>::subtraction &&
372 IsRowMajorMatrix<MT>::value };
381 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
382 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
392 template<
typename MT,
bool SO2 >
393 inline typename DisableIf< VectorizedAssign<MT> >::Type
394 assign(
const DenseMatrix<MT,SO2>& rhs );
396 template<
typename MT,
bool SO2 >
397 inline typename EnableIf< VectorizedAssign<MT> >::Type
398 assign(
const DenseMatrix<MT,SO2>& rhs );
400 template<
typename MT >
inline void assign(
const SparseMatrix<MT,SO>& rhs );
401 template<
typename MT >
inline void assign(
const SparseMatrix<MT,!SO>& rhs );
403 template<
typename MT,
bool SO2 >
404 inline typename DisableIf< VectorizedAddAssign<MT> >::Type
405 addAssign(
const DenseMatrix<MT,SO2>& rhs );
407 template<
typename MT,
bool SO2 >
408 inline typename EnableIf< VectorizedAddAssign<MT> >::Type
409 addAssign(
const DenseMatrix<MT,SO2>& rhs );
411 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,SO>& rhs );
412 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,!SO>& rhs );
414 template<
typename MT,
bool SO2 >
415 inline typename DisableIf< VectorizedSubAssign<MT> >::Type
416 subAssign(
const DenseMatrix<MT,SO2>& rhs );
418 template<
typename MT,
bool SO2 >
419 inline typename EnableIf< VectorizedSubAssign<MT> >::Type
420 subAssign(
const DenseMatrix<MT,SO2>& rhs );
422 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,SO>& rhs );
423 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,!SO>& rhs );
471 template<
typename Type
478 for(
size_t i=0UL; i<M*NN; ++i )
490 template<
typename Type
496 for(
size_t i=0UL; i<M; ++i ) {
497 for(
size_t j=0UL; j<N; ++j )
501 for(
size_t j=N; j<NN; ++j )
535 template<
typename Type
539 template<
typename Other >
543 throw std::invalid_argument(
"Invalid setup of static matrix" );
545 for(
size_t i=0UL; i<m; ++i ) {
546 for(
size_t j=0UL; j<n; ++j )
547 v_[i*NN+j] = array[i*n+j];
550 for(
size_t j=n; j<NN; ++j )
555 for(
size_t i=m; i<M; ++i ) {
556 for(
size_t j=0UL; j<NN; ++j )
583 template<
typename Type
587 template<
typename Other >
590 for(
size_t i=0UL; i<M; ++i ) {
591 for(
size_t j=0UL; j<N; ++j )
592 v_[i*NN+j] = array[i][j];
595 for(
size_t j=N; j<NN; ++j )
610 template<
typename Type
616 for(
size_t i=0UL; i<M*NN; ++i )
627 template<
typename Type
631 template<
typename Other
635 for(
size_t i=0UL; i<M; ++i ) {
636 for(
size_t j=0UL; j<N; ++j )
640 for(
size_t j=N; j<NN; ++j )
658 template<
typename Type
662 template<
typename MT
669 throw std::invalid_argument(
"Invalid setup of static matrix" );
672 for(
size_t i=0UL; i<M; ++i ) {
700 template<
typename Type
721 for(
size_t i=0UL; i<M; ++i ) {
722 for(
size_t j=N; j<NN; ++j )
748 template<
typename Type
771 for(
size_t i=0UL; i<M; ++i ) {
772 for(
size_t j=N; j<NN; ++j )
801 template<
typename Type
806 const Type& v3,
const Type& v4 )
819 else if( M == 2UL ) {
835 for(
size_t i=0UL; i<M; ++i ) {
836 for(
size_t j=N; j<NN; ++j )
864 template<
typename Type
869 const Type& v4,
const Type& v5 )
892 for(
size_t i=0UL; i<M; ++i ) {
893 for(
size_t j=N; j<NN; ++j )
925 template<
typename Type
930 const Type& v4,
const Type& v5,
const Type& v6 )
945 else if( M == 2UL ) {
955 else if( M == 3UL ) {
975 for(
size_t i=0UL; i<M; ++i ) {
976 for(
size_t j=N; j<NN; ++j )
1006 template<
typename Type
1011 const Type& v4,
const Type& v5,
const Type& v6,
1039 for(
size_t i=0UL; i<M; ++i ) {
1040 for(
size_t j=N; j<NN; ++j )
1041 v_[i*NN+j] = Type();
1073 template<
typename Type
1078 const Type& v4,
const Type& v5,
const Type& v6,
1079 const Type& v7,
const Type& v8 )
1096 else if( M == 2UL ) {
1108 else if( M == 4UL ) {
1114 v_[2UL*NN+1UL] = v6;
1116 v_[3UL*NN+1UL] = v8;
1132 for(
size_t i=0UL; i<M; ++i ) {
1133 for(
size_t j=N; j<NN; ++j )
1134 v_[i*NN+j] = Type();
1168 template<
typename Type
1173 const Type& v4,
const Type& v5,
const Type& v6,
1174 const Type& v7,
const Type& v8,
const Type& v9 )
1192 else if( M == 3UL ) {
1200 v_[2UL*NN+1UL] = v8;
1201 v_[2UL*NN+2UL] = v9;
1218 for(
size_t i=0UL; i<M; ++i ) {
1219 for(
size_t j=N; j<NN; ++j )
1220 v_[i*NN+j] = Type();
1255 template<
typename Type
1260 const Type& v4,
const Type& v5,
const Type& v6,
1261 const Type& v7,
const Type& v8,
const Type& v9,
1281 else if( M == 2UL ) {
1295 else if( M == 5UL ) {
1301 v_[2UL*NN+1UL] = v6;
1303 v_[3UL*NN+1UL] = v8;
1305 v_[4UL*NN+1UL] = v10;
1323 for(
size_t i=0UL; i<M; ++i ) {
1324 for(
size_t j=N; j<NN; ++j )
1325 v_[i*NN+j] = Type();
1347 template<
typename Type
1368 template<
typename Type
1391 template<
typename Type
1411 template<
typename Type
1430 template<
typename Type
1450 template<
typename Type
1473 template<
typename Type
1497 template<
typename Type
1521 template<
typename Type
1545 template<
typename Type
1569 template<
typename Type
1593 template<
typename Type
1635 template<
typename Type
1639 template<
typename Other >
1642 for(
size_t i=0UL; i<M; ++i )
1643 for(
size_t j=0UL; j<N; ++j )
1644 v_[i*NN+j] = array[i][j];
1657 template<
typename Type
1663 for(
size_t i=0UL; i<M; ++i )
1664 for(
size_t j=0UL; j<N; ++j )
1680 template<
typename Type
1700 template<
typename Type
1704 template<
typename Other
1728 template<
typename Type
1732 template<
typename MT
1739 throw std::invalid_argument(
"Invalid assignment to static matrix" );
1741 if( (~rhs).canAlias(
this ) ) {
1766 template<
typename Type
1770 template<
typename MT
1777 throw std::invalid_argument(
"Matrix sizes do not match" );
1779 if( (~rhs).canAlias(
this ) ) {
1802 template<
typename Type
1806 template<
typename MT
1813 throw std::invalid_argument(
"Matrix sizes do not match" );
1815 if( (~rhs).canAlias(
this ) ) {
1838 template<
typename Type
1842 template<
typename MT
1846 if( M != N || (~rhs).
rows() != M || (~rhs).
columns() != M )
1847 throw std::invalid_argument(
"Matrix sizes do not match" );
1850 return this->operator=( tmp );
1862 template<
typename Type
1866 template<
typename Other >
1872 assign( *
this, (*
this) * rhs );
1887 template<
typename Type
1891 template<
typename Other >
1899 assign( *
this, (*
this) / rhs );
1918 template<
typename Type
1934 template<
typename Type
1953 template<
typename Type
1969 template<
typename Type
1991 template<
typename Type
2008 template<
typename Type
2014 size_t nonzeros( 0UL );
2016 for(
size_t i=0UL; i<M; ++i )
2017 for(
size_t j=0UL; j<N; ++j )
2037 template<
typename Type
2045 const size_t jend( (i+1UL)*NN );
2046 size_t nonzeros( 0UL );
2048 for(
size_t j=i*NN; j<jend; ++j )
2062 template<
typename Type
2070 for(
size_t i=0UL; i<M; ++i )
2071 for(
size_t j=0UL; j<N; ++j )
2072 reset( v_[i*NN+j] );
2088 template<
typename Type
2097 for(
size_t j=0UL; j<N; ++j )
2098 reset( v_[i*NN+j] );
2108 template<
typename Type
2116 for(
size_t i=1UL; i<M; ++i )
2117 for(
size_t j=0UL; j<i; ++j )
2118 swap( v_[i*NN+j], v_[j*NN+i] );
2131 template<
typename Type
2135 template<
typename Other >
2138 for(
size_t i=0UL; i<M; ++i )
2139 for(
size_t j=0UL; j<N; ++j )
2140 v_[i*NN+j] *= scalar;
2154 template<
typename Type
2162 for(
size_t i=0UL; i<M; ++i ) {
2163 for(
size_t j=0UL; j<N; ++j ) {
2164 swap( v_[i*NN+j], m(i,j) );
2189 template<
typename Type
2193 template<
typename Other >
2196 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2211 template<
typename Type
2215 template<
typename Other >
2218 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2232 template<
typename Type
2258 template<
typename Type
2274 return load( &v_[i*NN+j] );
2294 template<
typename Type
2309 return loadu( &v_[i*NN+j] );
2330 template<
typename Type
2345 store( &v_[i*NN+j], value );
2366 template<
typename Type
2380 storeu( &v_[i*NN+j], value );
2401 template<
typename Type
2416 stream( &v_[i*NN+j], value );
2432 template<
typename Type
2436 template<
typename MT
2443 for(
size_t i=0UL; i<M; ++i ) {
2444 for(
size_t j=0UL; j<N; ++j ) {
2445 v_[i*NN+j] = (~rhs)(i,j);
2463 template<
typename Type
2467 template<
typename MT
2478 for(
size_t i=0UL; i<M; ++i ) {
2479 for(
size_t j=0UL; j<N; j+=IT::size ) {
2498 template<
typename Type
2502 template<
typename MT >
2509 for(
size_t i=0UL; i<M; ++i )
2510 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2511 v_[i*NN+element->index()] = element->value();
2527 template<
typename Type
2531 template<
typename MT >
2538 for(
size_t j=0UL; j<N; ++j )
2539 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2540 v_[element->index()*NN+j] = element->value();
2556 template<
typename Type
2560 template<
typename MT
2567 for(
size_t i=0UL; i<M; ++i ) {
2568 for(
size_t j=0UL; j<N; ++j ) {
2569 v_[i*NN+j] += (~rhs)(i,j);
2587 template<
typename Type
2591 template<
typename MT
2603 for(
size_t i=0UL; i<M; ++i ) {
2604 for(
size_t j=0UL; j<N; j+=IT::size ) {
2605 store( &v_[i*NN+j],
load( &v_[i*NN+j] ) + (~rhs).
load(i,j) );
2623 template<
typename Type
2627 template<
typename MT >
2634 for(
size_t i=0UL; i<M; ++i )
2635 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2636 v_[i*NN+element->index()] += element->value();
2652 template<
typename Type
2656 template<
typename MT >
2663 for(
size_t j=0UL; j<N; ++j )
2664 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2665 v_[element->index()*NN+j] += element->value();
2681 template<
typename Type
2685 template<
typename MT
2692 for(
size_t i=0UL; i<M; ++i ) {
2693 for(
size_t j=0UL; j<N; ++j ) {
2694 v_[i*NN+j] -= (~rhs)(i,j);
2712 template<
typename Type
2716 template<
typename MT
2728 for(
size_t i=0UL; i<M; ++i ) {
2729 for(
size_t j=0UL; j<N; j+=IT::size ) {
2730 store( &v_[i*NN+j],
load( &v_[i*NN+j] ) - (~rhs).
load(i,j) );
2748 template<
typename Type
2752 template<
typename MT >
2759 for(
size_t i=0UL; i<M; ++i )
2760 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2761 v_[i*NN+element->index()] -= element->value();
2777 template<
typename Type
2781 template<
typename MT >
2788 for(
size_t j=0UL; j<N; ++j )
2789 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2790 v_[element->index()*NN+j] -= element->value();
2815 template<
typename Type
2827 enum { MM = M + ( IT::size - ( M % IT::size ) ) % IT::size };
2832 typedef StaticMatrix<Type,M,N,true>
This;
2842 typedef DenseIterator<Type>
Iterator;
2852 enum { vectorizable = IsVectorizable<Type>::value };
2858 enum { smpAssignable = 0 };
2867 template<
typename Other >
explicit inline StaticMatrix(
size_t m,
size_t n,
const Other* array );
2868 template<
typename Other >
explicit inline StaticMatrix(
const Other (&array)[M][N] );
2871 template<
typename Other,
bool SO >
inline StaticMatrix(
const StaticMatrix<Other,M,N,SO>& m );
2872 template<
typename MT ,
bool SO >
inline StaticMatrix(
const Matrix<MT,SO>& m );
2875 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3 );
2876 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4 );
2877 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5 );
2878 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
2880 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
2881 const Type& v6,
const Type& v7 );
2882 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
2883 const Type& v6,
const Type& v7,
const Type& v8 );
2884 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
2885 const Type& v6,
const Type& v7,
const Type& v8,
const Type& v9 );
2886 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
2887 const Type& v6,
const Type& v7,
const Type& v8,
const Type& v9,
const Type& v10 );
2900 inline Type*
data ();
2901 inline const Type*
data ()
const;
2902 inline Type*
data (
size_t j );
2903 inline const Type*
data (
size_t j )
const;
2916 template<
typename Other >
2917 inline StaticMatrix& operator=(
const Other (&array)[M][N] );
2921 template<
typename Other,
bool SO >
inline StaticMatrix& operator= (
const StaticMatrix<Other,M,N,SO>& rhs );
2922 template<
typename MT ,
bool SO >
inline StaticMatrix& operator= (
const Matrix<MT,SO>& rhs );
2923 template<
typename MT ,
bool SO >
inline StaticMatrix& operator+=(
const Matrix<MT,SO>& rhs );
2924 template<
typename MT ,
bool SO >
inline StaticMatrix& operator-=(
const Matrix<MT,SO>& rhs );
2925 template<
typename MT ,
bool SO >
inline StaticMatrix& operator*=(
const Matrix<MT,SO>& rhs );
2927 template<
typename Other >
2928 inline typename EnableIf< IsNumeric<Other>,
StaticMatrix >::Type&
2929 operator*=( Other rhs );
2931 template<
typename Other >
2932 inline typename EnableIf< IsNumeric<Other>,
StaticMatrix >::Type&
2933 operator/=( Other rhs );
2940 inline size_t rows()
const;
2941 inline size_t columns()
const;
2942 inline size_t spacing()
const;
2944 inline size_t capacity(
size_t j )
const;
2946 inline size_t nonZeros(
size_t j )
const;
2947 inline void reset();
2948 inline void reset(
size_t i );
2950 template<
typename Other >
inline StaticMatrix& scale(
const Other& scalar );
2958 template<
typename MT >
2959 struct VectorizedAssign {
2960 enum { value = vectorizable && MT::vectorizable &&
2961 IsSame<Type,typename MT::ElementType>::value &&
2962 IsColumnMajorMatrix<MT>::value };
2968 template<
typename MT >
2969 struct VectorizedAddAssign {
2970 enum { value = vectorizable && MT::vectorizable &&
2971 IsSame<Type,typename MT::ElementType>::value &&
2972 IntrinsicTrait<Type>::addition &&
2973 IsColumnMajorMatrix<MT>::value };
2979 template<
typename MT >
2980 struct VectorizedSubAssign {
2981 enum { value = vectorizable && MT::vectorizable &&
2982 IsSame<Type,typename MT::ElementType>::value &&
2983 IntrinsicTrait<Type>::subtraction &&
2984 IsColumnMajorMatrix<MT>::value };
2992 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
2993 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
3003 template<
typename MT,
bool SO >
3004 inline typename DisableIf< VectorizedAssign<MT> >::Type
3005 assign(
const DenseMatrix<MT,SO>& rhs );
3007 template<
typename MT,
bool SO >
3008 inline typename EnableIf< VectorizedAssign<MT> >::Type
3009 assign(
const DenseMatrix<MT,SO>& rhs );
3011 template<
typename MT >
inline void assign(
const SparseMatrix<MT,true>& rhs );
3012 template<
typename MT >
inline void assign(
const SparseMatrix<MT,false>& rhs );
3014 template<
typename MT,
bool SO >
3015 inline typename DisableIf< VectorizedAddAssign<MT> >::Type
3016 addAssign(
const DenseMatrix<MT,SO>& rhs );
3018 template<
typename MT,
bool SO >
3019 inline typename EnableIf< VectorizedAddAssign<MT> >::Type
3020 addAssign(
const DenseMatrix<MT,SO>& rhs );
3022 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,true>& rhs );
3023 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,false>& rhs );
3025 template<
typename MT,
bool SO >
3026 inline typename DisableIf< VectorizedSubAssign<MT> >::Type
3027 subAssign(
const DenseMatrix<MT,SO>& rhs );
3029 template<
typename MT,
bool SO >
3030 inline typename EnableIf< VectorizedSubAssign<MT> >::Type
3031 subAssign(
const DenseMatrix<MT,SO>& rhs );
3033 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,true>& rhs );
3034 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,false>& rhs );
3042 AlignedArray<Type,MM*N>
v_;
3075 template<
typename Type
3080 if( IsNumeric<Type>::value ) {
3081 for(
size_t i=0UL; i<MM*N; ++i )
3095 template<
typename Type
3100 for(
size_t j=0UL; j<N; ++j ) {
3101 for(
size_t i=0UL; i<M; ++i )
3104 if( IsNumeric<Type>::value ) {
3105 for(
size_t i=M; i<MM; ++i )
3106 v_[i+j*MM] = Type();
3141 template<
typename Type
3144 template<
typename Other >
3147 if( m > M || n > N )
3148 throw std::invalid_argument(
"Invalid setup of static matrix" );
3150 for(
size_t j=0UL; j<n; ++j ) {
3151 for(
size_t i=0UL; i<m; ++i )
3152 v_[i+j*MM] = array[i+j*m];
3154 if( IsNumeric<Type>::value ) {
3155 for(
size_t i=m; i<MM; ++i )
3156 v_[i+j*MM] = Type();
3160 for(
size_t j=n; j<N; ++j ) {
3161 for(
size_t i=0UL; i<M; ++i )
3162 v_[i+j*MM] = Type();
3190 template<
typename Type
3193 template<
typename Other >
3196 for(
size_t j=0UL; j<N; ++j ) {
3197 for(
size_t i=0UL; i<M; ++i )
3198 v_[i+j*MM] = array[i][j];
3200 if( IsNumeric<Type>::value ) {
3201 for(
size_t i=M; i<MM; ++i )
3202 v_[i+j*MM] = Type();
3218 template<
typename Type
3223 for(
size_t i=0UL; i<MM*N; ++i )
3236 template<
typename Type
3239 template<
typename Other
3243 for(
size_t j=0UL; j<N; ++j ) {
3244 for(
size_t i=0UL; i<M; ++i )
3245 v_[i+j*MM] = m(i,j);
3247 if( IsNumeric<Type>::value ) {
3248 for(
size_t i=M; i<MM; ++i )
3249 v_[i+j*MM] = Type();
3268 template<
typename Type
3271 template<
typename MT
3278 throw std::invalid_argument(
"Invalid setup of static matrix" );
3280 if( IsNumeric<Type>::value ) {
3281 for(
size_t j=0UL; j<N; ++j )
3282 for(
size_t i=( IsSparseMatrix<MT>::value )?( 0UL ):( M ); i<MM; ++i ) {
3283 v_[i+j*MM] = Type();
3311 template<
typename Type
3330 if( IsNumeric<Type>::value ) {
3331 for(
size_t j=0UL; j<N; ++j )
3332 for(
size_t i=M; i<MM; ++i ) {
3333 v_[i+j*MM] = Type();
3360 template<
typename Type
3381 if( IsNumeric<Type>::value ) {
3382 for(
size_t j=0UL; j<N; ++j )
3383 for(
size_t i=M; i<MM; ++i ) {
3384 v_[i+j*MM] = Type();
3414 template<
typename Type
3431 else if( N == 2UL ) {
3446 if( IsNumeric<Type>::value ) {
3447 for(
size_t j=0UL; j<N; ++j )
3448 for(
size_t i=M; i<MM; ++i ) {
3449 v_[i+j*MM] = Type();
3478 template<
typename Type
3482 const Type& v4,
const Type& v5 )
3504 if( IsNumeric<Type>::value ) {
3505 for(
size_t j=0UL; j<N; ++j )
3506 for(
size_t i=M; i<MM; ++i ) {
3507 v_[i+j*MM] = Type();
3540 template<
typename Type
3544 const Type& v4,
const Type& v5,
const Type& v6 )
3559 else if( N == 2UL ) {
3569 else if( N == 3UL ) {
3575 v_[2UL*MM+1UL] = v6;
3588 if( IsNumeric<Type>::value ) {
3589 for(
size_t j=0UL; j<N; ++j )
3590 for(
size_t i=M; i<MM; ++i ) {
3591 v_[i+j*MM] = Type();
3622 template<
typename Type
3626 const Type& v4,
const Type& v5,
const Type& v6,
3653 if( IsNumeric<Type>::value ) {
3654 for(
size_t j=0UL; j<N; ++j )
3655 for(
size_t i=M; i<MM; ++i ) {
3656 v_[i+j*MM] = Type();
3691 template<
typename Type
3695 const Type& v4,
const Type& v5,
const Type& v6,
3696 const Type& v7,
const Type& v8 )
3713 else if( N == 2UL ) {
3725 else if( N == 4UL ) {
3731 v_[2UL*MM+1UL] = v6;
3733 v_[3UL*MM+1UL] = v8;
3748 if( IsNumeric<Type>::value ) {
3749 for(
size_t j=0UL; j<N; ++j )
3750 for(
size_t i=M; i<MM; ++i ) {
3751 v_[i+j*MM] = Type();
3787 template<
typename Type
3791 const Type& v4,
const Type& v5,
const Type& v6,
3792 const Type& v7,
const Type& v8,
const Type& v9 )
3810 else if( N == 3UL ) {
3818 v_[2UL*MM+1UL] = v8;
3819 v_[2UL*MM+2UL] = v9;
3835 if( IsNumeric<Type>::value ) {
3836 for(
size_t j=0UL; j<N; ++j )
3837 for(
size_t i=M; i<MM; ++i ) {
3838 v_[i+j*MM] = Type();
3875 template<
typename Type
3879 const Type& v4,
const Type& v5,
const Type& v6,
3880 const Type& v7,
const Type& v8,
const Type& v9,
3900 else if( N == 2UL ) {
3914 else if( N == 5UL ) {
3920 v_[2UL*MM+1UL] = v6;
3922 v_[3UL*MM+1UL] = v8;
3924 v_[4UL*MM+1UL] = v10;
3941 if( IsNumeric<Type>::value ) {
3942 for(
size_t j=0UL; j<N; ++j )
3943 for(
size_t i=M; i<MM; ++i ) {
3944 v_[i+j*MM] = Type();
3968 template<
typename Type
3990 template<
typename Type
4014 template<
typename Type
4035 template<
typename Type
4055 template<
typename Type
4076 template<
typename Type
4095 template<
typename Type
4115 template<
typename Type
4135 template<
typename Type
4155 template<
typename Type
4175 template<
typename Type
4195 template<
typename Type
4238 template<
typename Type
4241 template<
typename Other >
4242 inline StaticMatrix<Type,M,N,true>&
4243 StaticMatrix<Type,M,N,true>::operator=(
const Other (&array)[M][N] )
4245 for(
size_t j=0UL; j<N; ++j )
4246 for(
size_t i=0UL; i<M; ++i )
4247 v_[i+j*MM] = array[i][j];
4262 template<
typename Type
4265 inline StaticMatrix<Type,M,N,true>&
4266 StaticMatrix<Type,M,N,true>::operator=(
const Type&
set )
4268 for(
size_t j=0UL; j<N; ++j )
4269 for(
size_t i=0UL; i<M; ++i )
4287 template<
typename Type
4290 inline StaticMatrix<Type,M,N,true>&
4291 StaticMatrix<Type,M,N,true>::operator=(
const StaticMatrix& rhs )
4309 template<
typename Type
4312 template<
typename Other
4314 inline StaticMatrix<Type,M,N,true>&
4315 StaticMatrix<Type,M,N,true>::operator=(
const StaticMatrix<Other,M,N,SO>& rhs )
4338 template<
typename Type
4341 template<
typename MT
4343 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator=(
const Matrix<MT,SO>& rhs )
4348 throw std::invalid_argument(
"Invalid assignment to static matrix" );
4350 if( (~rhs).canAlias(
this ) ) {
4351 StaticMatrix tmp( ~rhs );
4355 if( IsSparseMatrix<MT>::value )
4377 template<
typename Type
4380 template<
typename MT
4382 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator+=(
const Matrix<MT,SO>& rhs )
4387 throw std::invalid_argument(
"Matrix sizes do not match" );
4389 if( (~rhs).canAlias(
this ) ) {
4390 StaticMatrix tmp( ~rhs );
4414 template<
typename Type
4417 template<
typename MT
4419 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator-=(
const Matrix<MT,SO>& rhs )
4424 throw std::invalid_argument(
"Matrix sizes do not match" );
4426 if( (~rhs).canAlias(
this ) ) {
4427 StaticMatrix tmp( ~rhs );
4451 template<
typename Type
4454 template<
typename MT
4456 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator*=(
const Matrix<MT,SO>& rhs )
4458 if( M != N || (~rhs).
rows() != M || (~rhs).
columns() != M )
4459 throw std::invalid_argument(
"Matrix sizes do not match" );
4461 StaticMatrix tmp( *
this * (~rhs) );
4462 return this->operator=( tmp );
4476 template<
typename Type
4479 template<
typename Other >
4480 inline typename EnableIf< IsNumeric<Other>, StaticMatrix<Type,M,N,true> >::Type&
4481 StaticMatrix<Type,M,N,true>::operator*=( Other rhs )
4485 assign( *
this, (*
this) * rhs );
4502 template<
typename Type
4505 template<
typename Other >
4506 inline typename EnableIf< IsNumeric<Other>, StaticMatrix<Type,M,N,true> >::Type&
4507 StaticMatrix<Type,M,N,true>::operator/=( Other rhs )
4513 assign( *
this, (*
this) / rhs );
4534 template<
typename Type
4551 template<
typename Type
4571 template<
typename Type
4588 template<
typename Type
4606 template<
typename Type
4624 template<
typename Type
4629 size_t nonzeros( 0UL );
4631 for(
size_t j=0UL; j<N; ++j )
4632 for(
size_t i=0UL; i<M; ++i )
4649 template<
typename Type
4656 const size_t iend( (j+1UL)*MM );
4657 size_t nonzeros( 0UL );
4659 for(
size_t i=j*MM; i<iend; ++i )
4675 template<
typename Type
4682 for(
size_t j=0UL; j<N; ++j )
4683 for(
size_t i=0UL; i<M; ++i )
4684 reset( v_[i+j*MM] );
4700 template<
typename Type
4708 for(
size_t i=0UL; i<M; ++i )
4709 reset( v_[i+j*MM] );
4721 template<
typename Type
4728 for(
size_t j=1UL; j<N; ++j )
4729 for(
size_t i=0UL; i<j; ++i )
4730 swap( v_[i+j*MM], v_[j+i*MM] );
4745 template<
typename Type
4748 template<
typename Other >
4749 inline StaticMatrix<Type,M,N,true>&
4750 StaticMatrix<Type,M,N,true>::scale(
const Other& scalar )
4752 for(
size_t j=0UL; j<N; ++j )
4753 for(
size_t i=0UL; i<M; ++i )
4754 v_[i+j*MM] *= scalar;
4770 template<
typename Type
4777 for(
size_t j=0UL; j<N; ++j ) {
4778 for(
size_t i=0UL; i<M; ++i ) {
4779 swap( v_[i+j*MM], m(i,j) );
4806 template<
typename Type
4809 template<
typename Other >
4812 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
4829 template<
typename Type
4832 template<
typename Other >
4835 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
4851 template<
typename Type
4877 template<
typename Type
4880 inline typename StaticMatrix<Type,M,N,true>::IntrinsicType
4892 return load( &v_[i+j*MM] );
4913 template<
typename Type
4916 inline typename StaticMatrix<Type,M,N,true>::IntrinsicType
4927 return loadu( &v_[i+j*MM] );
4949 template<
typename Type
4963 store( &v_[i+j*MM], value );
4985 template<
typename Type
4998 storeu( &v_[i+j*MM], value );
5021 template<
typename Type
5035 stream( &v_[i+j*MM], value );
5053 template<
typename Type
5056 template<
typename MT
5058 inline typename DisableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAssign<MT> >::Type
5063 for(
size_t j=0UL; j<N; ++j ) {
5064 for(
size_t i=0UL; i<M; ++i ) {
5065 v_[i+j*MM] = (~rhs)(i,j);
5085 template<
typename Type
5088 template<
typename MT
5090 inline typename EnableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAssign<MT> >::Type
5099 for(
size_t j=0UL; j<N; ++j ) {
5100 for(
size_t i=0UL; i<M; i+=IT::size ) {
5121 template<
typename Type
5124 template<
typename MT >
5131 for(
size_t j=0UL; j<N; ++j )
5132 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5133 v_[element->index()+j*MM] = element->value();
5151 template<
typename Type
5154 template<
typename MT >
5161 for(
size_t i=0UL; i<M; ++i )
5162 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5163 v_[i+element->index()*MM] = element->value();
5181 template<
typename Type
5184 template<
typename MT
5186 inline typename DisableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >::Type
5191 for(
size_t j=0UL; j<N; ++j ) {
5192 for(
size_t i=0UL; i<M; ++i ) {
5193 v_[i+j*MM] += (~rhs)(i,j);
5213 template<
typename Type
5216 template<
typename MT
5218 inline typename EnableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >::Type
5228 for(
size_t j=0UL; j<N; ++j ) {
5229 for(
size_t i=0UL; i<M; i+=IT::size ) {
5230 store( &v_[i+j*MM],
load( &v_[i+j*MM] ) + (~rhs).
load(i,j) );
5250 template<
typename Type
5253 template<
typename MT >
5260 for(
size_t j=0UL; j<N; ++j )
5261 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5262 v_[element->index()+j*MM] += element->value();
5280 template<
typename Type
5283 template<
typename MT >
5290 for(
size_t i=0UL; i<M; ++i )
5291 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5292 v_[i+element->index()*MM] += element->value();
5310 template<
typename Type
5313 template<
typename MT
5315 inline typename DisableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >::Type
5320 for(
size_t j=0UL; j<N; ++j ) {
5321 for(
size_t i=0UL; i<M; ++i ) {
5322 v_[i+j*MM] -= (~rhs)(i,j);
5342 template<
typename Type
5345 template<
typename MT
5347 inline typename EnableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >::Type
5357 for(
size_t j=0UL; j<N; ++j ) {
5358 for(
size_t i=0UL; i<M; i+=IT::size ) {
5359 store( &v_[i+j*MM],
load( &v_[i+j*MM] ) - (~rhs).
load(i,j) );
5379 template<
typename Type
5382 template<
typename MT >
5389 for(
size_t j=0UL; j<N; ++j )
5390 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5391 v_[element->index()+j*MM] -= element->value();
5409 template<
typename Type
5412 template<
typename MT >
5419 for(
size_t i=0UL; i<M; ++i )
5420 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5421 v_[i+element->index()*MM] -= element->value();
5447 template<
typename Type
5450 class StaticMatrix<Type,M,0UL,SO>;
5463 template<
typename Type
5466 class StaticMatrix<Type,0UL,N,SO>;
5479 template<
typename Type
5481 class StaticMatrix<Type,0UL,0UL,SO>;
5501 template<
typename Type,
size_t M,
size_t N,
bool SO >
5502 inline void reset( StaticMatrix<Type,M,N,SO>& m );
5504 template<
typename Type,
size_t M,
size_t N,
bool SO >
5505 inline void clear( StaticMatrix<Type,M,N,SO>& m );
5507 template<
typename Type,
size_t M,
size_t N,
bool SO >
5508 inline bool isDefault(
const StaticMatrix<Type,M,N,SO>& m );
5510 template<
typename Type,
size_t M,
size_t N,
bool SO >
5511 inline void swap( StaticMatrix<Type,M,N,SO>& a, StaticMatrix<Type,M,N,SO>& b ) ;
5523 template<
typename Type
5543 template<
typename Type
5561 template<
typename Type
5568 for(
size_t i=0UL; i<M; ++i )
5569 for(
size_t j=0UL; j<N; ++j )
5570 if( !
isDefault( m(i,j) ) )
return false;
5573 for(
size_t j=0UL; j<N; ++j )
5574 for(
size_t i=0UL; i<M; ++i )
5575 if( !
isDefault( m(i,j) ) )
return false;
5592 template<
typename Type
5613 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5614 struct AddTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
5616 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N, SO > Type;
5619 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5620 struct AddTrait< StaticMatrix<T1,M,N,SO1>, StaticMatrix<T2,M,N,SO2> >
5622 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N,
false > Type;
5638 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5639 struct SubTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
5641 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N, SO > Type;
5644 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
5645 struct SubTrait< StaticMatrix<T1,M,N,SO1>, StaticMatrix<T2,M,N,SO2> >
5647 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N,
false > Type;
5663 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5664 struct MultTrait< StaticMatrix<T1,M,N,SO>, T2 >
5666 typedef StaticMatrix< typename MultTrait<T1,T2>::Type, M, N, SO > Type;
5670 template<
typename T1,
typename T2,
size_t M,
size_t N,
bool SO >
5671 struct MultTrait< T1, StaticMatrix<T2,M,N,SO> >
5673 typedef StaticMatrix< typename MultTrait<T1,T2>::Type, M, N, SO > Type;
5677 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5678 struct MultTrait< StaticMatrix<T1,M,N,SO>, StaticVector<T2,N,false> >
5680 typedef StaticVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
5683 template<
typename T1,
size_t M,
typename T2,
size_t N,
bool SO >
5684 struct MultTrait< StaticVector<T1,M,true>, StaticMatrix<T2,M,N,SO> >
5686 typedef StaticVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
5689 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2,
size_t L >
5690 struct MultTrait< StaticMatrix<T1,M,N,SO>, HybridVector<T2,L,false> >
5692 typedef StaticVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
5695 template<
typename T1,
size_t L,
typename T2,
size_t M,
size_t N,
bool SO >
5696 struct MultTrait< HybridVector<T1,L,true>, StaticMatrix<T2,M,N,SO> >
5698 typedef StaticVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
5701 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5702 struct MultTrait< StaticMatrix<T1,M,N,SO>, DynamicVector<T2,false> >
5704 typedef StaticVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
5707 template<
typename T1,
typename T2,
size_t M,
size_t N,
bool SO >
5708 struct MultTrait< DynamicVector<T1,true>, StaticMatrix<T2,M,N,SO> >
5710 typedef StaticVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
5713 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5714 struct MultTrait< StaticMatrix<T1,M,N,SO>, CompressedVector<T2,false> >
5716 typedef StaticVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
5719 template<
typename T1,
typename T2,
size_t M,
size_t N,
bool SO >
5720 struct MultTrait< CompressedVector<T1,true>, StaticMatrix<T2,M,N,SO> >
5722 typedef StaticVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
5725 template<
typename T1,
size_t M,
size_t K,
bool SO1,
typename T2,
size_t N,
bool SO2 >
5726 struct MultTrait< StaticMatrix<T1,M,K,SO1>, StaticMatrix<T2,K,N,SO2> >
5728 typedef StaticMatrix< typename MultTrait<T1,T2>::Type, M, N, SO1 > Type;
5744 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5745 struct DivTrait< StaticMatrix<T1,M,N,SO>, T2 >
5747 typedef StaticMatrix< typename DivTrait<T1,T2>::Type, M, N, SO > Type;
5764 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
5765 struct MathTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
5767 typedef StaticMatrix< typename MathTrait<T1,T2>::HighType, M, N, SO > HighType;
5768 typedef StaticMatrix< typename MathTrait<T1,T2>::LowType , M, N, SO > LowType;
5784 template<
typename T1,
size_t M,
size_t N,
bool SO >
5785 struct SubmatrixTrait< StaticMatrix<T1,M,N,SO> >
5787 typedef DynamicMatrix<T1,SO> Type;
5803 template<
typename T1,
size_t M,
size_t N,
bool SO >
5804 struct RowTrait< StaticMatrix<T1,M,N,SO> >
5806 typedef StaticVector<T1,N,true> Type;
5822 template<
typename T1,
size_t M,
size_t N,
bool SO >
5823 struct ColumnTrait< StaticMatrix<T1,M,N,SO> >
5825 typedef StaticVector<T1,M,false> Type;
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:216
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 reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4579
#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
EnableIf< IsIntegral< T >, Load< T, sizeof(T)> >::Type::Type load(const T *address)
Loads a vector of integral values.
Definition: Load.h:222
Header file for the subtraction trait.
size_t nonZeros() const
Returns the total number of non-zero elements in the matrix.
Definition: StaticMatrix.h:2012
const bool defaultStorageOrder
The default storage order for all matrices of the Blaze library.This value specifies the default stor...
Definition: StorageOrder.h:56
Header file for the row trait.
bool canAlias(const Other *alias) const
Returns whether the matrix can alias with the given address alias.
Definition: StaticMatrix.h:2194
Header file for the IsSparseMatrix type trait.
bool isDefault(const DynamicMatrix< Type, SO > &m)
Returns whether the given dense matrix is in default state.
Definition: DynamicMatrix.h:4622
const Type & ConstReference
Reference to a constant matrix value.
Definition: StaticMatrix.h:224
StaticMatrix()
The default constructor for StaticMatrix.
Definition: StaticMatrix.h:475
EnableIf< IsIntegral< T >, Loadu< T, sizeof(T)> >::Type::Type loadu(const T *address)
Loads a vector of integral values.
Definition: Loadu.h:219
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:2370
Header file for the IsColumnMajorMatrix type trait.
StaticMatrix< Type, N, M,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: StaticMatrix.h:218
void storeu(float *address, const sse_float_t &value)
Unaligned store of a vector of 'float' values.
Definition: Storeu.h:234
Type ElementType
Type of the matrix elements.
Definition: StaticMatrix.h:219
AlignedArray< Type, M *NN > v_
The statically allocated matrix elements.
Definition: StaticMatrix.h:431
#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
Iterator end(size_t i)
Returns an iterator just past the last element of row/column i.
Definition: StaticMatrix.h:1550
void clear(DynamicMatrix< Type, SO > &m)
Clearing the given dense matrix.
Definition: DynamicMatrix.h:4595
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:104
Constraint on the data type.
bool isAligned() const
Returns whether the matrix is properly aligned in memory.
Definition: StaticMatrix.h:2236
Header file for the SparseMatrix base class.
void stream(float *address, const sse_float_t &value)
Aligned, non-temporal store of a vector of 'float' values.
Definition: Stream.h:233
ConstIterator cend(size_t i) const
Returns an iterator just past the last element of row/column i.
Definition: StaticMatrix.h:1598
Header file for the DisableIf class template.
StaticMatrix & transpose()
Transposing the matrix.
Definition: StaticMatrix.h:2112
void swap(StaticMatrix &m)
Swapping the contents of two static matrices.
Definition: StaticMatrix.h:2158
Header file for the multiplication trait.
Header file for nested template disabiguation.
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two sparse matrices.
Definition: CompressedMatrix.h:4558
DenseIterator< Type > Iterator
Iterator over non-constant elements.
Definition: StaticMatrix.h:225
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2388
#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:50
Header file for the DenseMatrix base class.
Header file for the DenseIterator class template.
void reset()
Reset to the default initial values.
Definition: StaticMatrix.h:2066
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:179
Constraint on the data type.
size_t columns() const
Returns the current number of columns of the matrix.
Definition: StaticMatrix.h:1938
IntrinsicType loadu(size_t i, size_t j) const
Unaligned load of an intrinsic element of the matrix.
Definition: StaticMatrix.h:2299
const This & CompositeType
Data type for composite expression templates.
Definition: StaticMatrix.h:222
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:1973
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2386
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:2216
ConstIterator cbegin(size_t i) const
Returns an iterator to the first element of row/column i.
Definition: StaticMatrix.h:1526
Iterator begin(size_t i)
Returns an iterator to the first element of row/column i.
Definition: StaticMatrix.h:1478
Header file for the equal shim.
Reference operator()(size_t i, size_t j)
2D-access to the matrix elements.
Definition: StaticMatrix.h:1352
Header file for the IsVectorizable type trait.
StaticMatrix< Type, M, N, SO > This
Type of this StaticMatrix instance.
Definition: StaticMatrix.h:215
Header file for the IsNumeric type trait.
Type * data()
Low-level data access to the matrix elements.
Definition: StaticMatrix.h:1395
IntrinsicTrait< Type > IT
Intrinsic trait for the matrix element type.
Definition: StaticMatrix.h:205
IT::Type IntrinsicType
Intrinsic type of the matrix elements.
Definition: StaticMatrix.h:220
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:748
Header file for run time assertion macros.
Header file for the addition trait.
Header file for the division trait.
void swap(DynamicMatrix< Type, SO > &a, DynamicMatrix< Type, SO > &b)
Swapping the contents of two matrices.
Definition: DynamicMatrix.h:4651
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:209
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
Header file for the reset shim.
Header file for the AlignedArray implementation.
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:239
#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:2387
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:85
Constraint on the data type.
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:2334
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:1957
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:1922
const Type & ReturnType
Return type for expression template evaluations.
Definition: StaticMatrix.h:221
DenseIterator< const Type > ConstIterator
Iterator over constant elements.
Definition: StaticMatrix.h:226
Type & Reference
Reference to a non-constant matrix value.
Definition: StaticMatrix.h:223
size_t columns(const Matrix< MT, SO > &m)
Returns the current number of columns of the matrix.
Definition: Matrix.h:154
Header file for basic type definitions.
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:2385
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:2405
#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
StaticMatrix< Type, M, N,!SO > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: StaticMatrix.h:217
size_t rows(const Matrix< MT, SO > &m)
Returns the current number of rows of the matrix.
Definition: Matrix.h:138
#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:2263
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:209
void store(float *address, const sse_float_t &value)
Aligned store of a vector of 'float' values.
Definition: Store.h:242