Skip to content

Commit

Permalink
fix templating errors and change header file to mat_computational_ope…
Browse files Browse the repository at this point in the history
…rators
  • Loading branch information
Apostolos Chalkis committed Jun 26, 2024
1 parent 9b72f5f commit 11b4948
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion include/preprocess/analytic_center_linear_ineq.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "preprocess/max_inscribed_ball.hpp"
#include "preprocess/feasible_point.hpp"
#include "preprocess/mat_computational_operator.h"
#include "preprocess/mat_computational_operators.h"

template <typename VT, typename NT>
NT get_max_step(VT const& Ad, VT const& b_Ax)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// Licensed under GNU LGPL.3, see LICENCE file


#ifndef MAT_COMPUTATIONAL_OPERATOR_H
#define MAT_COMPUTATIONAL_OPERATOR_H
#ifndef MAT_COMPUTATIONAL_OPERATORS_H
#define MAT_COMPUTATIONAL_OPERATORS_H

#include <memory>

Expand Down Expand Up @@ -61,8 +61,8 @@ initialize_chol(MT const& A_trans, MT const& A)
}
}

template <typename NT, template<typename...> typename Eigen_llt, typename MT, typename VT>
inline static VT solve_vec(std::unique_ptr<Eigen_llt<MT>> const& llt,
template <typename NT, typename MT, typename Eigen_lltMT, typename VT>
inline static VT solve_vec(std::unique_ptr<Eigen_lltMT> const& llt,
MT const& H, VT const& b)
{
using DenseMT = Eigen::Matrix<NT, Eigen::Dynamic, Eigen::Dynamic>;
Expand All @@ -82,9 +82,9 @@ inline static VT solve_vec(std::unique_ptr<Eigen_llt<MT>> const& llt,
}
}

template <template<typename...> typename Eigen_llt, typename MT, typename NT>
template <typename Eigen_lltMT, typename MT, typename NT>
inline static Eigen::Matrix<NT, Eigen::Dynamic, Eigen::Dynamic>
solve_mat(std::unique_ptr<Eigen_llt<MT>> const& llt,
solve_mat(std::unique_ptr<Eigen_lltMT> const& llt,
MT const& H, MT const& mat, NT &logdetE)
{
using DenseMT = Eigen::Matrix<NT, Eigen::Dynamic, Eigen::Dynamic>;
Expand Down Expand Up @@ -180,12 +180,12 @@ get_mat_prod_op(MT const& E)
}
}

template<typename NT, template<typename...> typename SpectraMatProd>
inline static auto get_eigs_solver(std::unique_ptr<SpectraMatProd<NT>> const& op, int const n)
template<typename NT, typename SpectraMatProdNT>
inline static auto get_eigs_solver(std::unique_ptr<SpectraMatProdNT> const& op, int const n)
{
using DenseMatProd = Spectra::DenseSymMatProd<NT>;
using SparseMatProd = Spectra::SparseSymMatProd<NT>;
if constexpr (std::is_same<SpectraMatProd<NT>, DenseMatProd>::value)
if constexpr (std::is_same<SpectraMatProdNT, DenseMatProd>::value)
{
using SymDenseEigsSolver = Spectra::SymEigsSolver
<
Expand All @@ -195,7 +195,7 @@ inline static auto get_eigs_solver(std::unique_ptr<SpectraMatProd<NT>> const& op
>;
// The value of ncv is chosen empirically
return std::make_unique<SymDenseEigsSolver>(op.get(), 2, std::min(std::max(10, n/5), n));
} else if constexpr (std::is_same<SpectraMatProd<NT>, SparseMatProd>::value)
} else if constexpr (std::is_same<SpectraMatProdNT, SparseMatProd>::value)
{
using SymSparseEigsSolver = Spectra::SymEigsSolver
<
Expand All @@ -207,7 +207,7 @@ inline static auto get_eigs_solver(std::unique_ptr<SpectraMatProd<NT>> const& op
return std::make_unique<SymSparseEigsSolver>(op.get(), 2, std::min(std::max(10, n/5), n));
} else
{
static_assert(AssertFalseType<SpectraMatProd<NT>>::value,
static_assert(AssertFalseType<SpectraMatProdNT>::value,
"Matrix-vector multiplication multiplication is not supported.");
}
}
Expand Down Expand Up @@ -313,4 +313,4 @@ update_Bmat(MT &B, VT const& AtDe, VT const& d,
}


#endif // MAT_COMPUTATIONAL_OPERATOR_H
#endif // MAT_COMPUTATIONAL_OPERATORS_H
2 changes: 1 addition & 1 deletion include/preprocess/max_inscribed_ball.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#ifndef MAX_INSCRIBED_BALL_HPP
#define MAX_INSCRIBED_BALL_HPP

#include "preprocess/mat_computational_operator.h"
#include "preprocess/mat_computational_operators.h"

/*
This implmentation computes the largest inscribed ball in a given convex polytope P.
Expand Down
2 changes: 1 addition & 1 deletion include/preprocess/max_inscribed_ellipsoid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <utility>
#include <Eigen/Eigen>
#include "preprocess/mat_computational_operator.h"
#include "preprocess/mat_computational_operators.h"


/*
Expand Down

0 comments on commit 11b4948

Please sign in to comment.