void sphNeumannDiff (double x, double *y, int n) { double *y1; if (n<0) return; if ((y1 = (double*)calloc(n+2,sizeof(double)))==0) return; sphNeumann (x,y,n+1); radialDiffRecurrence (x,y1,y,n); free(y1); }
static void mTXSphMatrix (MTXSph *x, t_symbol *s, int argc, t_atom *argv) { int rows = atom_getint (argv++); int columns = atom_getint (argv++); int size = rows * columns; int in_size = argc-2; int n,ofs; /* size check */ if (!size) post("mtx_spherical_radial: invalid dimensions"); else if (in_size<size) post("mtx_spherical_radial: sparse matrix not yet supported: use \"mtx_check\""); else if ((rows!=1)||(columns<1)) post("mtx_spherical_radial: 1 X L matrix expected with kr and h vector, but got more rows/no entries"); else { if (x->l!=columns) { deleteMTXSphdata(x); x->l=columns; allocMTXSphdata(x); } for (n=0;n<x->l;n++) { x->kr[n]=(double) atom_getfloat(argv+n); } if (x->h_re!=0) for (n=0,ofs=0;n<x->l;n++,ofs+=x->nmax+1) sphBessel(x->kr[n], x->h_re+ofs, x->nmax); if (x->h_im!=0) for (n=0,ofs=0;n<x->l;n++,ofs+=x->nmax+1) sphNeumann(x->kr[n], x->h_im+ofs, x->nmax); if (x->h_re!=0) { SETFLOAT(x->list_h_re+1,(float)(x->nmax+1)); SETFLOAT(x->list_h_re,(float)x->l); for (n=0;n<x->l*(x->nmax+1);n++) SETFLOAT(x->list_h_re+n+2,(float)x->h_re[n]); } if (x->h_im!=0) { SETFLOAT(x->list_h_im+1,(float)(x->nmax+1)); SETFLOAT(x->list_h_im,(float)x->l); for (n=0;n<x->l*(x->nmax+1);n++) SETFLOAT(x->list_h_im+n+2,(float)x->h_im[n]); } mTXSphBang(x); } }