1#ifndef LINEARALGEBRA_SRC_MOLPRO_LINALG_ITSOLV_WRAP_UTIL_H
2#define LINEARALGEBRA_SRC_MOLPRO_LINALG_ITSOLV_WRAP_UTIL_H
3#include <molpro/linalg/itsolv/wrap.h>
16template <
typename R,
typename ForwardIt>
18 auto indices = std::vector<size_t>{};
19 for (
auto it = begin; it != end; ++it) {
20 auto it_found = std::find_if(std::begin(wparams), std::end(wparams),
21 [&it](
const auto& w) {
return std::addressof(w.get()) == std::addressof(*it); });
22 if (it_found != std::end(wparams))
23 indices.emplace_back(std::distance(begin, it));
35 auto indices = std::vector<size_t>{};
36 for (
auto it = wparams_ref.cbegin(); it != wparams_ref.cend(); ++it) {
37 auto it_found = std::find_if(std::begin(wparams), std::end(wparams),
38 [&it](
const auto& w) {
return std::addressof(w.get()) == std::addressof(it->get()); });
39 if (it_found != std::end(wparams))
40 indices.emplace_back(std::distance(wparams_ref.cbegin(), it));
53template <
typename T,
typename U>
55 const auto n = params.size();
56 for (
size_t i = 0, j = 0; i < n; ++i) {
57 if (std::find(begin(indices), end(indices), i) != end(indices)) {
58 params.erase(begin(params) + j);
4-parameter interpolation of a 1-dimensional function given two points for which function values and ...
Definition: helper.h:10
auto remove_elements(std::vector< T > params, const std::vector< U > &indices)
Removes indices from a vector.
Definition: wrap_util.h:54
std::vector< std::reference_wrapper< const A > > CVecRef
Definition: wrap.h:14
std::vector< std::reference_wrapper< A > > VecRef
Definition: wrap.h:11
std::vector< size_t > find_ref(const VecRef< R > &wparams, ForwardIt begin, ForwardIt end)
Given wrapped references in wparams and a range of original parameters [begin, end),...
Definition: wrap_util.h:17