Clang-format tests, examples, libraries, benchmarks, etc.

This commit is contained in:
Antonio Sánchez
2023-12-05 21:22:55 +00:00
committed by Rasmus Munk Larsen
parent 3252ecc7a4
commit 46e9cdb7fe
876 changed files with 33453 additions and 37795 deletions

View File

@@ -12,24 +12,23 @@
namespace internal {
template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs, int StorageOrder>
template <typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs,
int StorageOrder>
struct packed_triangular_matrix_vector_product;
template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs>
struct packed_triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,ColMajor>
{
template <typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs>
struct packed_triangular_matrix_vector_product<Index, Mode, LhsScalar, ConjLhs, RhsScalar, ConjRhs, ColMajor> {
typedef typename ScalarBinaryOpTraits<LhsScalar, RhsScalar>::ReturnType ResScalar;
enum {
IsLower = (Mode & Lower) ==Lower,
HasUnitDiag = (Mode & UnitDiag)==UnitDiag,
HasZeroDiag = (Mode & ZeroDiag)==ZeroDiag
IsLower = (Mode & Lower) == Lower,
HasUnitDiag = (Mode & UnitDiag) == UnitDiag,
HasZeroDiag = (Mode & ZeroDiag) == ZeroDiag
};
static void run(Index size, const LhsScalar* lhs, const RhsScalar* rhs, ResScalar* res, ResScalar alpha)
{
static void run(Index size, const LhsScalar* lhs, const RhsScalar* rhs, ResScalar* res, ResScalar alpha) {
internal::conj_if<ConjRhs> cj;
typedef Map<const Matrix<LhsScalar,Dynamic,1> > LhsMap;
typedef typename conj_expr_if<ConjLhs,LhsMap>::type ConjLhsType;
typedef Map<Matrix<ResScalar,Dynamic,1> > ResMap;
typedef Map<const Matrix<LhsScalar, Dynamic, 1> > LhsMap;
typedef typename conj_expr_if<ConjLhs, LhsMap>::type ConjLhsType;
typedef Map<Matrix<ResScalar, Dynamic, 1> > ResMap;
for (Index i = 0; i < size; ++i) {
Index s = IsLower && (HasUnitDiag || HasZeroDiag) ? 1 : 0;
@@ -45,28 +44,28 @@ struct packed_triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsS
};
};
template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs>
struct packed_triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,RowMajor>
{
template <typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs>
struct packed_triangular_matrix_vector_product<Index, Mode, LhsScalar, ConjLhs, RhsScalar, ConjRhs, RowMajor> {
typedef typename ScalarBinaryOpTraits<LhsScalar, RhsScalar>::ReturnType ResScalar;
enum {
IsLower = (Mode & Lower) ==Lower,
HasUnitDiag = (Mode & UnitDiag)==UnitDiag,
HasZeroDiag = (Mode & ZeroDiag)==ZeroDiag
IsLower = (Mode & Lower) == Lower,
HasUnitDiag = (Mode & UnitDiag) == UnitDiag,
HasZeroDiag = (Mode & ZeroDiag) == ZeroDiag
};
static void run(Index size, const LhsScalar* lhs, const RhsScalar* rhs, ResScalar* res, ResScalar alpha)
{
static void run(Index size, const LhsScalar* lhs, const RhsScalar* rhs, ResScalar* res, ResScalar alpha) {
internal::conj_if<ConjRhs> cj;
typedef Map<const Matrix<LhsScalar,Dynamic,1> > LhsMap;
typedef typename conj_expr_if<ConjLhs,LhsMap>::type ConjLhsType;
typedef Map<const Matrix<RhsScalar,Dynamic,1> > RhsMap;
typedef typename conj_expr_if<ConjRhs,RhsMap>::type ConjRhsType;
typedef Map<const Matrix<LhsScalar, Dynamic, 1> > LhsMap;
typedef typename conj_expr_if<ConjLhs, LhsMap>::type ConjLhsType;
typedef Map<const Matrix<RhsScalar, Dynamic, 1> > RhsMap;
typedef typename conj_expr_if<ConjRhs, RhsMap>::type ConjRhsType;
for (Index i = 0; i < size; ++i) {
Index s = !IsLower && (HasUnitDiag || HasZeroDiag) ? 1 : 0;
Index r = IsLower ? i + 1 : size - i;
if (!(HasUnitDiag || HasZeroDiag) || (--r > 0)) {
res[i] += alpha * (ConjLhsType(LhsMap(lhs + s, r)).cwiseProduct(ConjRhsType(RhsMap(rhs + (IsLower ? 0 : s + i), r)))).sum();
res[i] +=
alpha *
(ConjLhsType(LhsMap(lhs + s, r)).cwiseProduct(ConjRhsType(RhsMap(rhs + (IsLower ? 0 : s + i), r)))).sum();
}
if (HasUnitDiag) {
res[i] += alpha * cj(rhs[i]);
@@ -76,6 +75,6 @@ struct packed_triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsS
};
};
} // end namespace internal
} // end namespace internal
#endif // EIGEN_PACKED_TRIANGULAR_MATRIX_VECTOR_H
#endif // EIGEN_PACKED_TRIANGULAR_MATRIX_VECTOR_H