mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-01-10 06:28:03 -05:00
Fix tuple types (#2634)
This commit is contained in:
@@ -367,8 +367,8 @@ class ChebyshevExpansion
|
||||
}
|
||||
|
||||
/// A vectorized variant (for use with Python interface)
|
||||
template <typename T>
|
||||
auto solve_for_x_many(const T& y, double a, double b, unsigned int bits, std::size_t max_iter, double boundsytol, T& x, T& counts) const {
|
||||
template <typename T, typename CountsT>
|
||||
auto solve_for_x_many(const T& y, double a, double b, unsigned int bits, std::size_t max_iter, double boundsytol, T& x, CountsT& counts) const {
|
||||
if (x.size() != y.size()) {
|
||||
throw std::invalid_argument("x and y are not the same size");
|
||||
}
|
||||
@@ -378,9 +378,9 @@ class ChebyshevExpansion
|
||||
}
|
||||
|
||||
/// A vectorized variant in which arrays are C-style, assumed to be of the same length
|
||||
template <typename T>
|
||||
template <typename T, typename CountsT>
|
||||
auto solve_for_x_manyC(const T y[], std::size_t N, double a, double b, unsigned int bits, std::size_t max_iter, double boundsytol, T x[],
|
||||
T counts[]) const {
|
||||
CountsT counts[]) const {
|
||||
for (std::size_t i = 0; i < N; ++i) {
|
||||
std::tie(x[i], counts[i]) = solve_for_x_count(y[i], a, b, bits, max_iter, boundsytol);
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ cdef class ChebyshevExpansion:
|
||||
def solve_for_x(self, double y, double a, double b, unsigned int bits, size_t max_iter, double boundstytol):
|
||||
return self.m_exp.solve_for_x(y, a, b, bits, max_iter, boundstytol)
|
||||
|
||||
def solve_for_x_many(self, double[::1] y, double a, double b, unsigned int bits, size_t max_iter, double boundstytol, double[::1] x, double [::1] counts):
|
||||
def solve_for_x_many(self, double[::1] y, double a, double b, unsigned int bits, size_t max_iter, double boundstytol, double[::1] x, size_t [::1] counts):
|
||||
cdef size_t N = y.shape[0]
|
||||
return self.m_exp.solve_for_x_manyC(&y[0], N, a, b, bits, max_iter, boundstytol, &x[0], &counts[0])
|
||||
|
||||
@@ -176,7 +176,7 @@ cdef class ChebyshevApproximation1D:
|
||||
def get_x_for_y(self, double y, unsigned int bits, size_t max_iter, double boundstytol):
|
||||
return self.thisptr.get_x_for_y(y, bits, max_iter, boundstytol)
|
||||
|
||||
def count_x_for_y_many(self, double[::1] y, unsigned int bits, size_t max_iter, double boundstytol, double[::1] counts):
|
||||
def count_x_for_y_many(self, double[::1] y, unsigned int bits, size_t max_iter, double boundstytol, size_t[::1] counts):
|
||||
assert y.shape[0] == counts.shape[0]
|
||||
cdef size_t N = y.shape[0]
|
||||
return self.thisptr.count_x_for_y_manyC(&y[0], N, bits, max_iter, boundstytol, &counts[0])
|
||||
|
||||
Reference in New Issue
Block a user