Open amaury1093 opened 4 years ago
Hi!
Yeah, the documentation of simba may not be completely accurate here. Not all simba traits are implemented by all primitive types. Traits like SimdValue
is implemented by all types, but Complex
is only implemented for f32
, f64
, and Complex<N>
because such an implementation would make no sense for other types.
So, yeah, to use lu
you will need your boolean to implement ComplexField
. Perhaps an alternative would be to relax the ComplexField
bound required by LU decomposition. Perhaps Field
is enough?
Hey,
I have a similar issue, where I need to invert matrices over a Galois Field. This is also not a ComplexField
but implements everything a Field
requires.
As far as I see, for a lot of the things that require a ComplexField
really only need a Field
.
I tried using an extension Trait to get things working, but it seems like a rabbit hole and I don't want to copy all of the nalgebra code over.
This also relates to a quite old issue #303.
Can I use nalgebra with with elements from Z/2Z (0 and 1)?
More specifically, I'm trying to solve linear equations in Z/2Z, e.g.
There are solutions in Z/2Z (for example:
[1 1 0 0 1]t
), and apparently no solutions in R (see this playground)Trying with
bool
I read on simba docs that
But when I try to create a
Matrix<bool>
, I get the trait bound not satisfied:Which makes sense, even
Add
andMul
are not implemented onbool
.Trying with my own type
Bool
So then I tried creating my own wrapper:
Would I need to
impl ComplexField for Bool
? I'm asking here first, would like to know if that's the way to go, if it's at all possible, or if there are any other shortcuts?