| 129 | |
| 130 | template <typename decision_function> |
| 131 | py::array_t<double> normalized_predict_np_vec ( |
| 132 | const normalized_function<decision_function>& df, |
| 133 | const numpy_image<double>& samps_ |
| 134 | ) |
| 135 | { |
| 136 | auto samps = make_image_view(samps_); |
| 137 | |
| 138 | if (df.function.basis_vectors(0).size() != samps.nc()) |
| 139 | { |
| 140 | std::ostringstream sout; |
| 141 | sout << "Input vector should have " << df.function.basis_vectors(0).size() |
| 142 | << " dimensions, not " << samps.nc() << "."; |
| 143 | PyErr_SetString( PyExc_ValueError, sout.str().c_str() ); |
| 144 | throw py::error_already_set(); |
| 145 | } |
| 146 | |
| 147 | py::array_t<double, py::array::c_style> out((size_t)samps.nr()); |
| 148 | matrix<double,0,1> temp(samps.nc()); |
| 149 | auto data = out.mutable_data(); |
| 150 | for (long r = 0; r < samps.nr(); ++r) |
| 151 | { |
| 152 | for (long c = 0; c < samps.nc(); ++c) |
| 153 | temp(c) = samps[r][c]; |
| 154 | *data++ = df(temp); |
| 155 | } |
| 156 | return out; |
| 157 | } |
| 158 | |
| 159 | template <typename decision_function> |
| 160 | double normalized_predict_np ( |
nothing calls this directly
no test coverage detected