Page 4 of 4
Re: Module for working with Vectors
Posted: 09 Dec 2012 21:14
by m127
yeah, totally right on all counts.
bottom line though, how would a new user ever grasp all that from the manual?
Quote from manual:
Comparison
== equal to
ie, not questioning whether the function outcome is correct or not. If == really means "equal to dinosaurs", fine; any outcome will be equal to dinosaurs, and it would be correct because such is the
native design of the function.
I had to do a lot of troubleshooting to actually see what was
really being compared.
Re: Module for working with Vectors
Posted: 09 Dec 2012 21:33
by brianc
m127 wrote:bottom line though, how would a new user ever grasp all that from the manual?
Yeah, who knows
I guess since I'm just used to using vectors for sets of things and for ordered sequences of data, I think whenever I think about these things it's in a specific context, but new users don't have that same context.
I don't have any say in the Lemur documentation, but if you end up using SLVector and have any feedback for the README, I'd be happy to have it.
Re: Module for working with Vectors
Posted: 10 Dec 2012 00:17
by m127
edit: nah, too heavy, disregard
Re: Module for working with Vectors
Posted: 10 Dec 2012 00:25
by Phil999
oh come on.
I also don't get it with this array arithmetic, but one day it might be valuable for me and I will be glad that other users have already done some work on this topic.
Patience my friend, patience.
Re: Module for working with Vectors
Posted: 10 Dec 2012 02:04
by Macciza
Hi
I think 'context' is important and you should try thinking more Lemur rather than try making Lemur think elsewise . . .
Arrays don't truncate to shortest when operated upon - because of the context in which they are used, a row of switches, lights etc
The best debugging method is simply to put parts of your equation into a Monitor.value
then you see vec1==vec2 returns an array {vec1-vec2} not simply a binary 0-1, T/F . . .
Comparisons can be done in many ways, without iterating as well, avoiding the loops
if x-y=0 then x=y
(firstof(vec1-vec2)==sizeof(vec1))&&(sizeof(vec1)==sizeof(vec2)) -
I find that you use too many loops in your functions for my liking . . .
Another option is conversion
arraytostring(vec1) == arraytostring(vec2) works a charm . . .
Cheers
MM
Re: Module for working with Vectors
Posted: 11 Dec 2012 00:01
by brianc
New version uploaded. Changes include less loops, new functions for creating vectors (linspace, arange, zeros, ones), new functions for sampling from vectors (random_choice, random_sample), and more. Much thanks to Macciza and Antonio Blanca for feedback!
Re: Module for working with Vectors
Posted: 11 Dec 2012 00:31
by m127
Macciza wrote:Hi
I think 'context' is important and you should try thinking more Lemur rather than try making Lemur think elsewise . . .
Arrays don't truncate to shortest when operated upon - because of the context in which they are used, a row of switches, lights etc
The best debugging method is simply to put parts of your equation into a Monitor.value
then you see vec1==vec2 returns an array {vec1-vec2} not simply a binary 0-1, T/F . . .
Comparisons can be done in many ways, without iterating as well, avoiding the loops
if x-y=0 then x=y
(firstof(vec1-vec2)==sizeof(vec1))&&(sizeof(vec1)==sizeof(vec2)) -
I find that you use too many loops in your functions for my liking . . .
Another option is conversion
arraytostring(vec1) == arraytostring(vec2) works a charm . . .
Cheers
MM
Excellent. Thanks much.
Re: Module for working with Vectors
Posted: 15 Jan 2013 19:22
by brianc
Updated to Version 1.5. Includes new functions:
count(a,val) - Return the number of elements in vector a whose value equals val (a singleton)
minval(a) - Return the minimum value in vector a
maxval(a) -Return the maximum value in vector a
I was surprised to see that the built-in min() and max() functions work with 2 arguments as is done in most languages instead of using vectors.