osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[numbers] Making Quaternion a VALJO


Hi

I had a look last night at making Quaternion a VALJO.

I've done the following

* changed the constructors to private and added equivalent of methods.
* added a parse method
* altered equals so that (like Complex) it uses Double.equals - gets round
an edge case where Quaternions with the equivalence of -0 and 0 discovered
while adding tests for hashCode
* added a divide by scalar method
* added a norm2 (square of norm) method
* added some additional unit tests so it should now have 100% coverage

I've raised a pull request, and I have also emailed an ICLA.

I think two convenience divide methods performing qr^{-1} and r^{-1}q for q
and r would be useful, but I couldn't think of nice names for them.

Steve