// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Chen-Pang He // // 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 STORMEIGEN_PACKED_TRIANGULAR_SOLVER_VECTOR_H #define STORMEIGEN_PACKED_TRIANGULAR_SOLVER_VECTOR_H namespace internal { template struct packed_triangular_solve_vector; // forward and backward substitution, row-major, rhs is a vector template struct packed_triangular_solve_vector { enum { IsLower = (Mode&Lower)==Lower }; static void run(Index size, const LhsScalar* lhs, RhsScalar* rhs) { internal::conj_if cj; typedef Map > LhsMap; typedef typename conj_expr_if::type ConjLhsType; lhs += IsLower ? 0 : (size*(size+1)>>1)-1; for(Index pi=0; pi0) rhs[i] -= (ConjLhsType(LhsMap(lhs+s,pi)) .cwiseProduct(Map >(rhs+(IsLower ? 0 : i+1),pi))).sum(); if (!(Mode & UnitDiag)) rhs[i] /= cj(lhs[IsLower ? i : 0]); IsLower ? lhs += pi+1 : lhs -= pi+2; } } }; // forward and backward substitution, column-major, rhs is a vector template struct packed_triangular_solve_vector { enum { IsLower = (Mode&Lower)==Lower }; static void run(Index size, const LhsScalar* lhs, RhsScalar* rhs) { internal::conj_if cj; typedef Map > LhsMap; typedef typename conj_expr_if::type ConjLhsType; lhs += IsLower ? 0 : size*(size-1)>>1; for(Index pi=0; pi0) Map >(rhs+(IsLower? i+1 : 0),r) -= rhs[i] * ConjLhsType(LhsMap(lhs+(IsLower? 1 : 0),r)); IsLower ? lhs += size-pi : lhs -= r; } } }; template struct packed_triangular_solve_vector { static void run(Index size, const LhsScalar* lhs, RhsScalar* rhs) { packed_triangular_solve_vector::run(size, lhs, rhs); } }; } // end namespace internal #endif // STORMEIGEN_PACKED_TRIANGULAR_SOLVER_VECTOR_H