// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2014 Gael Guennebaud <[email protected]> // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_SOLVE_H #define EIGEN_SOLVE_H // IWYU pragma: private #include "./InternalHeaderCheck.h" namespace Eigen { template <typename Decomposition, typename RhsType, typename StorageKind> class SolveImpl; /** \class Solve * \ingroup Core_Module * * \brief Pseudo expression representing a solving operation * * \tparam Decomposition the type of the matrix or decomposition object * \tparam Rhstype the type of the right-hand side * * This class represents an expression of A.solve(B) * and most of the time this is the only way it is used. * */ namespace internal { // this solve_traits class permits to determine the evaluation type with respect to storage kind (Dense vs Sparse) template <typename Decomposition, typename RhsType, typename StorageKind> struct solve_traits; solve_traits<Decomposition, RhsType, Dense>; traits<Solve<Decomposition, RhsType>>; } // namespace internal template <typename Decomposition, typename RhsType> class Solve : public SolveImpl<Decomposition, RhsType, typename internal::traits<RhsType>::StorageKind> { … }; // Specialization of the Solve expression for dense results SolveImpl<Decomposition, RhsType, Dense>; // Generic API dispatcher template <typename Decomposition, typename RhsType, typename StorageKind> class SolveImpl : public internal::generic_xpr_base<Solve<Decomposition, RhsType>, MatrixXpr, StorageKind>::type { … }; namespace internal { // Evaluator of Solve -> eval into a temporary evaluator<Solve<Decomposition, RhsType>>; // Specialization for "dst = dec.solve(rhs)" // NOTE we need to specialize it for Dense2Dense to avoid ambiguous specialization error and a Sparse2Sparse // specialization must exist somewhere Assignment<DstXprType, Solve<DecType, RhsType>, internal::assign_op<Scalar, Scalar>, Dense2Dense>; // Specialization for "dst = dec.transpose().solve(rhs)" Assignment<DstXprType, Solve<Transpose<const DecType>, RhsType>, internal::assign_op<Scalar, Scalar>, Dense2Dense>; // Specialization for "dst = dec.adjoint().solve(rhs)" Assignment<DstXprType, Solve<CwiseUnaryOp<internal::scalar_conjugate_op<typename DecType::Scalar>, const Transpose<const DecType>>, RhsType>, internal::assign_op<Scalar, Scalar>, Dense2Dense>; } // end namespace internal } // end namespace Eigen #endif // EIGEN_SOLVE_H