35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATCONJEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATCONJEXPR_H_
106 template<
typename MT
108 class SMatConjExpr :
public SparseMatrix< SMatConjExpr<MT,SO>, SO >
109 ,
private MatConjExpr
110 ,
private Computation
143 template<
typename MT2 >
146 enum { value = useAssign };
159 template<
typename MT2 >
160 struct UseSMPAssign {
161 enum { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
236 return Element(
conj( it_->value() ), it_->index() );
256 return conj( it_->value() );
277 return it_ == rhs.
it_;
288 return it_ != rhs.
it_;
299 return it_ - rhs.
it_;
312 enum { smpAssignable = MT::smpAssignable };
347 inline ReturnType
at(
size_t i,
size_t j )
const {
348 if( i >=
sm_.rows() ) {
351 if( j >=
sm_.columns() ) {
396 return sm_.columns();
406 return sm_.nonZeros();
417 return sm_.nonZeros(i);
476 template<
typename T >
478 return sm_.canAlias( alias );
488 template<
typename T >
490 return sm_.isAliased( alias );
500 return sm_.canSMPAssign();
523 template<
typename MT2
533 assign( ~lhs, rhs.sm_ );
534 assign( ~lhs,
conj( ~lhs ) );
553 template<
typename MT2 >
564 assign( ~lhs, rhs.sm_ );
566 const size_t m( rhs.rows() );
568 for(
size_t i=0UL; i<m; ++i ) {
569 const Iterator
end( (~lhs).
end(i) );
570 for( Iterator element=(~lhs).
begin(i); element!=
end; ++element ) {
592 template<
typename MT2 >
593 friend inline typename EnableIf< UseAssign<MT2> >::Type
594 assign( SparseMatrix<MT2,true>& lhs,
const SMatConjExpr& rhs )
603 assign( ~lhs, rhs.sm_ );
605 const size_t n( rhs.columns() );
607 for(
size_t j=0UL; j<n; ++j ) {
608 const Iterator
end( (~lhs).
end(j) );
609 for( Iterator element=(~lhs).
begin(j); element!=
end; ++element ) {
631 template<
typename MT2
633 friend inline typename EnableIf< UseAssign<MT2> >::Type
634 addAssign( DenseMatrix<MT2,SO2>& lhs,
const SMatConjExpr& rhs )
644 const ResultType tmp(
serial( rhs ) );
645 addAssign( ~lhs, tmp );
668 template<
typename MT2
670 friend inline typename EnableIf< UseAssign<MT2> >::Type
671 subAssign( DenseMatrix<MT2,SO2>& lhs,
const SMatConjExpr& rhs )
681 const ResultType tmp(
serial( rhs ) );
682 subAssign( ~lhs, tmp );
713 template<
typename MT2
715 friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
747 template<
typename MT2
749 friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
760 const ResultType tmp( rhs );
784 template<
typename MT2
786 friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
797 const ResultType tmp( rhs );
850 template<
typename MT
887 template<
typename MT
924 template<
typename MT
926 inline typename SMatConjExpr<MT,TF>::Operand
conj(
const SMatConjExpr<MT,TF>& sm )
954 template<
typename MT
956 inline const SMatTransExpr<MT,!SO>
conj(
const SMatTransExpr<SMatConjExpr<MT,SO>,!SO>& sm )
960 return SMatTransExpr<MT,!SO>( sm.operand().operand() );
976 template<
typename MT,
bool SO >
993 template<
typename MT,
bool SO >
994 struct Columns<
SMatConjExpr<MT,SO> > :
public Columns<MT>
1010 template<
typename MT,
bool SO >
1011 struct IsSymmetric<
SMatConjExpr<MT,SO> > :
public IsTrue< IsSymmetric<MT>::value >
1027 template<
typename MT,
bool SO >
1028 struct IsHermitian<
SMatConjExpr<MT,SO> > :
public IsTrue< IsHermitian<MT>::value >
1044 template<
typename MT,
bool SO >
1045 struct IsLower<
SMatConjExpr<MT,SO> > :
public IsTrue< IsLower<MT>::value >
1061 template<
typename MT,
bool SO >
1062 struct IsUniLower<
SMatConjExpr<MT,SO> > :
public IsTrue< IsUniLower<MT>::value >
1078 template<
typename MT,
bool SO >
1079 struct IsStrictlyLower<
SMatConjExpr<MT,SO> > :
public IsTrue< IsStrictlyLower<MT>::value >
1095 template<
typename MT,
bool SO >
1096 struct IsUpper<
SMatConjExpr<MT,SO> > :
public IsTrue< IsUpper<MT>::value >
1112 template<
typename MT,
bool SO >
1113 struct IsUniUpper<
SMatConjExpr<MT,SO> > :
public IsTrue< IsUniUpper<MT>::value >
1129 template<
typename MT,
bool SO >
1130 struct IsStrictlyUpper<
SMatConjExpr<MT,SO> > :
public IsTrue< IsStrictlyUpper<MT>::value >
1146 template<
typename MT >
1151 typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value
1152 ,
typename SMatConjExpr<MT,false>::Operand
1153 , INVALID_TYPE >::Type Type;
1162 template<
typename MT >
1167 typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value
1168 ,
typename SMatConjExpr<MT,true>::Operand
1169 , INVALID_TYPE >::Type Type;
1178 template<
typename MT >
1179 struct SMatConjExprTrait< SMatTransExpr<
SMatConjExpr<MT,true>, false > >
1183 typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value
1184 , SMatTransExpr<MT,false>
1185 , INVALID_TYPE >::Type Type;
1194 template<
typename MT >
1195 struct TSMatConjExprTrait< SMatTransExpr<
SMatConjExpr<MT,false>, true > >
1199 typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value
1200 , SMatTransExpr<MT,true>
1201 , INVALID_TYPE >::Type Type;
1210 template<
typename MT,
bool SO,
bool AF >
1215 typedef typename ConjExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type >::Type Type;
1224 template<
typename MT,
bool SO >
1229 typedef typename ConjExprTrait< typename RowExprTrait<const MT>::Type >::Type Type;
1238 template<
typename MT,
bool SO >
1243 typedef typename ConjExprTrait< typename ColumnExprTrait<const MT>::Type >::Type Type;
Expression object for the sparse matrix conj() function.The SMatConjExpr class represents the compile...
Definition: Forward.h:96
Pointer difference type of the Blaze library.
ValueType value_type
Type of the underlying pointers.
Definition: SMatConjExpr.h:205
ValueType * PointerType
Pointer return type.
Definition: SMatConjExpr.h:199
Compile time check whether the given type is a temporary vector or matrix type.This type trait class ...
Definition: IsTemporary.h:87
Header file for the Rows type trait.
Header file for the IsUniUpper type trait.
Header file for basic type definitions.
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatConjExpr.h:235
#define BLAZE_CONSTRAINT_MUST_BE_MATRIX_WITH_STORAGE_ORDER(T, SO)
Constraint on the data type.In case the given data type T is not a dense or sparse matrix type and in...
Definition: StorageOrder.h:81
Header file for the ColumnExprTrait class template.
ValueIndexPair< ElementType > Element
Element type of the sparse matrix expression.
Definition: SMatConjExpr.h:192
Header file for the IsColumnMajorMatrix type trait.
MT::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SMatConjExpr.h:171
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
MT::ResultType ResultType
Result type for expression template evaluations.
Definition: SMatConjExpr.h:169
Header file for the MatConjExpr base class.
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:721
Header file for the Computation base class.
Header file for the TSMatConjExprTrait class template.
Header file for the RequiresEvaluation type trait.
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatConjExpr.h:245
Header file for the SMatConjExprTrait class template.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatConjExpr.h:332
Header file for the IsUniLower type trait.
CompressedMatrix< Type, false > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: CompressedMatrix.h:2584
SelectType< useAssign, const ResultType, const SMatConjExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: SMatConjExpr.h:178
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:117
Constraint on the data type.
ConjExprTrait< RN >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: SMatConjExpr.h:129
Header file for the SparseMatrix base class.
PointerType pointer
Pointer return type.
Definition: SMatConjExpr.h:206
ConjExprTrait< typename DiagonalProxy< MT >::RepresentedType >::Type conj(const DiagonalProxy< MT > &proxy)
Computing the complex conjugate of the represented element.
Definition: DiagonalProxy.h:487
ValueType & ReferenceType
Reference return type.
Definition: SMatConjExpr.h:200
Constraint on the data type.
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
IteratorType it_
Iterator over the elements of the sparse matrix expression.
Definition: SMatConjExpr.h:305
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: SMatConjExpr.h:499
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:261
Header file for the ValueIndexPair class.
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
Header file for the IsTemporary type trait class.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatConjExpr.h:364
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SMatConjExpr.h:201
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exceptionThis macro encapsulates the default way of Bla...
Definition: Exception.h:331
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatConjExpr.h:347
Header file for the Columns type trait.
Operand operand() const
Returns the sparse matrix operand.
Definition: SMatConjExpr.h:465
BLAZE_ALWAYS_INLINE void conjugate(T &a)
In-place conjugation of the given value/object.
Definition: Conjugate.h:120
const CTransExprTrait< MT >::Type ctrans(const DenseMatrix< MT, SO > &dm)
Returns the conjugate transpose matrix of dm.
Definition: DMatConjExpr.h:974
Header file for the IsLower type trait.
Element ValueType
Type of the underlying pointers.
Definition: SMatConjExpr.h:198
#define BLAZE_CONSTRAINT_MUST_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:78
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SMatConjExpr.h:428
CompressedMatrix< Type, false > TransposeType
Transpose type for expression template evaluations.
Definition: CompressedMatrix.h:2585
Constraints on the storage order of matrix types.
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatConjExpr.h:375
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatConjExpr.h:405
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Operand sm_
Sparse matrix of the complex conjugate expression.
Definition: SMatConjExpr.h:506
Constraint on the data type.
Header file for the SelectType class template.
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Iterator over the elements of the sparse matrix complex conjugate expression.
Definition: SMatConjExpr.h:187
IteratorCategory iterator_category
The iterator category.
Definition: SMatConjExpr.h:204
MT::ResultType RT
Result type of the sparse matrix expression.
Definition: SMatConjExpr.h:114
Header file for the serial shim.
MT::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatConjExpr.h:170
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SMatConjExpr.h:298
Header file for the conjugate shim.
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SMatConjExpr.h:454
SMatConjExpr< MT, SO > This
Type of this SMatConjExpr instance.
Definition: SMatConjExpr.h:168
EnableIf< IsDenseMatrix< MT1 > >::Type smpSubAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP subtraction assignment of a matrix to dense matrix.
Definition: DenseMatrix.h:160
Evaluation of the return type of a complex conjugate expression.Via this type trait it is possible to...
Definition: ConjExprTrait.h:87
Header file for the IsSparseVector type trait.
Header file for the SubmatrixExprTrait class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2587
Removal of reference modifiers.The RemoveCV type trait removes any reference modifiers from the given...
Definition: RemoveReference.h:69
DifferenceType difference_type
Difference between two iterators.
Definition: SMatConjExpr.h:208
ReturnType value() const
Access to the current value of the sparse element.
Definition: SMatConjExpr.h:255
Header file for run time assertion macros.
EnableIf< IsDenseMatrix< MT1 > >::Type smpAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:98
Utility type for generic codes.
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatConjExpr.h:276
size_t rows() const
Returns the current number of rows of the matrix.
Definition: SMatConjExpr.h:385
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatConjExpr.h:287
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
MT::CompositeType CT
Composite type of the sparse matrix expression.
Definition: SMatConjExpr.h:116
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: SMatConjExpr.h:175
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SMatConjExpr.h:477
RemoveReference< Operand >::Type::ConstIterator IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatConjExpr.h:195
Element * Iterator
Iterator over non-constant elements.
Definition: CompressedMatrix.h:2591
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SMatConjExpr.h:489
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:118
Evaluation of the return type of a conjugate transpose expression.Via this type trait it is possible ...
Definition: CTransExprTrait.h:87
Header file for the RemoveReference type trait.
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SMatConjExpr.h:197
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatConjExpr.h:224
Index-value-pair for sparse vectors and matrices.The ValueIndexPair class represents a single index-v...
Definition: ValueIndexPair.h:70
Header file for the IsRowMajorMatrix type trait.
const DMatTransExpr< MT,!SO > trans(const DenseMatrix< MT, SO > &dm)
Calculation of the transpose of the given dense matrix.
Definition: DMatTransExpr.h:944
Header file for the IsComputation type trait class.
size_t index() const
Access to the current index of the sparse element.
Definition: SMatConjExpr.h:265
ConstIterator(IteratorType it)
Constructor for the ConstIterator class.
Definition: SMatConjExpr.h:214
EnableIf< IsDenseMatrix< MT1 > >::Type smpAddAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the SMP addition assignment of a matrix to a dense matrix.
Definition: DenseMatrix.h:129
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:157
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
Header file for the IsTrue value trait.
MT::ReturnType RN
Return type of the sparse matrix expression.
Definition: SMatConjExpr.h:115
Header file for the IsUpper type trait.
Header file for exception macros.
Header file for the CTransExprTrait class template.
Header file for the IsHermitian type trait.
SMatConjExpr(const MT &sm)
Constructor for the SMatConjExpr class.
Definition: SMatConjExpr.h:320
Header file for the ConjExprTrait class template.
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: SMatConjExpr.h:441
#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
ReferenceType reference
Reference return type.
Definition: SMatConjExpr.h:207
MT::ElementType ElementType
Resulting element type.
Definition: SMatConjExpr.h:172
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type...
Definition: SparseMatrix.h:79
size_t columns() const
Returns the current number of columns of the matrix.
Definition: SMatConjExpr.h:395
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type Operand
Composite data type of the sparse matrix expression.
Definition: SMatConjExpr.h:181
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatConjExpr.h:416
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.