Skip to content

Instantly share code, notes, and snippets.

@Bajena

Bajena/block5.c Secret

Created April 23, 2020 20:18
Show Gist options
  • Save Bajena/a403fdc489a20fa5880a5741c4b47cf3 to your computer and use it in GitHub Desktop.
Save Bajena/a403fdc489a20fa5880a5741c4b47cf3 to your computer and use it in GitHub Desktop.
VALUE matrix_to_rb_array(Matrix *matrix) {
VALUE result = rb_ary_new();
int row;
int column;
for (row = 0; row < matrix->rows; row++) {
VALUE rb_row = rb_ary_new();
rb_ary_push(result, rb_row);
for (column = 0; column < matrix->columns; column++) {
rb_ary_push(rb_row, DBL2NUM((matrix->numbers)[column][row]));
}
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment