35 #ifndef _BLAZE_MATH_DENSE_STATICMATRIX_H_
36 #define _BLAZE_MATH_DENSE_STATICMATRIX_H_
190 template<
typename Type
194 class StaticMatrix :
public DenseMatrix< StaticMatrix<Type,M,N,SO>, SO >
227 template<
typename ET >
245 enum { smpAssignable = 0 };
254 template<
typename Other >
explicit inline StaticMatrix(
size_t m,
size_t n,
const Other* array );
255 template<
typename Other >
explicit inline StaticMatrix(
const Other (&array)[M][N] );
258 template<
typename Other,
bool SO2 >
inline StaticMatrix(
const StaticMatrix<Other,M,N,SO2>& m );
259 template<
typename MT ,
bool SO2 >
inline StaticMatrix(
const Matrix<MT,SO2>& m );
262 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3 );
263 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4 );
264 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5 );
265 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
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 );
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 );
271 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
272 const Type& v6,
const Type& v7,
const Type& v8,
const Type& v9 );
273 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
274 const Type& v6,
const Type& v7,
const Type& v8,
const Type& v9,
const Type& v10 );
285 inline Reference
operator()(
size_t i,
size_t j );
286 inline ConstReference
operator()(
size_t i,
size_t j )
const;
287 inline Pointer
data ();
288 inline ConstPointer
data ()
const;
289 inline Pointer
data (
size_t i );
290 inline ConstPointer
data (
size_t i )
const;
291 inline Iterator
begin (
size_t i );
292 inline ConstIterator
begin (
size_t i )
const;
293 inline ConstIterator
cbegin(
size_t i )
const;
294 inline Iterator
end (
size_t i );
295 inline ConstIterator
end (
size_t i )
const;
296 inline ConstIterator
cend (
size_t i )
const;
303 template<
typename Other >
304 inline StaticMatrix& operator=(
const Other (&array)[M][N] );
308 template<
typename Other,
bool SO2 >
inline StaticMatrix& operator= (
const StaticMatrix<Other,M,N,SO2>& rhs );
309 template<
typename MT ,
bool SO2 >
inline StaticMatrix& operator= (
const Matrix<MT,SO2>& rhs );
310 template<
typename MT ,
bool SO2 >
inline StaticMatrix& operator+=(
const Matrix<MT,SO2>& rhs );
311 template<
typename MT ,
bool SO2 >
inline StaticMatrix& operator-=(
const Matrix<MT,SO2>& rhs );
312 template<
typename MT ,
bool SO2 >
inline StaticMatrix& operator*=(
const Matrix<MT,SO2>& rhs );
314 template<
typename Other >
315 inline typename EnableIf< IsNumeric<Other>,
StaticMatrix >::Type&
316 operator*=( Other rhs );
318 template<
typename Other >
319 inline typename EnableIf< IsNumeric<Other>,
StaticMatrix >::Type&
320 operator/=( Other rhs );
327 inline size_t rows()
const;
331 inline size_t capacity(
size_t i )
const;
333 inline size_t nonZeros(
size_t i )
const;
335 inline void reset(
size_t i );
337 template<
typename Other >
inline StaticMatrix& scale(
const Other& scalar );
345 static inline void*
operator new ( std::size_t
size );
346 static inline void*
operator new[]( std::size_t
size );
347 static inline void*
operator new ( std::size_t
size,
const std::nothrow_t& );
348 static inline void*
operator new[]( std::size_t
size,
const std::nothrow_t& );
350 static inline void operator delete (
void* ptr );
351 static inline void operator delete[](
void* ptr );
352 static inline void operator delete (
void* ptr,
const std::nothrow_t& );
353 static inline void operator delete[](
void* ptr,
const std::nothrow_t& );
360 template<
typename MT >
362 struct VectorizedAssign {
363 enum { value = vectorizable && MT::vectorizable &&
364 IsSame<Type,typename MT::ElementType>::value &&
365 IsRowMajorMatrix<MT>::value };
372 template<
typename MT >
374 struct VectorizedAddAssign {
375 enum { value = vectorizable && MT::vectorizable &&
376 IsSame<Type,typename MT::ElementType>::value &&
377 IntrinsicTrait<Type>::addition &&
378 IsRowMajorMatrix<MT>::value &&
379 !IsDiagonal<MT>::value };
386 template<
typename MT >
388 struct VectorizedSubAssign {
389 enum { value = vectorizable && MT::vectorizable &&
390 IsSame<Type,typename MT::ElementType>::value &&
391 IntrinsicTrait<Type>::subtraction &&
392 IsRowMajorMatrix<MT>::value &&
393 !IsDiagonal<MT>::value };
402 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
403 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
414 template<
typename MT,
bool SO2 >
415 inline typename DisableIf< VectorizedAssign<MT> >::Type
416 assign(
const DenseMatrix<MT,SO2>& rhs );
418 template<
typename MT,
bool SO2 >
419 inline typename EnableIf< VectorizedAssign<MT> >::Type
420 assign(
const DenseMatrix<MT,SO2>& rhs );
422 template<
typename MT >
inline void assign(
const SparseMatrix<MT,SO>& rhs );
423 template<
typename MT >
inline void assign(
const SparseMatrix<MT,!SO>& rhs );
425 template<
typename MT,
bool SO2 >
426 inline typename DisableIf< VectorizedAddAssign<MT> >::Type
427 addAssign(
const DenseMatrix<MT,SO2>& rhs );
429 template<
typename MT,
bool SO2 >
430 inline typename EnableIf< VectorizedAddAssign<MT> >::Type
431 addAssign(
const DenseMatrix<MT,SO2>& rhs );
433 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,SO>& rhs );
434 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,!SO>& rhs );
436 template<
typename MT,
bool SO2 >
437 inline typename DisableIf< VectorizedSubAssign<MT> >::Type
438 subAssign(
const DenseMatrix<MT,SO2>& rhs );
440 template<
typename MT,
bool SO2 >
441 inline typename EnableIf< VectorizedSubAssign<MT> >::Type
442 subAssign(
const DenseMatrix<MT,SO2>& rhs );
444 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,SO>& rhs );
445 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,!SO>& rhs );
493 template<
typename Type
503 for(
size_t i=0UL; i<M*
NN; ++i )
515 template<
typename Type
524 for(
size_t i=0UL; i<M; ++i ) {
525 for(
size_t j=0UL; j<N; ++j )
528 for(
size_t j=N; j<
NN; ++j )
561 template<
typename Type
565 template<
typename Other >
572 throw std::invalid_argument(
"Invalid setup of static matrix" );
574 for(
size_t i=0UL; i<m; ++i ) {
575 for(
size_t j=0UL; j<n; ++j )
576 v_[i*
NN+j] = array[i*n+j];
579 for(
size_t j=n; j<
NN; ++j )
585 for(
size_t i=m; i<M; ++i ) {
586 for(
size_t j=0UL; j<
NN; ++j )
614 template<
typename Type
618 template<
typename Other >
624 for(
size_t i=0UL; i<M; ++i ) {
625 for(
size_t j=0UL; j<N; ++j )
626 v_[i*
NN+j] = array[i][j];
628 for(
size_t j=N; j<
NN; ++j )
642 template<
typename Type
651 for(
size_t i=0UL; i<M*
NN; ++i )
662 template<
typename Type
666 template<
typename Other
673 for(
size_t i=0UL; i<M; ++i ) {
674 for(
size_t j=0UL; j<N; ++j )
677 for(
size_t j=N; j<
NN; ++j )
694 template<
typename Type
698 template<
typename MT
708 throw std::invalid_argument(
"Invalid setup of static matrix" );
710 for(
size_t i=0UL; i<M; ++i ) {
738 template<
typename Type
760 for(
size_t i=0UL; i<M; ++i ) {
761 for(
size_t j=N; j<
NN; ++j )
786 template<
typename Type
810 for(
size_t i=0UL; i<M; ++i ) {
811 for(
size_t j=N; j<
NN; ++j )
839 template<
typename Type
844 const Type& v3,
const Type& v4 )
859 else if( M == 2UL ) {
874 for(
size_t i=0UL; i<M; ++i ) {
875 for(
size_t j=N; j<
NN; ++j )
902 template<
typename Type
907 const Type& v4,
const Type& v5 )
931 for(
size_t i=0UL; i<M; ++i ) {
932 for(
size_t j=N; j<
NN; ++j )
963 template<
typename Type
968 const Type& v4,
const Type& v5,
const Type& v6 )
985 else if( M == 2UL ) {
995 else if( M == 3UL ) {
1001 v_[2UL*
NN+1UL] = v6;
1014 for(
size_t i=0UL; i<M; ++i ) {
1015 for(
size_t j=N; j<
NN; ++j )
1016 v_[i*NN+j] = Type();
1044 template<
typename Type
1049 const Type& v4,
const Type& v5,
const Type& v6,
1078 for(
size_t i=0UL; i<M; ++i ) {
1079 for(
size_t j=N; j<
NN; ++j )
1080 v_[i*NN+j] = Type();
1111 template<
typename Type
1116 const Type& v4,
const Type& v5,
const Type& v6,
1117 const Type& v7,
const Type& v8 )
1136 else if( M == 2UL ) {
1148 else if( M == 4UL ) {
1154 v_[2UL*
NN+1UL] = v6;
1156 v_[3UL*
NN+1UL] = v8;
1171 for(
size_t i=0UL; i<M; ++i ) {
1172 for(
size_t j=N; j<
NN; ++j )
1173 v_[i*NN+j] = Type();
1206 template<
typename Type
1211 const Type& v4,
const Type& v5,
const Type& v6,
1212 const Type& v7,
const Type& v8,
const Type& v9 )
1232 else if( M == 3UL ) {
1240 v_[2UL*
NN+1UL] = v8;
1241 v_[2UL*
NN+2UL] = v9;
1257 for(
size_t i=0UL; i<M; ++i ) {
1258 for(
size_t j=N; j<
NN; ++j )
1259 v_[i*NN+j] = Type();
1293 template<
typename Type
1298 const Type& v4,
const Type& v5,
const Type& v6,
1299 const Type& v7,
const Type& v8,
const Type& v9,
1321 else if( M == 2UL ) {
1335 else if( M == 5UL ) {
1341 v_[2UL*
NN+1UL] = v6;
1343 v_[3UL*
NN+1UL] = v8;
1345 v_[4UL*
NN+1UL] = v10;
1362 for(
size_t i=0UL; i<M; ++i ) {
1363 for(
size_t j=N; j<
NN; ++j )
1364 v_[i*NN+j] = Type();
1385 template<
typename Type
1406 template<
typename Type
1432 template<
typename Type
1456 template<
typename Type
1476 template<
typename Type
1497 template<
typename Type
1521 template<
typename Type
1545 template<
typename Type
1569 template<
typename Type
1593 template<
typename Type
1617 template<
typename Type
1641 template<
typename Type
1683 template<
typename Type
1687 template<
typename Other >
1690 for(
size_t i=0UL; i<M; ++i )
1691 for(
size_t j=0UL; j<N; ++j )
1692 v_[i*NN+j] = array[i][j];
1705 template<
typename Type
1711 for(
size_t i=0UL; i<M; ++i )
1712 for(
size_t j=0UL; j<N; ++j )
1728 template<
typename Type
1748 template<
typename Type
1752 template<
typename Other
1776 template<
typename Type
1780 template<
typename MT
1787 throw std::invalid_argument(
"Invalid assignment to static matrix" );
1789 if( (~rhs).canAlias(
this ) ) {
1814 template<
typename Type
1818 template<
typename MT
1825 throw std::invalid_argument(
"Matrix sizes do not match" );
1827 if( (~rhs).canAlias(
this ) ) {
1850 template<
typename Type
1854 template<
typename MT
1861 throw std::invalid_argument(
"Matrix sizes do not match" );
1863 if( (~rhs).canAlias(
this ) ) {
1886 template<
typename Type
1890 template<
typename MT
1894 if( M != N || (~rhs).
rows() != M || (~rhs).
columns() != M )
1895 throw std::invalid_argument(
"Matrix sizes do not match" );
1898 return this->operator=( tmp );
1910 template<
typename Type
1914 template<
typename Other >
1920 assign( *
this, (*
this) * rhs );
1935 template<
typename Type
1939 template<
typename Other >
1947 assign( *
this, (*
this) / rhs );
1966 template<
typename Type
1982 template<
typename Type
2001 template<
typename Type
2017 template<
typename Type
2039 template<
typename Type
2059 template<
typename Type
2065 size_t nonzeros( 0UL );
2067 for(
size_t i=0UL; i<M; ++i )
2068 for(
size_t j=0UL; j<N; ++j )
2088 template<
typename Type
2096 const size_t jend( (i+1UL)*NN );
2097 size_t nonzeros( 0UL );
2099 for(
size_t j=i*NN; j<jend; ++j )
2113 template<
typename Type
2121 for(
size_t i=0UL; i<M; ++i )
2122 for(
size_t j=0UL; j<N; ++j )
2123 clear( v_[i*NN+j] );
2139 template<
typename Type
2148 for(
size_t j=0UL; j<N; ++j )
2149 clear( v_[i*NN+j] );
2162 template<
typename Type
2172 for(
size_t i=1UL; i<M; ++i )
2173 for(
size_t j=0UL; j<i; ++j )
2174 swap( v_[i*NN+j], v_[j*NN+i] );
2187 template<
typename Type
2191 template<
typename Other >
2194 for(
size_t i=0UL; i<M; ++i )
2195 for(
size_t j=0UL; j<N; ++j )
2196 v_[i*NN+j] *= scalar;
2210 template<
typename Type
2218 for(
size_t i=0UL; i<M; ++i ) {
2219 for(
size_t j=0UL; j<N; ++j ) {
2220 swap( v_[i*NN+j], m(i,j) );
2245 template<
typename Type
2255 return allocate<StaticMatrix>( 1UL );
2270 template<
typename Type
2294 template<
typename Type
2304 return allocate<StaticMatrix>( 1UL );
2319 template<
typename Type
2328 return allocate<StaticMatrix>( size/
sizeof(
StaticMatrix) );
2339 template<
typename Type
2345 deallocate( static_cast<StaticMatrix*>( ptr ) );
2356 template<
typename Type
2362 deallocate( static_cast<StaticMatrix*>( ptr ) );
2373 template<
typename Type
2379 deallocate( static_cast<StaticMatrix*>( ptr ) );
2390 template<
typename Type
2396 deallocate( static_cast<StaticMatrix*>( ptr ) );
2419 template<
typename Type
2423 template<
typename Other >
2426 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2441 template<
typename Type
2445 template<
typename Other >
2448 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
2462 template<
typename Type
2488 template<
typename Type
2504 return load( &v_[i*NN+j] );
2524 template<
typename Type
2539 return loadu( &v_[i*NN+j] );
2560 template<
typename Type
2576 store( &v_[i*NN+j], value );
2597 template<
typename Type
2612 storeu( &v_[i*NN+j], value );
2633 template<
typename Type
2649 stream( &v_[i*NN+j], value );
2665 template<
typename Type
2669 template<
typename MT
2676 for(
size_t i=0UL; i<M; ++i ) {
2677 for(
size_t j=0UL; j<N; ++j ) {
2678 v_[i*NN+j] = (~rhs)(i,j);
2696 template<
typename Type
2700 template<
typename MT
2711 for(
size_t i=0UL; i<M; ++i ) {
2712 for(
size_t j=0UL; j<N; j+=
IT::size ) {
2731 template<
typename Type
2735 template<
typename MT >
2742 for(
size_t i=0UL; i<M; ++i )
2743 for( RhsConstIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
2744 v_[i*NN+element->index()] = element->value();
2760 template<
typename Type
2764 template<
typename MT >
2773 for(
size_t j=0UL; j<N; ++j )
2774 for( RhsConstIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2775 v_[element->index()*NN+j] = element->value();
2791 template<
typename Type
2795 template<
typename MT
2802 for(
size_t i=0UL; i<M; ++i )
2806 v_[i*NN+i] += (~rhs)(i,i);
2818 for(
size_t j=jbegin; j<jend; ++j ) {
2819 v_[i*NN+j] += (~rhs)(i,j);
2838 template<
typename Type
2842 template<
typename MT
2855 for(
size_t i=0UL; i<M; ++i )
2865 for(
size_t j=jbegin; j<jend; j+=
IT::size ) {
2866 store( &v_[i*NN+j],
load( &v_[i*NN+j] ) + (~rhs).
load(i,j) );
2884 template<
typename Type
2888 template<
typename MT >
2895 for(
size_t i=0UL; i<M; ++i )
2896 for( RhsConstIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
2897 v_[i*NN+element->index()] += element->value();
2913 template<
typename Type
2917 template<
typename MT >
2926 for(
size_t j=0UL; j<N; ++j )
2927 for( RhsConstIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
2928 v_[element->index()*NN+j] += element->value();
2944 template<
typename Type
2948 template<
typename MT
2955 for(
size_t i=0UL; i<M; ++i )
2959 v_[i*NN+i] -= (~rhs)(i,i);
2971 for(
size_t j=jbegin; j<jend; ++j ) {
2972 v_[i*NN+j] -= (~rhs)(i,j);
2991 template<
typename Type
2995 template<
typename MT
3008 for(
size_t i=0UL; i<M; ++i )
3018 for(
size_t j=jbegin; j<jend; j+=
IT::size ) {
3019 store( &v_[i*NN+j],
load( &v_[i*NN+j] ) - (~rhs).
load(i,j) );
3037 template<
typename Type
3041 template<
typename MT >
3048 for(
size_t i=0UL; i<M; ++i )
3049 for( RhsConstIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
3050 v_[i*NN+element->index()] -= element->value();
3066 template<
typename Type
3070 template<
typename MT >
3079 for(
size_t j=0UL; j<N; ++j )
3080 for( RhsConstIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
3081 v_[element->index()*NN+j] -= element->value();
3106 template<
typename Type
3142 template<
typename ET >
3154 enum { vectorizable = IsVectorizable<Type>::value };
3160 enum { smpAssignable = 0 };
3169 template<
typename Other >
explicit inline StaticMatrix(
size_t m,
size_t n,
const Other* array );
3170 template<
typename Other >
explicit inline StaticMatrix(
const Other (&array)[M][N] );
3173 template<
typename Other,
bool SO >
inline StaticMatrix(
const StaticMatrix<Other,M,N,SO>& m );
3174 template<
typename MT ,
bool SO >
inline StaticMatrix(
const Matrix<MT,SO>& m );
3177 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3 );
3178 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4 );
3179 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5 );
3180 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
3182 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
3183 const Type& v6,
const Type& v7 );
3184 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
3185 const Type& v6,
const Type& v7,
const Type& v8 );
3186 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
3187 const Type& v6,
const Type& v7,
const Type& v8,
const Type& v9 );
3188 inline StaticMatrix(
const Type& v1,
const Type& v2,
const Type& v3,
const Type& v4,
const Type& v5,
3189 const Type& v6,
const Type& v7,
const Type& v8,
const Type& v9,
const Type& v10 );
3200 inline Reference
operator()(
size_t i,
size_t j );
3201 inline ConstReference
operator()(
size_t i,
size_t j )
const;
3202 inline Pointer
data ();
3203 inline ConstPointer
data ()
const;
3204 inline Pointer
data (
size_t j );
3205 inline ConstPointer
data (
size_t j )
const;
3206 inline Iterator
begin (
size_t j );
3207 inline ConstIterator
begin (
size_t j )
const;
3208 inline ConstIterator
cbegin(
size_t j )
const;
3209 inline Iterator
end (
size_t j );
3210 inline ConstIterator
end (
size_t j )
const;
3211 inline ConstIterator
cend (
size_t j )
const;
3218 template<
typename Other >
3219 inline StaticMatrix& operator=(
const Other (&array)[M][N] );
3223 template<
typename Other,
bool SO >
inline StaticMatrix& operator= (
const StaticMatrix<Other,M,N,SO>& rhs );
3224 template<
typename MT ,
bool SO >
inline StaticMatrix& operator= (
const Matrix<MT,SO>& rhs );
3225 template<
typename MT ,
bool SO >
inline StaticMatrix& operator+=(
const Matrix<MT,SO>& rhs );
3226 template<
typename MT ,
bool SO >
inline StaticMatrix& operator-=(
const Matrix<MT,SO>& rhs );
3227 template<
typename MT ,
bool SO >
inline StaticMatrix& operator*=(
const Matrix<MT,SO>& rhs );
3229 template<
typename Other >
3230 inline typename EnableIf< IsNumeric<Other>,
StaticMatrix >::Type&
3231 operator*=( Other rhs );
3233 template<
typename Other >
3234 inline typename EnableIf< IsNumeric<Other>,
StaticMatrix >::Type&
3235 operator/=( Other rhs );
3242 inline size_t rows()
const;
3243 inline size_t columns()
const;
3244 inline size_t spacing()
const;
3246 inline size_t capacity(
size_t j )
const;
3248 inline size_t nonZeros(
size_t j )
const;
3249 inline void reset();
3250 inline void reset(
size_t i );
3252 template<
typename Other >
inline StaticMatrix& scale(
const Other& scalar );
3260 static inline void*
operator new ( std::size_t
size );
3261 static inline void*
operator new[]( std::size_t
size );
3262 static inline void*
operator new ( std::size_t
size,
const std::nothrow_t& );
3263 static inline void*
operator new[]( std::size_t
size,
const std::nothrow_t& );
3265 static inline void operator delete (
void* ptr );
3266 static inline void operator delete[](
void* ptr );
3267 static inline void operator delete (
void* ptr,
const std::nothrow_t& );
3268 static inline void operator delete[](
void* ptr,
const std::nothrow_t& );
3275 template<
typename MT >
3276 struct VectorizedAssign {
3277 enum { value = vectorizable && MT::vectorizable &&
3278 IsSame<Type,typename MT::ElementType>::value &&
3279 IsColumnMajorMatrix<MT>::value };
3285 template<
typename MT >
3286 struct VectorizedAddAssign {
3287 enum { value = vectorizable && MT::vectorizable &&
3288 IsSame<Type,typename MT::ElementType>::value &&
3289 IntrinsicTrait<Type>::addition &&
3290 IsColumnMajorMatrix<MT>::value &&
3291 !IsDiagonal<MT>::value };
3297 template<
typename MT >
3298 struct VectorizedSubAssign {
3299 enum { value = vectorizable && MT::vectorizable &&
3300 IsSame<Type,typename MT::ElementType>::value &&
3301 IntrinsicTrait<Type>::subtraction &&
3302 IsColumnMajorMatrix<MT>::value &&
3303 !IsDiagonal<MT>::value };
3311 template<
typename Other >
inline bool canAlias (
const Other* alias )
const;
3312 template<
typename Other >
inline bool isAliased(
const Other* alias )
const;
3323 template<
typename MT,
bool SO >
3324 inline typename DisableIf< VectorizedAssign<MT> >::Type
3325 assign(
const DenseMatrix<MT,SO>& rhs );
3327 template<
typename MT,
bool SO >
3328 inline typename EnableIf< VectorizedAssign<MT> >::Type
3329 assign(
const DenseMatrix<MT,SO>& rhs );
3331 template<
typename MT >
inline void assign(
const SparseMatrix<MT,true>& rhs );
3332 template<
typename MT >
inline void assign(
const SparseMatrix<MT,false>& rhs );
3334 template<
typename MT,
bool SO >
3335 inline typename DisableIf< VectorizedAddAssign<MT> >::Type
3336 addAssign(
const DenseMatrix<MT,SO>& rhs );
3338 template<
typename MT,
bool SO >
3339 inline typename EnableIf< VectorizedAddAssign<MT> >::Type
3340 addAssign(
const DenseMatrix<MT,SO>& rhs );
3342 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,true>& rhs );
3343 template<
typename MT >
inline void addAssign(
const SparseMatrix<MT,false>& rhs );
3345 template<
typename MT,
bool SO >
3346 inline typename DisableIf< VectorizedSubAssign<MT> >::Type
3347 subAssign(
const DenseMatrix<MT,SO>& rhs );
3349 template<
typename MT,
bool SO >
3350 inline typename EnableIf< VectorizedSubAssign<MT> >::Type
3351 subAssign(
const DenseMatrix<MT,SO>& rhs );
3353 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,true>& rhs );
3354 template<
typename MT >
inline void subAssign(
const SparseMatrix<MT,false>& rhs );
3362 AlignedArray<Type,MM*N>
v_;
3395 template<
typename Type
3403 if( IsNumeric<Type>::value ) {
3404 for(
size_t i=0UL; i<MM*N; ++i )
3418 template<
typename Type
3426 for(
size_t j=0UL; j<N; ++j ) {
3427 for(
size_t i=0UL; i<M; ++i )
3430 for(
size_t i=M; i<MM; ++i )
3431 v_[i+j*MM] = Type();
3465 template<
typename Type
3468 template<
typename Other >
3474 if( m > M || n > N )
3475 throw std::invalid_argument(
"Invalid setup of static matrix" );
3477 for(
size_t j=0UL; j<n; ++j ) {
3478 for(
size_t i=0UL; i<m; ++i )
3479 v_[i+j*MM] = array[i+j*m];
3481 if( IsNumeric<Type>::value ) {
3482 for(
size_t i=m; i<MM; ++i )
3483 v_[i+j*MM] = Type();
3487 if( IsNumeric<Type>::value ) {
3488 for(
size_t j=n; j<N; ++j ) {
3489 for(
size_t i=0UL; i<M; ++i )
3490 v_[i+j*MM] = Type();
3519 template<
typename Type
3522 template<
typename Other >
3528 for(
size_t j=0UL; j<N; ++j ) {
3529 for(
size_t i=0UL; i<M; ++i )
3530 v_[i+j*MM] = array[i][j];
3532 for(
size_t i=M; i<MM; ++i )
3533 v_[i+j*MM] = Type();
3548 template<
typename Type
3556 for(
size_t i=0UL; i<MM*N; ++i )
3569 template<
typename Type
3572 template<
typename Other
3579 for(
size_t j=0UL; j<N; ++j ) {
3580 for(
size_t i=0UL; i<M; ++i )
3581 v_[i+j*MM] = m(i,j);
3583 for(
size_t i=M; i<MM; ++i )
3584 v_[i+j*MM] = Type();
3602 template<
typename Type
3605 template<
typename MT
3615 throw std::invalid_argument(
"Invalid setup of static matrix" );
3617 for(
size_t j=0UL; j<N; ++j ) {
3618 for(
size_t i=( IsSparseMatrix<MT>::value ? 0UL : M ); i<MM; ++i ) {
3619 v_[i+j*MM] = Type();
3623 assign( *
this, ~m );
3647 template<
typename Type
3668 for(
size_t j=0UL; j<N; ++j )
3669 for(
size_t i=M; i<MM; ++i ) {
3670 v_[i+j*MM] = Type();
3696 template<
typename Type
3719 for(
size_t j=0UL; j<N; ++j )
3720 for(
size_t i=M; i<MM; ++i ) {
3721 v_[i+j*MM] = Type();
3750 template<
typename Type
3769 else if( N == 2UL ) {
3784 for(
size_t j=0UL; j<N; ++j )
3785 for(
size_t i=M; i<MM; ++i ) {
3786 v_[i+j*MM] = Type();
3814 template<
typename Type
3818 const Type& v4,
const Type& v5 )
3842 for(
size_t j=0UL; j<N; ++j )
3843 for(
size_t i=M; i<MM; ++i ) {
3844 v_[i+j*MM] = Type();
3876 template<
typename Type
3880 const Type& v4,
const Type& v5,
const Type& v6 )
3897 else if( N == 2UL ) {
3907 else if( N == 3UL ) {
3913 v_[2UL*MM+1UL] = v6;
3926 for(
size_t j=0UL; j<N; ++j )
3927 for(
size_t i=M; i<MM; ++i ) {
3928 v_[i+j*MM] = Type();
3958 template<
typename Type
3962 const Type& v4,
const Type& v5,
const Type& v6,
3991 for(
size_t j=0UL; j<N; ++j )
3992 for(
size_t i=M; i<MM; ++i ) {
3993 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 )
4051 else if( N == 2UL ) {
4063 else if( N == 4UL ) {
4069 v_[2UL*MM+1UL] = v6;
4071 v_[3UL*MM+1UL] = v8;
4086 for(
size_t j=0UL; j<N; ++j )
4087 for(
size_t i=M; i<MM; ++i ) {
4088 v_[i+j*MM] = Type();
4123 template<
typename Type
4127 const Type& v4,
const Type& v5,
const Type& v6,
4128 const Type& v7,
const Type& v8,
const Type& v9 )
4148 else if( N == 3UL ) {
4156 v_[2UL*MM+1UL] = v8;
4157 v_[2UL*MM+2UL] = v9;
4173 for(
size_t j=0UL; j<N; ++j )
4174 for(
size_t i=M; i<MM; ++i ) {
4175 v_[i+j*MM] = Type();
4211 template<
typename Type
4215 const Type& v4,
const Type& v5,
const Type& v6,
4216 const Type& v7,
const Type& v8,
const Type& v9,
4238 else if( N == 2UL ) {
4252 else if( N == 5UL ) {
4258 v_[2UL*MM+1UL] = v6;
4260 v_[3UL*MM+1UL] = v8;
4262 v_[4UL*MM+1UL] = v10;
4279 for(
size_t j=0UL; j<N; ++j )
4280 for(
size_t i=M; i<MM; ++i ) {
4281 v_[i+j*MM] = Type();
4304 template<
typename Type
4326 template<
typename Type
4352 template<
typename Type
4355 inline typename StaticMatrix<Type,M,N,true>::Pointer
4376 template<
typename Type
4379 inline typename StaticMatrix<Type,M,N,true>::ConstPointer
4397 template<
typename Type
4400 inline typename StaticMatrix<Type,M,N,true>::Pointer
4419 template<
typename Type
4422 inline typename StaticMatrix<Type,M,N,true>::ConstPointer
4439 template<
typename Type
4459 template<
typename Type
4479 template<
typename Type
4499 template<
typename Type
4519 template<
typename Type
4539 template<
typename Type
4582 template<
typename Type
4585 template<
typename Other >
4586 inline StaticMatrix<Type,M,N,true>&
4587 StaticMatrix<Type,M,N,true>::operator=(
const Other (&array)[M][N] )
4589 for(
size_t j=0UL; j<N; ++j )
4590 for(
size_t i=0UL; i<M; ++i )
4591 v_[i+j*MM] = array[i][j];
4606 template<
typename Type
4609 inline StaticMatrix<Type,M,N,true>&
4610 StaticMatrix<Type,M,N,true>::operator=(
const Type&
set )
4612 for(
size_t j=0UL; j<N; ++j )
4613 for(
size_t i=0UL; i<M; ++i )
4631 template<
typename Type
4634 inline StaticMatrix<Type,M,N,true>&
4635 StaticMatrix<Type,M,N,true>::operator=(
const StaticMatrix& rhs )
4653 template<
typename Type
4656 template<
typename Other
4658 inline StaticMatrix<Type,M,N,true>&
4659 StaticMatrix<Type,M,N,true>::operator=(
const StaticMatrix<Other,M,N,SO>& rhs )
4682 template<
typename Type
4685 template<
typename MT
4687 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator=(
const Matrix<MT,SO>& rhs )
4692 throw std::invalid_argument(
"Invalid assignment to static matrix" );
4694 if( (~rhs).canAlias(
this ) ) {
4695 StaticMatrix tmp( ~rhs );
4699 if( IsSparseMatrix<MT>::value )
4721 template<
typename Type
4724 template<
typename MT
4726 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator+=(
const Matrix<MT,SO>& rhs )
4731 throw std::invalid_argument(
"Matrix sizes do not match" );
4733 if( (~rhs).canAlias(
this ) ) {
4758 template<
typename Type
4761 template<
typename MT
4763 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator-=(
const Matrix<MT,SO>& rhs )
4768 throw std::invalid_argument(
"Matrix sizes do not match" );
4770 if( (~rhs).canAlias(
this ) ) {
4795 template<
typename Type
4798 template<
typename MT
4800 inline StaticMatrix<Type,M,N,true>& StaticMatrix<Type,M,N,true>::operator*=(
const Matrix<MT,SO>& rhs )
4802 if( M != N || (~rhs).
rows() != M || (~rhs).
columns() != M )
4803 throw std::invalid_argument(
"Matrix sizes do not match" );
4805 StaticMatrix tmp( *
this * (~rhs) );
4806 return this->operator=( tmp );
4820 template<
typename Type
4823 template<
typename Other >
4824 inline typename EnableIf< IsNumeric<Other>, StaticMatrix<Type,M,N,true> >::Type&
4825 StaticMatrix<Type,M,N,true>::operator*=( Other rhs )
4829 assign( *
this, (*
this) * rhs );
4846 template<
typename Type
4849 template<
typename Other >
4850 inline typename EnableIf< IsNumeric<Other>, StaticMatrix<Type,M,N,true> >::Type&
4851 StaticMatrix<Type,M,N,true>::operator/=( Other rhs )
4857 assign( *
this, (*
this) / rhs );
4878 template<
typename Type
4895 template<
typename Type
4915 template<
typename Type
4932 template<
typename Type
4950 template<
typename Type
4971 template<
typename Type
4976 size_t nonzeros( 0UL );
4978 for(
size_t j=0UL; j<N; ++j )
4979 for(
size_t i=0UL; i<M; ++i )
4996 template<
typename Type
5003 const size_t iend( (j+1UL)*MM );
5004 size_t nonzeros( 0UL );
5006 for(
size_t i=j*MM; i<iend; ++i )
5022 template<
typename Type
5029 for(
size_t j=0UL; j<N; ++j )
5030 for(
size_t i=0UL; i<M; ++i )
5031 clear( v_[i+j*MM] );
5047 template<
typename Type
5055 for(
size_t i=0UL; i<M; ++i )
5056 clear( v_[i+j*MM] );
5071 template<
typename Type
5080 for(
size_t j=1UL; j<N; ++j )
5081 for(
size_t i=0UL; i<j; ++i )
5082 swap( v_[i+j*MM], v_[j+i*MM] );
5097 template<
typename Type
5100 template<
typename Other >
5101 inline StaticMatrix<Type,M,N,true>&
5102 StaticMatrix<Type,M,N,true>::scale(
const Other& scalar )
5104 for(
size_t j=0UL; j<N; ++j )
5105 for(
size_t i=0UL; i<M; ++i )
5106 v_[i+j*MM] *= scalar;
5122 template<
typename Type
5129 for(
size_t j=0UL; j<N; ++j ) {
5130 for(
size_t i=0UL; i<M; ++i ) {
5131 swap( v_[i+j*MM], m(i,j) );
5158 template<
typename Type
5161 inline void* StaticMatrix<Type,M,N,true>::operator
new( std::size_t
size )
5167 return allocate<StaticMatrix>( 1UL );
5184 template<
typename Type
5187 inline void* StaticMatrix<Type,M,N,true>::operator
new[]( std::size_t
size )
5192 return allocate<StaticMatrix>( size/
sizeof(StaticMatrix) );
5209 template<
typename Type
5212 inline void* StaticMatrix<Type,M,N,true>::operator
new( std::size_t
size,
const std::nothrow_t& )
5218 return allocate<StaticMatrix>( 1UL );
5235 template<
typename Type
5238 inline void* StaticMatrix<Type,M,N,true>::operator
new[]( std::size_t
size,
const std::nothrow_t& )
5243 return allocate<StaticMatrix>( size/
sizeof(StaticMatrix) );
5256 template<
typename Type
5259 inline void StaticMatrix<Type,M,N,true>::operator
delete(
void* ptr )
5261 deallocate( static_cast<StaticMatrix*>( ptr ) );
5274 template<
typename Type
5277 inline void StaticMatrix<Type,M,N,true>::operator
delete[](
void* ptr )
5279 deallocate( static_cast<StaticMatrix*>( ptr ) );
5292 template<
typename Type
5295 inline void StaticMatrix<Type,M,N,true>::operator
delete(
void* ptr,
const std::nothrow_t& )
5297 deallocate( static_cast<StaticMatrix*>( ptr ) );
5310 template<
typename Type
5313 inline void StaticMatrix<Type,M,N,true>::operator
delete[](
void* ptr,
const std::nothrow_t& )
5315 deallocate( static_cast<StaticMatrix*>( ptr ) );
5340 template<
typename Type
5343 template<
typename Other >
5346 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
5363 template<
typename Type
5366 template<
typename Other >
5369 return static_cast<const void*
>( this ) == static_cast<const void*>( alias );
5385 template<
typename Type
5411 template<
typename Type
5426 return load( &v_[i+j*MM] );
5447 template<
typename Type
5461 return loadu( &v_[i+j*MM] );
5483 template<
typename Type
5498 store( &v_[i+j*MM], value );
5520 template<
typename Type
5534 storeu( &v_[i+j*MM], value );
5557 template<
typename Type
5572 stream( &v_[i+j*MM], value );
5590 template<
typename Type
5593 template<
typename MT
5595 inline typename DisableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAssign<MT> >::Type
5600 for(
size_t j=0UL; j<N; ++j ) {
5601 for(
size_t i=0UL; i<M; ++i ) {
5602 v_[i+j*MM] = (~rhs)(i,j);
5622 template<
typename Type
5625 template<
typename MT
5627 inline typename EnableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAssign<MT> >::Type
5636 for(
size_t j=0UL; j<N; ++j ) {
5637 for(
size_t i=0UL; i<M; i+=
IT::size ) {
5658 template<
typename Type
5661 template<
typename MT >
5668 for(
size_t j=0UL; j<N; ++j )
5669 for( RhsConstIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
5670 v_[element->index()+j*MM] = element->value();
5688 template<
typename Type
5691 template<
typename MT >
5700 for(
size_t i=0UL; i<M; ++i )
5701 for( RhsConstIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
5702 v_[i+element->index()*MM] = element->value();
5720 template<
typename Type
5723 template<
typename MT
5725 inline typename DisableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >::Type
5730 for(
size_t j=0UL; j<N; ++j )
5732 if( IsDiagonal<MT>::value )
5734 v_[j+j*MM] += (~rhs)(j,j);
5738 const size_t ibegin( ( IsLower<MT>::value )
5739 ?( IsStrictlyLower<MT>::value ? j+1UL : j )
5741 const size_t iend ( ( IsUpper<MT>::value )
5742 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5746 for(
size_t i=ibegin; i<iend; ++i ) {
5747 v_[i+j*MM] += (~rhs)(i,j);
5768 template<
typename Type
5771 template<
typename MT
5773 inline typename EnableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedAddAssign<MT> >::Type
5784 for(
size_t j=0UL; j<N; ++j )
5786 const size_t ibegin( ( IsLower<MT>::value )
5787 ?( ( IsStrictlyLower<MT>::value ? j+1UL : j ) &
size_t(-
IT::size) )
5789 const size_t iend ( ( IsUpper<MT>::value )
5790 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5794 for(
size_t i=ibegin; i<iend; i+=
IT::size ) {
5795 store( &v_[i+j*MM],
load( &v_[i+j*MM] ) + (~rhs).
load(i,j) );
5815 template<
typename Type
5818 template<
typename MT >
5825 for(
size_t j=0UL; j<N; ++j )
5826 for( RhsConstIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
5827 v_[element->index()+j*MM] += element->value();
5845 template<
typename Type
5848 template<
typename MT >
5857 for(
size_t i=0UL; i<M; ++i )
5858 for( RhsConstIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
5859 v_[i+element->index()*MM] += element->value();
5877 template<
typename Type
5880 template<
typename MT
5882 inline typename DisableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >::Type
5887 for(
size_t j=0UL; j<N; ++j )
5889 if( IsDiagonal<MT>::value )
5891 v_[j+j*MM] -= (~rhs)(j,j);
5895 const size_t ibegin( ( IsLower<MT>::value )
5896 ?( IsStrictlyLower<MT>::value ? j+1UL : j )
5898 const size_t iend ( ( IsUpper<MT>::value )
5899 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5903 for(
size_t i=ibegin; i<iend; ++i ) {
5904 v_[i+j*MM] -= (~rhs)(i,j);
5925 template<
typename Type
5928 template<
typename MT
5930 inline typename EnableIf< typename StaticMatrix<Type,M,N,true>::BLAZE_TEMPLATE VectorizedSubAssign<MT> >::Type
5941 for(
size_t j=0UL; j<N; ++j )
5943 const size_t ibegin( ( IsLower<MT>::value )
5944 ?( ( IsStrictlyLower<MT>::value ? j+1UL : j ) &
size_t(-
IT::size) )
5946 const size_t iend ( ( IsUpper<MT>::value )
5947 ?( IsStrictlyUpper<MT>::value ? j : j+1UL )
5951 for(
size_t i=ibegin; i<iend; i+=
IT::size ) {
5952 store( &v_[i+j*MM],
load( &v_[i+j*MM] ) - (~rhs).
load(i,j) );
5972 template<
typename Type
5975 template<
typename MT >
5982 for(
size_t j=0UL; j<N; ++j )
5983 for( RhsConstIterator element=(~rhs).
begin(j); element!=(~rhs).
end(j); ++element )
5984 v_[element->index()+j*MM] -= element->value();
6002 template<
typename Type
6005 template<
typename MT >
6014 for(
size_t i=0UL; i<M; ++i )
6015 for( RhsConstIterator element=(~rhs).
begin(i); element!=(~rhs).
end(i); ++element )
6016 v_[i+element->index()*MM] -= element->value();
6042 template<
typename Type
6045 class StaticMatrix<Type,M,0UL,SO>;
6058 template<
typename Type
6061 class StaticMatrix<Type,0UL,N,SO>;
6074 template<
typename Type
6076 class StaticMatrix<Type,0UL,0UL,SO>;
6096 template<
typename Type,
size_t M,
size_t N,
bool SO >
6097 inline void reset( StaticMatrix<Type,M,N,SO>& m );
6099 template<
typename Type,
size_t M,
size_t N,
bool SO >
6100 inline void reset( StaticMatrix<Type,M,N,SO>& m,
size_t i );
6102 template<
typename Type,
size_t M,
size_t N,
bool SO >
6103 inline void clear( StaticMatrix<Type,M,N,SO>& m );
6105 template<
typename Type,
size_t M,
size_t N,
bool SO >
6106 inline bool isDefault(
const StaticMatrix<Type,M,N,SO>& m );
6108 template<
typename Type,
size_t M,
size_t N,
bool SO >
6109 inline void swap( StaticMatrix<Type,M,N,SO>& a, StaticMatrix<Type,M,N,SO>& b ) ;
6111 template<
typename Type,
size_t M,
size_t N,
bool SO >
6112 inline void move( StaticMatrix<Type,M,N,SO>& dst, StaticMatrix<Type,M,N,SO>& src ) ;
6124 template<
typename Type
6148 template<
typename Type
6168 template<
typename Type
6186 template<
typename Type
6193 for(
size_t i=0UL; i<M; ++i )
6194 for(
size_t j=0UL; j<N; ++j )
6195 if( !
isDefault( m(i,j) ) )
return false;
6198 for(
size_t j=0UL; j<N; ++j )
6199 for(
size_t i=0UL; i<M; ++i )
6200 if( !
isDefault( m(i,j) ) )
return false;
6217 template<
typename Type
6237 template<
typename Type
6258 template<
typename T,
size_t M,
size_t N,
bool SO >
6259 struct Rows< StaticMatrix<T,M,N,SO> > :
public SizeT<M>
6275 template<
typename T,
size_t M,
size_t N,
bool SO >
6276 struct Columns< StaticMatrix<T,M,N,SO> > :
public SizeT<N>
6292 template<
typename T,
size_t N,
bool SO >
6293 struct IsSquare< StaticMatrix<T,N,N,SO> > :
public TrueType
6312 template<
typename T,
size_t M,
size_t N,
bool SO >
6313 struct HasConstDataAccess< StaticMatrix<T,M,N,SO> > :
public TrueType
6332 template<
typename T,
size_t M,
size_t N,
bool SO >
6333 struct HasMutableDataAccess< StaticMatrix<T,M,N,SO> > :
public TrueType
6352 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6353 struct AddTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
6355 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N, SO > Type;
6358 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6359 struct AddTrait< StaticMatrix<T1,M,N,SO1>, StaticMatrix<T2,M,N,SO2> >
6361 typedef StaticMatrix< typename AddTrait<T1,T2>::Type, M, N,
false > Type;
6377 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6378 struct SubTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
6380 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N, SO > Type;
6383 template<
typename T1,
size_t M,
size_t N,
bool SO1,
typename T2,
bool SO2 >
6384 struct SubTrait< StaticMatrix<T1,M,N,SO1>, StaticMatrix<T2,M,N,SO2> >
6386 typedef StaticMatrix< typename SubTrait<T1,T2>::Type, M, N,
false > Type;
6402 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6403 struct MultTrait< StaticMatrix<T1,M,N,SO>, T2 >
6405 typedef StaticMatrix< typename MultTrait<T1,T2>::Type, M, N, SO > Type;
6409 template<
typename T1,
typename T2,
size_t M,
size_t N,
bool SO >
6410 struct MultTrait< T1, StaticMatrix<T2,M,N,SO> >
6412 typedef StaticMatrix< typename MultTrait<T1,T2>::Type, M, N, SO > Type;
6416 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6417 struct MultTrait< StaticMatrix<T1,M,N,SO>, StaticVector<T2,N,false> >
6419 typedef StaticVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
6422 template<
typename T1,
size_t M,
typename T2,
size_t N,
bool SO >
6423 struct MultTrait< StaticVector<T1,M,true>, StaticMatrix<T2,M,N,SO> >
6425 typedef StaticVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
6428 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2,
size_t L >
6429 struct MultTrait< StaticMatrix<T1,M,N,SO>, HybridVector<T2,L,false> >
6431 typedef StaticVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
6434 template<
typename T1,
size_t L,
typename T2,
size_t M,
size_t N,
bool SO >
6435 struct MultTrait< HybridVector<T1,L,true>, StaticMatrix<T2,M,N,SO> >
6437 typedef StaticVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
6440 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6441 struct MultTrait< StaticMatrix<T1,M,N,SO>, DynamicVector<T2,false> >
6443 typedef StaticVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
6446 template<
typename T1,
typename T2,
size_t M,
size_t N,
bool SO >
6447 struct MultTrait< DynamicVector<T1,true>, StaticMatrix<T2,M,N,SO> >
6449 typedef StaticVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
6452 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6453 struct MultTrait< StaticMatrix<T1,M,N,SO>, CompressedVector<T2,false> >
6455 typedef StaticVector< typename MultTrait<T1,T2>::Type, M,
false > Type;
6458 template<
typename T1,
typename T2,
size_t M,
size_t N,
bool SO >
6459 struct MultTrait< CompressedVector<T1,true>, StaticMatrix<T2,M,N,SO> >
6461 typedef StaticVector< typename MultTrait<T1,T2>::Type, N,
true > Type;
6464 template<
typename T1,
size_t M,
size_t K,
bool SO1,
typename T2,
size_t N,
bool SO2 >
6465 struct MultTrait< StaticMatrix<T1,M,K,SO1>, StaticMatrix<T2,K,N,SO2> >
6467 typedef StaticMatrix< typename MultTrait<T1,T2>::Type, M, N, SO1 > Type;
6483 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6484 struct DivTrait< StaticMatrix<T1,M,N,SO>, T2 >
6486 typedef StaticMatrix< typename DivTrait<T1,T2>::Type, M, N, SO > Type;
6503 template<
typename T1,
size_t M,
size_t N,
bool SO,
typename T2 >
6504 struct MathTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
6506 typedef StaticMatrix< typename MathTrait<T1,T2>::HighType, M, N, SO > HighType;
6507 typedef StaticMatrix< typename MathTrait<T1,T2>::LowType , M, N, SO > LowType;
6523 template<
typename T1,
size_t M,
size_t N,
bool SO >
6524 struct SubmatrixTrait< StaticMatrix<T1,M,N,SO> >
6526 typedef HybridMatrix<T1,M,N,SO> Type;
6542 template<
typename T1,
size_t M,
size_t N,
bool SO >
6543 struct RowTrait< StaticMatrix<T1,M,N,SO> >
6545 typedef StaticVector<T1,N,true> Type;
6561 template<
typename T1,
size_t M,
size_t N,
bool SO >
6562 struct ColumnTrait< StaticMatrix<T1,M,N,SO> >
6564 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
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.
BLAZE_ALWAYS_INLINE IntrinsicType loadu(size_t i, size_t j) const
Unaligned load of an intrinsic element of the matrix.
Definition: StaticMatrix.h:2529
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_USER_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERT flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:117
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
size_t nonZeros() const
Returns the total number of non-zero elements in the matrix.
Definition: StaticMatrix.h:2063
Header file for basic type definitions.
const bool defaultStorageOrder
The default storage order for all matrices of the Blaze library.This value specifies the default stor...
Definition: StorageOrder.h:56
IntrinsicTrait< Type > IT
Intrinsic trait for the matrix element type.
Definition: StaticMatrix.h:198
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:264
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type stream(T *address, const sse_int16_t &value)
Aligned, non-temporal store of a vector of 2-byte integral values.
Definition: Stream.h:76
Header file for the row trait.
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:258
bool canAlias(const Other *alias) const
Returns whether the matrix can alias with the given address alias.
Definition: StaticMatrix.h:2424
Header file for the IsSparseMatrix type trait.
Header file for the IsDiagonal type trait.
StaticMatrix()
The default constructor for StaticMatrix.
Definition: StaticMatrix.h:497
StaticMatrix< ET, M, N, SO > Other
The type of the other StaticMatrix.
Definition: StaticMatrix.h:229
Header file for the IsSame and IsStrictlySame type traits.
StaticMatrix< Type, N, M,!SO > TransposeType
Transpose type for expression template evaluations.
Definition: StaticMatrix.h:211
Header file for the IsColumnMajorMatrix type trait.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:821
StaticMatrix< Type, M, N,!SO > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: StaticMatrix.h:210
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:316
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Compile time check for lower triangular matrices.This type trait tests whether or not the given templ...
Definition: IsLower.h:90
static const size_t NN
Alignment adjustment.
Definition: StaticMatrix.h:203
#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
Header file for the SizeT class template.
Compile time check for upper triangular matrices.This type trait tests whether or not the given templ...
Definition: IsUpper.h:90
Iterator end(size_t i)
Returns an iterator just past the last element of row/column i.
Definition: StaticMatrix.h:1598
Header file for memory allocation and deallocation functionality.
This ResultType
Result type for expression template evaluations.
Definition: StaticMatrix.h:209
AlignedArray< Type, M *NN > v_
The statically allocated matrix elements.
Definition: StaticMatrix.h:453
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
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:861
Constraint on the data type.
bool isAligned() const
Returns whether the matrix is properly aligned in memory.
Definition: StaticMatrix.h:2466
const Type * ConstPointer
Pointer to a constant matrix value.
Definition: StaticMatrix.h:219
Header file for the SparseMatrix base class.
Header file for the IsSquare type trait.
BLAZE_ALWAYS_INLINE void store(size_t i, size_t j, const IntrinsicType &value)
Aligned store of an intrinsic element of the matrix.
Definition: StaticMatrix.h:2565
ConstIterator cend(size_t i) const
Returns an iterator just past the last element of row/column i.
Definition: StaticMatrix.h:1646
const Type & ConstReference
Reference to a constant matrix value.
Definition: StaticMatrix.h:217
Header file for the DisableIf class template.
StaticMatrix & transpose()
Transposing the matrix.
Definition: StaticMatrix.h:2166
void swap(StaticMatrix &m)
Swapping the contents of two static matrices.
Definition: StaticMatrix.h:2214
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the clear shim.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type loadu(const T *address)
Loads a vector of 2-byte integral values.
Definition: Loadu.h:76
Header file for nested template disabiguation.
IT::Type IntrinsicType
Intrinsic type of the matrix elements.
Definition: StaticMatrix.h:213
void swap(CompressedMatrix< Type, SO > &a, CompressedMatrix< Type, SO > &b)
Swapping the contents of two compressed matrices.
Definition: CompressedMatrix.h:4807
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
BLAZE_ALWAYS_INLINE void storeu(size_t i, size_t j, const IntrinsicType &value)
Unaligned store of an intrinsic element of the matrix.
Definition: StaticMatrix.h:2602
#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
Type & Reference
Reference to a non-constant matrix value.
Definition: StaticMatrix.h:216
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type store(T *address, const sse_int16_t &value)
Aligned store of a vector of 2-byte integral values.
Definition: Store.h:80
Efficient implementation of a fixed-sized matrix.The StaticMatrix class template is the representatio...
Definition: Forward.h:58
Header file for the DenseMatrix base class.
BLAZE_ALWAYS_INLINE void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:635
Header file for the Columns type trait.
EnableIf< IsBuiltin< T > >::Type deallocate(T *address)
Deallocation of memory for built-in data types.
Definition: Memory.h:226
Header file for the DenseIterator class template.
void reset()
Reset to the default initial values.
Definition: StaticMatrix.h:2117
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t i, size_t j) const
Aligned load of an intrinsic element of the matrix.
Definition: StaticMatrix.h:2493
BLAZE_ALWAYS_INLINE 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:2638
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_DIAGONAL_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a diagonal matrix type, a compilation error is created.
Definition: Diagonal.h:116
size_t columns() const
Returns the current number of columns of the matrix.
Definition: StaticMatrix.h:1986
Header file for the IsLower type trait.
Compile time check for diagonal matrices.This type trait tests whether or not the given template para...
Definition: IsDiagonal.h:92
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:2021
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:195
Compile time check for strictly upper triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyUpper.h:86
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2509
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:841
bool isAliased(const Other *alias) const
Returns whether the matrix is aliased with the given address alias.
Definition: StaticMatrix.h:2446
ConstIterator cbegin(size_t i) const
Returns an iterator to the first element of row/column i.
Definition: StaticMatrix.h:1574
Iterator begin(size_t i)
Returns an iterator to the first element of row/column i.
Definition: StaticMatrix.h:1526
Reference operator()(size_t i, size_t j)
2D-access to the matrix elements.
Definition: StaticMatrix.h:1390
Header file for the IsVectorizable type trait.
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type load(const T *address)
Loads a vector of 2-byte integral values.
Definition: Load.h:79
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
Type ElementType
Type of the matrix elements.
Definition: StaticMatrix.h:212
const This & CompositeType
Data type for composite expression templates.
Definition: StaticMatrix.h:215
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:116
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:749
Header file for run time assertion macros.
Pointer data()
Low-level data access to the matrix elements.
Definition: StaticMatrix.h:1437
Header file for the addition trait.
BLAZE_ALWAYS_INLINE void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:742
Header file for the division trait.
Header file for the submatrix trait.
Constraint on the data type.
Type * Pointer
Pointer to a non-constant matrix value.
Definition: StaticMatrix.h:218
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
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > > >::Type storeu(T *address, const sse_int16_t &value)
Unaligned store of a vector of 2-byte integral values.
Definition: Storeu.h:77
void move(DynamicMatrix< Type, SO > &dst, DynamicMatrix< Type, SO > &src)
Moving the contents of one dynamic matrix to another.
Definition: DynamicMatrix.h:4934
Header file for the AlignedArray implementation.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.In case the given data type T is not a reference type, a compilation error is created.
Definition: Reference.h:116
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2510
Header file for the column trait.
Header file for the isDefault shim.
Constraint on the data type.
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:87
Constraint on the data type.
Constraint on the data type.
Header file for the HasMutableDataAccess type trait.
Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool...
Definition: DisableIf.h:184
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b)
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:200
BLAZE_ALWAYS_INLINE EnableIf< And< IsIntegral< T >, HasSize< T, 2UL > >, sse_int16_t >::Type set(T value)
Sets all values in the vector to the given 2-byte integral value.
Definition: Set.h:73
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.
Compile time check for strictly lower triangular matrices.This type trait tests whether or not the gi...
Definition: IsStrictlyLower.h:86
Header file for the IsRowMajorMatrix type trait.
size_t spacing() const
Returns the spacing between the beginning of two rows.
Definition: StaticMatrix.h:2005
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:1970
DenseIterator< Type > Iterator
Iterator over non-constant elements.
Definition: StaticMatrix.h:220
DenseIterator< const Type > ConstIterator
Iterator over constant elements.
Definition: StaticMatrix.h:221
Rebind mechanism to obtain a StaticMatrix with different data/element type.
Definition: StaticMatrix.h:228
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2502
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:332
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:2508
Rebind mechanism to obtain a CompressedMatrix with different data/element type.
Definition: CompressedMatrix.h:2518
Header file for the IsUpper type trait.
boost::true_type TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
StaticMatrix< Type, M, N, SO > This
Type of this StaticMatrix instance.
Definition: StaticMatrix.h:208
#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
System settings for the inline keywords.
#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
BLAZE_ALWAYS_INLINE void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:849
const Type & ReturnType
Return type for expression template evaluations.
Definition: StaticMatrix.h:214