Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* N-dimensional output arrays */
- %define TYPEMAP_OUTND(oct_type, sg_type, if_type, error_string)
- %typemap(out) shogun::SGNDArray<sg_type>
- {
- sg_type* array = $1.array;
- int32_t* dims = $1.dims;
- int32_t num_dims = $1.num_dims;
- dim_vector vdims(1, num_dims);
- int32_t n = 1;
- for (int32_t i = 0; i < num_dims; i++)
- {
- n *= dims[i];
- vdims(i) = dims[i];
- printf("%d ", vdims(i));
- }
- printf("\n");
- oct_type mat = oct_type(dim_vector(vdims));
- for (int32_t i=0; i<n; i++)
- {
- mat(i) = (if_type) array[i];
- printf("%f ", mat(i));
- }
- printf("\n");
- $result=mat;
- }
- %enddef
Advertisement
Add Comment
Please, Sign In to add comment