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_.cbegin( i );
184 return dm_.cbegin( i );
200 return dm_.cend( i );
216 return dm_.cend( i );
227 template<
typename Other >
244 template<
typename Other >
260 return dm_.columns();
280 return dm_.spacing();
300 template<
typename Other >
303 return dm_.canAlias( alias );
313 template<
typename Other >
316 return dm_.isAliased( alias );
327 return dm_.isAligned();
344 return dm_.load( j, i );
361 return dm_.loadu( j, i );
379 dm_.store( j, i, value );
397 dm_.storeu( j, i, value );
415 dm_.stream( j, i, value );
430 template<
typename MT2 >
438 const size_t m(
rows() );
442 const size_t jend( n &
size_t(-2) );
444 for(
size_t i=0UL; i<m; ++i ) {
445 for(
size_t j=0UL; j<jend; j+=2UL ) {
446 dm_(j ,i) = (~rhs)(i,j );
447 dm_(j+1UL,i) = (~rhs)(i,j+1UL);
450 dm_(jend,i) = (~rhs)(i,jend);
467 template<
typename MT2 >
475 const size_t m(
rows() );
477 const size_t block( 16UL );
479 for(
size_t ii=0UL; ii<m; ii+=block ) {
480 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
481 for(
size_t jj=0UL; jj<n; jj+=block ) {
482 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
483 for(
size_t i=ii; i<iend; ++i ) {
484 for(
size_t j=jj; j<jend; ++j ) {
485 dm_(j,i) = (~rhs)(i,j);
504 template<
typename MT2 >
514 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
515 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
516 dm_(element->index(),i) = element->value();
531 template<
typename MT2 >
541 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
542 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
543 dm_(j,element->index()) = element->value();
558 template<
typename MT2 >
566 const size_t m(
rows() );
570 const size_t jend( n &
size_t(-2) );
572 for(
size_t i=0UL; i<m; ++i ) {
573 for(
size_t j=0UL; j<jend; j+=2UL ) {
574 dm_(j ,i) += (~rhs)(i,j );
575 dm_(j+1UL,i) += (~rhs)(i,j+1UL);
579 dm_(jend,i) += (~rhs)(i,jend);
596 template<
typename MT2 >
604 const size_t m(
rows() );
606 const size_t block( 16UL );
608 for(
size_t ii=0UL; ii<m; ii+=block ) {
609 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
610 for(
size_t jj=0UL; jj<n; jj+=block ) {
611 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
612 for(
size_t i=ii; i<iend; ++i ) {
613 for(
size_t j=jj; j<jend; ++j ) {
614 dm_(j,i) += (~rhs)(i,j);
633 template<
typename MT2 >
643 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
644 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
645 dm_(element->index(),i) += element->value();
660 template<
typename MT2 >
670 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
671 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
672 dm_(j,element->index()) += element->value();
687 template<
typename MT2 >
695 const size_t m(
rows() );
699 const size_t jend( n &
size_t(-2) );
701 for(
size_t i=0UL; i<m; ++i ) {
702 for(
size_t j=0UL; j<jend; j+=2UL ) {
703 dm_(j ,i) -= (~rhs)(i,j );
704 dm_(j+1UL,i) -= (~rhs)(i,j+1UL);
708 dm_(jend,i) -= (~rhs)(i,jend);
725 template<
typename MT2 >
733 const size_t m(
rows() );
735 const size_t block( 16UL );
737 for(
size_t ii=0UL; ii<m; ii+=block ) {
738 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
739 for(
size_t jj=0UL; jj<n; jj+=block ) {
740 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
741 for(
size_t i=ii; i<iend; ++i ) {
742 for(
size_t j=jj; j<jend; ++j ) {
743 dm_(j,i) -= (~rhs)(i,j);
762 template<
typename MT2 >
772 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
773 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
774 dm_(element->index(),i) -= element->value();
789 template<
typename MT2 >
799 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
800 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
801 dm_(j,element->index()) -= element->value();
845 template<
typename MT >
874 enum { vectorizable = MT::vectorizable };
880 enum { smpAssignable = MT::smpAssignable };
938 return dm_.cbegin(j);
949 return dm_.cbegin(j);
982 template<
typename Other >
999 template<
typename Other >
1014 inline size_t rows()
const {
1015 return dm_.columns();
1024 inline size_t columns()
const {
1034 inline size_t spacing()
const {
1035 return dm_.spacing();
1044 inline void reset() {
1055 template<
typename Other >
1056 inline bool canAlias(
const Other* alias )
const
1058 return dm_.canAlias( alias );
1068 template<
typename Other >
1069 inline bool isAliased(
const Other* alias )
const
1071 return dm_.isAliased( alias );
1082 return dm_.isAligned();
1099 return dm_.load( j, i );
1116 return dm_.loadu( j, i );
1134 dm_.store( j, i, value );
1152 dm_.storeu( j, i, value );
1170 dm_.stream( j, i, value );
1185 template<
typename MT2 >
1186 inline void assign(
const DenseMatrix<MT2,true>& rhs )
1193 const size_t m(
rows() );
1197 const size_t iend( m &
size_t(-2) );
1199 for(
size_t j=0UL; j<n; ++j ) {
1200 for(
size_t i=0UL; i<iend; i+=2UL ) {
1201 dm_(j,i ) = (~rhs)(i ,j);
1202 dm_(j,i+1UL) = (~rhs)(i+1UL,j);
1205 dm_(j,iend) = (~rhs)(iend,j);
1222 template<
typename MT2 >
1223 inline void assign(
const DenseMatrix<MT2,false>& rhs )
1230 const size_t m(
rows() );
1232 const size_t block( 16UL );
1234 for(
size_t jj=0UL; jj<n; jj+=block ) {
1235 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
1236 for(
size_t ii=0UL; ii<m; ii+=block ) {
1237 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
1238 for(
size_t j=jj; j<jend; ++j ) {
1239 for(
size_t i=ii; i<iend; ++i ) {
1240 dm_(j,i) = (~rhs)(i,j);
1259 template<
typename MT2 >
1260 inline void assign(
const SparseMatrix<MT2,true>& rhs )
1269 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
1270 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
1271 dm_(j,element->index()) = element->value();
1286 template<
typename MT2 >
1287 inline void assign(
const SparseMatrix<MT2,false>& rhs )
1296 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
1297 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
1298 dm_(element->index(),i) = element->value();
1313 template<
typename MT2 >
1314 inline void addAssign(
const DenseMatrix<MT2,true>& rhs )
1321 const size_t m(
rows() );
1325 const size_t iend( m &
size_t(-2) );
1327 for(
size_t j=0UL; j<n; ++j ) {
1328 for(
size_t i=0UL; i<iend; i+=2UL ) {
1329 dm_(j,i ) += (~rhs)(i ,j);
1330 dm_(j,i+1UL) += (~rhs)(i+1UL,j);
1333 dm_(j,iend) += (~rhs)(iend,j);
1350 template<
typename MT2 >
1351 inline void addAssign(
const DenseMatrix<MT2,false>& rhs )
1358 const size_t m(
rows() );
1360 const size_t block( 16UL );
1362 for(
size_t jj=0UL; jj<n; jj+=block ) {
1363 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
1364 for(
size_t ii=0UL; ii<m; ii+=block ) {
1365 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
1366 for(
size_t j=jj; j<jend; ++j ) {
1367 for(
size_t i=ii; i<iend; ++i ) {
1368 dm_(j,i) += (~rhs)(i,j);
1387 template<
typename MT2 >
1388 inline void addAssign(
const SparseMatrix<MT2,true>& rhs )
1397 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
1398 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
1399 dm_(j,element->index()) += element->value();
1414 template<
typename MT2 >
1415 inline void addAssign(
const SparseMatrix<MT2,false>& rhs )
1424 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
1425 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
1426 dm_(element->index(),i) += element->value();
1441 template<
typename MT2 >
1442 inline void subAssign(
const DenseMatrix<MT2,true>& rhs )
1449 const size_t m(
rows() );
1453 const size_t iend( m &
size_t(-2) );
1455 for(
size_t j=0UL; j<n; ++j ) {
1456 for(
size_t i=0UL; i<iend; i+=2UL ) {
1457 dm_(j,i ) -= (~rhs)(i ,j);
1458 dm_(j,i+1UL) -= (~rhs)(i+1UL,j);
1461 dm_(j,iend) -= (~rhs)(iend,j);
1478 template<
typename MT2 >
1479 inline void subAssign(
const DenseMatrix<MT2,false>& rhs )
1486 const size_t m(
rows() );
1488 const size_t block( 16UL );
1490 for(
size_t jj=0UL; jj<n; jj+=block ) {
1491 const size_t jend( ( n < jj+block )?( n ):( jj+block ) );
1492 for(
size_t ii=0UL; ii<m; ii+=block ) {
1493 const size_t iend( ( m < ii+block )?( m ):( ii+block ) );
1494 for(
size_t j=jj; j<jend; ++j ) {
1495 for(
size_t i=ii; i<iend; ++i ) {
1496 dm_(j,i) -= (~rhs)(i,j);
1515 template<
typename MT2 >
1516 inline void subAssign(
const SparseMatrix<MT2,true>& rhs )
1525 for(
size_t j=0UL; j<(~rhs).
columns(); ++j )
1526 for( RhsConstIterator element=(~rhs).begin(j); element!=(~rhs).
end(j); ++element )
1527 dm_(j,element->index()) -= element->value();
1542 template<
typename MT2 >
1543 inline void subAssign(
const SparseMatrix<MT2,false>& rhs )
1552 for(
size_t i=0UL; i<(~rhs).
rows(); ++i )
1553 for( RhsConstIterator element=(~rhs).begin(i); element!=(~rhs).
end(i); ++element )
1554 dm_(element->index(),i) -= element->value();
1599 template<
typename MT
1601 inline void reset( DMatTransposer<MT,SO>& m )
1619 template<
typename MT,
bool SO >
1620 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:634
void reset(DynamicMatrix< Type, SO > &m)
Resetting the given dense matrix.
Definition: DynamicMatrix.h:4579
#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:199
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:197
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:413
EnableIf< IsNumeric< Other >, DMatTransposer >::Type & operator/=(Other rhs)
Division assignment operator for the division of a matrix by a scalar value ( ).
Definition: DMatTransposer.h:245
#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:790
size_t rows() const
Returns the current number of rows of the matrix.
Definition: DMatTransposer.h:259
void addAssign(const DenseMatrix< MT2, SO > &rhs)
Implementation of the transpose addition assignment of a row-major dense matrix.
Definition: DMatTransposer.h:559
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:269
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:2380
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
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:688
#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:2388
bool isAliased(const Other *alias) const
Returns whether the matrix is aliased with the given address alias.
Definition: DMatTransposer.h:314
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:228
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:815
IntrinsicType loadu(size_t i, size_t j) const
Unaligned load of an intrinsic element of the matrix.
Definition: DMatTransposer.h:359
bool isAligned() const
Returns whether the matrix is properly aligned in memory.
Definition: DMatTransposer.h:325
IntrinsicType load(size_t i, size_t j) const
Aligned load of an intrinsic element of the matrix.
Definition: DMatTransposer.h:342
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2381
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:532
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2382
const Type & ConstReference
Reference to a constant matrix value.
Definition: CompressedMatrix.h:2386
void reset()
Resets the matrix elements.
Definition: DMatTransposer.h:289
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:468
size_t spacing() const
Returns the spacing between the beginning of two rows.
Definition: DMatTransposer.h:279
void assign(const DenseMatrix< MT2, SO > &rhs)
Implementation of the transpose assignment of a row-major dense matrix.
Definition: DMatTransposer.h:431
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:763
#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:2383
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:748
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:726
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:215
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:597
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:183
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2387
bool canAlias(const Other *alias) const
Returns whether the matrix can alias with the given address alias.
Definition: DMatTransposer.h:301
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:661
MT::ConstIterator ConstIterator
Iterator over constant elements.
Definition: DMatTransposer.h:91
void assign(const SparseMatrix< MT2, SO > &rhs)
Implementation of the transpose assignment of a row-major sparse matrix.
Definition: DMatTransposer.h:505
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2379
void store(size_t i, size_t j, const IntrinsicType &value)
Aligned store of an intrinsic element of the matrix.
Definition: DMatTransposer.h:377
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:2385
#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:167
void storeu(size_t i, size_t j, const IntrinsicType &value)
Unaligned store of an intrinsic element of the matrix.
Definition: DMatTransposer.h:395