Skip Menu |

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

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

People
Owner: chm [...] cpan.org
Requestors: ased [...] cce.cz
Cc:
AdminCc:

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



Subject: Bug in mqr QR decomposotion
Date: Mon, 04 Aug 2008 15:55:27 +0200
To: bug-PDL-LinearAlgebra [...] rt.cpan.org
From: Anton Sedlak <ased [...] cce.cz>
Hi, it looks that there is a problem with 'mqr' in PDL-LinearAlgebra - while lapack 'geqrf' equivalent is OK. Routine mqr has dimension problem: Ex: let we have two vectors [2 1 0] and [1 2 0] A= [ [2 1] [1 2] [0 0] ] --- mqr returns Q= [ [-0.89442719 -0.4472136] [ -0.4472136 0.89442719] [ -0 -0] ] R= [ [ -2.236068 -1.7888544] [ 0 1.3416408] ] But this is definitely wrong. Dim of Q must be 3x3 (rotation in 3D) and R must be [3x2] [row x col] Correct answer is (octave output and is correct): q = -0.89443 -0.44721 0.00000 -0.44721 0.89443 0.00000 -0.00000 -0.00000 1.00000 r = -2.23607 -1.78885 0.00000 1.34164 0.00000 0.00000 Bye Anton Sedlak
You want the full decomposition (see documentation of mqr): Show quoted text
perldl> $a
[ [2 1] [1 2] [0 0] ] Show quoted text
perldl> ($q,$r) = $a->mqr;
Show quoted text
perldl> $q->mcrossprod
[ [ 1 -5.5511151e-17] [-5.5511151e-17 1] ] Show quoted text
perldl> $q x $r
[ [ 2 1] [ 1 2] [ 0 0] ] Show quoted text
perldl> ($q,$r) = $a->mqr(1)
[ [-0.89442719 -0.4472136 0] [ -0.4472136 0.89442719 0] [ -0 0 1] ] [ [ -2.236068 -1.7888544] [ 0 1.3416408] [ 0 0]
Subject: Re: [rt.cpan.org #38167] Bug in mqr QR decomposotion
Date: Wed, 06 Aug 2008 01:04:15 +0200
To: bug-PDL-LinearAlgebra [...] rt.cpan.org
From: Anton Sedlak <ased [...] cce.cz>
Sorry to bother you again, previous claim was my fault. In mpascal routine I found little bug (I think). Eg: mpascal(3,2) - only for !symetric! returns [ [ 0 0 0] [ 0 2.6645353e-15 3.9968029e-15] [ 0 3.9968029e-15 7.9936058e-15] ] and should be [ [0 1 2] [1 2 3] [2 3 4] ] Wrong line is require PDL::GSLSF::GAMMA; if ($n > 1){ $mat = xvals($m); return PDL::GSLSF::GAMMA::gsl_sf_choose($mat + $mat->dummy(0),$mat); <<<<<< ERROR here and should be return (PDL::GSLSF::GAMMA::gsl_sf_choose($mat + $mat->dummy(0),$mat))[0]; I didn't check PDL::Stat::Distributions because I don't have this package. Sedlak Anton
Will be applied, thanks Le Mar 05 Aoû 2008 19:04:32, ASED a écrit : Show quoted text
> Sorry to bother you again, previous claim was my fault. > In mpascal routine I found little bug (I think). > > Eg: mpascal(3,2) - only for !symetric! returns > > [ > [ 0 0 0] > [ 0 2.6645353e-15 3.9968029e-15] > [ 0 3.9968029e-15 7.9936058e-15] > ] > and should be > [ > [0 1 2] > [1 2 3] > [2 3 4] > ] > > Wrong line is > > require PDL::GSLSF::GAMMA; > if ($n > 1){ > $mat = xvals($m); > return PDL::GSLSF::GAMMA::gsl_sf_choose($mat + $mat->dummy(0),$mat); > <<<<<< ERROR here > > and should be > return (PDL::GSLSF::GAMMA::gsl_sf_choose($mat +
$mat->dummy(0),$mat))[0]; Show quoted text
> > I didn't check PDL::Stat::Distributions because I don't have this package. > > Sedlak Anton >
Fixed in git and will be available in the next CPAN release of PDL::LinearAlgebra.