bug-gsl
[Top][All Lists]
Advanced

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

Re: [Bug-gsl] multiwlinear.c:73: ERROR: size of workspace does not match


From: Patrick Alken
Subject: Re: [Bug-gsl] multiwlinear.c:73: ERROR: size of workspace does not match size of observation matrix
Date: Sat, 10 Feb 2018 10:52:45 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

So as it turns out, the gsl_multifit_wlinear_svd function should be
deprecated, and I removed it from the documentation, but kept it around
for legacy reasons - without testing it properly!

The new function is called gsl_multifit_wlinear_tsvd, and you can use
this call in your code:

gsl_multifit_wlinear_tsvd(A, w, y, tol, x, cov, &chisq, &rank, wsp);

This should make your program run correctly. In the meantime I will
figure out what to do with gsl_multifit_wlinear_svd - maybe just make it
a wrapper function for the new tsvd call.

Sorry for the trouble,
Patrick

On 02/10/2018 10:28 AM, Patrick Alken wrote:
> Thanks for reporting this, it is indeed a bug. My apologies, I had
> rewritten the linear least squares routines recently and didn't make
> proper tests for the wlinear_svd routine. I will work on a fix asap. In
> the meantime, you can replace the gsl_multifit_wlinear_svd call with:
>
> gsl_multifit_wlinear(A, w, y, x, cov, &chisq, wsp);
>
> which should work as a temporary fix.
>
> On 02/10/2018 12:26 AM, Vlad Koli wrote:
>> Hi,
>>
>> In Debian 9  (gsl 2.3) compilation/execution of the following test-file 
>> causes 
>> error messages. In Debian 7 (gsl ???)  it worked fine. The same error message
>> also appears in other my programs that worked well in Debian 7 and 
>> were recompiled in Debian 9.
>>
>> ** compilation:
>>
>>  cc -o a -lm -lgsl -lgslcblas linfit-pseudoinv.c 
>>
>> **  execution: 
>>
>>  ./a
>>
>> ** result:
>>
>>> gsl: multiwlinear.c:73: ERROR: size of workspace does not match size of 
>>> observation matrix
>>> Default GSL error handler invoked.
>>> Aborted
>> Thank you in advance.
>>
>> Vladimir
>>
>> ----- begin file: linfit-pseudoinv.c:---------
>> // compile:
>> //     cc -o a -lm -lgsl -lgslcblas linfit-pseudoinv.c 
>> #include <stdio.h>
>> #include <gsl/gsl_multifit.h>
>>
>>
>> double tol = 1.e-08; // tolerance
>>
>> main()
>> {
>>      
>>     int n = 3; // observations
>>     int m = 2; // parameters 
>>
>>     size_t rank;   // rank
>>     double chisq;  // sum of squares of residuals
>>
>>     // allocate:
>>     gsl_vector *x = gsl_vector_alloc(m); // solution 
>>     gsl_vector *y = gsl_vector_alloc(n); // data 
>>     gsl_vector *w = gsl_vector_alloc(n); // weights
>>
>>     gsl_matrix *A = gsl_matrix_alloc(n, m);
>>     gsl_matrix *cov = gsl_matrix_alloc(m, m); // covariances
>>
>>     gsl_multifit_linear_workspace* wsp = gsl_multifit_linear_alloc (n, m);
>>
>>
>>     // set matrix
>>     gsl_matrix_set(A, 0,0, 1.);
>>     gsl_matrix_set(A, 0,1, 1.);
>>     gsl_matrix_set(A, 1,0, 2.);
>>     gsl_matrix_set(A, 1,1, 2.);
>>     gsl_matrix_set(A, 2,0, 3.);
>>     gsl_matrix_set(A, 2,1, 3.);
>>
>>     // set data 
>>     gsl_vector_set(y, 0, 1.);
>>     gsl_vector_set(y, 1, 2.);
>>     gsl_vector_set(y, 2, 3.1);
>>
>>     // set weights
>>     gsl_vector_set_all(w,1.);
>>     gsl_vector_set(w, 0, 0.);
>>     gsl_vector_set(w, 2, 100.);
>>
>>
>>     gsl_multifit_wlinear_svd (A, w, y,  tol, &rank, x, cov, &chisq, wsp);
>>  
>>
>>     printf("solution: x=%.4f  y=%.4f   (rank=%d, chi2=%.3f)\n", 
>>             gsl_vector_get(x,0), gsl_vector_get(x,1), rank, chisq);
>>
>>
>> }
>> ----- end file: linfit-pseudoinv.c:---------
>>
>>
>>
>




reply via email to

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