Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix multiplication #48

Open
BlinkyStitt opened this issue Oct 16, 2018 · 3 comments
Open

Matrix multiplication #48

BlinkyStitt opened this issue Oct 16, 2018 · 3 comments

Comments

@BlinkyStitt
Copy link

Hello! I'm wanting to do some matrix multiplication with BigDecimal. Do you know of any matrix crates that are compatible?

I tried using https://docs.rs/matrix/0.21.12/matrix/, but got this error:

368 |                     sparse.set((i, j), BigDecimal::from(1.0));
    |                            ^^^ the trait `matrix::Element` is not implemented for `bigdecimal::BigDecimal`

I don't think it would be too hard to add this trait, but if someone's already done the work that would be great.

If no one has done the work, I think I need to do something like this in my code: https://doc.rust-lang.org/book/second-edition/ch19-03-advanced-traits.html#using-the-newtype-pattern-to-implement-external-traits-on-external-types

Although, I think it might be easier to modify BigDecimal and add an optional dependency on matrix kind of like how there is an optional dependency on serde.

I'm new to Rust, so any pointers are appreciated.

@BlinkyStitt
Copy link
Author

Found another problem that I think is a blocker. matrix's Element trait needs Copy, but BigInt (and BigDecimal) do not impl Copy: rust-num/num#191

@rubdos
Copy link
Contributor

rubdos commented Oct 18, 2018

Found another problem that I think is a blocker. matrix's Element trait needs Copy,

Why would it need T: Copy? That sounds like a waste of time and space.

@dengelt
Copy link

dengelt commented Mar 19, 2022

@wysenynja Have you found a workable solution yet? I'm also looking to do matrix multiplication on big integers / fractions. I was looking at the ndarray crate, but it also requires Copy, at least for matrix multiplications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants