numeric types need "conjugate" operator #33

Closed
coke opened this Issue Mar 28, 2013 · 3 comments

Projects

None yet

4 participants

@coke
Collaborator
coke commented Mar 28, 2013

Originally entered by Dave Whipp as https://rt.perl.org/rt3/Ticket/Display.html?id=76602

I was looking at colomon's Vector.pm in github, and noticed that
Vector::length is defined as { sqrt( self dot self ) }. This is
obviously incorrect for complex numbers: it should be { sqrt( self dot
conjugate self ) } (for some syntax of "conjugate")

I can't just add the method to the Complex class, because then the
Vector code would fail ("method not found") for all non-complex
numeric types (for which conjugation is an identity operation).

@colomon
Member
colomon commented Mar 29, 2013

Seems reasonable to me. I have to admit I thought complex conjugate was already in there. I will take a stab at it after rehearsal tonight if no one beats me to it.

@dwhipp
Collaborator
dwhipp commented Mar 29, 2013

Yes, I added it to Rakudo a couple of years back ... not sure if it made it
to the spec.
rakudo/rakudo@cd1154b

On Thu, Mar 28, 2013 at 5:14 PM, colomon notifications@github.com wrote:

Seems reasonable to me. I have to admit I thought complex conjugate was
already in there. I will take a stab at it after rehearsal tonight if no
one beats me to it.


Reply to this email directly or view it on GitHubhttps://github.com/perl6/specs/issues/33#issuecomment-15622833
.

@leto
Member
leto commented Mar 29, 2013

+1

@colomon
Member
colomon commented Mar 29, 2013

Complex conjugate is already in there, as conj. It was also as conjugate in one place, I have corrected that. I'm working on updating Math:: Vector, and may add a few additional tests to roast as well.

@colomon colomon closed this Mar 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment