Posted by
Bill Shortall on
Feb 21, 2004; 2:35am
URL: http://quantlib.414.s1.nabble.com/SVD-routine-error-tp2794p2807.html
----- Original Message -----
From: "Luigi Ballabio" <
[hidden email]>
To: "wdgann2002" <
[hidden email]>
Cc: <
[hidden email]>
Sent: Wednesday, February 18, 2004 3:33 AM
Subject: Re: [Quantlib-users] SVD routine error?
> On 2004.02.18 02:16, wdgann2002 wrote:
> > I'm new to quantLib but I'm getting some bad numbers back from the
> > SVD getV() routine. The other matricies are ok but not not V. Are
> > there any know problems with that code or is the problem (more
> > likely) somewhere on my side?
>
> Rick,
> it might very well be that the problem is in the code--it was
> contributed only recently and did not have a lot of testing.
>
> Can you file this report in the bug tracker? This way it doesn't get
> lost in some mailbox in case that we're not able to tackle it right
> away (which is likely.)
>
> Thanks,
> Luigi
Hi Luigi,
, There are some more problems with SVD
In the line
T scale = QL_MAX(QL_MAX(QL_MAX(QL_MAX(
QL_FABS(s[p-1]),QL_FABS(s[p-2])),QL_FABS(e[p-2])),
QL_FABS(s[k])),QL_FABS(e[k]));
The Microsoft compiler VC6 doesn't like the macro expansion. Won't work
in release mode. I think its the recursion.
Try something like
double scale = max_funct(max_funct(max_funct(max_funct(
abs_func(s[p-1]),abs_func(s[p-2])),abs_func(e[p-2])),
abs_func(s[k])),abs_func(e[k]));
where
double max_funct(double a, double b){
if(a>b) return a;
else
return b;
}
and also
double abs_func(double x) // returns |x| {
if( x <= 0 )
return -x ;
else
return x;
}
This class is going to be a real bear.
Regards.. Bill Shortall