Documentation for libraries distributed with Logtalk

Suggestions for new Logtalk features

Moderator: Paulo Moura

Post Reply
Parker
Posts: 33
Joined: Wed Feb 27, 2008 2:51 pm

Documentation for libraries distributed with Logtalk

Post by Parker » Fri Nov 07, 2008 10:57 am

Hi Paulo,

Could I make a suggestion? In the library documentation I find no mention of the specific algorithms used. It is often useful to know the properties of an algorithm one is about to use but if we don't know what the algorithm is it becomes harder to look into. By referencing the algorithm it will also be easier to check for and fix bugs. Furthermore, it is nice to give credit when possible.

I ran into this problem when using the pseudo-random number generator a few months ago, and again yesterday when using the standard deviation algorithm in the brand new descriptive statistics library. A quick glance here http://en.wikipedia.org/wiki/Algorithms ... g_variance shows that there may be problems with precision when calculating standard deviation or variance. However, without dissecting the code it is not clear what the library is doing; is it possible there will be precision problems?

The number of libraries being distributed with Logtalk is growing all the time and I want to thank you for making it an increasingly powerful and pleasant environment to develop in.

Cheers,
Parker

Paulo Moura
Logtalk developer
Posts: 474
Joined: Sat May 05, 2007 8:35 am
Location: Portugal
Contact:

Re: Documentation for libraries distributed with Logtalk

Post by Paulo Moura » Fri Nov 07, 2008 1:27 pm

Hi Parker!
Parker wrote: Could I make a suggestion? In the library documentation I find no mention of the specific algorithms used. It is often useful to know the properties of an algorithm one is about to use but if we don't know what the algorithm is it becomes harder to look into. By referencing the algorithm it will also be easier to check for and fix bugs. Furthermore, it is nice to give credit when possible.
That's a good idea. I toyed with something along your suggestion when developing the "statistics" library. For most calculations in this library, I had to look for and implement numerically stable algorithms. A possible solution would be to add "complexity" and "algorithm" keys to the predicate info/2 directives. Feedback appreciated.
Parker wrote: I ran into this problem when using the pseudo-random number generator a few months ago, and again yesterday when using the standard deviation algorithm in the brand new descriptive statistics library. A quick glance here http://en.wikipedia.org/wiki/Algorithms ... g_variance shows that there may be problems with precision when calculating standard deviation or variance. However, without dissecting the code it is not clear what the library is doing; is it possible there will be precision problems?
The variance predicate uses a numerically stable algorithm due to Knuth, described in the Wikipedia page you cite. The standard deviation uses an algorithm that provides better performance than the naive algorithm. As the calculation of the variance is different for samples and for populations, you can always calculate the appropriated variance and then take its square root to get the standard deviation. In any case, the "statistics" library is a work in progress that needs to be checked by someone knowledgeable in statistics (which Im not); the usual disclaimer applies. Contributions welcome.
Parker wrote: The number of libraries being distributed with Logtalk is growing all the time and I want to thank you for making it an increasingly powerful and pleasant environment to develop in.
Thanks :-) More goodies coming in the next release (I'm currently working in conditional compilation support in order to simplify writing portable code).

Cheers,

Paulo
Paulo Moura
Logtalk developer

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests