Closed Wynand closed 2 years ago
An alternative would be to remove the inv_diag
field from PDDiagMat
(and similarly inv_value
from ScalMat
). From a quick look it seems that it should not be needed if multiplications with inv_diag
are replaced with divisions by diag
. This would also avoid the issue in this PR and unwanted promotions: Eg, the fix suggested by @andreasnoack would cause integer-valued diagonal matrices to be promoted to floating point numbers which would affect eg multiplication which should not depend on the type of the inverse (IMO).
Currently for any
AbstractVector
v
wheretypeof(inv(v))
isn't a subtype oftypeof(v))
creating aPDiagMat
will failFor example, if we use a range such a
0.1:0.1:0.5
to construct aPDiagMat
we get this error:To fix this I've changed this function to create a
PDiagMat
with a Union of the twoAbstractVector
types as the types for the two vectors