10 #ifndef EIGEN_SPARSE_DOT_H 11 #define EIGEN_SPARSE_DOT_H 15 template<
typename Derived>
16 template<
typename OtherDerived>
17 typename internal::traits<Derived>::Scalar
24 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
27 eigen_assert(other.size()>0 &&
"you are using a non initialized vector");
29 typename Derived::InnerIterator i(derived(),0);
33 res += numext::conj(i.value()) * other.coeff(i.index());
39 template<
typename Derived>
40 template<
typename OtherDerived>
48 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
52 typedef typename Derived::Nested Nested;
53 typedef typename OtherDerived::Nested OtherNested;
57 Nested nthis(derived());
58 OtherNested nother(other.
derived());
60 typename NestedCleaned::InnerIterator i(nthis,0);
61 typename OtherNestedCleaned::InnerIterator j(nother,0);
65 if (i.index()==j.index())
67 res += numext::conj(i.value()) * j.value();
70 else if (i.index()<j.index())
78 template<
typename Derived>
85 template<
typename Derived>
90 return sqrt(squaredNorm());
93 template<
typename Derived>
101 #endif // EIGEN_SPARSE_DOT_H RealScalar squaredNorm() const
#define EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(TYPE0, TYPE1)
RealReturnType real() const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
NumTraits< typename traits< Derived >::Scalar >::Real blueNorm_impl(const EigenBase< Derived > &_vec)
Base class of any sparse matrices or sparse expressions.
internal::traits< CwiseBinaryOp< BinaryOp, Lhs, Rhs > >::Scalar Scalar
RealScalar blueNorm() const
Scalar dot(const MatrixBase< OtherDerived > &other) const
const Derived & derived() const
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
Base class for all dense matrices, vectors, and expressions.
const CwiseUnaryOp< internal::scalar_sqrt_op< Scalar >, const Derived > sqrt() const