Matrix multiplication does not work over all generics, with misleading compiler error
- Dominant language
- Rust
- Stars
- 4.8k
- Forks
- 565
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
It seems matrix multiplcation only works over standard types, e.g. u32, u64...
The following code compiles:
```
let m1 = Matrix2x4::::zeros();
let m2 = Matrix4x2::::zeros();
let should_be_zeros = m1 * m2;
```
But replacing u32 with Fr gives the compilation error:
```
let m1 = Matrix2x4::::zeros();
let m2 = Matrix4x2::::zeros();
let should_be_zeros = m1 * m2;
```
This gives the compile error `mismatched types expected struct 'Fr' found struct 'Matrix, nalgebra::Const<2>, ArrayStorage>'`
For reproducibility and context, `Fr` is a struct defined as
```
use ff::Field;
#[macro_use]
extern crate ff;
use crate::ff::PrimeField;
#[derive(PrimeField)]
#[PrimeFieldModulus = "21888242871839275222246405745257275088548364400416034343698204186575808495617"]
#[PrimeFieldGenerator = "7"]
#[PrimeFieldReprEndianness = "big"]
pub struct Fr([u64; 4]);
```
using `nalgebra` version 0.32.3 and `ff` version 0.13.
I am guessing there could be some important trait `Fr` doesn't implement. However, It is hard to discern what the cause of the error is ebcuase the error message implies mul() only works when RHS is a scalar.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.