-
-
Save Bajena/a403fdc489a20fa5880a5741c4b47cf3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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