From: Teemu I. <tpi...@us...> - 2004-05-13 14:01:29
|
Update of /cvsroot/octave/octave-forge/main/gsl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12249 Modified Files: Makefile Added Files: legendre_sphPlm_array.cc Log Message: Add function legendre_sphPlm_array.oct --- NEW FILE: legendre_sphPlm_array.cc --- /* Copyright (C) 2004 Teemu Ikonen <tpi...@pc...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <octave/oct.h> #include <gsl/gsl_sf.h> #include <gsl/gsl_sf_result.h> #include <gsl/gsl_errno.h> void octave_gsl_errorhandler (const char * reason, const char * file, int line, int gsl_errno) { error("GSL error %d at %s, line %d: %s\n", gsl_errno, file, line, reason); } DEFUN_DLD(legendre_sphPlm_array, args, nargout, "\ function y = legendre_sphPlm_array (lmax, m, x)\n\n\ This function computes an array of normalized associated Legendre functions\n\ $\\sqrt{(2l+1)/(4\\pi)} \\sqrt{(l-m)!/(l+m)!} P_l^m(x)$\n\ for m >= 0, l = |m|, ..., lmax, |x| <= 1.0\n\ \n\ This function is from the GNU Scientific Library,\n\ see http://www.gnu.org/software/gsl/ for documentation.\n\ ") { int i; gsl_set_error_handler (octave_gsl_errorhandler); if(args.length() != 3) { print_usage ("legendre_sphPlm_array"); return octave_value_list(); } if(!args(0).is_real_type() || !args(1).is_real_type() || !args(2).is_real_type() || !args(0).is_scalar_type() || !args(1).is_scalar_type() || !args(2).is_scalar_type()) { error("The arguments must be real scalars."); print_usage ("legendre_sphPlm_array"); return octave_value_list(); } int lmax = static_cast<int>(args(0).scalar_value()); int m = static_cast<int>(args(1).scalar_value()); double x = args(2).scalar_value(); RowVector *y = new RowVector(gsl_sf_legendre_array_size (lmax, m)); double *yd = y->fortran_vec(); gsl_sf_legendre_sphPlm_array (lmax, m, x, yd); return octave_value_list(octave_value(*y)); } Index: Makefile =================================================================== RCS file: /cvsroot/octave/octave-forge/main/gsl/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile 4 May 2004 15:49:42 -0000 1.1 +++ Makefile 13 May 2004 14:01:18 -0000 1.2 @@ -8,7 +8,7 @@ LIBS=-lgsl # all compiled functions -PROGS=gsl_sf.oct $(SF_LINKS) +PROGS=legendre_sphPlm_array.oct gsl_sf.oct $(SF_LINKS) all: gsl_sf.cc $(PROGS) @@ -24,4 +24,4 @@ -$(RM) -f $@ $(LN_S) gsl_sf.oct $@ -clean: ; -$(RM) gsl_sf.cc *.o core octave-core *.oct *~ \ No newline at end of file +clean: ; -$(RM) gsl_sf.cc *.o core octave-core *.oct *~ |