35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATTRANSPOSER_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATTRANSPOSER_H_
97 enum { vectorizable = MT::vectorizable };
141 template<
typename Other >
158 template<
typename Other >
174 return dm_.columns();
194 return dm_.spacing();
214 template<
typename Other >
217 return dm_.canAlias( alias );
227 template<
typename Other >
230 return dm_.isAliased( alias );
247 return dm_.load( j, i );
264 return dm_.loadu( j, i );
282 dm_.store( j, i, value );
300 dm_.storeu( j, i, value );
318 dm_.stream( j, i, value );
333 template<
typename MT2 >
341 const size_t m(
rows() );
345 const size_t end( n &
size_t(-2) );
347 for(
size_t i=0UL; i<m; ++i ) {
348 for(
size_t j=0UL; j<end; j+=2UL ) {
349 dm_(j ,i) = (~rhs)(i,j );
350 dm_(j+1UL,i) = (~rhs)(i,j+1UL);
353 dm_(end,i) = (~rhs)(i,end);
370 template<
typename MT2 >
378 const size_t m(
rows() );
380 const size_t block( 16UL );
382 for(
size_t ii=0UL; ii<m; ii+=block ) {
383 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
384 for(
size_t jj=0UL; jj<n; jj+=block ) {
385 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
386 for(
size_t i=ii; i<iend; ++i ) {
387 for(
size_t j=jj; j<jend; ++j ) {
388 dm_(j,i) = (~rhs)(i,j);
407 template<
typename MT2 >
417 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
418 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
419 dm_(element->index(),i) = element->value();
434 template<
typename MT2 >
444 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
445 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
446 dm_(j,element->index()) = element->value();
461 template<
typename MT2 >
469 const size_t m(
rows() );
473 const size_t end( n &
size_t(-2) );
475 for(
size_t i=0UL; i<m; ++i ) {
476 for(
size_t j=0UL; j<end; j+=2UL ) {
477 dm_(j ,i) += (~rhs)(i,j );
478 dm_(j+1UL,i) += (~rhs)(i,j+1UL);
482 dm_(end,i) += (~rhs)(i,end);
499 template<
typename MT2 >
507 const size_t m(
rows() );
509 const size_t block( 16UL );
511 for(
size_t ii=0UL; ii<m; ii+=block ) {
512 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
513 for(
size_t jj=0UL; jj<n; jj+=block ) {
514 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
515 for(
size_t i=ii; i<iend; ++i ) {
516 for(
size_t j=jj; j<jend; ++j ) {
517 dm_(j,i) += (~rhs)(i,j);
536 template<
typename MT2 >
546 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
547 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
548 dm_(element->index(),i) += element->value();
563 template<
typename MT2 >
573 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
574 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
575 dm_(j,element->index()) += element->value();
590 template<
typename MT2 >
598 const size_t m(
rows() );
602 const size_t end( n &
size_t(-2) );
604 for(
size_t i=0UL; i<m; ++i ) {
605 for(
size_t j=0UL; j<end; j+=2UL ) {
606 dm_(j ,i) -= (~rhs)(i,j );
607 dm_(j+1UL,i) -= (~rhs)(i,j+1UL);
611 dm_(end,i) -= (~rhs)(i,end);
628 template<
typename MT2 >
636 const size_t m(
rows() );
638 const size_t block( 16UL );
640 for(
size_t ii=0UL; ii<m; ii+=block ) {
641 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
642 for(
size_t jj=0UL; jj<n; jj+=block ) {
643 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
644 for(
size_t i=ii; i<iend; ++i ) {
645 for(
size_t j=jj; j<jend; ++j ) {
646 dm_(j,i) -= (~rhs)(i,j);
665 template<
typename MT2 >
675 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
676 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
677 dm_(element->index(),i) -= element->value();
692 template<
typename MT2 >
702 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
703 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
704 dm_(j,element->index()) -= element->value();
740 template<
typename MT >
767 enum { vectorizable = MT::vectorizable };
809 inline size_t rows()
const {
810 return dm_.columns();
819 inline size_t columns()
const {
829 inline size_t spacing()
const {
830 return dm_.spacing();
839 inline void reset() {
850 template<
typename Other >
851 inline bool canAlias(
const Other* alias )
const
853 return dm_.canAlias( alias );
863 template<
typename Other >
864 inline bool isAliased(
const Other* alias )
const
866 return dm_.isAliased( alias );
883 return dm_.load( j, i );
900 return dm_.loadu( j, i );
918 dm_.store( j, i, value );
936 dm_.storeu( j, i, value );
954 dm_.stream( j, i, value );
969 template<
typename MT2 >
970 inline void assign(
const DenseMatrix<MT2,true>& rhs )
977 const size_t m(
rows() );
981 const size_t end( m &
size_t(-2) );
983 for(
size_t j=0UL; j<n; ++j ) {
984 for(
size_t i=0UL; i<end; i+=2UL ) {
985 dm_(j,i ) = (~rhs)(i ,j);
986 dm_(j,i+1UL) = (~rhs)(i+1UL,j);
989 dm_(j,end) = (~rhs)(end,j);
1006 template<
typename MT2 >
1007 inline void assign(
const DenseMatrix<MT2,false>& rhs )
1014 const size_t m(
rows() );
1016 const size_t block( 16UL );
1018 for(
size_t jj=0UL; jj<n; jj+=block ) {
1019 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
1020 for(
size_t ii=0UL; ii<m; ii+=block ) {
1021 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
1022 for(
size_t j=jj; j<jend; ++j ) {
1023 for(
size_t i=ii; i<iend; ++i ) {
1024 dm_(j,i) = (~rhs)(i,j);
1043 template<
typename MT2 >
1044 inline void assign(
const SparseMatrix<MT2,true>& rhs )
1053 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
1054 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
1055 dm_(j,element->index()) = element->value();
1070 template<
typename MT2 >
1071 inline void assign(
const SparseMatrix<MT2,false>& rhs )
1080 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
1081 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
1082 dm_(element->index(),i) = element->value();
1097 template<
typename MT2 >
1098 inline void addAssign(
const DenseMatrix<MT2,true>& rhs )
1105 const size_t m(
rows() );
1109 const size_t end( m &
size_t(-2) );
1111 for(
size_t j=0UL; j<n; ++j ) {
1112 for(
size_t i=0UL; i<end; i+=2UL ) {
1113 dm_(j,i ) += (~rhs)(i ,j);
1114 dm_(j,i+1UL) += (~rhs)(i+1UL,j);
1117 dm_(j,end) += (~rhs)(end,j);
1134 template<
typename MT2 >
1135 inline void addAssign(
const DenseMatrix<MT2,false>& rhs )
1142 const size_t m(
rows() );
1144 const size_t block( 16UL );
1146 for(
size_t jj=0UL; jj<n; jj+=block ) {
1147 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
1148 for(
size_t ii=0UL; ii<m; ii+=block ) {
1149 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
1150 for(
size_t j=jj; j<jend; ++j ) {
1151 for(
size_t i=ii; i<iend; ++i ) {
1152 dm_(j,i) += (~rhs)(i,j);
1171 template<
typename MT2 >
1172 inline void addAssign(
const SparseMatrix<MT2,true>& rhs )
1181 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
1182 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
1183 dm_(j,element->index()) += element->value();
1198 template<
typename MT2 >
1199 inline void addAssign(
const SparseMatrix<MT2,false>& rhs )
1208 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
1209 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
1210 dm_(element->index(),i) += element->value();
1225 template<
typename MT2 >
1226 inline void subAssign(
const DenseMatrix<MT2,true>& rhs )
1233 const size_t m(
rows() );
1237 const size_t end( m &
size_t(-2) );
1239 for(
size_t j=0UL; j<n; ++j ) {
1240 for(
size_t i=0UL; i<end; i+=2UL ) {
1241 dm_(j,i ) -= (~rhs)(i ,j);
1242 dm_(j,i+1UL) -= (~rhs)(i+1UL,j);
1245 dm_(j,end) -= (~rhs)(end,j);
1262 template<
typename MT2 >
1263 inline void subAssign(
const DenseMatrix<MT2,false>& rhs )
1270 const size_t m(
rows() );
1272 const size_t block( 16UL );
1274 for(
size_t jj=0UL; jj<n; jj+=block ) {
1275 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
1276 for(
size_t ii=0UL; ii<m; ii+=block ) {
1277 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
1278 for(
size_t j=jj; j<jend; ++j ) {
1279 for(
size_t i=ii; i<iend; ++i ) {
1280 dm_(j,i) -= (~rhs)(i,j);
1299 template<
typename MT2 >
1300 inline void subAssign(
const SparseMatrix<MT2,true>& rhs )
1309 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
1310 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).end(j); ++element )
1311 dm_(j,element->index()) -= element->value();
1326 template<
typename MT2 >
1327 inline void subAssign(
const SparseMatrix<MT2,false>& rhs )
1336 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
1337 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).end(i); ++element )
1338 dm_(element->index(),i) -= element->value();
1383 template<
typename MT
1385 inline void reset( DMatTransposer<MT,SO>& m )
1403 template<
typename MT,
bool SO >
1404 struct SubmatrixTrait< DMatTransposer<MT,SO> >
void addAssign(const SparseMatrix< MT2, SO > &rhs)
Implementation of the transpose addition assignment of a row-major sparse matrix. ...
Definition: DMatTransposer.h:537
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4512
#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
DMatTransposer< MT, SO > This
Type of this DMatTransposer instance.
Definition: DMatTransposer.h:80
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:196
void stream(size_t i, size_t j, const IntrinsicType &value)
Aligned, non-temporal store of an intrinsic element of the matrix.
Definition: DMatTransposer.h:316
EnableIf< IsNumeric< Other >, DMatTransposer >::Type & operator/=(Other rhs)
Division assignment operator for the division of a matrix by a scalar value ( ).
Definition: DMatTransposer.h:159
#define BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a dense, N-dimensional matrix type...
Definition: DenseMatrix.h:79
Constraint on the data type.
void subAssign(const SparseMatrix< MT2,!SO > &rhs)
Implementation of the transpose subtraction assignment of a column-major sparse matrix.
Definition: DMatTransposer.h:693
size_t rows() const
Returns the current number of rows of the matrix.
Definition: DMatTransposer.h:173
void addAssign(const DenseMatrix< MT2, SO > &rhs)
Implementation of the transpose addition assignment of a row-major dense matrix.
Definition: DMatTransposer.h:462
ElementType * data()
Low-level data access to the matrix elements.
Definition: DMatTransposer.h:129
size_t columns() const
Returns the current number of columns of the matrix.
Definition: DMatTransposer.h:183
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: DMatTransposer.h:86
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2371
Header file for the intrinsic trait.
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes...
Definition: Forward.h:104
const This & CompositeType
Data type for composite expression templates.
Definition: DMatTransposer.h:87
Constraint on the data type.
void subAssign(const DenseMatrix< MT2, SO > &rhs)
Implementation of the transpose subtraction assignment of a row-major dense matrix.
Definition: DMatTransposer.h:591
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: StorageOrder.h:161
Reference operator()(size_t i, size_t j)
2D-access to the matrix elements.
Definition: DMatTransposer.h:117
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2379
bool isAliased(const Other *alias) const
Returns whether the matrix is aliased with the given address alias.
Definition: DMatTransposer.h:228
Header file for the DenseMatrix base class.
EnableIf< IsNumeric< Other >, DMatTransposer >::Type & operator*=(Other rhs)
Multiplication assignment operator for the multiplication between a matrix and a scalar value ( )...
Definition: DMatTransposer.h:142
Expression object for the transposition of a dense matrix.The DMatTransposer class is a wrapper objec...
Definition: DMatTransposer.h:71
MT & dm_
The dense matrix operand.
Definition: DMatTransposer.h:710
IntrinsicType loadu(size_t i, size_t j) const
Unaligned load of an intrinsic element of the matrix.
Definition: DMatTransposer.h:262
IntrinsicType load(size_t i, size_t j) const
Aligned load of an intrinsic element of the matrix.
Definition: DMatTransposer.h:245
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2372
Constraints on the storage order of matrix types.
MT::TransposeType ResultType
Result type for expression template evaluations.
Definition: DMatTransposer.h:81
void assign(const SparseMatrix< MT2,!SO > &rhs)
Implementation of the transpose assignment of a column-major sparse matrix.
Definition: DMatTransposer.h:435
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2373
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2377
void reset()
Resets the matrix elements.
Definition: DMatTransposer.h:203
Header file for the EnableIf class template.
void assign(const DenseMatrix< MT2,!SO > &rhs)
Implementation of the transpose assignment of a column-major dense matrix.
Definition: DMatTransposer.h:371
size_t spacing() const
Returns the spacing between the beginning of two rows.
Definition: DMatTransposer.h:193
void assign(const DenseMatrix< MT2, SO > &rhs)
Implementation of the transpose assignment of a row-major dense matrix.
Definition: DMatTransposer.h:334
Header file for the IsNumeric type trait.
IntrinsicTrait< typename MT::ElementType > IT
Intrinsic trait for the vector element type.
Definition: DMatTransposer.h:75
void subAssign(const SparseMatrix< MT2, SO > &rhs)
Implementation of the transpose subtraction assignment of a row-major sparse matrix.
Definition: DMatTransposer.h:666
#define BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a row-major dense or sparse matrix t...
Definition: StorageOrder.h:81
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2374
MT::ElementType ElementType
Type of the matrix elements.
Definition: DMatTransposer.h:84
Intrinsic characteristics of data types.The IntrinsicTrait class template provides the intrinsic char...
Definition: IntrinsicTrait.h:648
IT::Type IntrinsicType
Intrinsic type of the matrix elements.
Definition: DMatTransposer.h:85
Header file for run time assertion macros.
void subAssign(const DenseMatrix< MT2,!SO > &rhs)
Implementation of the transpose subtraction assignment of a column-major dense matrix.
Definition: DMatTransposer.h:629
Header file for the submatrix trait.
MT::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatTransposer.h:82
void addAssign(const DenseMatrix< MT2,!SO > &rhs)
Implementation of the transpose addition assignment of a column-major dense matrix.
Definition: DMatTransposer.h:500
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
bool canAlias(const Other *alias) const
Returns whether the matrix can alias with the given address alias.
Definition: DMatTransposer.h:215
MT::Reference Reference
Reference to a non-constant matrix value.
Definition: DMatTransposer.h:88
MT::ResultType TransposeType
Transpose type for expression template evaluations.
Definition: DMatTransposer.h:83
MT::ConstReference ConstReference
Reference to a constant matrix value.
Definition: DMatTransposer.h:89
void addAssign(const SparseMatrix< MT2,!SO > &rhs)
Implementation of the transpose addition assignment of a column-major sparse matrix.
Definition: DMatTransposer.h:564
#define BLAZE_CONSTRAINT_MUST_NOT_BE_EXPRESSION_TYPE(T)
Constraint on the data type.In case the given data type T is an expression (i.e. a type derived from ...
Definition: Expression.h:118
void assign(const SparseMatrix< MT2, SO > &rhs)
Implementation of the transpose assignment of a row-major sparse matrix.
Definition: DMatTransposer.h:408
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2370
void store(size_t i, size_t j, const IntrinsicType &value)
Aligned store of an intrinsic element of the matrix.
Definition: DMatTransposer.h:280
Header file for basic type definitions.
DMatTransposer(MT &dm)
Constructor for the DMatTransposer class.
Definition: DMatTransposer.h:105
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2376
#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
void storeu(size_t i, size_t j, const IntrinsicType &value)
Unaligned store of an intrinsic element of the matrix.
Definition: DMatTransposer.h:298