35 #ifndef _BLAZE_MATH_EXPRESSIONS_SVECTSVECMULTEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_SVECTSVECMULTEXPR_H_
89 template<
typename VT1
91 class SVecTSVecMultExpr :
public SparseMatrix< SVecTSVecMultExpr<VT1,VT2>, false >
92 ,
private VecTVecMultExpr
147 enum { smpAssignable = 0 };
203 return lhs_.nonZeros() *
rhs_.nonZeros();
244 template<
typename T >
246 return (
lhs_.canAlias( alias ) ||
rhs_.canAlias( alias ) );
256 template<
typename T >
258 return (
lhs_.isAliased( alias ) ||
rhs_.isAliased( alias ) );
280 template<
typename MT >
299 const LeftIterator lend( x.end() );
300 const RightIterator rend( y.end() );
302 for( LeftIterator lelem=x.begin(); lelem!=lend; ++lelem ) {
304 for( RightIterator relem=y.begin(); relem!=rend; ++relem ) {
305 (~lhs)(lelem->index(),relem->index()) = lelem->value() * relem->value();
326 template<
typename MT >
347 const LeftIterator lend( x.end() );
348 const RightIterator rend( y.end() );
350 for( RightIterator relem=y.begin(); relem!=rend; ++relem ) {
352 for( LeftIterator lelem=x.begin(); lelem!=lend; ++lelem ) {
353 (~lhs)(lelem->index(),relem->index()) = lelem->value() * relem->value();
373 template<
typename MT >
392 const LeftIterator lend( x.end() );
393 const RightIterator rend( y.end() );
395 for( LeftIterator lelem=x.begin(); lelem!=lend; ++lelem ) {
397 (~lhs).reserve( lelem->index(), y.nonZeros() );
398 for( RightIterator relem=y.begin(); relem!=rend; ++relem ) {
399 (~lhs).append( lelem->index(), relem->index(), lelem->value() * relem->value() );
420 template<
typename MT >
441 const LeftIterator lend( x.end() );
442 const RightIterator rend( y.end() );
444 for( RightIterator relem=y.begin(); relem!=rend; ++relem ) {
446 (~lhs).reserve( relem->index(), x.nonZeros() );
447 for( LeftIterator lelem=x.begin(); lelem!=lend; ++lelem ) {
448 (~lhs).append( lelem->index(), relem->index(), lelem->value() * relem->value() );
469 template<
typename MT >
488 const LeftIterator lend( x.end() );
489 const RightIterator rend( y.end() );
491 for( LeftIterator lelem=x.begin(); lelem!=lend; ++lelem ) {
493 for( RightIterator relem=y.begin(); relem!=rend; ++relem ) {
494 (~lhs)(lelem->index(),relem->index()) += lelem->value() * relem->value();
515 template<
typename MT >
536 const LeftIterator lend( x.end() );
537 const RightIterator rend( y.end() );
539 for( RightIterator relem=y.begin(); relem!=rend; ++relem ) {
541 for( LeftIterator lelem=x.begin(); lelem!=lend; ++lelem ) {
542 (~lhs)(lelem->index(),relem->index()) += lelem->value() * relem->value();
567 template<
typename MT >
586 const LeftIterator lend( x.end() );
587 const RightIterator rend( y.end() );
589 for( LeftIterator lelem=x.begin(); lelem!=lend; ++lelem ) {
591 for( RightIterator relem=y.begin(); relem!=rend; ++relem ) {
592 (~lhs)(lelem->index(),relem->index()) -= lelem->value() * relem->value();
613 template<
typename MT >
634 const LeftIterator lend( x.end() );
635 const RightIterator rend( y.end() );
637 for( RightIterator relem=y.begin(); relem!=rend; ++relem ) {
639 for( LeftIterator lelem=x.begin(); lelem!=lend; ++lelem ) {
640 (~lhs)(lelem->index(),relem->index()) -= lelem->value() * relem->value();
708 template<
typename T1
710 inline const SVecTSVecMultExpr<T1,T2>
730 template<
typename VT1,
typename VT2 >
731 struct Rows< SVecTSVecMultExpr<VT1,VT2> > :
public Size<VT1>
747 template<
typename VT1,
typename VT2 >
748 struct Columns< SVecTSVecMultExpr<VT1,VT2> > :
public Size<VT2>
764 template<
typename VT1,
typename VT2,
bool AF >
765 struct SubmatrixExprTrait< SVecTSVecMultExpr<VT1,VT2>, AF >
769 typedef typename MultExprTrait< typename SubvectorExprTrait<const VT1,AF>::Type
770 ,
typename SubvectorExprTrait<const VT2,AF>::Type >::Type Type;
779 template<
typename VT1,
typename VT2 >
780 struct RowExprTrait< SVecTSVecMultExpr<VT1,VT2> >
784 typedef typename MultExprTrait< typename VT1::ReturnType, VT2 >::Type Type;
793 template<
typename VT1,
typename VT2 >
794 struct ColumnExprTrait< SVecTSVecMultExpr<VT1,VT2> >
798 typedef typename MultExprTrait< VT1, typename VT2::ReturnType >::Type Type;
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.
const DMatDMatMultExpr< T1, T2 > operator*(const DenseMatrix< T1, false > &lhs, const DenseMatrix< T2, false > &rhs)
Multiplication operator for the multiplication of two row-major dense matrices ( ).
Definition: DMatDMatMultExpr.h:4838
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a column dense or sparse vector type...
Definition: TransposeFlag.h:159
Efficient implementation of a compressed matrix.The CompressedMatrix class template is the represent...
Definition: CompressedMatrix.h:205
Header file for the ColumnExprTrait class template.
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: SVecTSVecMultExpr.h:169
SelectType< IsComputation< VT1 >::value, const RT1, CT1 >::Type LT
Type for the assignment of the left-hand side dense vector operand.
Definition: SVecTSVecMultExpr.h:139
const This & CompositeType
Data type for composite expression templates.
Definition: CompressedMatrix.h:2478
SVecTSVecMultExpr(const VT1 &lhs, const VT2 &rhs)
Constructor for the SVecTSVecMultExpr class.
Definition: SVecTSVecMultExpr.h:156
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:257
VT1::ResultType RT1
Result type of the left-hand side sparse vector expression.
Definition: SVecTSVecMultExpr.h:97
bool isAliased(const T *alias) const
Returns whether the expression is aliased with the given address alias.
Definition: SVecTSVecMultExpr.h:257
const DMatSerialExpr< MT, SO > serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:695
Header file for the Computation base class.
size_t columns() const
Returns the current number of columns of the matrix.
Definition: SVecTSVecMultExpr.h:192
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: SVecTSVecMultExpr.h:202
ResultType::TransposeType TransposeType
Transpose type for expression template evaluations.
Definition: SVecTSVecMultExpr.h:123
bool canAlias(const T *alias) const
Returns whether the expression can alias with the given address alias.
Definition: SVecTSVecMultExpr.h:245
ResultType::ElementType ElementType
Resulting element type.
Definition: SVecTSVecMultExpr.h:124
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:70
Constraint on the data type.
Header file for the SparseMatrix base class.
Constraint on the data type.
Header file for the MultExprTrait class template.
Compile time type selection.The SelectType class template selects one of the two given types T1 and T...
Definition: SelectType.h:59
VT2::CompositeType CT2
Composite type of the right-hand side sparse vector expression.
Definition: SVecTSVecMultExpr.h:102
Header file for the IsTemporary type trait class.
Header file for the multiplication trait.
size_t rows() const
Returns the current number of rows of the matrix.
Definition: SVecTSVecMultExpr.h:182
SelectType< IsExpression< VT2 >::value, const VT2, const VT2 & >::Type RightOperand
Composite type of the right-hand side sparse vector expression.
Definition: SVecTSVecMultExpr.h:136
LeftOperand lhs_
Left-hand side sparse vector of the multiplication expression.
Definition: SVecTSVecMultExpr.h:264
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: SVecTSVecMultExpr.h:213
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2482
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_VECTVECMULTEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid vector/vector ...
Definition: VecTVecMultExpr.h:161
BLAZE_ALWAYS_INLINE void assign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the assignment of a matrix to a matrix.
Definition: Matrix.h:635
Header file for the Columns type trait.
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional vector type...
Definition: SparseVector.h:79
Constraint on the data type.
Expression object for sparse vector-sparse vector outer products.The SVecTSVecMultExpr class represen...
Definition: Forward.h:124
MultExprTrait< RN1, RN2 >::Type ExprReturnType
Expression return type for the subscript operator.
Definition: SVecTSVecMultExpr.h:115
Header file for the SelectType class template.
Header file for the RowExprTrait class template.
Header file for all forward declarations for expression class templates.
Constraint on the data type.
Header file for the VecTVecMultExpr base class.
Header file for the serial shim.
ResultType::OppositeType OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: SVecTSVecMultExpr.h:122
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:116
Header file for the SubmatrixExprTrait class template.
const Type & ReturnType
Return type for expression template evaluations.
Definition: CompressedMatrix.h:2477
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.
Base template for the MultTrait class.
Definition: MultTrait.h:142
RightOperand rhs_
Right-hand side sparse vector of the multiplication expression.
Definition: SVecTSVecMultExpr.h:265
BLAZE_ALWAYS_INLINE void addAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the addition assignment of a matrix to a matrix.
Definition: Matrix.h:742
VT1::CompositeType CT1
Composite type of the left-hand side sparse vector expression.
Definition: SVecTSVecMultExpr.h:101
VT2::ReturnType RN2
Return type of the right-hand side sparse vector expression.
Definition: SVecTSVecMultExpr.h:100
RightOperand rightOperand() const
Returns the right-hand side sparse vector operand.
Definition: SVecTSVecMultExpr.h:233
SelectType< IsExpression< VT1 >::value, const VT1, const VT1 & >::Type LeftOperand
Composite type of the left-hand side sparse vector expression.
Definition: SVecTSVecMultExpr.h:133
Header file for the isDefault shim.
BLAZE_ALWAYS_INLINE bool isDefault(const NonNumericProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: NonNumericProxy.h:874
Constraint on the data type.
const ResultType CompositeType
Data type for composite expression templates.
Definition: SVecTSVecMultExpr.h:130
MultTrait< RT1, RT2 >::Type ResultType
Result type for expression template evaluations.
Definition: SVecTSVecMultExpr.h:121
Constraint on the data type.
Header file for the RemoveReference type trait.
VT1::ReturnType RN1
Return type of the left-hand side sparse vector expression.
Definition: SVecTSVecMultExpr.h:99
SVecTSVecMultExpr< VT1, VT2 > This
Type of this SVecTSVecMultExpr instance.
Definition: SVecTSVecMultExpr.h:120
Header file for the IsComputation type trait class.
Base class for sparse vectors.The SparseVector class is a base class for all arbitrarily sized (N-dim...
Definition: Forward.h:108
#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:2473
Header file for basic type definitions.
#define BLAZE_CONSTRAINT_MUST_BE_ROW_VECTOR_TYPE(T)
Constraint on the data type.In case the given data type T is not a row dense or sparse vector type (i...
Definition: TransposeFlag.h:81
Header file for the SubvectorExprTrait class template.
VT2::ResultType RT2
Result type of the right-hand side sparse vector expression.
Definition: SVecTSVecMultExpr.h:98
const SelectType< returnExpr, ExprReturnType, ElementType >::Type ReturnType
Return type for expression template evaluations.
Definition: SVecTSVecMultExpr.h:127
Header file for the Size type trait.
Evaluation of the resulting expression type of a multiplication.Via this type trait it is possible to...
Definition: MultExprTrait.h:137
Size type of the Blaze library.
#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
LeftOperand leftOperand() const
Returns the left-hand side sparse vector operand.
Definition: SVecTSVecMultExpr.h:223
SelectType< IsComputation< VT2 >::value, const RT2, CT2 >::Type RT
Type for the assignment of the right-hand side dense vector operand.
Definition: SVecTSVecMultExpr.h:142
Header file for the IsExpression type trait class.
Header file for the FunctionTrace class.
BLAZE_ALWAYS_INLINE void subAssign(Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Default implementation of the subtraction assignment of a matrix to matrix.
Definition: Matrix.h:849