help-gsl
[Top][All Lists]
Advanced

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

[Help-gsl] gsl: blas.c:1411: ERROR: invalid length


From: avinash chaurasia
Subject: [Help-gsl] gsl: blas.c:1411: ERROR: invalid length
Date: Wed, 26 Jan 2011 06:18:13 +0000

hello all ,
I am getting this error
eorrr: 2 0 1 1 2 2 (printed by myself as shown in code below)
gsl: blas.c:1411: ERROR: invalid length
Default GSL error handler invoked.


I appended the code below please tell me what i can do.

 if(hdr->last_==1) {
              gsl_matrix_complex *yr = gsl_matrix_complex_alloc(2,1);


              for (int i = 0; i < dim1; i++) {
                for (int j = 0; j < dim2; j++) {
                  double d0, d1;
                  gsl_complex z;
                  d0 = A[i*dim1+j]/sqrt(2);
                  d1 = CA[i*dim1+j]/sqrt(2);
                  GSL_SET_COMPLEX(&z, d0, d1);
                  gsl_matrix_complex_set(mat1, i, j, z);
                }
              }

              gsl_matrix_complex * h_inv =
gsl_matrix_complex_alloc(dim1,dim2);
              gsl_permutation *p1 = gsl_permutation_alloc(2);
              int s1;
              gsl_linalg_complex_LU_decomp(mat1,p1,&s1);
              gsl_linalg_complex_LU_invert(mat1,p1,h_inv);
              gsl_complex alpha ,beta;
              GSL_REAL(alpha) =  1.0; GSL_IMAG(alpha) = 0.0;
              GSL_REAL(beta)  =  0.0; GSL_IMAG(beta)  = 0.0;

            //printf("size %d\n",xr->size1);


             // unsigned char* pdata = hdr->file;
             int len =  hdr->realPayload;


              for(int i=0;i<len-1;i++)
              {
                int m = 0;
                for(int j=0;j<8;j+=4)
                {
                  int d1=0,d2=0,d3=0,d4=0;
                  for(int k=0;k<dim2;k++){
                gsl_complex z;
                GSL_REAL(z)=mimoPacket[i*8+j+k*2];
                GSL_IMAG(z)=mimoPacket[i*8+j+k*2+1];

                gsl_matrix_complex_set(yr, k, 0, z);

                }
                  gsl_matrix_complex *xr = gsl_matrix_complex_alloc(2,1);
            const size_t M = xr->size1;
              const size_t N = xr->size2;
              const size_t MA =  h_inv->size1 ;
              const size_t NA = h_inv->size2 ;
              const size_t MB = yr->size1 ;
              const size_t NB =  yr->size2 ;
              if ((M == MA && N == NB && NA == MB));
             else
                printf("eorrr: %d %d %d %d %d %d\n",M ,MA , N ,NB , NA ,
MB);


gsl_blas_zgemm(CblasNoTrans,CblasNoTrans,alpha,h_inv,yr,beta,xr);
                gsl_complex z1 = gsl_matrix_complex_get(xr,0,0);
                double real,imag;
                real=GSL_REAL(z1);
                imag=GSL_IMAG(z1);

                 d1=(real>0)?1:0;
                    d2=(imag>0)?1:0;
                   z1= gsl_matrix_complex_get(xr,1,0);
                   real=GSL_REAL(z1);
                   imag=GSL_IMAG(z1);
                 gsl_matrix_complex_free(xr);

                   d3=(real>0)?1:0;
                    d4=(imag>0)?1:0;

                  m=m|(d1<<j)|(d2<<(j+1))|(d3<<(j+2))|(d4<<(j+3));
                }
                hdr->file[i]=m;
              }
              free(mimoPacket);
              gsl_matrix_complex_free(yr);
              gsl_matrix_complex_free(mat1);

              gsl_matrix_complex_free(h_inv);
              gsl_permutation_free (p1);

            }



Thanks
Avinash Kumar Chaurasia
Department of Computer Science
IIT Kanpur, India


reply via email to

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