scheme - Matrix Operations? -
as scheme beginner, having tough time figuring out how work matrices.
i unsure on how following:
a) given matrix, return dimensions of said matrix
ex:// '(2 3 4) (1 0 6)
should return (2.3) 2 rows, 3 columns
b) reverse order of rows in given matrix
ex:// given '((1 2) (3 5) (9 0))
the reverse should '((9 0)(3 5)(1 2))
c) same part b reverse order of columns instead
d) reverse order of columns , rows
thanks in advance! mean lot if give @ all!
standard r6rs scheme doesn't provide matrices, though implementations may provide them. usual trick when implementing them use vector of vectors, rather list of lists showed above, because don't want access elements of matrix in order, , vectors provide constant-time access each of elements whereas lists provide linear-time access each of elements.
i have small library of matrix operations @ my blog; can find uses of library search function on blog.
Comments
Post a Comment