Skip Menu |

This queue is for tickets about the PDL-LinearAlgebra CPAN distribution.

Report information
The Basics
Id: 66452
Status: resolved
Priority: 0/
Queue: PDL-LinearAlgebra

People
Owner: chm [...] cpan.org
Requestors: chad.a.davis [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 0.08



Subroutine sumover redefined at .../i386-linux-thread- multi/PDL/LinearAlgebra.pm line 93. PDL::LinearAlgebra.pm 0.6 defines PDL::Complex::somover (line 93), which conflicts with the sumover imported from PDL::Ufunc. However, PDL::Ufunc::sumover is always called with the fully qualified name. So, the import is not actually necessary (trivial patch attached). Without the import, PDL-LinearAlgebra-0.6 still passes all tests. PDL 2.4.7 PDL::LinearAlgebra 0.6 This is perl 5, version 12, subversion 3 (v5.12.3) built for i386-linux- thread-multi Fedora-14-i686
Subject: pdl-linearalgebra.patch
From: chad.a.davis [...] gmail.com
On Mon Mar 07 11:32:16 2011, chad.a.davis@gmail.com wrote: Show quoted text
> Subroutine sumover redefined at .../i386-linux-thread- > multi/PDL/LinearAlgebra.pm line 93. > > PDL::LinearAlgebra.pm 0.6 defines PDL::Complex::somover (line 93),
which Show quoted text
> conflicts with the sumover imported from PDL::Ufunc. However, > PDL::Ufunc::sumover is always called with the fully qualified name.
So, Show quoted text
> the import is not actually necessary (trivial patch attached). Without > the import, PDL-LinearAlgebra-0.6 still passes all tests. > > PDL 2.4.7 > PDL::LinearAlgebra 0.6 > This is perl 5, version 12, subversion 3 (v5.12.3) built for i386-
linux- Show quoted text
> thread-multi > Fedora-14-i686 >
Subject: pdl-linearalgebra.patch
--- PDL/LinearAlgebra.pm.bak 2011-03-07 17:23:17.785155000 +0100 +++ PDL/LinearAlgebra.pm 2011-03-07 17:23:22.322698000 +0100 @@ -3,7 +3,7 @@ use PDL::Core; use PDL::Basic qw/sequence/; use PDL::Primitive qw/which which_both/; -use PDL::Ufunc qw/sumover/; +use PDL::Ufunc; use PDL::NiceSlice; use PDL::Slices; use PDL::Complex;
From: chad.a.davis [...] gmail.com
Reading into this, I see that not importing sumover from PDL::Ufunc will not supress the warning, because Core also seems to import sumover. This is mentioned in the docs for PDL::PP which seem to provide a better solution.
Le Lun 07 Mar 2011 12:07:55, chad.a.davis@gmail.com a écrit : Show quoted text
> Reading into this, I see that not importing sumover from PDL::Ufunc will > not supress the warning, because Core also seems to import sumover. This > is mentioned in the docs for PDL::PP which seem to provide a better > solution.
Thanks, will look into this when time permits. Do you have in mind a solution? Cheers G. Vanuxem
Subject: Patch re. sumover() being redefined
From: chad.a.davis [...] gmail.com
I don't recall what the original idea was, but I've made a simple patch that explicitly undefines the function being redefined and creates a temporary sub name before assigning to the target symbol. Both of these were required to prevent the warnings. This has the advantage that the overriding is explicitly documented. I did this for sumover() in LinearAlgebra.pm and for sec() in Trans/trans.pd. The tests pass without warning. Would you anticipate any negative side effects from doing it this way? Chad
Subject: pdl-l-a-redefine-sumover-sec.patch
diff -urN --strip-trailing-cr -r PDL-LinearAlgebra-0.06-clean/LinearAlgebra.pm PDL-LinearAlgebra-0.06-patched/LinearAlgebra.pm --- PDL-LinearAlgebra-0.06-clean/LinearAlgebra.pm 2007-10-08 23:59:11.000000000 +0200 +++ PDL-LinearAlgebra-0.06-patched/LinearAlgebra.pm 2011-06-09 14:15:26.499885000 +0200 @@ -90,11 +90,12 @@ } -sub sumover { +sub _sumover { my $c = shift; return dims($c) > 1 ? PDL::Ufunc::sumover($c->xchg(0,1)) : $c; } - +undef &PDL::Complex::sumover; +*sumover = \&_sumover; sub norm { diff -urN --strip-trailing-cr -r PDL-LinearAlgebra-0.06-clean/Trans/trans.pd PDL-LinearAlgebra-0.06-patched/Trans/trans.pd --- PDL-LinearAlgebra-0.06-clean/Trans/trans.pd 2007-10-09 00:04:09.000000000 +0200 +++ PDL-LinearAlgebra-0.06-patched/Trans/trans.pd 2011-06-09 14:15:11.872213000 +0200 @@ -1026,8 +1026,10 @@ BEGIN { $pi = pdl(3.1415926535897932384626433832795029) } sub pi () { $pi->copy }; -*sec = \&PDL::sec; -sub PDL::sec{1/cos($_[0])} +sub _sec{1/cos($_[0])} +undef &PDL::sec; +*PDL::sec = \&_sec; +*sec = \&_sec; *csc = \&PDL::csc; sub PDL::csc($) {1/sin($_[0])}
Subject: Re: sumover warnings in PDL::LinearAlgebra
What is the status of this report with respect to the latest
PDL-LinearAlgebra-0.08 release?  Is it still a problem and
is the proposed patch still valid?

--Chris
Closing this ticket as I don't see any issues as of PDL-LinearAlgebra-0.08 and there has been no follow up by the original requester.