computing distance to neighbors

Jul 16, 2007 at 1:34pm

computing distance to neighbors

I currently store data in rows of a coll; the first value is 0 or 1 (representing Off or On). For each “On” coll row, the second value is the “distance” until the next On row. For each “Off” row, the second value is zero. The distance of the last On row is computed to be the distance until (# rows + 1). Here’s an example:

1, 0 0
2, 1 1
3, 1 2
4, 0 0
5, 1 1

In my app, the values of each row change from On to Off and vice versa frequently. Currently, if row N’s value is changed, I first march backwards from N until I find the previous On row, and recompute its new distance. Then, if N got turned On, I march forward from N until I find the next On row (or end of rows) to compute its distance.

So now my question – is there an object (maybe one of Jitter’s matrix objects?) that could keep track of and update these distances for me, instead of me using my manual method above?

Thanks,
Dan

#32903
Jul 16, 2007 at 3:13pm

Hi there,

i am sorry I do not have a sollution for ya, ~Just want to support your problem. I have similar difficulties with max’s matrices and list generators en coll/store objects. There should be more versatile matrix objects for more systematic algorithmic matrix and coll- “filling” so to speak.
Can anyone at cycling 74 support this? Let’s ask for help onthis one….

Doppio

#108916
Jul 16, 2007 at 4:34pm

Why not use some of the other capabilities available for max/msp?
java/javascript/rtcmix/maxlisp/peter-elsea’s stuff/peter castine’s
stuff/etc.

Some things just don’t work well using a dataflow/event-driven
approach.

brad

http://music.columbia.edu/~brad

Quoting andreas :

>
> Hi there,
>
> i am sorry I do not have a sollution for ya, ~Just want to
> support your problem. I have similar difficulties with max’s
> matrices and list generators en coll/store objects. There should
> be more versatile matrix objects for more systematic algorithmic
> matrix and coll- “filling” so to speak.
> Can anyone at cycling 74 support this? Let’s ask for help onthis
> one….
>
> Doppio
>

#108917
Jul 16, 2007 at 4:47pm

thanks Brad – I’m certainly game for either Java or better still
Javascript, but I don’t know either well enough to understand whether
they offer me what I’m looking for. Can you point me in a direction?

Thanks,
Dan

At 12:34 PM -0400 7/16/07, garton@columbia.edu wrote:
>Why not use some of the other capabilities available for max/msp?
>java/javascript/rtcmix/maxlisp/peter-elsea’s stuff/peter castine’s
>stuff/etc.
>
>Some things just don’t work well using a dataflow/event-driven
>approach.
>
>brad
>http://music.columbia.edu/~brad


Dan Nigrin
Defective Records
202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X / Major
Malfunction
http://www.defectiverecords.com

http://www.jackosx.com

#108918
Jul 16, 2007 at 5:07pm

hi

if i were you, i ‘d use the FTM library to do this sort of computation.

g

#108919
Jul 16, 2007 at 5:28pm

Thanks for the suggestion Guillaume. Having never looked at FTM
before though, and just glancing now, it seems non-trivial to get
started… I will try though, thanks.

Dan

At 11:07 AM -0600 7/16/07, guillaume wrote:
>hi
>
>if i were you, i ‘d use the FTM library to do this sort of computation.
>
>g
>–
>GE
>http://ge.lib.free.fr/


Dan Nigrin
Defective Records
202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X / Major
Malfunction
http://www.defectiverecords.com

http://www.jackosx.com

#108920
Jul 16, 2007 at 7:48pm

Also, if you’re going to get into something like this heavily, I’d
recommend checking into MySQL or another database language. Handy
things like last_insert_id OR SELECT max(id) WHERE inputType = 0.
There’s definitely a way of writing a procedure that will do this in a
flash. Though there’s some overhead in learning MySQL, it definitely
pays off for large data management problems. (depends on the size of
your problem though…)

Peter McCulloch
http://www.petermcculloch.com

#108921
Jul 16, 2007 at 7:55pm

Thanks Peter, that’s a good idea too. My application is one that’s
very dependent on speed though, and so am a little nervous about the
overhead of a database-based approach. Still, I know enough SQL to
give the idea a try though.

Best,
dan

At 3:48 PM -0400 7/16/07, Peter McCulloch wrote:
>Also, if you’re going to get into something like this heavily, I’d
>recommend checking into MySQL or another database language. Handy
>things like last_insert_id OR SELECT max(id) WHERE inputType = 0.
>There’s definitely a way of writing a procedure that will do this in
>a flash. Though there’s some overhead in learning MySQL, it
>definitely pays off for large data management problems. (depends on
>the size of your problem though…)
>
>Peter McCulloch
>http://www.petermcculloch.com
>


Dan Nigrin
Defective Records
202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X / Major
Malfunction
http://www.defectiverecords.com

http://www.jackosx.com

#108922
Jul 17, 2007 at 4:36am

I suppose the retrieval speed for MySQL is potentially an issue. I’ve
not used it with Max (OSX 10.3.9…ah, well), but the performance has
been fine for me within a Java application that I’m writing. You can
set priority for the update statements, and since everything you’re
doing is numbers, things should run pretty quick.

If it’s not absolutely gigantor, you could even do it in Java. There’s
the nice COLT package out there for high performance matrix computing.
The transition from Max to Java and back is probably more of a speed
hit than the Java computation in that case.

How many rows are you looking at?

Peter McCulloch

#108923
Jul 17, 2007 at 5:45am

this does not help you, Dan, but recently i switched
to [text] instead of coll whenever i dont need to
sort by index or things like that.

#108924
Jul 17, 2007 at 11:36am

Thanks Peter, I’ll look at that stuff. Re: # rows, not a lot –
maximum would be 64.

Dan

At 12:36 AM -0400 7/17/07, Peter McCulloch wrote:
>I suppose the retrieval speed for MySQL is potentially an issue.
>I’ve not used it with Max (OSX 10.3.9…ah, well), but the
>performance has been fine for me within a Java application that I’m
>writing. You can set priority for the update statements, and since
>everything you’re doing is numbers, things should run pretty quick.
>
>If it’s not absolutely gigantor, you could even do it in Java.
>There’s the nice COLT package out there for high performance matrix
>computing. The transition from Max to Java and back is probably
>more of a speed hit than the Java computation in that case.
>
>How many rows are you looking at?
>
>Peter McCulloch


Dan Nigrin
Defective Records
202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X / Major
Malfunction
http://www.defectiverecords.com

http://www.jackosx.com

#108925
Jul 17, 2007 at 11:36am

Thanks Roman, but I do need to sort…

Dan

At 11:45 PM -0600 7/16/07, Roman Thilenius wrote:
>this does not help you, Dan, but recently i switched
>to [text] instead of coll whenever i dont need to
>sort by index or things like that.


Dan Nigrin
Defective Records
202 Hack / PC-1600 User / VSTi Host / OMS Convert / Jack OS X / Major
Malfunction
http://www.defectiverecords.com

http://www.jackosx.com

#108926

You must be logged in to reply to this topic.