[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gsl] multiwlinear.c:73: ERROR: size of workspace does not match siz
From: |
Vlad Koli |
Subject: |
[Bug-gsl] multiwlinear.c:73: ERROR: size of workspace does not match size of observation matrix |
Date: |
Sat, 10 Feb 2018 09:26:17 +0200 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
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:---------
- [Bug-gsl] multiwlinear.c:73: ERROR: size of workspace does not match size of observation matrix,
Vlad Koli <=