35 #ifndef _BLAZE_MATH_DENSE_STATICMATRIX_H_
36 #define _BLAZE_MATH_DENSE_STATICMATRIX_H_
177 template<
typename Type
181 class StaticMatrix :
public DenseMatrix< StaticMatrix<Type,M,N,SO>, SO >
190 enum { NN = N + ( IT::size - ( N % IT::size ) ) % IT::size };
223 enum { smpAssignable = 0 };
232 template<
typename Other >
explicit inline StaticMatrix(
size_t m,
size_t n,
const Other* array );
233 template<
typename Other >
explicit inline StaticMatrix(
const Other (&array)[M][N] );
236 template<
typename Other,
bool SO2 >
inline StaticMatrix(
const StaticMatrix<Other,M,N,SO2>& m );
237 template<
typename MT ,
bool SO2 >
inline StaticMatrix(
const Matrix<MT,SO2>& m );
240 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3 );
241 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4 );
242 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5 );
243 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
245 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
246 const Type& v6,
const Type& v7 );
247 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
248 const Type& v6,
const Type& v7,
const Type& v8 );
249 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
250 const Type& v6,
const Type& v7,
const Type& v8,
const Type& v9 );
251 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
252 const Type& v6,
const Type& v7,
const Type& v8,
const Type& v9,
const Type& v10 );
281 template<
typename Other >
282 inline StaticMatrix& operator=(
const Other (&array)[M][N] );
286 template<
typename Other,
bool SO2 >
inline StaticMatrix& operator= (
const StaticMatrix<Other,M,N,SO2>& rhs );
287 template<
typename MT ,
bool SO2 >
inline StaticMatrix& operator= (
const Matrix<MT,SO2>& rhs );
288 template<
typename MT ,
bool SO2 >
inline StaticMatrix& operator+=(
const Matrix<MT,SO2>& rhs );
289 template<
typename MT ,
bool SO2 >
inline StaticMatrix& operator-=(
const Matrix<MT,SO2>& rhs );
290 template<
typename MT ,
bool SO2 >
inline StaticMatrix& operator*=(
const Matrix<MT,SO2>& rhs );
292 template<
typename Other >
293 inline typename EnableIf< IsNumeric<Other>,
StaticMatrix >::Type&
294 operator*=( Other rhs );
296 template<
typename Other >
297 inline typename EnableIf< IsNumeric<Other>,
StaticMatrix >::Type&
298 operator/=( Other rhs );
305 inline size_t rows()
const;
309 inline size_t capacity(
size_t i )
const;
311 inline size_t nonZeros(
size_t i )
const;
313 inline void reset(
size_t i );
315 template<
typename Other >
inline StaticMatrix& scale(
const Other& scalar );
323 static inline void*
operator new ( std::size_t size );
324 static inline void*
operator new[]( std::size_t size );
325 static inline void*
operator new ( std::size_t size,
const std::nothrow_t& );
326 static inline void*
operator new[]( std::size_t size,
const std::nothrow_t& );
328 static inline void operator delete (
void* ptr );
329 static inline void operator delete[](
void* ptr );
330 static inline void operator delete (
void* ptr,
const std::nothrow_t& );
331 static inline void operator delete[](
void* ptr,
const std::nothrow_t& );
338 template<
typename MT >
340 struct VectorizedAssign {
341 enum { value = vectorizable && MT::vectorizable &&
342 IsSame<Type,typename MT::ElementType>::value &&
343 IsRowMajorMatrix<MT>::value };
350 template<
typename MT >
352 struct VectorizedAddAssign {
353 enum { value = vectorizable && MT::vectorizable &&
354 IsSame<Type,typename MT::ElementType>::value &&
355 IntrinsicTrait<Type>::addition &&
356 IsRowMajorMatrix<MT>::value };
363 template<
typename MT >
365 struct VectorizedSubAssign {
366 enum { value = vectorizable && MT::vectorizable &&
367 IsSame<Type,typename MT::ElementType>::value &&
368 IntrinsicTrait<Type>::subtraction &&
369 IsRowMajorMatrix<MT>::value };
378 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
379 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
389 template<
typename MT,
bool SO2 >
390 inline typename DisableIf< VectorizedAssign<MT> >::Type
391 assign(
const DenseMatrix<MT,SO2>& rhs );
393 template<
typename MT,
bool SO2 >
394 inline typename EnableIf< VectorizedAssign<MT> >::Type
395 assign(
const DenseMatrix<MT,SO2>& rhs );
397 template<
typename MT >
inline void assign(
const SparseMatrix<MT,SO>& rhs );
398 template<
typename MT >
inline void assign(
const SparseMatrix<MT,!SO>& rhs );
400 template<
typename MT,
bool SO2 >
401 inline typename DisableIf< VectorizedAddAssign<MT> >::Type
402 addAssign(
const DenseMatrix<MT,SO2>& rhs );
404 template<
typename MT,
bool SO2 >
405 inline typename EnableIf< VectorizedAddAssign<MT> >::Type
406 addAssign(
const DenseMatrix<MT,SO2>& rhs );
408 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,SO>& rhs );
409 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,!SO>& rhs );
411 template<
typename MT,
bool SO2 >
412 inline typename DisableIf< VectorizedSubAssign<MT> >::Type
413 subAssign(
const DenseMatrix<MT,SO2>& rhs );
415 template<
typename MT,
bool SO2 >
416 inline typename EnableIf< VectorizedSubAssign<MT> >::Type
417 subAssign(
const DenseMatrix<MT,SO2>& rhs );
419 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,SO>& rhs );
420 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,!SO>& rhs );
468 template<
typename Type
476 for(
size_t i=0UL; i<M*NN; ++i )
488 template<
typename Type
495 for(
size_t i=0UL; i<M; ++i ) {
496 for(
size_t j=0UL; j<N; ++j )
500 for(
size_t j=N; j<NN; ++j )
534 template<
typename Type
538 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 )
556 for(
size_t i=m; i<M; ++i ) {
557 for(
size_t j=0UL; j<NN; ++j )
585 template<
typename Type
589 template<
typename Other >
593 for(
size_t i=0UL; i<M; ++i ) {
594 for(
size_t j=0UL; j<N; ++j )
595 v_[i*NN+j] = array[i][j];
598 for(
size_t j=N; j<NN; ++j )
613 template<
typename Type
620 for(
size_t i=0UL; i<M*NN; ++i )
631 template<
typename Type
635 template<
typename Other
640 for(
size_t i=0UL; i<M; ++i ) {
641 for(
size_t j=0UL; j<N; ++j )
645 for(
size_t j=N; j<NN; ++j )
663 template<
typename Type
667 template<
typename MT
675 throw std::invalid_argument(
"Invalid setup of static matrix" );
677 for(
size_t i=0UL; i<M; ++i ) {
679 j<( IsVectorizable<Type>::value ? NN : N ); ++j ) {
706 template<
typename Type
728 for(
size_t i=0UL; i<M; ++i ) {
729 for(
size_t j=N; j<NN; ++j )
755 template<
typename Type
779 for(
size_t i=0UL; i<M; ++i ) {
780 for(
size_t j=N; j<NN; ++j )
809 template<
typename Type
814 const Type& v3,
const Type& v4 )
828 else if( M == 2UL ) {
844 for(
size_t i=0UL; i<M; ++i ) {
845 for(
size_t j=N; j<NN; ++j )
873 template<
typename Type
878 const Type& v4,
const Type& v5 )
902 for(
size_t i=0UL; i<M; ++i ) {
903 for(
size_t j=N; j<NN; ++j )
935 template<
typename Type
940 const Type& v4,
const Type& v5,
const Type& v6 )
956 else if( M == 2UL ) {
966 else if( M == 3UL ) {
986 for(
size_t i=0UL; i<M; ++i ) {
987 for(
size_t j=N; j<NN; ++j )
1017 template<
typename Type
1022 const Type& v4,
const Type& v5,
const Type& v6,
1051 for(
size_t i=0UL; i<M; ++i ) {
1052 for(
size_t j=N; j<NN; ++j )
1053 v_[i*NN+j] = Type();
1085 template<
typename Type
1090 const Type& v4,
const Type& v5,
const Type& v6,
1091 const Type& v7,
const Type& v8 )
1109 else if( M == 2UL ) {
1121 else if( M == 4UL ) {
1127 v_[2UL*NN+1UL] = v6;
1129 v_[3UL*NN+1UL] = v8;
1145 for(
size_t i=0UL; i<M; ++i ) {
1146 for(
size_t j=N; j<NN; ++j )
1147 v_[i*NN+j] = Type();
1181 template<
typename Type
1186 const Type& v4,
const Type& v5,
const Type& v6,
1187 const Type& v7,
const Type& v8,
const Type& v9 )
1206 else if( M == 3UL ) {
1214 v_[2UL*NN+1UL] = v8;
1215 v_[2UL*NN+2UL] = v9;
1232 for(
size_t i=0UL; i<M; ++i ) {
1233 for(
size_t j=N; j<NN; ++j )
1234 v_[i*NN+j] = Type();
1269 template<
typename Type
1274 const Type& v4,
const Type& v5,
const Type& v6,
1275 const Type& v7,
const Type& v8,
const Type& v9,
1296 else if( M == 2UL ) {
1310 else if( M == 5UL ) {
1316 v_[2UL*NN+1UL] = v6;
1318 v_[3UL*NN+1UL] = v8;
1320 v_[4UL*NN+1UL] = v10;
1338 for(
size_t i=0UL; i<M; ++i ) {
1339 for(
size_t j=N; j<NN; ++j )
1340 v_[i*NN+j] = Type();
1362 template<
typename Type
1383 template<
typename Type
1409 template<
typename Type
1433 template<
typename Type
1453 template<
typename Type
1474 template<
typename Type
1498 template<
typename Type
1522 template<
typename Type
1546 template<
typename Type
1570 template<
typename Type
1594 template<
typename Type
1618 template<
typename Type
1660 template<
typename Type
1664 template<
typename Other >
1667 for(
size_t i=0UL; i<M; ++i )
1668 for(
size_t j=0UL; j<N; ++j )
1669 v_[i*NN+j] = array[i][j];
1682 template<
typename Type
1688 for(
size_t i=0UL; i<M; ++i )
1689 for(
size_t j=0UL; j<N; ++j )
1705 template<
typename Type
1725 template<
typename Type
1729 template<
typename Other
1753 template<
typename Type
1757 template<
typename MT
1764 throw std::invalid_argument(
"Invalid assignment to static matrix" );
1766 if( (~rhs).canAlias(
this ) ) {
1791 template<
typename Type
1795 template<
typename MT
1802 throw std::invalid_argument(
"Matrix sizes do not match" );
1804 if( (~rhs).canAlias(
this ) ) {
1827 template<
typename Type
1831 template<
typename MT
1838 throw std::invalid_argument(
"Matrix sizes do not match" );
1840 if( (~rhs).canAlias(
this ) ) {
1863 template<
typename Type
1867 template<
typename MT
1871 if( M != N || (~rhs).
rows() != M || (~rhs).
columns() != M )
1872 throw std::invalid_argument(
"Matrix sizes do not match" );
1875 return this->operator=( tmp );
1887 template<
typename Type
1891 template<
typename Other >
1897 assign( *
this, (*
this) * rhs );
1912 template<
typename Type
1916 template<
typename Other >
1924 assign( *
this, (*
this) / rhs );
1943 template<
typename Type
1959 template<
typename Type
1978 template<
typename Type
1994 template<
typename Type
2016 template<
typename Type
2036 template<
typename Type
2042 size_t nonzeros( 0UL );
2044 for(
size_t i=0UL; i<M; ++i )
2045 for(
size_t j=0UL; j<N; ++j )
2065 template<
typename Type
2073 const size_t jend( (i+1UL)*NN );
2074 size_t nonzeros( 0UL );
2076 for(
size_t j=i*NN; j<jend; ++j )
2090 template<
typename Type
2098 for(
size_t i=0UL; i<M; ++i )
2099 for(
size_t j=0UL; j<N; ++j )
2100 reset( v_[i*NN+j] );
2116 template<
typename Type
2125 for(
size_t j=0UL; j<N; ++j )
2126 reset( v_[i*NN+j] );
2139 template<
typename Type
2149 for(
size_t i=1UL; i<M; ++i )
2150 for(
size_t j=0UL; j<i; ++j )
2151 swap( v_[i*NN+j], v_[j*NN+i] );
2164 template<
typename Type
2168 template<
typename Other >
2171 for(
size_t i=0UL; i<M; ++i )
2172 for(
size_t j=0UL; j<N; ++j )
2173 v_[i*NN+j] *= scalar;
2187 template<
typename Type
2195 for(
size_t i=0UL; i<M; ++i ) {
2196 for(
size_t j=0UL; j<N; ++j ) {
2197 swap( v_[i*NN+j], m(i,j) );
2222 template<
typename Type
2232 return allocate<StaticMatrix>( 1UL );
2247 template<
typename Type
2256 return allocate<StaticMatrix>( size/
sizeof(
StaticMatrix) );
2271 template<
typename Type
2281 return allocate<StaticMatrix>( 1UL );
2296 template<
typename Type
2305 return allocate<StaticMatrix>( size/
sizeof(
StaticMatrix) );
2316 template<
typename Type
2322 deallocate( static_cast<StaticMatrix*>( ptr ) );
2333 template<
typename Type
2339 deallocate( static_cast<StaticMatrix*>( ptr ) );
2350 template<
typename Type
2356 deallocate( static_cast<StaticMatrix*>( ptr ) );
2367 template<
typename Type
2373 deallocate( static_cast<StaticMatrix*>( ptr ) );
2396 template<
typename Type
2400 template<
typename Other >
2403 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2418 template<
typename Type
2422 template<
typename Other >
2425 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2439 template<
typename Type
2465 template<
typename Type
2481 return load( &v_[i*NN+j] );
2501 template<
typename Type
2516 return loadu( &v_[i*NN+j] );
2537 template<
typename Type
2552 store( &v_[i*NN+j], value );
2573 template<
typename Type
2587 storeu( &v_[i*NN+j], value );
2608 template<
typename Type
2623 stream( &v_[i*NN+j], value );
2639 template<
typename Type
2643 template<
typename MT
2650 for(
size_t i=0UL; i<M; ++i ) {
2651 for(
size_t j=0UL; j<N; ++j ) {
2652 v_[i*NN+j] = (~rhs)(i,j);
2670 template<
typename Type
2674 template<
typename MT
2685 for(
size_t i=0UL; i<M; ++i ) {
2686 for(
size_t j=0UL; j<N; j+=IT::size ) {
2705 template<
typename Type
2709 template<
typename MT >
2716 for(
size_t i=0UL; i<M; ++i )
2717 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2718 v_[i*NN+element->index()] = element->value();
2734 template<
typename Type
2738 template<
typename MT >
2745 for(
size_t j=0UL; j<N; ++j )
2746 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2747 v_[element->index()*NN+j] = element->value();
2763 template<
typename Type
2767 template<
typename MT
2774 for(
size_t i=0UL; i<M; ++i ) {
2775 for(
size_t j=0UL; j<N; ++j ) {
2776 v_[i*NN+j] += (~rhs)(i,j);
2794 template<
typename Type
2798 template<
typename MT
2810 for(
size_t i=0UL; i<M; ++i ) {
2811 for(
size_t j=0UL; j<N; j+=IT::size ) {
2812 store( &v_[i*NN+j],
load( &v_[i*NN+j] ) + (~rhs).
load(i,j) );
2830 template<
typename Type
2834 template<
typename MT >
2841 for(
size_t i=0UL; i<M; ++i )
2842 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2843 v_[i*NN+element->index()] += element->value();
2859 template<
typename Type
2863 template<
typename MT >
2870 for(
size_t j=0UL; j<N; ++j )
2871 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2872 v_[element->index()*NN+j] += element->value();
2888 template<
typename Type
2892 template<
typename MT
2899 for(
size_t i=0UL; i<M; ++i ) {
2900 for(
size_t j=0UL; j<N; ++j ) {
2901 v_[i*NN+j] -= (~rhs)(i,j);
2919 template<
typename Type
2923 template<
typename MT
2935 for(
size_t i=0UL; i<M; ++i ) {
2936 for(
size_t j=0UL; j<N; j+=IT::size ) {
2937 store( &v_[i*NN+j],
load( &v_[i*NN+j] ) - (~rhs).
load(i,j) );
2955 template<
typename Type
2959 template<
typename MT >
2966 for(
size_t i=0UL; i<M; ++i )
2967 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
2968 v_[i*NN+element->index()] -= element->value();
2984 template<
typename Type
2988 template<
typename MT >
2995 for(
size_t j=0UL; j<N; ++j )
2996 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
2997 v_[element->index()*NN+j] -= element->value();
3022 template<
typename Type
3034 enum { MM = M + ( IT::size - ( M % IT::size ) ) % IT::size };
3039 typedef StaticMatrix<Type,M,N,true>
This;
3051 typedef DenseIterator<Type>
Iterator;
3061 enum { vectorizable = IsVectorizable<Type>::value };
3067 enum { smpAssignable = 0 };
3076 template<
typename Other >
explicit inline StaticMatrix(
size_t m,
size_t n,
const Other* array );
3077 template<
typename Other >
explicit inline StaticMatrix(
const Other (&array)[M][N] );
3080 template<
typename Other,
bool SO >
inline StaticMatrix(
const StaticMatrix<Other,M,N,SO>& m );
3081 template<
typename MT ,
bool SO >
inline StaticMatrix(
const Matrix<MT,SO>& m );
3084 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3 );
3085 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4 );
3086 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5 );
3087 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
3089 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
3090 const Type& v6,
const Type& v7 );
3091 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
3092 const Type& v6,
const Type& v7,
const Type& v8 );
3093 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
3094 const Type& v6,
const Type& v7,
const Type& v8,
const Type& v9 );
3095 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
3096 const Type& v6,
const Type& v7,
const Type& v8,
const Type& v9,
const Type& v10 );
3125 template<
typename Other >
3126 inline StaticMatrix& operator=(
const Other (&array)[M][N] );
3130 template<
typename Other,
bool SO >
inline StaticMatrix& operator= (
const StaticMatrix<Other,M,N,SO>& rhs );
3131 template<
typename MT ,
bool SO >
inline StaticMatrix& operator= (
const Matrix<MT,SO>& rhs );
3132 template<
typename MT ,
bool SO >
inline StaticMatrix& operator+=(
const Matrix<MT,SO>& rhs );
3133 template<
typename MT ,
bool SO >
inline StaticMatrix& operator-=(
const Matrix<MT,SO>& rhs );
3134 template<
typename MT ,
bool SO >
inline StaticMatrix& operator*=(
const Matrix<MT,SO>& rhs );
3136 template<
typename Other >
3137 inline typename EnableIf< IsNumeric<Other>,
StaticMatrix >::Type&
3138 operator*=( Other rhs );
3140 template<
typename Other >
3141 inline typename EnableIf< IsNumeric<Other>,
StaticMatrix >::Type&
3142 operator/=( Other rhs );
3149 inline size_t rows()
const;
3150 inline size_t columns()
const;
3151 inline size_t spacing()
const;
3153 inline size_t capacity(
size_t j )
const;
3155 inline size_t nonZeros(
size_t j )
const;
3156 inline void reset();
3157 inline void reset(
size_t i );
3159 template<
typename Other >
inline StaticMatrix& scale(
const Other& scalar );
3167 static inline void*
operator new ( std::size_t size );
3168 static inline void*
operator new[]( std::size_t size );
3169 static inline void*
operator new ( std::size_t size,
const std::nothrow_t& );
3170 static inline void*
operator new[]( std::size_t size,
const std::nothrow_t& );
3172 static inline void operator delete (
void* ptr );
3173 static inline void operator delete[](
void* ptr );
3174 static inline void operator delete (
void* ptr,
const std::nothrow_t& );
3175 static inline void operator delete[](
void* ptr,
const std::nothrow_t& );
3182 template<
typename MT >
3183 struct VectorizedAssign {
3184 enum { value = vectorizable && MT::vectorizable &&
3185 IsSame<Type,typename MT::ElementType>::value &&
3186 IsColumnMajorMatrix<MT>::value };
3192 template<
typename MT >
3193 struct VectorizedAddAssign {
3194 enum { value = vectorizable && MT::vectorizable &&
3195 IsSame<Type,typename MT::ElementType>::value &&
3196 IntrinsicTrait<Type>::addition &&
3197 IsColumnMajorMatrix<MT>::value };
3203 template<
typename MT >
3204 struct VectorizedSubAssign {
3205 enum { value = vectorizable && MT::vectorizable &&
3206 IsSame<Type,typename MT::ElementType>::value &&
3207 IntrinsicTrait<Type>::subtraction &&
3208 IsColumnMajorMatrix<MT>::value };
3216 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
3217 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
3227 template<
typename MT,
bool SO >
3228 inline typename DisableIf< VectorizedAssign<MT> >::Type
3229 assign(
const DenseMatrix<MT,SO>& rhs );
3231 template<
typename MT,
bool SO >
3232 inline typename EnableIf< VectorizedAssign<MT> >::Type
3233 assign(
const DenseMatrix<MT,SO>& rhs );
3235 template<
typename MT >
inline void assign(
const SparseMatrix<MT,true>& rhs );
3236 template<
typename MT >
inline void assign(
const SparseMatrix<MT,false>& rhs );
3238 template<
typename MT,
bool SO >
3239 inline typename DisableIf< VectorizedAddAssign<MT> >::Type
3240 addAssign(
const DenseMatrix<MT,SO>& rhs );
3242 template<
typename MT,
bool SO >
3243 inline typename EnableIf< VectorizedAddAssign<MT> >::Type
3244 addAssign(
const DenseMatrix<MT,SO>& rhs );
3246 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,true>& rhs );
3247 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,false>& rhs );
3249 template<
typename MT,
bool SO >
3250 inline typename DisableIf< VectorizedSubAssign<MT> >::Type
3251 subAssign(
const DenseMatrix<MT,SO>& rhs );
3253 template<
typename MT,
bool SO >
3254 inline typename EnableIf< VectorizedSubAssign<MT> >::Type
3255 subAssign(
const DenseMatrix<MT,SO>& rhs );
3257 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,true>& rhs );
3258 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,false>& rhs );
3266 AlignedArray<Type,MM*N>
v_;
3299 template<
typename Type
3305 if( IsVectorizable<Type>::value ) {
3306 for(
size_t i=0UL; i<MM*N; ++i )
3320 template<
typename Type
3326 for(
size_t j=0UL; j<N; ++j ) {
3327 for(
size_t i=0UL; i<M; ++i )
3330 if( IsVectorizable<Type>::value ) {
3331 for(
size_t i=M; i<MM; ++i )
3332 v_[i+j*MM] = Type();
3367 template<
typename Type
3370 template<
typename Other >
3374 if( m > M || n > N )
3375 throw std::invalid_argument(
"Invalid setup of static matrix" );
3377 for(
size_t j=0UL; j<n; ++j ) {
3378 for(
size_t i=0UL; i<m; ++i )
3379 v_[i+j*MM] = array[i+j*m];
3381 if( IsVectorizable<Type>::value ) {
3382 for(
size_t i=m; i<MM; ++i )
3383 v_[i+j*MM] = Type();
3387 if( IsVectorizable<Type>::value ) {
3388 for(
size_t j=n; j<N; ++j ) {
3389 for(
size_t i=0UL; i<M; ++i )
3390 v_[i+j*MM] = Type();
3419 template<
typename Type
3422 template<
typename Other >
3426 for(
size_t j=0UL; j<N; ++j ) {
3427 for(
size_t i=0UL; i<M; ++i )
3428 v_[i+j*MM] = array[i][j];
3430 if( IsVectorizable<Type>::value ) {
3431 for(
size_t i=M; i<MM; ++i )
3432 v_[i+j*MM] = Type();
3448 template<
typename Type
3454 for(
size_t i=0UL; i<MM*N; ++i )
3467 template<
typename Type
3470 template<
typename Other
3475 for(
size_t j=0UL; j<N; ++j ) {
3476 for(
size_t i=0UL; i<M; ++i )
3477 v_[i+j*MM] = m(i,j);
3479 if( IsVectorizable<Type>::value ) {
3480 for(
size_t i=M; i<MM; ++i )
3481 v_[i+j*MM] = Type();
3500 template<
typename Type
3503 template<
typename MT
3511 throw std::invalid_argument(
"Invalid setup of static matrix" );
3513 for(
size_t j=0UL; j<N; ++j ) {
3514 for(
size_t i=( IsSparseMatrix<MT>::value ? 0UL : M );
3515 i<( IsVectorizable<Type>::value ? MM : M ); ++i ) {
3516 v_[i+j*MM] = Type();
3520 assign( *
this, ~m );
3544 template<
typename Type
3564 if( IsVectorizable<Type>::value ) {
3565 for(
size_t j=0UL; j<N; ++j )
3566 for(
size_t i=M; i<MM; ++i ) {
3567 v_[i+j*MM] = Type();
3594 template<
typename Type
3616 if( IsVectorizable<Type>::value ) {
3617 for(
size_t j=0UL; j<N; ++j )
3618 for(
size_t i=M; i<MM; ++i ) {
3619 v_[i+j*MM] = Type();
3649 template<
typename Type
3667 else if( N == 2UL ) {
3682 if( IsVectorizable<Type>::value ) {
3683 for(
size_t j=0UL; j<N; ++j )
3684 for(
size_t i=M; i<MM; ++i ) {
3685 v_[i+j*MM] = Type();
3714 template<
typename Type
3718 const Type& v4,
const Type& v5 )
3741 if( IsVectorizable<Type>::value ) {
3742 for(
size_t j=0UL; j<N; ++j )
3743 for(
size_t i=M; i<MM; ++i ) {
3744 v_[i+j*MM] = Type();
3777 template<
typename Type
3781 const Type& v4,
const Type& v5,
const Type& v6 )
3797 else if( N == 2UL ) {
3807 else if( N == 3UL ) {
3813 v_[2UL*MM+1UL] = v6;
3826 if( IsVectorizable<Type>::value ) {
3827 for(
size_t j=0UL; j<N; ++j )
3828 for(
size_t i=M; i<MM; ++i ) {
3829 v_[i+j*MM] = Type();
3860 template<
typename Type
3864 const Type& v4,
const Type& v5,
const Type& v6,
3892 if( IsVectorizable<Type>::value ) {
3893 for(
size_t j=0UL; j<N; ++j )
3894 for(
size_t i=M; i<MM; ++i ) {
3895 v_[i+j*MM] = Type();
3930 template<
typename Type
3934 const Type& v4,
const Type& v5,
const Type& v6,
3935 const Type& v7,
const Type& v8 )
3953 else if( N == 2UL ) {
3965 else if( N == 4UL ) {
3971 v_[2UL*MM+1UL] = v6;
3973 v_[3UL*MM+1UL] = v8;
3988 if( IsVectorizable<Type>::value ) {
3989 for(
size_t j=0UL; j<N; ++j )
3990 for(
size_t i=M; i<MM; ++i ) {
3991 v_[i+j*MM] = Type();
4027 template<
typename Type
4031 const Type& v4,
const Type& v5,
const Type& v6,
4032 const Type& v7,
const Type& v8,
const Type& v9 )
4051 else if( N == 3UL ) {
4059 v_[2UL*MM+1UL] = v8;
4060 v_[2UL*MM+2UL] = v9;
4076 if( IsVectorizable<Type>::value ) {
4077 for(
size_t j=0UL; j<N; ++j )
4078 for(
size_t i=M; i<MM; ++i ) {
4079 v_[i+j*MM] = Type();
4116 template<
typename Type
4120 const Type& v4,
const Type& v5,
const Type& v6,
4121 const Type& v7,
const Type& v8,
const Type& v9,
4142 else if( N == 2UL ) {
4156 else if( N == 5UL ) {
4162 v_[2UL*MM+1UL] = v6;
4164 v_[3UL*MM+1UL] = v8;
4166 v_[4UL*MM+1UL] = v10;
4183 if( IsVectorizable<Type>::value ) {
4184 for(
size_t j=0UL; j<N; ++j )
4185 for(
size_t i=M; i<MM; ++i ) {
4186 v_[i+j*MM] = Type();
4210 template<
typename Type
4232 template<
typename Type
4258 template<
typename Type
4261 inline typename StaticMatrix<Type,M,N,true>::Pointer
4282 template<
typename Type
4285 inline typename StaticMatrix<Type,M,N,true>::ConstPointer
4303 template<
typename Type
4306 inline typename StaticMatrix<Type,M,N,true>::Pointer
4325 template<
typename Type
4328 inline typename StaticMatrix<Type,M,N,true>::ConstPointer
4345 template<
typename Type
4365 template<
typename Type
4385 template<
typename Type
4405 template<
typename Type
4425 template<
typename Type
4445 template<
typename Type
4488 template<
typename Type
4491 template<
typename Other >
4492 inline StaticMatrix<Type,M,N,true>&
4493 StaticMatrix<Type,M,N,true>::operator=(
const Other (&array)[M][N] )
4495 for(
size_t j=0UL; j<N; ++j )
4496 for(
size_t i=0UL; i<M; ++i )
4497 v_[i+j*MM] = array[i][j];
4512 template<
typename Type
4515 inline StaticMatrix<Type,M,N,true>&
4516 StaticMatrix<Type,M,N,true>::operator=(
const Type&
set )
4518 for(
size_t j=0UL; j<N; ++j )
4519 for(
size_t i=0UL; i<M; ++i )
4537 template<
typename Type
4540 inline StaticMatrix<Type,M,N,true>&
4541 StaticMatrix<Type,M,N,true>::operator=(
const StaticMatrix& rhs )
4559 template<
typename Type
4562 template<
typename Other
4564 inline StaticMatrix<Type,M,N,true>&
4565 StaticMatrix<Type,M,N,true>::operator=(
const StaticMatrix<Other,M,N,SO>& rhs )
4588 template<
typename Type
4591 template<
typename MT
4593 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator=(
const Matrix<MT,SO>& rhs )
4598 throw std::invalid_argument(
"Invalid assignment to static matrix" );
4600 if( (~rhs).canAlias(
this ) ) {
4601 StaticMatrix tmp( ~rhs );
4605 if( IsSparseMatrix<MT>::value )
4627 template<
typename Type
4630 template<
typename MT
4632 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator+=(
const Matrix<MT,SO>& rhs )
4637 throw std::invalid_argument(
"Matrix sizes do not match" );
4639 if( (~rhs).canAlias(
this ) ) {
4664 template<
typename Type
4667 template<
typename MT
4669 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator-=(
const Matrix<MT,SO>& rhs )
4674 throw std::invalid_argument(
"Matrix sizes do not match" );
4676 if( (~rhs).canAlias(
this ) ) {
4701 template<
typename Type
4704 template<
typename MT
4706 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator*=(
const Matrix<MT,SO>& rhs )
4708 if( M != N || (~rhs).
rows() != M || (~rhs).
columns() != M )
4709 throw std::invalid_argument(
"Matrix sizes do not match" );
4711 StaticMatrix tmp( *
this * (~rhs) );
4712 return this->operator=( tmp );
4726 template<
typename Type
4729 template<
typename Other >
4730 inline typename EnableIf< IsNumeric<Other>, StaticMatrix<Type,M,N,true> >::Type&
4731 StaticMatrix<Type,M,N,true>::operator*=( Other rhs )
4735 assign( *
this, (*
this) * rhs );
4752 template<
typename Type
4755 template<
typename Other >
4756 inline typename EnableIf< IsNumeric<Other>, StaticMatrix<Type,M,N,true> >::Type&
4757 StaticMatrix<Type,M,N,true>::operator/=( Other rhs )
4763 assign( *
this, (*
this) / rhs );
4784 template<
typename Type
4801 template<
typename Type
4821 template<
typename Type
4838 template<
typename Type
4856 template<
typename Type
4877 template<
typename Type
4882 size_t nonzeros( 0UL );
4884 for(
size_t j=0UL; j<N; ++j )
4885 for(
size_t i=0UL; i<M; ++i )
4902 template<
typename Type
4909 const size_t iend( (j+1UL)*MM );
4910 size_t nonzeros( 0UL );
4912 for(
size_t i=j*MM; i<iend; ++i )
4928 template<
typename Type
4935 for(
size_t j=0UL; j<N; ++j )
4936 for(
size_t i=0UL; i<M; ++i )
4937 reset( v_[i+j*MM] );
4953 template<
typename Type
4961 for(
size_t i=0UL; i<M; ++i )
4962 reset( v_[i+j*MM] );
4977 template<
typename Type
4986 for(
size_t j=1UL; j<N; ++j )
4987 for(
size_t i=0UL; i<j; ++i )
4988 swap( v_[i+j*MM], v_[j+i*MM] );
5003 template<
typename Type
5006 template<
typename Other >
5007 inline StaticMatrix<Type,M,N,true>&
5008 StaticMatrix<Type,M,N,true>::scale(
const Other& scalar )
5010 for(
size_t j=0UL; j<N; ++j )
5011 for(
size_t i=0UL; i<M; ++i )
5012 v_[i+j*MM] *= scalar;
5028 template<
typename Type
5035 for(
size_t j=0UL; j<N; ++j ) {
5036 for(
size_t i=0UL; i<M; ++i ) {
5037 swap( v_[i+j*MM], m(i,j) );
5064 template<
typename Type
5067 inline void* StaticMatrix<Type,M,N,true>::operator
new( std::size_t size )
5073 return allocate<StaticMatrix>( 1UL );
5090 template<
typename Type
5093 inline void* StaticMatrix<Type,M,N,true>::operator
new[]( std::size_t size )
5098 return allocate<StaticMatrix>( size/
sizeof(StaticMatrix) );
5115 template<
typename Type
5118 inline void* StaticMatrix<Type,M,N,true>::operator
new( std::size_t size,
const std::nothrow_t& )
5124 return allocate<StaticMatrix>( 1UL );
5141 template<
typename Type
5144 inline void* StaticMatrix<Type,M,N,true>::operator
new[]( std::size_t size,
const std::nothrow_t& )
5149 return allocate<StaticMatrix>( size/
sizeof(StaticMatrix) );
5162 template<
typename Type
5165 inline void StaticMatrix<Type,M,N,true>::operator
delete(
void* ptr )
5167 deallocate( static_cast<StaticMatrix*>( ptr ) );
5180 template<
typename Type
5183 inline void StaticMatrix<Type,M,N,true>::operator
delete[](
void* ptr )
5185 deallocate( static_cast<StaticMatrix*>( ptr ) );
5198 template<
typename Type
5201 inline void StaticMatrix<Type,M,N,true>::operator
delete(
void* ptr,
const std::nothrow_t& )
5203 deallocate( static_cast<StaticMatrix*>( ptr ) );
5216 template<
typename Type
5219 inline void StaticMatrix<Type,M,N,true>::operator
delete[](
void* ptr,
const std::nothrow_t& )
5221 deallocate( static_cast<StaticMatrix*>( ptr ) );
5246 template<
typename Type
5249 template<
typename Other >
5252 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
5269 template<
typename Type
5272 template<
typename Other >
5275 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
5291 template<
typename Type
5317 template<
typename Type
5320 inline typename StaticMatrix<Type,M,N,true>::IntrinsicType
5332 return load( &v_[i+j*MM] );
5353 template<
typename Type
5356 inline typename StaticMatrix<Type,M,N,true>::IntrinsicType
5367 return loadu( &v_[i+j*MM] );
5389 template<
typename Type
5403 store( &v_[i+j*MM], value );
5425 template<
typename Type
5438 storeu( &v_[i+j*MM], value );
5461 template<
typename Type
5475 stream( &v_[i+j*MM], value );
5493 template<
typename Type
5496 template<
typename MT
5498 inline typename DisableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAssign<MT> >::Type
5503 for(
size_t j=0UL; j<N; ++j ) {
5504 for(
size_t i=0UL; i<M; ++i ) {
5505 v_[i+j*MM] = (~rhs)(i,j);
5525 template<
typename Type
5528 template<
typename MT
5530 inline typename EnableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAssign<MT> >::Type
5539 for(
size_t j=0UL; j<N; ++j ) {
5540 for(
size_t i=0UL; i<M; i+=IT::size ) {
5561 template<
typename Type
5564 template<
typename MT >
5571 for(
size_t j=0UL; j<N; ++j )
5572 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5573 v_[element->index()+j*MM] = element->value();
5591 template<
typename Type
5594 template<
typename MT >
5601 for(
size_t i=0UL; i<M; ++i )
5602 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5603 v_[i+element->index()*MM] = element->value();
5621 template<
typename Type
5624 template<
typename MT
5626 inline typename DisableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >::Type
5631 for(
size_t j=0UL; j<N; ++j ) {
5632 for(
size_t i=0UL; i<M; ++i ) {
5633 v_[i+j*MM] += (~rhs)(i,j);
5653 template<
typename Type
5656 template<
typename MT
5658 inline typename EnableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >::Type
5668 for(
size_t j=0UL; j<N; ++j ) {
5669 for(
size_t i=0UL; i<M; i+=IT::size ) {
5670 store( &v_[i+j*MM],
load( &v_[i+j*MM] ) + (~rhs).
load(i,j) );
5690 template<
typename Type
5693 template<
typename MT >
5700 for(
size_t j=0UL; j<N; ++j )
5701 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5702 v_[element->index()+j*MM] += element->value();
5720 template<
typename Type
5723 template<
typename MT >
5730 for(
size_t i=0UL; i<M; ++i )
5731 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5732 v_[i+element->index()*MM] += element->value();
5750 template<
typename Type
5753 template<
typename MT
5755 inline typename DisableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >::Type
5760 for(
size_t j=0UL; j<N; ++j ) {
5761 for(
size_t i=0UL; i<M; ++i ) {
5762 v_[i+j*MM] -= (~rhs)(i,j);
5782 template<
typename Type
5785 template<
typename MT
5787 inline typename EnableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >::Type
5797 for(
size_t j=0UL; j<N; ++j ) {
5798 for(
size_t i=0UL; i<M; i+=IT::size ) {
5799 store( &v_[i+j*MM],
load( &v_[i+j*MM] ) - (~rhs).
load(i,j) );
5819 template<
typename Type
5822 template<
typename MT >
5829 for(
size_t j=0UL; j<N; ++j )
5830 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
5831 v_[element->index()+j*MM] -= element->value();
5849 template<
typename Type
5852 template<
typename MT >
5859 for(
size_t i=0UL; i<M; ++i )
5860 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
5861 v_[i+element->index()*MM] -= element->value();
5887 template<
typename Type
5890 class StaticMatrix<Type,M,0UL,SO>;
5903 template<
typename Type
5906 class StaticMatrix<Type,0UL,N,SO>;
5919 template<
typename Type
5921 class StaticMatrix<Type,0UL,0UL,SO>;
5941 template<
typename Type,
size_t M,
size_t N,
bool SO >
5942 inline void reset( StaticMatrix<Type,M,N,SO>& m );
5944 template<
typename Type,
size_t M,
size_t N,
bool SO >
5945 inline void clear( StaticMatrix<Type,M,N,SO>& m );
5947 template<
typename Type,
size_t M,
size_t N,
bool SO >
5948 inline bool isDefault(
const StaticMatrix<Type,M,N,SO>& m );
5950 template<
typename Type,
size_t M,
size_t N,
bool SO >
5951 inline void swap( StaticMatrix<Type,M,N,SO>& a, StaticMatrix<Type,M,N,SO>& b ) ;
5963 template<
typename Type
5983 template<
typename Type
6001 template<
typename Type
6008 for(
size_t i=0UL; i<M; ++i )
6009 for(
size_t j=0UL; j<N; ++j )
6010 if( !
isDefault( m(i,j) ) )
return false;
6013 for(
size_t j=0UL; j<N; ++j )
6014 for(
size_t i=0UL; i<M; ++i )
6015 if( !
isDefault( m(i,j) ) )
return false;
6032 template<
typename Type
6053 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6054 struct AddTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
6056 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N, SO > Type;
6059 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6060 struct AddTrait< StaticMatrix<T1,M,N,SO1>, StaticMatrix<T2,M,N,SO2> >
6062 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N,
false > Type;
6078 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6079 struct SubTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
6081 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N, SO > Type;
6084 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6085 struct SubTrait< StaticMatrix<T1,M,N,SO1>, StaticMatrix<T2,M,N,SO2> >
6087 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N,
false > Type;
6103 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6104 struct MultTrait< StaticMatrix<T1,M,N,SO>, T2 >
6106 typedef StaticMatrix< typename MultTrait<T1,T2>::Type, M, N, SO > Type;
6110 template<
typename T1,
typename T2,
size_t M,
size_t N,
bool SO >
6111 struct MultTrait< T1, StaticMatrix<T2,M,N,SO> >
6113 typedef StaticMatrix< typename MultTrait<T1,T2>::Type, M, N, SO > Type;
6117 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6118 struct MultTrait< StaticMatrix<T1,M,N,SO>, StaticVector<T2,N,false> >
6120 typedef StaticVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
6123 template<
typename T1,
size_t M,
typename T2,
size_t N,
bool SO >
6124 struct MultTrait< StaticVector<T1,M,true>, StaticMatrix<T2,M,N,SO> >
6126 typedef StaticVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
6129 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2,
size_t L >
6130 struct MultTrait< StaticMatrix<T1,M,N,SO>, HybridVector<T2,L,false> >
6132 typedef StaticVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
6135 template<
typename T1,
size_t L,
typename T2,
size_t M,
size_t N,
bool SO >
6136 struct MultTrait< HybridVector<T1,L,true>, StaticMatrix<T2,M,N,SO> >
6138 typedef StaticVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
6141 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6142 struct MultTrait< StaticMatrix<T1,M,N,SO>, DynamicVector<T2,false> >
6144 typedef StaticVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
6147 template<
typename T1,
typename T2,
size_t M,
size_t N,
bool SO >
6148 struct MultTrait< DynamicVector<T1,true>, StaticMatrix<T2,M,N,SO> >
6150 typedef StaticVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
6153 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6154 struct MultTrait< StaticMatrix<T1,M,N,SO>, CompressedVector<T2,false> >
6156 typedef StaticVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
6159 template<
typename T1,
typename T2,
size_t M,
size_t N,
bool SO >
6160 struct MultTrait< CompressedVector<T1,true>, StaticMatrix<T2,M,N,SO> >
6162 typedef StaticVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
6165 template<
typename T1,
size_t M,
size_t K,
bool SO1,
typename T2,
size_t N,
bool SO2 >
6166 struct MultTrait< StaticMatrix<T1,M,K,SO1>, StaticMatrix<T2,K,N,SO2> >
6168 typedef StaticMatrix< typename MultTrait<T1,T2>::Type, M, N, SO1 > Type;
6184 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6185 struct DivTrait< StaticMatrix<T1,M,N,SO>, T2 >
6187 typedef StaticMatrix< typename DivTrait<T1,T2>::Type, M, N, SO > Type;
6204 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6205 struct MathTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
6207 typedef StaticMatrix< typename MathTrait<T1,T2>::HighType, M, N, SO > HighType;
6208 typedef StaticMatrix< typename MathTrait<T1,T2>::LowType , M, N, SO > LowType;
6224 template<
typename T1,
size_t M,
size_t N,
bool SO >
6225 struct SubmatrixTrait< StaticMatrix<T1,M,N,SO> >
6227 typedef HybridMatrix<T1,M,N,SO> Type;
6243 template<
typename T1,
size_t M,
size_t N,
bool SO >
6244 struct RowTrait< StaticMatrix<T1,M,N,SO> >
6246 typedef StaticVector<T1,N,true> Type;
6262 template<
typename T1,
size_t M,
size_t N,
bool SO >
6263 struct ColumnTrait< StaticMatrix<T1,M,N,SO> >
6265 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:196
Constraint on the data type.
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4599
#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 > >::Type store(T *address, const typename Store< T, sizeof(T)>::Type &value)
Aligned store of a vector of integral values.
Definition: Store.h:223
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 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:2040
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:2401
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:4642
const Type & ConstReference
Reference to a constant matrix value.
Definition: StaticMatrix.h:204
StaticMatrix()
The default constructor for StaticMatrix.
Definition: StaticMatrix.h:472
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:2577
Header file for the IsColumnMajorMatrix type trait.
StaticMatrix< Type, N, M,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: StaticMatrix.h:198
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:84
Type ElementType
Type of the matrix elements.
Definition: StaticMatrix.h:199
AlignedArray< Type, M *NN > v_
The statically allocated matrix elements.
Definition: StaticMatrix.h:428
#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:205
Iterator end(size_t i)
Returns an iterator just past the last element of row/column i.
Definition: StaticMatrix.h:1575
Header file for memory allocation and deallocation functionality.
void clear(DynamicMatrix< Type, SO > &m)
Clearing the given dense matrix.
Definition: DynamicMatrix.h:4615
const Type * ConstPointer
Pointer to a constant matrix value.
Definition: StaticMatrix.h:206
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:2443
Header file for the SparseMatrix base class.
void deallocate(T *address)
Deallocation of memory.
Definition: Memory.h:115
ConstIterator cend(size_t i) const
Returns an iterator just past the last element of row/column i.
Definition: StaticMatrix.h:1623
Header file for the DisableIf class template.
StaticMatrix & transpose()
Transposing the matrix.
Definition: StaticMatrix.h:2143
void swap(StaticMatrix &m)
Swapping the contents of two static matrices.
Definition: StaticMatrix.h:2191
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:4605
DenseIterator< Type > Iterator
Iterator over non-constant elements.
Definition: StaticMatrix.h:207
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2412
#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:51
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:2094
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:271
Constraint on the data type.
size_t columns() const
Returns the current number of columns of the matrix.
Definition: StaticMatrix.h:1963
IntrinsicType loadu(size_t i, size_t j) const
Unaligned load of an intrinsic element of the matrix.
Definition: StaticMatrix.h:2506
const This & CompositeType
Data type for composite expression templates.
Definition: StaticMatrix.h:202
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:1998
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2410
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:2423
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:216
ConstIterator cbegin(size_t i) const
Returns an iterator to the first element of row/column i.
Definition: StaticMatrix.h:1551
Iterator begin(size_t i)
Returns an iterator to the first element of row/column i.
Definition: StaticMatrix.h:1503
Header file for the equal shim.
Reference operator()(size_t i, size_t j)
2D-access to the matrix elements.
Definition: StaticMatrix.h:1367
Header file for the IsVectorizable type trait.
StaticMatrix< Type, M, N, SO > This
Type of this StaticMatrix instance.
Definition: StaticMatrix.h:195
Header file for the IsNumeric type trait.
IntrinsicTrait< Type > IT
Intrinsic trait for the matrix element type.
Definition: StaticMatrix.h:185
IT::Type IntrinsicType
Intrinsic type of the matrix elements.
Definition: StaticMatrix.h:200
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:218
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:748
Header file for run time assertion macros.
Pointer data()
Low-level data access to the matrix elements.
Definition: StaticMatrix.h:1414
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:4671
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:301
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:331
#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:2411
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
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:2541
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:1982
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:1947
const Type & ReturnType
Return type for expression template evaluations.
Definition: StaticMatrix.h:201
DenseIterator< const Type > ConstIterator
Iterator over constant elements.
Definition: StaticMatrix.h:208
Type & Reference
Reference to a non-constant matrix value.
Definition: StaticMatrix.h:203
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2403
size_t columns(const Matrix< MT, SO > &m)
Returns the current number of columns of the matrix.
Definition: Matrix.h:170
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:2409
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:2612
#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:197
size_t rows(const Matrix< MT, SO > &m)
Returns the current number of rows of the matrix.
Definition: Matrix.h:154
#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:2470
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