From 281b7de7c3a376dec1966dccf34a844a0ed614f2 Mon Sep 17 00:00:00 2001 From: Randall Morgan Date: Fri, 17 Feb 2012 07:30:59 +0000 Subject: [PATCH] [GB.GSL] * NEW: Added ComplexPolynomial and NewtonPolynomial class files. git-svn-id: svn://localhost/gambas/trunk@4485 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- gb.gsl/src/c_complexpolynomial.c | 51 ++++++++++++++++++++++++++++++ gb.gsl/src/c_complexpolynomial.h | 48 +++++++++++++++++++++++++++++ gb.gsl/src/c_newtonpolynomial.c | 53 ++++++++++++++++++++++++++++++++ gb.gsl/src/c_newtonpolynomial.h | 48 +++++++++++++++++++++++++++++ 4 files changed, 200 insertions(+) create mode 100644 gb.gsl/src/c_complexpolynomial.c create mode 100644 gb.gsl/src/c_complexpolynomial.h create mode 100644 gb.gsl/src/c_newtonpolynomial.c create mode 100644 gb.gsl/src/c_newtonpolynomial.h diff --git a/gb.gsl/src/c_complexpolynomial.c b/gb.gsl/src/c_complexpolynomial.c new file mode 100644 index 000000000..ab5639089 --- /dev/null +++ b/gb.gsl/src/c_complexpolynomial.c @@ -0,0 +1,51 @@ +/*************************************************************************** + c_complexpolynomial.c + + gb.gsl component + + (c) 2012 Randall Morgan + + 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 1, 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., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. + +***************************************************************************/ +/*========================================================================= + === NOTE THIS IS SIMPLE LEARNING CODE === + AND NOTHING USEFUL EXISTS HERE YET +==========================================================================*/ + +#define __C_GSL_COMPLEXPOLYNOMIAL_C + +#include "c_complexpolynomial.h" + + +#define THIS ((CCOMPLEXPOLYNOMIAL *)_object) + +static CCOMPLEXPOLYNOMIAL *create_plynomial() +{ + return (CCOMPLEXPOLYNOMIAL *)GB.New(GB.FindClass("ComplexPolynomial"), NULL, NULL); +} + + + +GB_DESC CComplexPolynomialDesc[] = +{ + GB_DECLARE("ComplexPoly", sizeof(CCOMPLEXPOLYNOMIAL)), + + GB_END_DECLARE +}; + + + diff --git a/gb.gsl/src/c_complexpolynomial.h b/gb.gsl/src/c_complexpolynomial.h new file mode 100644 index 000000000..7cda66ffb --- /dev/null +++ b/gb.gsl/src/c_complexpolynomial.h @@ -0,0 +1,48 @@ +/*************************************************************************** + + c_complexpolynomial.h + + gb.gsl component + + (c) 2012 Randall Morgan + + 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 1, 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., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. + +***************************************************************************/ + +#ifndef __C_GSL_COMPLEXPOLYNOMIAL_H +#define __C_GSL_COMPLEXPOLYNOMIAL_H + +#include "gambas.h" +#include +#include "c_complex.h" + +GB_INTERFACE GB EXPORT; + +extern GB_DESC CComplexPolynomialDesc[]; + + + +typedef + struct { + GB_BASE ob; + gsl_complex *c; // coefficients + int len; + } + CCOMPLEXPOLYNOMIAL; + + +#endif /* __C_GSL_POLYNOMIAL_H */ diff --git a/gb.gsl/src/c_newtonpolynomial.c b/gb.gsl/src/c_newtonpolynomial.c new file mode 100644 index 000000000..5c48d0f7e --- /dev/null +++ b/gb.gsl/src/c_newtonpolynomial.c @@ -0,0 +1,53 @@ +/*************************************************************************** + + c_newtonpolynomial.c + + gb.gsl component + + (c) 2012 Randall Morgan + + 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 1, 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., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. + +***************************************************************************/ +/*========================================================================= + === NOTE THIS IS SIMPLE LEARNING CODE === + AND NOTHING USEFUL EXISTS HERE YET +==========================================================================*/ + +#define __C_GSL_NEWTONPOLYNOMIAL_C + +#include "c_newtonpolynomial.h" + + +#define THIS ((CNEWTONPOLYNOMIAL *)_object) + +static CNEWTONPOLYNOMIAL *create_newtonplynomial() +{ + return (CNEWTONPOLYNOMIAL *)GB.New(GB.FindClass("NetonPolynomial"), NULL, NULL); +} + + + +/************************************************** + Describe Class properties and methods to Gambas +**************************************************/ +GB_DESC CNetwonPolynomial[] = +{ + GB_DECLARE("NewtonPolynomial", sizeof(CNEWTONPOLYNOMIAL)), + + GB_END_DECLARE +}; + diff --git a/gb.gsl/src/c_newtonpolynomial.h b/gb.gsl/src/c_newtonpolynomial.h new file mode 100644 index 000000000..cfc4055f2 --- /dev/null +++ b/gb.gsl/src/c_newtonpolynomial.h @@ -0,0 +1,48 @@ +/*************************************************************************** + + c_newtonpolynomial.h + + gb.gsl component + + (c) 2012 Randall Morgan + + 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 1, 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., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. + +***************************************************************************/ + +#ifndef __C_GSL_NEWTONPOLYNOMIAL_H +#define __C_GSL_NEWTONPOLYNOMIAL_H + +#include "gambas.h" +#include +#include + + +GB_INTERFACE GB EXPORT; + +extern GB_DESC CNewtonPolynomialDesc[]; + +typedef + struct { + GB_BASE ob; + double *dd; + double *xa; + int len; + } + CNEWTONPOLYNOMIAL; + + +#endif /* __C_GSL_NEWTONPOLYNOMIAL_H */