Skip to content

Commit

Permalink
bump fix from htool and add clear_data to virtual lrmat generator
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreMarchand20 committed Nov 9, 2024
1 parent c250626 commit 03c57b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/htool/hmatrix/interfaces/virtual_low_rank_generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,18 @@ class VirtualLowRankGeneratorPython : public VirtualLowRankGenerator<Coefficient
return false;
}

bool is_htool_owning_data() const override { return false; }

// lcov does not see it because of trampoline I assume
virtual bool build_low_rank_approximation(const py::array_t<int, py::array::f_style> &rows, const py::array_t<int, py::array::f_style> &cols, underlying_type<CoefficientPrecision> epsilon) const = 0; // LCOV_EXCL_LINE

void set_U(py::array_t<CoefficientPrecision, py::array::f_style> U0) {
m_mats_U.push_back(U0); // no copy here
}
void set_V(py::array_t<CoefficientPrecision, py::array::f_style> V0) { m_mats_V.push_back(V0); }

void clear_data(){
m_mats_U.clear();
m_mats_V.clear();
}
};

template <typename CoefficientPrecision>
Expand Down Expand Up @@ -76,6 +79,7 @@ void declare_custom_VirtualLowRankGenerator(py::module &m, const std::string &cl
py_class.def("build_low_rank_approximation", &Class::build_low_rank_approximation);
py_class.def("set_U", &Class::set_U);
py_class.def("set_V", &Class::set_V);
py_class.def("clear_data", &Class::clear_data);
}

#endif

0 comments on commit 03c57b1

Please sign in to comment.