Module for working with Vectors
Module for working with Vectors
I've just uploaded a module that contains a collection of functions for working with vectors. Examples include sorting, shuffling, adding items, removing items, getting every ith element, calculating the distance between vectors, and more. Hope it's helpful!
http://liine.net/en/community/user-library/view/330/
http://liine.net/en/community/user-library/view/330/
- Attachments
-
- SLVectorScreenshot.png (19.31 KiB) Viewed 4743 times
Re: Module for working with Vectors
Hey brianc, that does look useful - many thanks.
Is this part of the "learning curve about to drop" or is it just a coincidence that several instructional-type modules have been uploaded by forum members in the last few days?
Is this part of the "learning curve about to drop" or is it just a coincidence that several instructional-type modules have been uploaded by forum members in the last few days?
Re: Module for working with Vectors
Pure coincidence, at least on my part I just thought that it'd be useful to modularize and release functions/objects that can be reused, both for myself and others.Joe Soap wrote:Is this part of the "learning curve about to drop" or is it just a coincidence that several instructional-type modules have been uploaded by forum members in the last few days?
More to come from me...
Re: Module for working with Vectors
Nice one man.
I'd go further with this idea in fact, as though very useful (and appreciated) . . . it still falls into the category of "the code is the documentation". All well and good for those from (almost any) coding background - but still quite a leap.
For instance it might be a nice idea to explain to people why vectors are useful / necessary. What sorts of things are they used for etc.Oftentimes, the level of abstraction involved makes it difficult to connect the dots between an idea someone has in mind to the underlying techniques required to implement that idea?
IOW . . . we need pics and diagrams, real-world examples, to stand alongside code examples / modules. Nothing about the process should be considered too basic to outline.
This isn't a criticism levelled at you specifically (or at all), Glad people are making the effort.
I'd go further with this idea in fact, as though very useful (and appreciated) . . . it still falls into the category of "the code is the documentation". All well and good for those from (almost any) coding background - but still quite a leap.
For instance it might be a nice idea to explain to people why vectors are useful / necessary. What sorts of things are they used for etc.Oftentimes, the level of abstraction involved makes it difficult to connect the dots between an idea someone has in mind to the underlying techniques required to implement that idea?
IOW . . . we need pics and diagrams, real-world examples, to stand alongside code examples / modules. Nothing about the process should be considered too basic to outline.
This isn't a criticism levelled at you specifically (or at all), Glad people are making the effort.
Re: Module for working with Vectors
I definitely agree with you. I chose to be pretty minimal on the documentation just to keep the code small. Most of my projects are pretty big and use quite a few modules like this, and I try to keep the code as small (but still readable) as I can.
Maybe I'll start creating a separate README instead of just the small README() functions included in my modules (those are limited by the cap on script size). I'm also planning to include example templates with modules to show a little bit about how to integrate the modules.
Maybe I'll start creating a separate README instead of just the small README() functions included in my modules (those are limited by the cap on script size). I'm also planning to include example templates with modules to show a little bit about how to integrate the modules.
Re: Module for working with Vectors
that would be very helpful.
Thank you very much for these modules. They are complex, therefore look interesting, but I don't know how to take advantage of or learn from them.
Thank you very much for these modules. They are complex, therefore look interesting, but I don't know how to take advantage of or learn from them.
Formant+Eurorack, PPG wave 2.2, Korg MS-20, etc., EWI 4000s, QuNeo, etc., Mixbus32c, u-he, MadronaLabs, Samplemodeling, NI, etc., iPad2/4/Pro
Re: Module for working with Vectors
@ Phil999 . . . exactly.
I mean, I have a very rough idea what vectors can be used for (indexing into grids?) . . . but even that (and I may be misunderstanding even still) bit of knowledge was hard-won, from the contexts in which "use vectors" seemed to be the answer (here on the forums).
Oh . . . I've seen various people handwave in the direction of "any basic programming tutorial" etc when asked to explain some stuff further - but this kind of advice rather misses the point. WHICH basic turorial??? Link some FFS!!!
It's a wild and wooly internet out there . . . what if some poor n00b* ends up studying Haskell or LISP in their ignorance?
* Yeah . . . I'll cop to that.
I mean, I have a very rough idea what vectors can be used for (indexing into grids?) . . . but even that (and I may be misunderstanding even still) bit of knowledge was hard-won, from the contexts in which "use vectors" seemed to be the answer (here on the forums).
Oh . . . I've seen various people handwave in the direction of "any basic programming tutorial" etc when asked to explain some stuff further - but this kind of advice rather misses the point. WHICH basic turorial??? Link some FFS!!!
It's a wild and wooly internet out there . . . what if some poor n00b* ends up studying Haskell or LISP in their ignorance?
* Yeah . . . I'll cop to that.
Re: Module for working with Vectors
Hi All
Nice bit of work there though I still have to have a good look through it all . . .
But a few general comments . . .
I must admit I think I prefer 'array' to 'vector' as terminology but much of a muchness in the end - both terms have simultaneous overlapping and exclusive definitions in my mind . .
Think of an 'array/vector' as a 'list' - a bunch of numbers or names that you can access by there position/index in the list . . .
In general I would say check out a 'C-based' tutorial just to get an understanding of assignment, variables, equations, functions etc
There are not really any tutorials that cover both basic program design/structure and Lemur specific approaches . . .
A few specific comments . .
Not sure what the usual result should be for adding unequal arrays - I thought you 0-padded the shorter and return the longer of the two . . .
This is actually the result you get when using standard maths operations on arrays in Lemur ie {1, 2, 3}+{4, 5, 6, 7} = {5,7,9,7}
Perhaps it would be better to call them add_tr, subtract_tr etc to make it clear that they truncate to the shortest as opposed to maintain longest length
Any particular reason why you went with functions for some and scripts for others - ie push vs pop?? Just wondering . . .
Nice bit of work there though I still have to have a good look through it all . . .
But a few general comments . . .
I must admit I think I prefer 'array' to 'vector' as terminology but much of a muchness in the end - both terms have simultaneous overlapping and exclusive definitions in my mind . .
Think of an 'array/vector' as a 'list' - a bunch of numbers or names that you can access by there position/index in the list . . .
In general I would say check out a 'C-based' tutorial just to get an understanding of assignment, variables, equations, functions etc
There are not really any tutorials that cover both basic program design/structure and Lemur specific approaches . . .
A few specific comments . .
Not sure what the usual result should be for adding unequal arrays - I thought you 0-padded the shorter and return the longer of the two . . .
This is actually the result you get when using standard maths operations on arrays in Lemur ie {1, 2, 3}+{4, 5, 6, 7} = {5,7,9,7}
Perhaps it would be better to call them add_tr, subtract_tr etc to make it clear that they truncate to the shortest as opposed to maintain longest length
Any particular reason why you went with functions for some and scripts for others - ie push vs pop?? Just wondering . . .
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]
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Re: Module for working with Vectors
I do too. I went with the word "vector" just because that's what the Lemur documentation calls them.Macciza wrote:I must admit I think I prefer 'array' to 'vector' as terminology but much of a muchness in the end - both terms have simultaneous overlapping and exclusive definitions in my mind . .
Yeah, this was a tough design decision. In the mathematical sense, vectors of different dimensions aren't compatible, and just about all implementations of element-by-element arithmetic I've seen (MATLAB/Octave, Mathematica, R, and implementations I've encountered in C/C++/Python) all assert that the lengths are the same. Because of that, I don't like the way it's done in Lemur. I suppose I should make the change, though, to at least make it consistent. Next version...Macciza wrote:Not sure what the usual result should be for adding unequal arrays - I thought you 0-padded the shorter and return the longer of the two . . .
This is actually the result you get when using standard maths operations on arrays in Lemur ie {1, 2, 3}+{4, 5, 6, 7} = {5,7,9,7}
Perhaps it would be better to call them add_tr, subtract_tr etc to make it clear that they truncate to the shortest as opposed to maintain longest length
Size. For things I could do as one-liners, I used functions.Macciza wrote:Any particular reason why you went with functions for some and scripts for others - ie push vs pop?? Just wondering . . .
Can you think of anything that's missing? The next version will also have filter functions, like ge({9,4,6,1,3,5,8},5) returns all elements greater than or equal to 5, or {9,6,5,8}.
Re: Module for working with Vectors
Some good functions there Brianc, thanks! I think some of them mightbe built-in functions.
That is one thing I have requested from legacy times, I would love to save/load functions, instead of copy/pasting or re-writing from scratch, but hey, Liine guys are makig a great job with lemur imo, so simply I can't complaint.
@Macciza about of adding arrays with different sizes, recently I had a project where I used it alot (generative template), so I what did was to wrap arrays, I don't know if this helps in some way, but I have added a file.
Cheers and thanks again brianc.
That is one thing I have requested from legacy times, I would love to save/load functions, instead of copy/pasting or re-writing from scratch, but hey, Liine guys are makig a great job with lemur imo, so simply I can't complaint.
@Macciza about of adding arrays with different sizes, recently I had a project where I used it alot (generative template), so I what did was to wrap arrays, I don't know if this helps in some way, but I have added a file.
Cheers and thanks again brianc.
- Attachments
-
- addArray.jzml
- (1.72 KiB) Downloaded 207 times