CC: | jonathan [...] leto.net |
Subject: | Better vector support: function for generating unit vector as well as creating column vectors. |
Hello!
The module Math::GSL::Vector contains a nice method, "normalize" which
returns the unit vector for a specific vector. Could we have the same
functionality to Math::MatrixReal, that is, given a (column) vector,
return a matrix of the same dimensions (that is, an equally large column
vector) with the unit vector for that vector? I know that we cannot
call that function/method "normalize", because that name is already
taken for another, quite different operation.
One of the names "unitvector" or "unit" can be a nice choice.
If you don't have time to create that functionality, would you accept a
patch that implement it? Just curious. And if so, what name would you
prefer for that added function/method?
Also, to turn Math::MatrixReal into a "Math::VectorReal in disguise",
would it be possible to create some sort of convenience method for make
it easier to create matrix object denoting column vector? This is not
critical, but it would be nice, as the syntax
Math::MatrixReal->new([[$x],[$y],[$z]]) of course is useful and readable
but still a bit cumbersome and inelegant. Something along the lines
Math::MatrixReal->new_column_vector($x,$y,$z) would be easy to both code
and read.
Best regards
/IllvilJa