[Gambas-devel] Function Signature

Randall Morgan rmorgan62 at ...176...
Thu Feb 16 01:16:39 CET 2012


Thanks Benoit,

I do truly appreciate all your help!

The ToString method you added to the complex class was a wonderful addition
and so I will include it in the other classes.

I'll let Juergen look at your recommendations but I see no issues other
than my lack of current programming techniques and knowledge of Gambas
internals.

In the last few minutes I was able to write a crude test for dealing with
array of doubles passed into a method (See c_polynomial.c). However, at
this point I am simply trying to figure out how it all works.

If I understand you correctly, then I simply need to create an array within
the class and use a method to add values to that array. Then run a method
on the array values. Is this correct? If it is I was already thinking along
those lines...

Thanks again for everyone's help and support!




2012/2/15 Benoît Minisini <gambas at ...1...>

> Le 16/02/2012 00:08, Randall Morgan a écrit :
> > Thanks! I'll look at that now.
> >
>
> Yes, you have to add a ';' at the end of the class name in signatures.
>
> Anyway, I looked at the polynomial part of the GSL documentation, and I
> think you shouldn't use the library interface directly, but create one
> class for each polynomial type:
>
> Polynomial: 'gsl_poly_*' functions.
> ComplexPolynomial: 'gsl_complex_poly_*' functions.
> NewtonPolynomial: 'gsl_poly_dd_*' functions.
>
> The C structures associated with these classes would be:
>
> typedef
>   struct {
>     GB_BASE ob;
>     double *c; // coefficients
>     int len;
>     }
>   CPOLYNOMIAL;
>
> typedef
>   struct {
>     GB_BASE ob;
>     gsl_complex *c; // coefficients
>     int len;
>     }
>   CCOMPLEXPOLYNOMIAL;
>
> These two classes should act like an array (_get, _put methods, Count,
> Max property).
>
> Contrary to arrays, writing the i-th element should automatically
> expands the internal '*c' array. Then we should add an arbitrary maximum
> length to a polynomial.
>
> A ToString() methods is a good idea too.
>
> typedef
>   struct {
>     GB_BASE ob;
>     double *dd;
>     double *xa;
>     int len;
>     }
>   CNEWTONPOLYNOMIAL;
>
> This class is not exactly like an array, as a Newton polynomial is
> defined by two arrays of double. But AFAIK, you have only three methods
> to implement:
>
> gsl_poly_dd_init: create a NewtonPolynomial from an array of points.
>
> gsl_poly_dd_eval: evaluate the value of a NewtonPolynomial for a
> specific value of 'x'.
>
> gsl_poly_dd_taylor: converts a NewtonPolynomial to a Taylor expansion.
> Apparently this taylor expansion is just an array of double, and is not
> used anywhere else in the library. So no need to create a specific
> object for it.
>
> Tell me what you think about that, and if you see where to go exactly.
> If you have difficulties to write the array methods of these classes, I
> will help you.
>
> Regards,
>
> --
> Benoît Minisini
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Gambas-devel mailing list
> Gambas-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-devel
>



-- 
If you ask me if it can be done. The answer is YES, it can always be done.
The correct questions however are... What will it cost, and how long will
it take?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20120215/5efbf922/attachment.html>


More information about the Devel mailing list