help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] linear least squares fitting for complex data set


From: Patrick Alken
Subject: Re: [Help-gsl] linear least squares fitting for complex data set
Date: Tue, 07 Aug 2012 16:49:55 -0600
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:14.0) Gecko/20120713 Thunderbird/14.0

Yes that is possible. However you need to be very careful because lets say you have a model:

sum_{lm} A_{lm} X_{lm} = Y_{lm}

and lets say that A_{lm} is real everytime m = 0 (this is quite common in spherical harmonic expansions), then if you naively pack the matrix as real imag..., the matrix will be singular because it will have 0 for the imag part whenever m = 0.

This is why I suggest using the LAPACK complex routines, unless you have a very simple problem and you know the matrix won't be singular.

On 08/07/2012 04:42 PM, Apurv Bhartia wrote:
"In principle you could order a real matrix and coeff and rhs vectors as: real imag real imag, etc."

Sorry I'm new to GSL. In my dataset, X is real and Y, A are complex. Just to make sure, do you mean that it can be done by having X, Y and A as complex data sets, and packing them into a real vector by alternating real and imaginary values? This way, is it then possible to use gsl_multifit_linear(x, y, a, cov, chisq, ws)?

Thanks,
Apurv

On Tue, Aug 7, 2012 at 4:56 PM, Patrick Alken <address@hidden <mailto:address@hidden>> wrote:

    There aren't any native complex implementations of the multifit
    routines. In principle you could order a real matrix and coeff and
    rhs vectors as: real imag real imag, etc. But its probably easiest
    to use the complex LAPACK routines for this.


    On 08/07/2012 03:29 PM, Apurv Bhartia wrote:

        Hi,

        Is there a way to use least squares fit for complex data sets?
        All of the
        *_multifit_* variants seem to require non-complex data. If
        not, then any
        advice on how I can somehow get this done?

        Thanks,
        Apurv







reply via email to

[Prev in Thread] Current Thread [Next in Thread]