numeric-rust / numeric

N-dimensional matrix class for Rust
MIT License
60 stars 10 forks source link

vertor_matrix dot without blas #3

Closed neutronest closed 7 years ago

neutronest commented 7 years ago

Hi.

It seems that the vector.dot(matrix) is not supported yet both in numeric library and blas library. Therefore I just add some naive code that make the dot product directly..

Example: Given a 1D tensor [1.0, 2.0] and a 2D tensor [1.0, 2.0, 3.0; 4.0, 5.0, 6.0], the dot result is 1D tensor [9.0, 12.0, 15.0]

[Dev] src/tensor/dot.rs [Tests] tests/dot.rs

gustavla commented 7 years ago

LGTM! Thanks for the contribution! You have chosen for the vector to be interpreted as a row vector here. I think this is definitely the right call and it is the behavior of numpy and matlab. I'll try to add a BLAS version too.

Do you mind adding your name to the CONTRIBUTORS.md file before I merge?

gustavla commented 7 years ago

Thanks again!

gustavla commented 7 years ago

Just added BLAS support for this by the way (507dd57cc081f3c99fa6b90c8f2a4481638d4bc6).

neutronest commented 7 years ago

Oh! Thanks! I should be read the code of BLAS library more carefully...