-
Notifications
You must be signed in to change notification settings - Fork 182
MatrixObj: add StandardBasisVector (or so) helper #6239
Description
The basic idea is that StandardBasisVector(filter, len, k, basedomain) would produce vector in the given filter of length len over ring with zero everywhere except at position k it has a 1.
For convenience, StandardBasisVector(len, k, basedomain) could be short for StandardBasisVector(DefaultVectorRepForBaseDomain(basedomain), len, k, basedomain) (whether it would be implemented like that is another question)
There is lots of code which uses IdentityMat(len, ring) to get such vectors. Such a use case could be replaced by List([1..len], k-> StandardBasisVector(len, k, ring))
Implementation would be simple enough:
v:=ZeroVector(filter, len, basedomain);
v[k]:=One(basedomain);This might be the strongest argument against it: it is so easy to do that... But I think the added convenience is real; I've encountered lots of code where it would have been nice to have StandardBasisVector.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status