clifford
clifford copied to clipboard
Come up with a better way to get the scalar
As discussed in https://github.com/pygae/clifford/pull/371#r549158697.
We find ourself using 1 + 0*x
a lot of the time to obtain the scalar element.
Right, now, there is no great alternative to this spelling. The obvious choice of x.layout.scalar
results in a multivector of int
type, which is fine for most code, but is awkward for jitted code where really we want a scalar with the same coefficient type as x
.
Maybe x.unit_scalar
or something similar might be a good spelling
cf.one_like(x)
or cf.scalar_like(x)
is another option, sort of like np.zeros_like
.