clojure - Transform Incanter matrix to nested vector -
consider function outputs incanter matrix.
here example matrix containing output function:
a 6x4 matrix -4.77e-01 8.45e-01 1.39e-01 -9.83e-18 8.55e-01 2.49e-01 1.33e-01 2.57e-17 -2.94e-03 6.60e-03 -9.63e-01 1.16e-16 ... 6.64e-09 2.55e-08 1.16e-07 -1.11e-16 -1.44e-01 -3.33e-01 1.32e-01 -7.07e-01 -1.44e-01 -3.33e-01 1.32e-01 7.07e-01
i'd continue analyzing rows of matrix, represent points. function want feed incanter matrix takes nested vectors inputs.
so function need above data in form
[[-4.77e-01 8.45e-01 1.39e-01 -9.83e-18] [8.55e-01 2.49e-01 1.33e-01 2.57e-17] [-2.94e-03 6.60e-03 -9.63e-01 1.16e-16] [6.64e-09 2.55e-08 1.16e-07 -1.11e-16] [-1.44e-01 -3.33e-01 1.32e-01 -7.07e-01] [-1.44e-01 -3.33e-01 1.32e-01 7.07e-01]]
it transformation incanter matrix representation nested vector structure unsure how perform. there simple way convert data's representation?
you can build-in to-vect
function:
(to-vect m)
(to-list m)
both functions produce vector-of-vectors when given matrix:
=> (def m (matrix [[1 2] [3 4]])) 2x2 matrix ------------- 1.00e+00 2.00e+00 3.00e+00 4.00e+00 => (to-vect m) [[1.0 2.0] [3.0 4.0]] => (to-list m) [[1.0 2.0] [3.0 4.0]]
Comments
Post a Comment