35 #ifndef _BLAZE_MATH_EXPRESSIONS_DMATTRANSPOSER_H_
36 #define _BLAZE_MATH_EXPRESSIONS_DMATTRANSPOSER_H_
100 enum { vectorizable = MT::vectorizable };
106 enum { smpAssignable = MT::smpAssignable };
140 inline ConstReference
operator()(
size_t i,
size_t j )
const {
169 return dm_.begin( i );
184 inline ConstIterator
begin(
size_t i )
const {
185 return dm_.cbegin( i );
200 inline ConstIterator
cbegin(
size_t i )
const {
201 return dm_.cbegin( i );
216 inline Iterator
end(
size_t i ) {
232 inline ConstIterator
end(
size_t i )
const {
233 return dm_.cend( i );
248 inline ConstIterator
cend(
size_t i )
const {
249 return dm_.cend( i );
260 template<
typename Other >
277 template<
typename Other >
293 return dm_.columns();
313 return dm_.spacing();
333 template<
typename Other >
336 return dm_.canAlias( alias );
346 template<
typename Other >
349 return dm_.isAliased( alias );
360 return dm_.isAligned();
371 return dm_.canSMPAssign();
388 return dm_.load( j, i );
405 return dm_.loadu( j, i );
423 dm_.store( j, i, value );
441 dm_.storeu( j, i, value );
459 dm_.stream( j, i, value );
474 template<
typename MT2 >
482 const size_t m(
rows() );
485 const size_t jpos( n &
size_t(-2) );
488 for(
size_t i=0UL; i<m; ++i ) {
489 for(
size_t j=0UL; j<jpos; j+=2UL ) {
490 dm_(j ,i) = (~rhs)(i,j );
491 dm_(j+1UL,i) = (~rhs)(i,j+1UL);
494 dm_(jpos,i) = (~rhs)(i,jpos);
511 template<
typename MT2 >
519 const size_t m(
rows() );
521 const size_t block( 16UL );
523 for(
size_t ii=0UL; ii<m; ii+=block ) {
524 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
525 for(
size_t jj=0UL; jj<n; jj+=block ) {
526 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
527 for(
size_t i=ii; i<iend; ++i ) {
528 for(
size_t j=jj; j<jend; ++j ) {
529 dm_(j,i) = (~rhs)(i,j);
548 template<
typename MT2 >
558 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
559 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
560 dm_(element->index(),i) = element->value();
575 template<
typename MT2 >
585 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
586 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
587 dm_(j,element->index()) = element->value();
602 template<
typename MT2 >
610 const size_t m(
rows() );
613 const size_t jpos( n &
size_t(-2) );
616 for(
size_t i=0UL; i<m; ++i ) {
617 for(
size_t j=0UL; j<jpos; j+=2UL ) {
618 dm_(j ,i) += (~rhs)(i,j );
619 dm_(j+1UL,i) += (~rhs)(i,j+1UL);
623 dm_(jpos,i) += (~rhs)(i,jpos);
640 template<
typename MT2 >
648 const size_t m(
rows() );
650 const size_t block( 16UL );
652 for(
size_t ii=0UL; ii<m; ii+=block ) {
653 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
654 for(
size_t jj=0UL; jj<n; jj+=block ) {
655 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
656 for(
size_t i=ii; i<iend; ++i ) {
657 for(
size_t j=jj; j<jend; ++j ) {
658 dm_(j,i) += (~rhs)(i,j);
677 template<
typename MT2 >
687 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
688 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
689 dm_(element->index(),i) += element->value();
704 template<
typename MT2 >
714 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
715 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
716 dm_(j,element->index()) += element->value();
731 template<
typename MT2 >
739 const size_t m(
rows() );
742 const size_t jpos( n &
size_t(-2) );
745 for(
size_t i=0UL; i<m; ++i ) {
746 for(
size_t j=0UL; j<jpos; j+=2UL ) {
747 dm_(j ,i) -= (~rhs)(i,j );
748 dm_(j+1UL,i) -= (~rhs)(i,j+1UL);
752 dm_(jpos,i) -= (~rhs)(i,jpos);
769 template<
typename MT2 >
777 const size_t m(
rows() );
779 const size_t block( 16UL );
781 for(
size_t ii=0UL; ii<m; ii+=block ) {
782 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
783 for(
size_t jj=0UL; jj<n; jj+=block ) {
784 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
785 for(
size_t i=ii; i<iend; ++i ) {
786 for(
size_t j=jj; j<jend; ++j ) {
787 dm_(j,i) -= (~rhs)(i,j);
806 template<
typename MT2 >
816 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
817 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
818 dm_(element->index(),i) -= element->value();
833 template<
typename MT2 >
843 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
844 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
845 dm_(j,element->index()) -= element->value();
889 template<
typename MT >
918 enum { vectorizable = MT::vectorizable };
924 enum { smpAssignable = MT::smpAssignable };
944 inline Reference
operator()(
size_t i,
size_t j ) {
958 inline ConstReference
operator()(
size_t i,
size_t j )
const {
970 inline ElementType*
data() {
981 inline Iterator
begin(
size_t j ) {
992 inline ConstIterator
begin(
size_t j )
const {
993 return dm_.cbegin(j);
1003 inline ConstIterator
cbegin(
size_t j )
const {
1004 return dm_.cbegin(j);
1014 inline Iterator
end(
size_t j ) {
1025 inline ConstIterator
end(
size_t j )
const {
1036 inline ConstIterator
cend(
size_t j )
const {
1048 template<
typename Other >
1065 template<
typename Other >
1080 inline size_t rows()
const {
1081 return dm_.columns();
1090 inline size_t columns()
const {
1100 inline size_t spacing()
const {
1101 return dm_.spacing();
1110 inline void reset() {
1121 template<
typename Other >
1122 inline bool canAlias(
const Other* alias )
const
1124 return dm_.canAlias( alias );
1134 template<
typename Other >
1135 inline bool isAliased(
const Other* alias )
const
1137 return dm_.isAliased( alias );
1148 return dm_.isAligned();
1159 return dm_.canSMPAssign();
1176 return dm_.load( j, i );
1193 return dm_.loadu( j, i );
1211 dm_.store( j, i, value );
1229 dm_.storeu( j, i, value );
1247 dm_.stream( j, i, value );
1262 template<
typename MT2 >
1263 inline void assign(
const DenseMatrix<MT2,true>& rhs )
1270 const size_t m(
rows() );
1273 const size_t ipos( m &
size_t(-2) );
1276 for(
size_t j=0UL; j<n; ++j ) {
1277 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1278 dm_(j,i ) = (~rhs)(i ,j);
1279 dm_(j,i+1UL) = (~rhs)(i+1UL,j);
1282 dm_(j,ipos) = (~rhs)(ipos,j);
1299 template<
typename MT2 >
1300 inline void assign(
const DenseMatrix<MT2,false>& rhs )
1307 const size_t m(
rows() );
1309 const size_t block( 16UL );
1311 for(
size_t jj=0UL; jj<n; jj+=block ) {
1312 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
1313 for(
size_t ii=0UL; ii<m; ii+=block ) {
1314 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
1315 for(
size_t j=jj; j<jend; ++j ) {
1316 for(
size_t i=ii; i<iend; ++i ) {
1317 dm_(j,i) = (~rhs)(i,j);
1336 template<
typename MT2 >
1337 inline void assign(
const SparseMatrix<MT2,true>& rhs )
1346 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
1347 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
1348 dm_(j,element->index()) = element->value();
1363 template<
typename MT2 >
1364 inline void assign(
const SparseMatrix<MT2,false>& rhs )
1373 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
1374 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
1375 dm_(element->index(),i) = element->value();
1390 template<
typename MT2 >
1391 inline void addAssign(
const DenseMatrix<MT2,true>& rhs )
1398 const size_t m(
rows() );
1401 const size_t ipos( m &
size_t(-2) );
1404 for(
size_t j=0UL; j<n; ++j ) {
1405 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1406 dm_(j,i ) += (~rhs)(i ,j);
1407 dm_(j,i+1UL) += (~rhs)(i+1UL,j);
1410 dm_(j,ipos) += (~rhs)(ipos,j);
1427 template<
typename MT2 >
1428 inline void addAssign(
const DenseMatrix<MT2,false>& rhs )
1435 const size_t m(
rows() );
1437 const size_t block( 16UL );
1439 for(
size_t jj=0UL; jj<n; jj+=block ) {
1440 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
1441 for(
size_t ii=0UL; ii<m; ii+=block ) {
1442 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
1443 for(
size_t j=jj; j<jend; ++j ) {
1444 for(
size_t i=ii; i<iend; ++i ) {
1445 dm_(j,i) += (~rhs)(i,j);
1464 template<
typename MT2 >
1465 inline void addAssign(
const SparseMatrix<MT2,true>& rhs )
1474 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
1475 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
1476 dm_(j,element->index()) += element->value();
1491 template<
typename MT2 >
1492 inline void addAssign(
const SparseMatrix<MT2,false>& rhs )
1501 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
1502 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
1503 dm_(element->index(),i) += element->value();
1518 template<
typename MT2 >
1519 inline void subAssign(
const DenseMatrix<MT2,true>& rhs )
1526 const size_t m(
rows() );
1529 const size_t ipos( m &
size_t(-2) );
1532 for(
size_t j=0UL; j<n; ++j ) {
1533 for(
size_t i=0UL; i<ipos; i+=2UL ) {
1534 dm_(j,i ) -= (~rhs)(i ,j);
1535 dm_(j,i+1UL) -= (~rhs)(i+1UL,j);
1538 dm_(j,ipos) -= (~rhs)(ipos,j);
1555 template<
typename MT2 >
1556 inline void subAssign(
const DenseMatrix<MT2,false>& rhs )
1563 const size_t m(
rows() );
1565 const size_t block( 16UL );
1567 for(
size_t jj=0UL; jj<n; jj+=block ) {
1568 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
1569 for(
size_t ii=0UL; ii<m; ii+=block ) {
1570 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
1571 for(
size_t j=jj; j<jend; ++j ) {
1572 for(
size_t i=ii; i<iend; ++i ) {
1573 dm_(j,i) -= (~rhs)(i,j);
1592 template<
typename MT2 >
1593 inline void subAssign(
const SparseMatrix<MT2,true>& rhs )
1602 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
1603 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
1604 dm_(j,element->index()) -= element->value();
1619 template<
typename MT2 >
1620 inline void subAssign(
const SparseMatrix<MT2,false>& rhs )
1629 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
1630 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
1631 dm_(element->index(),i) -= element->value();
1676 template<
typename MT
1678 inline void reset( DMatTransposer<MT,SO>& m )
1696 template<
typename MT,
bool SO >
1697 struct SubmatrixTrait< DMatTransposer<MT,SO> >
ConstReference operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: DMatTransposer.h:140
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:678
bool canSMPAssign() const
Returns whether the matrix can be used in SMP assignments.
Definition: DMatTransposer.h:369
#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:81
Header file for basic type definitions.
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row/column i.
Definition: DMatTransposer.h:232
BLAZE_ALWAYS_INLINE IntrinsicType load(size_t i, size_t j) const
Aligned load of an intrinsic element of the matrix.
Definition: DMatTransposer.h:386
EnableIf< IsNumeric< Other >, DMatTransposer >::Type & operator/=(Other rhs)
Division assignment operator for the division of a matrix by a scalar value ( ).
Definition: DMatTransposer.h:278
#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:834
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:821
size_t rows() const
Returns the current number of rows of the matrix.
Definition: DMatTransposer.h:292
void addAssign(const DenseMatrix< MT2, SO > &rhs)
Implementation of the transpose addition assignment of a row-major dense matrix.
Definition: DMatTransposer.h:603
ElementType * data()
Low-level data access to the matrix elements.
Definition: DMatTransposer.h:152
size_t columns() const
Returns the current number of columns of the matrix.
Definition: DMatTransposer.h:302
MT::ReturnType ReturnType
Return type for expression template evaluations.
Definition: DMatTransposer.h:87
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2503
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:91
const This & CompositeType
Data type for composite expression templates.
Definition: DMatTransposer.h:88
Constraint on the data type.
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
void subAssign(const DenseMatrix< MT2, SO > &rhs)
Implementation of the transpose subtraction assignment of a row-major dense matrix.
Definition: DMatTransposer.h:732
#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:126
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2511
bool isAliased(const Other *alias) const
Returns whether the matrix is aliased with the given address alias.
Definition: DMatTransposer.h:347
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:261
Expression object for the transposition of a dense matrix.The DMatTransposer class is a wrapper objec...
Definition: DMatTransposer.h:72
MT & dm_
The dense matrix operand.
Definition: DMatTransposer.h:859
bool isAligned() const
Returns whether the matrix is properly aligned in memory.
Definition: DMatTransposer.h:358
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2504
Constraints on the storage order of matrix types.
BLAZE_ALWAYS_INLINE IntrinsicType loadu(size_t i, size_t j) const
Unaligned load of an intrinsic element of the matrix.
Definition: DMatTransposer.h:403
MT::TransposeType ResultType
Result type for expression template evaluations.
Definition: DMatTransposer.h:82
void assign(const SparseMatrix< MT2,!SO > &rhs)
Implementation of the transpose assignment of a column-major sparse matrix.
Definition: DMatTransposer.h:576
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2505
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: DMatTransposer.h:457
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2509
void reset()
Resets the matrix elements.
Definition: DMatTransposer.h:322
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:512
size_t spacing() const
Returns the spacing between the beginning of two rows.
Definition: DMatTransposer.h:312
void assign(const DenseMatrix< MT2, SO > &rhs)
Implementation of the transpose assignment of a row-major dense matrix.
Definition: DMatTransposer.h:475
Header file for the IsNumeric type trait.
IntrinsicTrait< typename MT::ElementType > IT
Intrinsic trait for the vector element type.
Definition: DMatTransposer.h:76
void subAssign(const SparseMatrix< MT2, SO > &rhs)
Implementation of the transpose subtraction assignment of a row-major sparse matrix.
Definition: DMatTransposer.h:807
#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:2506
MT::ElementType ElementType
Type of the matrix elements.
Definition: DMatTransposer.h:85
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:86
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:770
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:248
MT::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: DMatTransposer.h:83
void addAssign(const DenseMatrix< MT2,!SO > &rhs)
Implementation of the transpose addition assignment of a column-major dense matrix.
Definition: DMatTransposer.h:641
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:200
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2510
bool canAlias(const Other *alias) const
Returns whether the matrix can alias with the given address alias.
Definition: DMatTransposer.h:334
MT::Reference Reference
Reference to a non-constant matrix value.
Definition: DMatTransposer.h:89
BLAZE_ALWAYS_INLINE void storeu(size_t i, size_t j, const IntrinsicType &value)
Unaligned store of an intrinsic element of the matrix.
Definition: DMatTransposer.h:439
MT::ResultType TransposeType
Transpose type for expression template evaluations.
Definition: DMatTransposer.h:84
MT::ConstReference ConstReference
Reference to a constant matrix value.
Definition: DMatTransposer.h:90
void addAssign(const SparseMatrix< MT2,!SO > &rhs)
Implementation of the transpose addition assignment of a column-major sparse matrix.
Definition: DMatTransposer.h:705
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: DMatTransposer.h:92
Iterator begin(size_t i)
Returns an iterator to the first non-zero element of row/column i.
Definition: DMatTransposer.h:168
void assign(const SparseMatrix< MT2, SO > &rhs)
Implementation of the transpose assignment of a row-major sparse matrix.
Definition: DMatTransposer.h:549
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2502
DMatTransposer(MT &dm)
Constructor for the DMatTransposer class.
Definition: DMatTransposer.h:114
MatrixAccessProxy< This > Reference
Reference to a non-constant matrix value.
Definition: CompressedMatrix.h:2508
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 store(size_t i, size_t j, const IntrinsicType &value)
Aligned store of an intrinsic element of the matrix.
Definition: DMatTransposer.h:421
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row/column i.
Definition: DMatTransposer.h:184
Iterator end(size_t i)
Returns an iterator just past the last non-zero element of row/column i.
Definition: DMatTransposer.h:216