Skip Menu |

This queue is for tickets about the Math-Matrix CPAN distribution.

Report information
The Basics
Id: 88821
Status: resolved
Worked: 40 min
Priority: 0/
Queue: Math-Matrix

People
Owner: ULPFR [...] cpan.org
Requestors: djerius [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.7
Fixed in: (no value)



Subject: support for overload of unary minus
Hi, Math::Matrix overloads '-' using the subtract function, which doesn't handle being called when the unary minus operation is invoked, as in $m1 = -$m2; The attached patch supplies that behavior. Thanks, Diab
Subject: Math-Matrix-0.7.patch
diff -r Math-Matrix-0.7.orig/Matrix.pm Math-Matrix-0.7/Matrix.pm 155c155 < =head2 substract --- > =head2 subtract 571c571,581 < $self->add($other->negative); --- > > # if $swap is present, $other operand isn't a Math::Matrix. in > # general that's undefined, but, if called as > # subtract($self,0,1) > # we've been called as unary minus, which is defined. > if ( @_ && $_[0] && ! ref $other && $other == 0 ) { > $self->negative; > } > else { > $self->add($other->negative); > }
Added in 0.8