sorting and labeling cells in matrix

Christopher Overstreet's icon

Hello list,
I am currently needing 3 versions of a very similar function, and can't figure out how to accomplish them in the matrix realm. I've looked thru all of my externals and can't seem to find anything that will do this. If only jit.bsort spit out a matrix of the re-ordering.

Version #1
I want to know the 5(or n) highest values in a 1-plane matrix, AND their address in the matrix.

Version #2
I want a matrix to go in and the matrix that comes out should only pass the 5 highest values and fill the rest with 0's.

Version #3
I want to take in a 12 X 3 matrix, and spit out a 12 X 1 matrix which contains the highest values of each column.

Any suggestions or leads?

(karrrlo)'s icon

> Version #3
> I want to take in a 12 X 3 matrix, and spit out a 12 X 1 matrix which contains the highest values of each column.
>

here's version#3 for a start, not elegant but does the job:

Max Patch
Copy patch and select New From Clipboard in Max.

Wesley Smith's icon

These things are a bit tricky to do with the standard jitter objects.
At one point, I needed the same kind of functionality and ended up
writing a number of jitter objects for these purposes. Here's a patch
that shows how to do the 3 things you were interested in. You can
download the objects at:

wes

Max Patch
Copy patch and select New From Clipboard in Max.

On 12/5/06, Christopher Overstreet wrote:
>
> Hello list,
> I am currently needing 3 versions of a very similar function, and can't figure out how to accomplish them in the matrix realm. I've looked thru all of my externals and can't seem to find anything that will do this. If only jit.bsort spit out a matrix of the re-ordering.
>
> Version #1
> I want to know the 5(or n) highest values in a 1-plane matrix, AND their address in the matrix.
>
> Version #2
> I want a matrix to go in and the matrix that comes out should only pass the 5 highest values and fill the rest with 0's.
>
> Version #3
> I want to take in a 12 X 3 matrix, and spit out a 12 X 1 matrix which contains the highest values of each column.
>
> Any suggestions or leads?
>

(karrrlo)'s icon

> Version #1
> I want to know the 5(or n) highest values in a 1-plane matrix, AND their address in the matrix.
>
> Version #2
> I want a matrix to go in and the matrix that comes out should only pass the 5 highest values and fill the rest with 0's.
>

here is a simple solution using the Lobjects. could be tidious for bigger matrices of course.

Max Patch
Copy patch and select New From Clipboard in Max.

(karrrlo)'s icon

Wes,
havent spent enough time on your objects, and just realized that i should ...

Quote: wesley.hoke@gmail.com wrote on Tue, 05 December 2006 18:13
----------------------------------------------------
> These things are a bit tricky to do with the standard jitter objects.
> At one point, I needed the same kind of functionality and ended up
> writing a number of jitter objects for these purposes. Here's a patch
> that shows how to do the 3 things you were interested in. You can
> download the objects at:
>
> http://www.mat.ucsb.edu/~whsmith/xray-mac-UB.zip
>
> wes
>
>

(karrrlo)'s icon

Christopher or anybody else, disregard my last patch for version#2 and #3 it is actually incorrect... sorry for the bandwidth.

Christopher Overstreet's icon

Thanks for the help.

The Lobj solution isn't ideal, as sometimes I will be dealing with larger matrices. The xray objects are great, however Wesley's example still doesn't quite solve my problem, as the "mapping" matrix is variable, based on values over a threshold. I want the size to be fixed.

ie. A Map that contains references to the 5(var) highest cells. No more or less. Not sure what it should output if they are all zero? This is basically a patch to manage polyphony.

Thanks,
Christopher

Wesley Smith's icon

I didn't complete the job for you. What I would do is use 2
xray.jit.quicksort objects sorting in x and y dimension and then take
out the appropriate 5 cells. Things will be properly ordered for you
this way.

wes

On 12/6/06, Christopher Overstreet wrote:
>
> Thanks for the help.
>
> The Lobj solution isn't ideal, as sometimes I will be dealing with larger matrices. The xray objects are great, however Wesley's example still doesn't quite solve my problem, as the "mapping" matrix is variable, based on values over a threshold. I want the size to be fixed.
>
> ie. A Map that contains references to the 5(var) highest cells. No more or less. Not sure what it should output if they are all zero? This is basically a patch to manage polyphony.
>
> Thanks,
> Christopher
>