Prev: Specifying size of mxArray in CMEX file
Next: surflm
From: kk KKsingh on 19 Jul 2010 19:27 AM i compiling the files below in a wrong way ! Some body send me file which run fine on his 32 bit machine , i am running it on 64 bit machine >> mex potts_nfft.c potts_nfft.o: In function `nfft': potts_nfft.c:(.text+0xc9): undefined reference to `nfft_init_guru' potts_nfft.c:(.text+0x122): undefined reference to `nfft_precompute_one_psi' potts_nfft.c:(.text+0x170): undefined reference to `nfft_trafo' collect2: ld returned 1 exit status mex: link of ' "potts_nfft.mexa64"' failed. ??? Error using ==> mex at 221 Unable to complete successfully. >> mex potts_ndft.c potts_ndft.o: In function `ndft': potts_ndft.c:(.text+0xc9): undefined reference to `nfft_init_guru' potts_ndft.c:(.text+0x122): undefined reference to `nfft_precompute_one_psi' potts_ndft.c:(.text+0x170): undefined reference to `ndft_trafo' collect2: ld returned 1 exit status mex: link of ' "potts_ndft.mexa64"' failed. ??? Error using ==> mex at 221 Unable to complete successfully.
From: dpb on 19 Jul 2010 19:28 kk KKsingh wrote: > AM i compiling the files below in a wrong way ! .... Looks like your missing an include (.h) file or somesuch for the missing references... --
From: kk KKsingh on 19 Jul 2010 19:36 "kk KKsingh" <akikumar1983(a)gmail.com> wrote in message <i22n08$nj6$1(a)fred.mathworks.com>... > AM i compiling the files below in a wrong way ! Some body send me file which run fine on his 32 bit machine , i am running it on 64 bit machine > > > >> mex potts_nfft.c > potts_nfft.o: In function `nfft': > potts_nfft.c:(.text+0xc9): undefined reference to `nfft_init_guru' > potts_nfft.c:(.text+0x122): undefined reference to `nfft_precompute_one_psi' > potts_nfft.c:(.text+0x170): undefined reference to `nfft_trafo' > collect2: ld returned 1 exit status > > mex: link of ' "potts_nfft.mexa64"' failed. > > ??? Error using ==> mex at 221 > Unable to complete successfully. > > >> mex potts_ndft.c > potts_ndft.o: In function `ndft': > potts_ndft.c:(.text+0xc9): undefined reference to `nfft_init_guru' > potts_ndft.c:(.text+0x122): undefined reference to `nfft_precompute_one_psi' > potts_ndft.c:(.text+0x170): undefined reference to `ndft_trafo' > collect2: ld returned 1 exit status > > mex: link of ' "potts_ndft.mexa64"' failed. > > ??? Error using ==> mex at 221 > Unable to complete successfully. Some one suggest me to do changes in this file for 64 bit machine, can any one tell me what should me changes #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include <complex.h> #include "nfft3.h" #include "matrix.h" #include "mex.h" double complex *nfft(int d, int M, int N[], double *pos, double complex *in) { nfft_plan p; int l; int Mf = 1; int n[d]; for(l = 0; l < d; l++) { Mf = Mf*N[l]; n[l] = 2*N[l]; } double complex *out = malloc(sizeof(double complex)*M); /** init a two dimensional plan */ nfft_init_guru(&p, d, N, M, n, 7, PRE_PHI_HUT| PRE_FULL_PSI| MALLOC_F_HAT| MALLOC_X| MALLOC_F | FFTW_INIT| FFT_OUT_OF_PLACE, FFTW_ESTIMATE| FFTW_DESTROY_INPUT); for(l = 0;l < d*M; l++) p.x[l] = -pos[l]; if(p.nfft_flags & PRE_ONE_PSI) nfft_precompute_one_psi(&p); for( l = 0; l < Mf; l++) p.f_hat[l] = in[l]; nfft_trafo(&p); for(l = 0;l < M; l++) out[l] = p.f[l]; return out; free(out); nfft_finalize(&p); } void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { const mxArray *fi1 = prhs[0]; const mxArray *fi2 = prhs[1]; const mxArray *fd1 = prhs[2]; const mxArray *fc = prhs[3]; double *i1 = mxGetPr(fi1); double *i2 = mxGetPr(fi2); double *pos = mxGetPr(fd1); double *cr = mxGetPr(fc); int mc = mxGetM(fc); int nc = mxGetN(fc); int nmc = mc*nc, h; int d = mxGetM(fi1); int df = mxGetM(fi2); int N[d], Nf[df]; for( h = 0; h < d; h++) N[h] = (int)i1[h]; for( h = 0; h < df; h++) Nf[h] = (int)i2[h]; double complex *in = malloc(sizeof(double complex)*nmc); if(mxIsComplex(fc)) { double *ci = mxGetPi(fc); for( h = 0; h < nmc; h++) in[h] = cr[h] + I*ci[h]; } else for( h = 0; h < nmc; h++) in[h] = cr[h] + I*0; int M = 1; for( h = 0; h < d; h++) M = M*N[h]; double complex* out = nfft( df, M, Nf, pos, in); if(d==1) plhs[0] = mxCreateDoubleMatrix(1, N[0], mxCOMPLEX); else plhs[0] = mxCreateDoubleMatrix(N[1], N[0], mxCOMPLEX); double *or = mxGetPr(plhs[0]); double *oi = mxGetPi(plhs[0]); for ( h = 0; h < M; h++) { or[h] = creal(out[h]); oi[h] = cimag(out[h]); } free(in); }
From: kk KKsingh on 20 Jul 2010 02:50 "kk KKsingh" <akikumar1983(a)gmail.com> wrote in message <i22nh5$p4b$1(a)fred.mathworks.com>... > "kk KKsingh" <akikumar1983(a)gmail.com> wrote in message <i22n08$nj6$1(a)fred.mathworks.com>... > > AM i compiling the files below in a wrong way ! Some body send me file which run fine on his 32 bit machine , i am running it on 64 bit machine > > > > > > >> mex potts_nfft.c > > potts_nfft.o: In function `nfft': > > potts_nfft.c:(.text+0xc9): undefined reference to `nfft_init_guru' > > potts_nfft.c:(.text+0x122): undefined reference to `nfft_precompute_one_psi' > > potts_nfft.c:(.text+0x170): undefined reference to `nfft_trafo' > > collect2: ld returned 1 exit status > > > > mex: link of ' "potts_nfft.mexa64"' failed. > > > > ??? Error using ==> mex at 221 > > Unable to complete successfully. > > > > >> mex potts_ndft.c > > potts_ndft.o: In function `ndft': > > potts_ndft.c:(.text+0xc9): undefined reference to `nfft_init_guru' > > potts_ndft.c:(.text+0x122): undefined reference to `nfft_precompute_one_psi' > > potts_ndft.c:(.text+0x170): undefined reference to `ndft_trafo' > > collect2: ld returned 1 exit status > > > > mex: link of ' "potts_ndft.mexa64"' failed. > > > > ??? Error using ==> mex at 221 > > Unable to complete successfully. > > > > > > Some one suggest me to do changes in this file for 64 bit machine, can any one tell me what should me changes > > #include <stdio.h> > #include <stdlib.h> > #include <math.h> > #include <string.h> > #include <complex.h> > #include "nfft3.h" > #include "matrix.h" > #include "mex.h" > > > > double complex *nfft(int d, int M, int N[], double *pos, double complex *in) > { > nfft_plan p; > int l; > int Mf = 1; > int n[d]; > > for(l = 0; l < d; l++) > { > Mf = Mf*N[l]; > n[l] = 2*N[l]; > } > > double complex *out = malloc(sizeof(double complex)*M); > > /** init a two dimensional plan */ > nfft_init_guru(&p, d, N, M, n, 7, > PRE_PHI_HUT| PRE_FULL_PSI| MALLOC_F_HAT| MALLOC_X| MALLOC_F | > FFTW_INIT| FFT_OUT_OF_PLACE, > FFTW_ESTIMATE| FFTW_DESTROY_INPUT); > > for(l = 0;l < d*M; l++) > p.x[l] = -pos[l]; > > if(p.nfft_flags & PRE_ONE_PSI) > nfft_precompute_one_psi(&p); > > for( l = 0; l < Mf; l++) > p.f_hat[l] = in[l]; > > nfft_trafo(&p); > > for(l = 0;l < M; l++) > out[l] = p.f[l]; > > return out; > free(out); > > nfft_finalize(&p); > > } > > > void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) > { > > const mxArray *fi1 = prhs[0]; > const mxArray *fi2 = prhs[1]; > const mxArray *fd1 = prhs[2]; > const mxArray *fc = prhs[3]; > > double *i1 = mxGetPr(fi1); > double *i2 = mxGetPr(fi2); > double *pos = mxGetPr(fd1); > double *cr = mxGetPr(fc); > > int mc = mxGetM(fc); > int nc = mxGetN(fc); > int nmc = mc*nc, h; > > int d = mxGetM(fi1); > int df = mxGetM(fi2); > > int N[d], Nf[df]; > > for( h = 0; h < d; h++) > N[h] = (int)i1[h]; > > for( h = 0; h < df; h++) > Nf[h] = (int)i2[h]; > > double complex *in = malloc(sizeof(double complex)*nmc); > > if(mxIsComplex(fc)) > { > double *ci = mxGetPi(fc); > for( h = 0; h < nmc; h++) > in[h] = cr[h] + I*ci[h]; > } > else > for( h = 0; h < nmc; h++) > in[h] = cr[h] + I*0; > > int M = 1; > for( h = 0; h < d; h++) > M = M*N[h]; > > double complex* out = nfft( df, M, Nf, pos, in); > > if(d==1) > plhs[0] = mxCreateDoubleMatrix(1, N[0], mxCOMPLEX); > else > plhs[0] = mxCreateDoubleMatrix(N[1], N[0], mxCOMPLEX); > > double *or = mxGetPr(plhs[0]); > double *oi = mxGetPi(plhs[0]); > > for ( h = 0; h < M; h++) > { > or[h] = creal(out[h]); > oi[h] = cimag(out[h]); > } > > free(in); > } Just thought of giving update ! I was able to create potts_nfft.mexa64 But now when i use it in function it gives me error like ??? Invalid MEX-file '/disk/jelly1/agulati/Matlabdir/irt/nufft/akiexamples/potts_nfft.mexa64': libnfft3.so.0: cannot open shared object file: No such file or directory. Error in ==> test_potts_nfft_mex at 24 nfft_sine = potts_nfft( N, Nf, t, aki_spec); % nfft Is this because its linking the dynamic libray ! Do i need to add path to my LIbray _Path kk
|
Pages: 1 Prev: Specifying size of mxArray in CMEX file Next: surflm |