array join(const int dim, const array& first, const array& second, const array &third, const array &fourth) { af_array out = 0; af_array inputs[4] = {first.get(), second.get(), third.get(), fourth.get()}; AF_THROW(af_join_many(&out, dim, 4, inputs)); return array(out); }
void Window::vectorField(const array& xPoints, const array& yPoints, const array& xDirs, const array& yDirs, const char* const title) { af_cell temp{_r, _c, title, AF_COLORMAP_DEFAULT}; AF_THROW(af_draw_vector_field_2d(get(), xPoints.get(), yPoints.get(), xDirs.get(), yDirs.get(), &temp)); }
array approx2(const array& zi, const array &xo, const array &yo, const interpType method, const float offGrid) { af_array zo = 0; AF_THROW(af_approx2(&zo, zi.get(), xo.get(), yo.get(), method, offGrid)); return array(zo); }
array transform(const array& in, const array& transform, const dim_t odim0, const dim_t odim1, const interpType method, const bool inverse) { af_array out = 0; AF_THROW(af_transform(&out, in.get(), transform.get(), odim0, odim1, method, inverse)); return array(out); }
array approx1(const array &yi, const array &xo, const int xdim, const double xi_beg, const double xi_step, const interpType method, const float offGrid) { af_array yo = 0; AF_THROW(af_approx1_uniform(&yo, yi.get(), xo.get(), xdim, xi_beg, xi_step, method, offGrid)); return array(yo); }
void nearestNeighbour(array& idx, array& dist, const array& query, const array& train, const dim_t dist_dim, const unsigned n_dist, const af_match_type dist_type) { af_array temp_idx = 0; af_array temp_dist = 0; AF_THROW(af_nearest_neighbour(&temp_idx, &temp_dist, query.get(), train.get(), dist_dim, n_dist, dist_type)); idx = array(temp_idx); dist = array(temp_dist); }
array diag(const array &in, const int num, const bool extract) { af_array res; if (extract) { AF_THROW(af_diag_extract(&res, in.get(), num)); } else { AF_THROW(af_diag_create(&res, in.get(), num)); } return array(res); }
array approx2(const array &zi, const array &xo, const int xdim, const double xi_beg, const double xi_step, const array &yo, const int ydim, const double yi_beg, const double yi_step, const interpType method, const float offGrid) { af_array zo = 0; AF_THROW(af_approx2_uniform(&zo, zi.get(), xo.get(), xdim, xi_beg, xi_step, yo.get(), ydim, yi_beg, yi_step, method, offGrid)); return array(zo); }
array translate(const array& in, const float trans0, const float trans1, const dim_t odim0, const dim_t odim1, const interpType method) { af_array out = 0; AF_THROW( af_translate(&out, in.get(), trans0, trans1, odim0, odim1, method)); return array(out); }
void grad(array &rows, array &cols, const array &in) { af_array rows_handle = 0; af_array cols_handle = 0; AF_THROW(af_gradient(&rows_handle, &cols_handle, in.get())); rows = array(rows_handle); cols = array(cols_handle); }
features susan(const array& in, const unsigned radius, const float diff_thr, const float geom_thr, const float feature_ratio, const unsigned edge) { af_features temp; AF_THROW(af_susan(&temp, in.get(), radius, diff_thr, geom_thr, feature_ratio, edge)); return features(temp); }
void max(array &val, array &idx, const array &in, const int dim) { af_array out = 0; af_array loc = 0; AF_THROW(af_imax(&out, &loc, in.get(), getFNSD(dim, in.dims()))); val = array(out); idx = array(loc); }
array wrap(const array& in, const dim_t ox, const dim_t oy, const dim_t wx, const dim_t wy, const dim_t sx, const dim_t sy, const dim_t px, const dim_t py, const bool is_column) { af_array out = 0; AF_THROW( af_wrap(&out, in.get(), ox, oy, wx, wy, sx, sy, px, py, is_column)); return array(out); }
features harris(const array& in, const unsigned max_corners, const float min_response, const float sigma, const unsigned block_size, const float k_thr) { af_features temp; AF_THROW(af_harris(&temp, in.get(), max_corners, min_response, sigma, block_size, k_thr)); return features(temp); }
features fast(const array& in, const float thr, const unsigned arc_length, const bool non_max, const float feature_ratio, const unsigned edge) { af_features temp; AF_THROW(af_fast(&temp, in.get(), thr, arc_length, non_max, feature_ratio, edge)); return features(temp); }
array where(const array& in) { if (gforGet()) { AF_THROW_ERR("WHERE can not be used inside GFOR", AF_ERR_RUNTIME); } af_array out = 0; AF_THROW(af_where(&out, in.get())); return array(out); }
array exampleFunction(const array& a, const af_someenum_t p) { // create a temporary af_array handle af_array temp = 0; // call C-API function AF_THROW(af_example_function(&temp, a.get(), p)); // array::get() returns af_array handle for the corresponding cpp af::array return array(temp); }
void from_double(const array<double>& bl) { for(int k=0;k<depth_;++k) { for(int i=0;i<height_;++i) { for(int j=0;j<width_;++j) { T d=(T)bl.get(k,i,j); set(k,i,j,d); } } } }
void instantiate(char *DYND_UNUSED(static_data), char *DYND_UNUSED(data), kernel_builder *ckb, const ndt::type &dst_tp, const char *dst_arrmeta, intptr_t DYND_UNUSED(nsrc), const ndt::type *DYND_UNUSED(src_tp), const char *const *DYND_UNUSED(src_arrmeta), kernel_request_t kernreq, intptr_t DYND_UNUSED(nkwd), const nd::array *DYND_UNUSED(kwds), const std::map<std::string, ndt::type> &tp_vars) { ckb->emplace_back<constant_kernel>(kernreq, const_cast<char *>(m_val.cdata())); nd::array error_mode = assign_error_default; const char *child_src_metadata = m_val.get()->metadata(); assign::get()->instantiate(assign::get()->static_data(), NULL, ckb, dst_tp, dst_arrmeta, 1, &dst_tp, &child_src_metadata, kernreq | kernel_request_data_only, 1, &error_mode, tp_vars); }
array isNaN(const array &in) { af_array out = 0; AF_THROW(af_isnan(&out, in.get())); return array(out); }
array rgb2ycbcr(const array& in, const YCCStd standard) { af_array temp = 0; AF_THROW(af_rgb2ycbcr(&temp, in.get(), standard)); return array(temp); }
array::array(const array& in) : arr(0), isRef(false) { AF_THROW(af_weak_copy(&arr, in.get())); }
template<> AFAPI af_cdouble var(const array& in, const array weights) { double real, imag; AF_THROW(af_var_all_weighted(&real, &imag, in.get(), weights.get())); return std::complex<double>(real, imag); }
template<> AFAPI af_cdouble var(const array& in, bool isbiased) { double real, imag; AF_THROW(af_var_all(&real, &imag, in.get(), isbiased)); return std::complex<double>(real, imag); }
template<> AFAPI af_cfloat var(const array& in, bool isbiased) { double real, imag; AF_THROW(af_var_all(&real, &imag, in.get(), isbiased)); return std::complex<float>((float)real, (float)imag); }
array var(const array& in, const array weights, dim_type dim) { af_array temp = 0; AF_THROW(af_var_weighted(&temp, in.get(), weights.get(), getFNSD(dim, in.dims()))); return array(temp); }
array var(const array& in, bool isbiased, dim_type dim) { af_array temp = 0; AF_THROW(af_var(&temp, in.get(), isbiased, getFNSD(dim, in.dims()))); return array(temp); }
array dot(const array &lhs, const array &rhs, const matProp optLhs, const matProp optRhs) { af_array out = 0; AF_THROW(af_dot(&out, lhs.get(), rhs.get(), optLhs, optRhs)); return array(out); }
array matmulTT(const array &lhs, const array &rhs) { af_array out = 0; AF_THROW(af_matmul(&out, lhs.get(), rhs.get(), AF_MAT_TRANS, AF_MAT_TRANS)); return array(out); }
void saveImageNative(const char* filename, const array& in) { AF_THROW(af_save_image_native(filename, in.get())); }