You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Same happens: .mpow(1) (not that is useful), .mpow(2) and all perfect powers (powers of 2), so mpow(8) fails as well. It does not happen with .mpow(3).
Possible solutions (but I could be irrational):
This line should use >= instead, and all previous problems are fixed.
It seems that this line makes it inefficient: an extra product is calculated even when it's not used. Given that mmul is expensive, I'd simply test that e/2 >= 1 again, before running the product.
for(lete=scalar;e>=1;e/=2){// >=1 ensures running for 'evens'if((e&1)!==0){result=result.mmul(bb);}if(e/2>=1){// since it wont run otherwisebb=bb.mmul(bb);}}
So if a user uses 7, it runs A, AA, 3.5, then A^3,(AA)^2, 1.75, A^7, (AA)^4 And it skips running (AA)^4 which is not needed since A^3 * A^4 is the result.
I'm not doing a PR since my knowledge of this method is limited and there may be other edge cases, but that plus robust tests may help.
Comment
I think the library may benefit from these missing methods:
Back substitution (it's partially implemented within some decompositions, but I'm unsure whether it's complete),
Forward Substitution (same here)
Symmetric multiplication (which would speed up some of your dependent libraries.)
The reason for 1 and 2 is that it would allows you to invert any triangular matrix, the reason for 3 is computing the normal matrix (which can be done in half the time.)
I'd also use _ (underscore) for methods that mutate the input matrix, since it's hard to remember it otherwise, but that may be a hard choice.
The text was updated successfully, but these errors were encountered:
I've read the interesting code for mpow but there could be a few bugs.
In this case, the identity is returned:
Same happens:
.mpow(1)
(not that is useful),.mpow(2)
and all perfect powers (powers of 2), sompow(8)
fails as well. It does not happen with.mpow(3)
.Possible solutions (but I could be irrational):
>=
instead, and all previous problems are fixed.e/2 >= 1
again, before running the product.So something like from this:
To this:
So if a user uses 7, it runs
A, AA, 3.5
, thenA^3,(AA)^2, 1.75
,A^7, (AA)^4
And it skips running(AA)^4
which is not needed sinceA^3 * A^4
is the result.I'm not doing a PR since my knowledge of this method is limited and there may be other edge cases, but that plus robust tests may help.
Comment
I think the library may benefit from these missing methods:
The reason for 1 and 2 is that it would allows you to invert any triangular matrix, the reason for 3 is computing the normal matrix (which can be done in half the time.)
I'd also use
_
(underscore) for methods that mutate the input matrix, since it's hard to remember it otherwise, but that may be a hard choice.The text was updated successfully, but these errors were encountered: