[R] error in Fields TPS function {svd ...}

Martin Maechler maechler at stat.math.ethz.ch
Wed Oct 30 08:54:33 CET 2002


>>>>> "Jason" == Jason Bond <jbond at arg.org>
>>>>>     on Tue, 29 Oct 2002 14:17:28 -0800 writes:

    Jason> Hello, I was wondering whether anyone out there knows of the solution to a 
    Jason> problem that I'm having with the Fields package.  I am getting the error 
    Jason> message when I try and run the fields function tps (thin plate 
    Jason> splines).  Namely, for two different sets of variables, I get:

(if you had provided one of the sets of variables we would have
 a chance to reproduce your problem)

    >> bout <- Tps( bvolcap, bdsm)
    Jason> Error in svd(tempM) : error  159  in dsvdc
    >> wout <- Tps( wvolcap, wdsm)
    Jason> Error in svd(tempM) : error  546  in dsvdc

[Ok, I'm starting a general `sermon' ;-)]

1) After error messages like these, always first try
   traceback()
   ~~~~~~~~~~~  which shows you the function calls nesting
   leading to the error.

2) The above message indicates it comes from svd().
   This should lead you immediately to carefully look at the
   output of
     ?svd   [aka  help(svd) ]

   In this case, this will only help to suggest (to the author
   of Fields!) that maybe  La.svd() should be tried instead of svd().
   svd() is based on LINPACK which was state-of-the-art (in
   numerical linear algebra) in the 70's and (early) 80's. 
   It's successor, LAPACK, is +/- current state-of-the-art and
   that's why  help(svd) suggests using La.svd() for all new projects.

3) For non-standard packages (not "Base" or "Recommended") I'd
   suggest you always first ask the package maintainer, i.e.
   the one in the line "Maintainer : ..........."
   you get from 
	   library(help = Fields)
		   ^^^^^^^
-----------

Back to the concrete problem:
svd's source has

    z <- .Fortran("dsvdc", as.double(x), n, n, p, d = double(mm), 
        double(p), u = u, n, v = v, p, double(n), as.integer(job), 
        info = integer(1), DUP = FALSE, PACKAGE = "base")[c("d", 
        "u", "v", "info")]
    if (z$info) 
        stop(paste("error ", z$info, " in dsvdc"))

which is where the error message is produced.
As R is GNU software and hence Open Source, we can `quickly'(:-)
jump to the Fortran source  <SOURCEDIR>/src/appl/dsvdc.f
and dig there. In the initial comments we find

c     on return
c
	<..........>

c         info      integer.
c                   the singular values (and their corresponding
c                   singular vectors) s(info+1),s(info+2),...,s(m)
c                   are correct (here m=min(n,p)).  thus if
c                   info.eq.0, all the singular values and their
c                   vectors are correct.  in any event, the matrix
c                   b = trans(u)*x*v is the bidiagonal matrix
c                   with the elements of s on its diagonal and the
c                   elements of e on its super-diagonal (trans(u)
c                   is the transpose of u).  thus the singular
c                   values of x and b are the same.

so you now only know that quite a few singular values could
*not* be computed for your matrix / data.

    Jason> Any help would be greatly appreciated.
    Jason> Jason
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list