Module for working with Vectors

Post and discuss Lemur Modules.
m127
Newbie
Posts:36
Joined:14 Dec 2011 07:57
Re: Module for working with Vectors

Post by m127 » 09 Dec 2012 21:14

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.

brianc
Regular
Posts:87
Joined:10 Jan 2012 02:16

Re: Module for working with Vectors

Post by brianc » 09 Dec 2012 21:33

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.

m127
Newbie
Posts:36
Joined:14 Dec 2011 07:57

Re: Module for working with Vectors

Post by m127 » 10 Dec 2012 00:17

edit: nah, too heavy, disregard :)
Last edited by m127 on 10 Dec 2012 07:47, edited 1 time in total.

Phil999
Regular
Posts:932
Joined:11 Jan 2012 01:53

Re: Module for working with Vectors

Post by Phil999 » 10 Dec 2012 00:25

oh come on. :lol:

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.
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro

Macciza
Regular
Posts:1325
Joined:07 Dec 2011 04:57
Location:Sydney, Australia.

Re: Module for working with Vectors

Post by Macciza » 10 Dec 2012 02:04

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
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]

brianc
Regular
Posts:87
Joined:10 Jan 2012 02:16

Re: Module for working with Vectors

Post by brianc » 11 Dec 2012 00:01

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!

m127
Newbie
Posts:36
Joined:14 Dec 2011 07:57

Re: Module for working with Vectors

Post by m127 » 11 Dec 2012 00:31

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.

brianc
Regular
Posts:87
Joined:10 Jan 2012 02:16

Re: Module for working with Vectors

Post by brianc » 15 Jan 2013 19:22

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.

Post Reply