ext/sparse.c
VALUE nm_sparse_get_shape(VALUE self){
  sparse_nmatrix* input;

  Data_Get_Struct(self, sparse_nmatrix, input);

  VALUE* array = ALLOC_N(VALUE, input->ndims);
  for (size_t index = 0; index < input->ndims; index++){
    array[index] = LONG2NUM(input->shape[index]);
  }

  return rb_ary_new4(input->ndims, array);
}
//return shape of given sparse matrix
return shape of given sparse matrix
return shape of given sparse matrix
VALUE nm_sparse_get_shape(VALUE self){
  sparse_nmatrix* input;
  Data_Get_Struct(self, sparse_nmatrix, input);
  VALUE* array = ALLOC_N(VALUE, input->ndims);
  for (size_t index = 0; index < input->ndims; index++){
    array[index] = LONG2NUM(input->shape[index]);
  }
  return rb_ary_new4(input->ndims, array);
}
VALUE nm_sparse_get_shape ( VALUE self ) { sparse_nmatrix * input ; Data_Get_Struct ( self , sparse_nmatrix , input ) ; VALUE * array = ALLOC_N ( VALUE , input -> ndims ) ; for ( size_t index = 0 ; index < input -> ndims ; index ++ ) { array [ index ] = LONG2NUM ( input -> shape [ index ] ) ; } return rb_ary_new4 ( input -> ndims , array ) ; }
return shape of given sparse matrix
return shape of given sparse matrix