35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATTRANSPOSER_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATTRANSPOSER_H_
99 enum { vectorizable = MT::vectorizable };
105 enum { smpAssignable = MT::smpAssignable };
168 return dm_.begin( i );
184 return dm_.cbegin( i );
200 return dm_.cbegin( i );
232 return dm_.cend( i );
248 return dm_.cend( i );
259 template<
typename Other >
276 template<
typename Other >
292 return dm_.columns();
312 return dm_.spacing();
332 template<
typename Other >
335 return dm_.canAlias( alias );
345 template<
typename Other >
348 return dm_.isAliased( alias );
359 return dm_.isAligned();
370 return dm_.canSMPAssign();
387 return dm_.load( j, i );
404 return dm_.loadu( j, i );
422 dm_.store( j, i, value );
440 dm_.storeu( j, i, value );
458 dm_.stream( j, i, value );
473 template<
typename MT2 >
481 const size_t m(
rows() );
485 const size_t jend( n &
size_t(-2) );
487 for(
size_t i=0UL; i<m; ++i ) {
488 for(
size_t j=0UL; j<jend; j+=2UL ) {
489 dm_(j ,i) = (~rhs)(i,j );
490 dm_(j+1UL,i) = (~rhs)(i,j+1UL);
493 dm_(jend,i) = (~rhs)(i,jend);
510 template<
typename MT2 >
518 const size_t m(
rows() );
520 const size_t block( 16UL );
522 for(
size_t ii=0UL; ii<m; ii+=block ) {
523 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
524 for(
size_t jj=0UL; jj<n; jj+=block ) {
525 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
526 for(
size_t i=ii; i<iend; ++i ) {
527 for(
size_t j=jj; j<jend; ++j ) {
528 dm_(j,i) = (~rhs)(i,j);
547 template<
typename MT2 >
557 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
558 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
559 dm_(element->index(),i) = element->value();
574 template<
typename MT2 >
584 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
585 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
586 dm_(j,element->index()) = element->value();
601 template<
typename MT2 >
609 const size_t m(
rows() );
613 const size_t jend( n &
size_t(-2) );
615 for(
size_t i=0UL; i<m; ++i ) {
616 for(
size_t j=0UL; j<jend; j+=2UL ) {
617 dm_(j ,i) += (~rhs)(i,j );
618 dm_(j+1UL,i) += (~rhs)(i,j+1UL);
622 dm_(jend,i) += (~rhs)(i,jend);
639 template<
typename MT2 >
647 const size_t m(
rows() );
649 const size_t block( 16UL );
651 for(
size_t ii=0UL; ii<m; ii+=block ) {
652 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
653 for(
size_t jj=0UL; jj<n; jj+=block ) {
654 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
655 for(
size_t i=ii; i<iend; ++i ) {
656 for(
size_t j=jj; j<jend; ++j ) {
657 dm_(j,i) += (~rhs)(i,j);
676 template<
typename MT2 >
686 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
687 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
688 dm_(element->index(),i) += element->value();
703 template<
typename MT2 >
713 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
714 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
715 dm_(j,element->index()) += element->value();
730 template<
typename MT2 >
738 const size_t m(
rows() );
742 const size_t jend( n &
size_t(-2) );
744 for(
size_t i=0UL; i<m; ++i ) {
745 for(
size_t j=0UL; j<jend; j+=2UL ) {
746 dm_(j ,i) -= (~rhs)(i,j );
747 dm_(j+1UL,i) -= (~rhs)(i,j+1UL);
751 dm_(jend,i) -= (~rhs)(i,jend);
768 template<
typename MT2 >
776 const size_t m(
rows() );
778 const size_t block( 16UL );
780 for(
size_t ii=0UL; ii<m; ii+=block ) {
781 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
782 for(
size_t jj=0UL; jj<n; jj+=block ) {
783 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
784 for(
size_t i=ii; i<iend; ++i ) {
785 for(
size_t j=jj; j<jend; ++j ) {
786 dm_(j,i) -= (~rhs)(i,j);
805 template<
typename MT2 >
815 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
816 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
817 dm_(element->index(),i) -= element->value();
832 template<
typename MT2 >
842 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
843 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
844 dm_(j,element->index()) -= element->value();
888 template<
typename MT >
917 enum { vectorizable = MT::vectorizable };
923 enum { smpAssignable = MT::smpAssignable };
992 return dm_.cbegin(j);
1003 return dm_.cbegin(j);
1047 template<
typename Other >
1064 template<
typename Other >
1079 inline size_t rows()
const {
1080 return dm_.columns();
1089 inline size_t columns()
const {
1099 inline size_t spacing()
const {
1100 return dm_.spacing();
1109 inline void reset() {
1120 template<
typename Other >
1121 inline bool canAlias(
const Other* alias )
const
1123 return dm_.canAlias( alias );
1133 template<
typename Other >
1134 inline bool isAliased(
const Other* alias )
const
1136 return dm_.isAliased( alias );
1147 return dm_.isAligned();
1158 return dm_.canSMPAssign();
1175 return dm_.load( j, i );
1192 return dm_.loadu( j, i );
1210 dm_.store( j, i, value );
1228 dm_.storeu( j, i, value );
1246 dm_.stream( j, i, value );
1261 template<
typename MT2 >
1262 inline void assign(
const DenseMatrix<MT2,true>& rhs )
1269 const size_t m(
rows() );
1273 const size_t iend( m &
size_t(-2) );
1275 for(
size_t j=0UL; j<n; ++j ) {
1276 for(
size_t i=0UL; i<iend; i+=2UL ) {
1277 dm_(j,i ) = (~rhs)(i ,j);
1278 dm_(j,i+1UL) = (~rhs)(i+1UL,j);
1281 dm_(j,iend) = (~rhs)(iend,j);
1298 template<
typename MT2 >
1299 inline void assign(
const DenseMatrix<MT2,false>& rhs )
1306 const size_t m(
rows() );
1308 const size_t block( 16UL );
1310 for(
size_t jj=0UL; jj<n; jj+=block ) {
1311 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
1312 for(
size_t ii=0UL; ii<m; ii+=block ) {
1313 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
1314 for(
size_t j=jj; j<jend; ++j ) {
1315 for(
size_t i=ii; i<iend; ++i ) {
1316 dm_(j,i) = (~rhs)(i,j);
1335 template<
typename MT2 >
1336 inline void assign(
const SparseMatrix<MT2,true>& rhs )
1345 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
1346 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
1347 dm_(j,element->index()) = element->value();
1362 template<
typename MT2 >
1363 inline void assign(
const SparseMatrix<MT2,false>& rhs )
1372 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
1373 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
1374 dm_(element->index(),i) = element->value();
1389 template<
typename MT2 >
1390 inline void addAssign(
const DenseMatrix<MT2,true>& rhs )
1397 const size_t m(
rows() );
1401 const size_t iend( m &
size_t(-2) );
1403 for(
size_t j=0UL; j<n; ++j ) {
1404 for(
size_t i=0UL; i<iend; i+=2UL ) {
1405 dm_(j,i ) += (~rhs)(i ,j);
1406 dm_(j,i+1UL) += (~rhs)(i+1UL,j);
1409 dm_(j,iend) += (~rhs)(iend,j);
1426 template<
typename MT2 >
1427 inline void addAssign(
const DenseMatrix<MT2,false>& rhs )
1434 const size_t m(
rows() );
1436 const size_t block( 16UL );
1438 for(
size_t jj=0UL; jj<n; jj+=block ) {
1439 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
1440 for(
size_t ii=0UL; ii<m; ii+=block ) {
1441 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
1442 for(
size_t j=jj; j<jend; ++j ) {
1443 for(
size_t i=ii; i<iend; ++i ) {
1444 dm_(j,i) += (~rhs)(i,j);
1463 template<
typename MT2 >
1464 inline void addAssign(
const SparseMatrix<MT2,true>& rhs )
1473 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
1474 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
1475 dm_(j,element->index()) += element->value();
1490 template<
typename MT2 >
1491 inline void addAssign(
const SparseMatrix<MT2,false>& rhs )
1500 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
1501 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
1502 dm_(element->index(),i) += element->value();
1517 template<
typename MT2 >
1518 inline void subAssign(
const DenseMatrix<MT2,true>& rhs )
1525 const size_t m(
rows() );
1529 const size_t iend( m &
size_t(-2) );
1531 for(
size_t j=0UL; j<n; ++j ) {
1532 for(
size_t i=0UL; i<iend; i+=2UL ) {
1533 dm_(j,i ) -= (~rhs)(i ,j);
1534 dm_(j,i+1UL) -= (~rhs)(i+1UL,j);
1537 dm_(j,iend) -= (~rhs)(iend,j);
1554 template<
typename MT2 >
1555 inline void subAssign(
const DenseMatrix<MT2,false>& rhs )
1562 const size_t m(
rows() );
1564 const size_t block( 16UL );
1566 for(
size_t jj=0UL; jj<n; jj+=block ) {
1567 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
1568 for(
size_t ii=0UL; ii<m; ii+=block ) {
1569 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
1570 for(
size_t j=jj; j<jend; ++j ) {
1571 for(
size_t i=ii; i<iend; ++i ) {
1572 dm_(j,i) -= (~rhs)(i,j);
1591 template<
typename MT2 >
1592 inline void subAssign(
const SparseMatrix<MT2,true>& rhs )
1601 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
1602 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
1603 dm_(j,element->index()) -= element->value();
1618 template<
typename MT2 >
1619 inline void subAssign(
const SparseMatrix<MT2,false>& rhs )
1628 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
1629 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
1630 dm_(element->index(),i) -= element->value();
1675 template<
typename MT
1677 inline void reset( DMatTransposer<MT,SO>& m )
1695 template<
typename MT,
bool SO >
1696 struct SubmatrixTrait< DMatTransposer<MT,SO> >
ConstReference operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatTransposer.h:139
Constraint on the data type.
void addAssign(const SparseMatrix< MT2, SO > &rhs)
Implementation of the transpose addition assignment of a row-major sparse matrix. ...
Definition: DMatTransposer.h:677
bool canSMPAssign() const
Returns whether the matrix can be used in SMP assignments.
Definition: DMatTransposer.h:368
#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
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: DMatTransposer.h:231
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:205
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:456
EnableIf< IsNumeric< Other >, DMatTransposer >::Type & operator/=(Other rhs)
Division assignment operator for the division of a matrix by a scalar value ( ).
Definition: DMatTransposer.h:277
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:118
#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
void subAssign(const SparseMatrix< MT2,!SO > &rhs)
Implementation of the transpose subtraction assignment of a column-major sparse matrix.
Definition: DMatTransposer.h:833
size_t rows() const
Returns the current number of rows of the matrix.
Definition: DMatTransposer.h:291
void addAssign(const DenseMatrix< MT2, SO > &rhs)
Implementation of the transpose addition assignment of a row-major dense matrix.
Definition: DMatTransposer.h:602
ElementType * data()
Low-level data access to the matrix elements.
Definition: DMatTransposer.h:151
size_t columns() const
Returns the current number of columns of the matrix.
Definition: DMatTransposer.h:301
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:2474
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:107
MT::Iterator Iterator
Iterator over non-constant elements.
Definition: DMatTransposer.h:90
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:731
#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:125
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2482
bool isAliased(const Other *alias) const
Returns whether the matrix is aliased with the given address alias.
Definition: DMatTransposer.h:346
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:260
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:858
IntrinsicType loadu(size_t i, size_t j) const
Unaligned load of an intrinsic element of the matrix.
Definition: DMatTransposer.h:402
bool isAligned() const
Returns whether the matrix is properly aligned in memory.
Definition: DMatTransposer.h:357
IntrinsicType load(size_t i, size_t j) const
Aligned load of an intrinsic element of the matrix.
Definition: DMatTransposer.h:385
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2475
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:575
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2476
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2480
void reset()
Resets the matrix elements.
Definition: DMatTransposer.h:321
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:511
size_t spacing() const
Returns the spacing between the beginning of two rows.
Definition: DMatTransposer.h:311
void assign(const DenseMatrix< MT2, SO > &rhs)
Implementation of the transpose assignment of a row-major dense matrix.
Definition: DMatTransposer.h:474
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:806
#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:2477
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:749
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:769
Header file for the submatrix trait.
ConstIterator cend(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: DMatTransposer.h:247
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:640
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
ConstIterator cbegin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: DMatTransposer.h:199
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2481
bool canAlias(const Other *alias) const
Returns whether the matrix can alias with the given address alias.
Definition: DMatTransposer.h:333
MT::Reference Reference
Reference to a non-constant matrix value.
Definition: DMatTransposer.h:88
BLAZE_ALWAYS_INLINE void reset(const NonNumericProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: NonNumericProxy.h:833
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:704
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: DMatTransposer.h:91
Iterator begin(size_t i)
Returns an iterator to the first non-zero element of row/column i.
Definition: DMatTransposer.h:167
void assign(const SparseMatrix< MT2, SO > &rhs)
Implementation of the transpose assignment of a row-major sparse matrix.
Definition: DMatTransposer.h:548
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2473
void store(size_t i, size_t j, const IntrinsicType &value)
Aligned store of an intrinsic element of the matrix.
Definition: DMatTransposer.h:420
Header file for basic type definitions.
DMatTransposer(MT &dm)
Constructor for the DMatTransposer class.
Definition: DMatTransposer.h:113
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2479
#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
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: DMatTransposer.h:183
void storeu(size_t i, size_t j, const IntrinsicType &value)
Unaligned store of an intrinsic element of the matrix.
Definition: DMatTransposer.h:438
Iterator end(size_t i)
Returns an iterator just past the last non-zero element of row/column i.
Definition: DMatTransposer.h:215