#19 Dependency-free implementation of PDL::Fit::Polynomial

closed
None
5
2010-07-29
2009-11-03
David Mertens
No

The package PDL::Fit::Polynomial depends on Slatec, but that's silly because Slatec has its own polynomial fitter called polyfit. This means that I can't fit my data to a line unless I use PDL::Fit::Linfit, which does linear fitting for arbitrary functions.

This is particularly frustrating since a polynomial fitter is not too hard to implement by hand. In the very least, the documentation should point the user to PDL::Fit::Linfit as a Slatec-free option.

Discussion

<< < 1 2 3 > >> (Page 2 of 3)
  • David Mertens
    David Mertens
    2010-02-21

    PDL::Fit::Householder implements a pure PDL::PP matrix inversion routine. :)

     
  • David Mertens
    David Mertens
    2010-02-21

    I'm sorry, that wasn't a very useful comment, nor entirely correct. Strictly speaking, PDL::Fit::Householder doesn't actually invert a matrix. Rather, in $A x $coefs = $y, it converts $A (a not necessarily square matrix) to an upper-triangular matrix and properly modifies $y so that you can use back-substitution on $A to solve for $coefs.

     
  • Chris Marshall
    Chris Marshall
    2010-07-25

    As far as I can tell the inv() routine in PDL::MatrixOps
    is an all PDL routine for matrix inversion. Is it sufficient
    for this processing?

     
  • Chris Marshall
    Chris Marshall
    2010-07-27

    This has been fixed in PDL git by replacing the use of
    the PDL::Slatec matinv() routine by the PDL::MatrixOps
    routine inv() for matrix inversion. This removes the
    dependency on Slatec for this routine. The ticket is
    marked Pending and will be closed in 2weeks if no
    further updates are made.

     
  • Chris Marshall
    Chris Marshall
    2010-07-27

    • assigned_to: nobody --> marshallch
    • status: open --> pending
     
  • David Mertens
    David Mertens
    2010-07-27

    This won't work because inv() only works with square matrices, but for fitting you need to diagonalize (actually upper-triangularize) rectangular matrices. Unfortunately I have a routine that does this, but I don't think it threads properly and I'm pretty sure it's inefficient. It's in my Householder module on CPAN. It needs a lot of cleaning up before it would be a candidate for inclusion in PDL. Basically, I want to make my Householder routine to return something that an LU back-substitution solver can use, and then I'll propose it for inclusion.

     
  • David Mertens
    David Mertens
    2010-07-27

    • status: pending --> open
     
  • Chris Marshall
    Chris Marshall
    2010-07-27

    Please add a test to poly.t that shows this.
    Matrix inverse is not defined for rectangular
    matrices (at least in the normal sense).

    Just because inv() doesn't work, maybe the
    lu_decomp and lu_backsub could be used
    directly. Hard to tell without a test case.

    --Chris

     
  • Chris Marshall
    Chris Marshall
    2010-07-27

    I cooked up a few more test cases in the pdl2 shell.
    No errors with using inv() instead of matinv(). A
    cursory look at the code doesn't show any way
    that the matrix being inverted would not be square.

     
  • Chris Marshall
    Chris Marshall
    2010-07-29

    Marking this closed again. If there is a problem with the new
    implementation, please open a bug tracker ticket for that.
    This implementation does resolve the feature request. Thanks.

     
<< < 1 2 3 > >> (Page 2 of 3)