35 #ifndef _BLAZE_MATH_EXPRESSIONS_SMATIMAGEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SMATIMAGEXPR_H_
108 template<
typename MT
110 class SMatImagExpr :
public SparseMatrix< SMatImagExpr<MT,SO>, SO >
111 ,
private MatImagExpr
112 ,
private Computation
145 template<
typename MT2 >
148 enum { value = useAssign };
161 template<
typename MT2 >
162 struct UseSMPAssign {
163 enum { value = ( !MT2::smpAssignable || !MT::smpAssignable ) && useAssign };
238 return Element(
imag( it_->value() ), it_->index() );
258 return imag( it_->value() );
279 return it_ == rhs.
it_;
290 return it_ != rhs.
it_;
301 return it_ - rhs.
it_;
314 enum { smpAssignable = MT::smpAssignable };
349 inline ReturnType
at(
size_t i,
size_t j )
const {
350 if( i >=
sm_.rows() ) {
353 if( j >=
sm_.columns() ) {
398 return sm_.columns();
408 return sm_.nonZeros();
419 return sm_.nonZeros(i);
478 template<
typename T >
480 return sm_.canAlias( alias );
490 template<
typename T >
492 return sm_.isAliased( alias );
502 return sm_.canSMPAssign();
526 template<
typename MT2
540 const RT tmp(
serial( rhs.sm_ ) );
541 assign( ~lhs,
imag( tmp ) );
560 template<
typename MT2
574 const RT tmp(
serial( rhs.sm_ ) );
575 (~lhs).reserve( tmp.nonZeros() );
576 assign( ~lhs,
imag( tmp ) );
595 template<
typename MT2
597 friend inline typename EnableIf< UseAssign<MT2> >::Type
598 addAssign( DenseMatrix<MT2,SO2>& lhs,
const SMatImagExpr& rhs )
609 const RT tmp(
serial( rhs.sm_ ) );
610 addAssign( ~lhs,
imag( tmp ) );
633 template<
typename MT2
635 friend inline typename EnableIf< UseAssign<MT2> >::Type
636 subAssign( DenseMatrix<MT2,SO2>& lhs,
const SMatImagExpr& rhs )
647 const RT tmp(
serial( rhs.sm_ ) );
648 subAssign( ~lhs,
imag( tmp ) );
680 template<
typename MT2
682 friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
694 const RT tmp( rhs.sm_ );
718 template<
typename MT2
720 friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
732 const RT tmp( rhs.sm_ );
756 template<
typename MT2
758 friend inline typename EnableIf< UseSMPAssign<MT2> >::Type
770 const RT tmp( rhs.sm_ );
824 template<
typename MT
854 template<
typename MT
856 inline const SMatImagExpr<MT,TF>&
imag(
const SMatImagExpr<MT,TF>& sm )
876 template<
typename MT,
bool SO >
893 template<
typename MT,
bool SO >
894 struct Columns<
SMatImagExpr<MT,SO> > :
public Columns<MT>
910 template<
typename MT,
bool SO >
911 struct IsSymmetric<
SMatImagExpr<MT,SO> > :
public IsTrue< IsSymmetric<MT>::value >
927 template<
typename MT,
bool SO >
928 struct IsHermitian<
SMatImagExpr<MT,SO> > :
public IsTrue< IsHermitian<MT>::value >
944 template<
typename MT,
bool SO >
945 struct IsLower<
SMatImagExpr<MT,SO> > :
public IsTrue< IsLower<MT>::value >
961 template<
typename MT,
bool SO >
962 struct IsUniLower<
SMatImagExpr<MT,SO> > :
public IsTrue< IsUniLower<MT>::value >
978 template<
typename MT,
bool SO >
979 struct IsStrictlyLower<
SMatImagExpr<MT,SO> > :
public IsTrue< IsStrictlyLower<MT>::value >
995 template<
typename MT,
bool SO >
996 struct IsUpper<
SMatImagExpr<MT,SO> > :
public IsTrue< IsUpper<MT>::value >
1012 template<
typename MT,
bool SO >
1013 struct IsUniUpper<
SMatImagExpr<MT,SO> > :
public IsTrue< IsUniUpper<MT>::value >
1029 template<
typename MT,
bool SO >
1030 struct IsStrictlyUpper<
SMatImagExpr<MT,SO> > :
public IsTrue< IsStrictlyUpper<MT>::value >
1046 template<
typename MT >
1051 typedef typename SelectType< IsSparseMatrix<MT>::value && IsRowMajorMatrix<MT>::value
1052 , SMatImagExpr<MT,false>
1053 , INVALID_TYPE >::Type Type;
1062 template<
typename MT >
1067 typedef typename SelectType< IsSparseMatrix<MT>::value && IsColumnMajorMatrix<MT>::value
1068 , SMatImagExpr<MT,true>
1069 , INVALID_TYPE >::Type Type;
1078 template<
typename MT,
bool SO,
bool AF >
1083 typedef typename ImagExprTrait< typename SubmatrixExprTrait<const MT,AF>::Type >::Type Type;
1092 template<
typename MT,
bool SO >
1097 typedef typename ImagExprTrait< typename RowExprTrait<const MT>::Type >::Type Type;
1106 template<
typename MT,
bool SO >
1111 typedef typename ImagExprTrait< typename ColumnExprTrait<const MT>::Type >::Type Type;
Header file for the UnderlyingNumeric type trait.
Header file for the ImagExprTrait class template.
ImagExprTrait< RN >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: SMatImagExpr.h:131
Pointer difference type of the Blaze library.
ConstIterator lowerBound(size_t i, size_t j) const
Returns an iterator to the first index not less then the given index.
Definition: SMatImagExpr.h:443
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.
Operand operand() const
Returns the sparse matrix operand.
Definition: SMatImagExpr.h:467
Header file for basic type definitions.
ResultType::ElementType ElementType
Resulting element type.
Definition: SMatImagExpr.h:174
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SMatImagExpr.h:491
Header file for the imaginary shim.
ConstIterator find(size_t i, size_t j) const
Searches for a specific matrix element.
Definition: SMatImagExpr.h:430
#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
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:207
ptrdiff_t DifferenceType
Difference between two iterators.
Definition: SMatImagExpr.h:203
ConstIterator upperBound(size_t i, size_t j) const
Returns an iterator to the first index greater then the given index.
Definition: SMatImagExpr.h:456
Evaluation of the return type of a imaginary part expression.Via this type trait it is possible to ev...
Definition: ImagExprTrait.h:88
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SMatImagExpr.h:407
Header file for the ColumnExprTrait class template.
Header file for the IsColumnMajorMatrix type trait.
SMatImagExpr< MT, SO > This
Type of this SMatImagExpr instance.
Definition: SMatImagExpr.h:170
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2588
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:259
ValueType value_type
Type of the underlying pointers.
Definition: SMatImagExpr.h:207
DifferenceType operator-(const ConstIterator &rhs) const
Calculating the number of elements between two expression iterators.
Definition: SMatImagExpr.h:300
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SMatImagExpr.h:418
Base template for the ImagTrait class.The ImagTrait class template offers the possibility to select t...
Definition: ImagTrait.h:78
Element ValueType
Type of the underlying pointers.
Definition: SMatImagExpr.h:200
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 RequiresEvaluation type trait.
bool canSMPAssign() const
Returns whether the expression can be used in SMP assignments.
Definition: SMatImagExpr.h:501
ValueIndexPair< ElementType > Element
Element type of the sparse matrix expression.
Definition: SMatImagExpr.h:194
Header file for the IsUniLower type trait.
const Element operator*() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatImagExpr.h:237
RemoveReference< Operand >::Type::ConstIterator IteratorType
Iterator type of the sparse matrix expression.
Definition: SMatImagExpr.h:197
const ImagExprTrait< MT >::Type imag(const DenseMatrix< MT, SO > &dm)
Returns a matrix containing the imaginary part of each single element of dm.
Definition: DMatImagExpr.h:920
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
ImagTrait< RT >::Type ResultType
Result type for expression template evaluations.
Definition: SMatImagExpr.h:171
Constraint on the data type.
Header file for the SparseMatrix base class.
IteratorType it_
Iterator over the elements of the sparse matrix expression.
Definition: SMatImagExpr.h:307
const ConstIterator * operator->() const
Direct access to the sparse matrix element at the current iterator position.
Definition: SMatImagExpr.h:247
Constraint on the data type.
size_t index() const
Access to the current index of the sparse element.
Definition: SMatImagExpr.h:267
Compile time check to query the requirement to evaluate an expression.Via this type trait it is possi...
Definition: RequiresEvaluation.h:90
SMatImagExpr(const MT &sm)
Constructor for the SMatImagExpr class.
Definition: SMatImagExpr.h:322
size_t columns() const
Returns the current number of columns of the matrix.
Definition: SMatImagExpr.h:397
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.
SelectType< IsExpression< MT >::value, const MT, const MT & >::Type Operand
Composite data type of the sparse matrix expression.
Definition: SMatImagExpr.h:183
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
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
MT::CompositeType CT
Composite type of the sparse matrix expression.
Definition: SMatImagExpr.h:118
#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
Header file for the Columns type trait.
IteratorCategory iterator_category
The iterator category.
Definition: SMatImagExpr.h:206
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SMatImagExpr.h:172
ConstIterator begin(size_t i) const
Returns an iterator to the first non-zero element of row i.
Definition: SMatImagExpr.h:366
Header file for the IsLower type trait.
#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
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SMatImagExpr.h:173
Constraints on the storage order of matrix types.
ReturnType value() const
Access to the current value of the sparse element.
Definition: SMatImagExpr.h:257
Constraint on the data type.
Header file for the SelectType class template.
Header file for the RowExprTrait class template.
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: SMatImagExpr.h:349
Header file for all forward declarations for expression class templates.
size_t rows() const
Returns the current number of rows of the matrix.
Definition: SMatImagExpr.h:387
SelectType< useAssign, const ResultType, const SMatImagExpr & >::Type CompositeType
Data type for composite expression templates.
Definition: SMatImagExpr.h:180
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
Header file for the serial shim.
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
Header file for the IsSparseVector type trait.
Header file for the SubmatrixExprTrait class template.
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SMatImagExpr.h:479
Header file for the TSMatImagExprTrait 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
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
ReferenceType reference
Reference return type.
Definition: SMatImagExpr.h:209
Utility type for generic codes.
Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool ...
Definition: EnableIf.h:184
ConstIterator(IteratorType it)
Constructor for the ConstIterator class.
Definition: SMatImagExpr.h:216
#define BLAZE_CONSTRAINT_MUST_NOT_BE_BUILTIN_TYPE(T)
Constraint on the data type.In case the given data type T is a built-in data type, a compilation error is created.
Definition: Builtin.h:116
bool operator==(const ConstIterator &rhs) const
Equality comparison between two ConstIterator objects.
Definition: SMatImagExpr.h:278
ValueType * PointerType
Pointer return type.
Definition: SMatImagExpr.h:201
Header file for the imaginary trait.
#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
Header file for the RemoveReference type trait.
ValueType & ReferenceType
Reference return type.
Definition: SMatImagExpr.h:202
Iterator over the elements of the sparse matrix imaginary part expression.
Definition: SMatImagExpr.h:189
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: SMatImagExpr.h:177
DifferenceType difference_type
Difference between two iterators.
Definition: SMatImagExpr.h:210
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.
Header file for the IsComputation type trait class.
Header file for the SMatImagExprTrait class template.
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
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition: SMatImagExpr.h:199
This ResultType
Result type for expression template evaluations.
Definition: CompressedMatrix.h:2583
Header file for the IsTrue value trait.
Expression object for the sparse matrix imag() function.The SMatImagExpr class represents the compile...
Definition: Forward.h:101
MT::ReturnType RN
Return type of the sparse matrix expression.
Definition: SMatImagExpr.h:117
Header file for the IsUpper type trait.
Header file for exception macros.
MT::ResultType RT
Result type of the sparse matrix expression.
Definition: SMatImagExpr.h:116
Operand sm_
Sparse matrix of the imaginary part expression.
Definition: SMatImagExpr.h:508
ConstIterator end(size_t i) const
Returns an iterator just past the last non-zero element of row i.
Definition: SMatImagExpr.h:377
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SMatImagExpr.h:334
Header file for the IsHermitian type trait.
#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
bool operator!=(const ConstIterator &rhs) const
Inequality comparison between two ConstIterator objects.
Definition: SMatImagExpr.h:289
Constraint on the data type.
#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
Header file for the MatImagExpr base class.
Header file for the IsExpression type trait class.
ConstIterator & operator++()
Pre-increment operator.
Definition: SMatImagExpr.h:226
Header file for the FunctionTrace class.
PointerType pointer
Pointer return type.
Definition: SMatImagExpr.h:208