Hey all,
What is the best (least cpu usage) way to get some basic stats on the content of a table?
I'm using a table to store arbitrary data, and would like to get things like min/max so I can adjust the table bounds for the data it contains.
Any recommendations?
I currently have 100 data points, but hoping for 1000+.
untiling through the whole thing and doing the calc manually seems like it would be resource inefficient.
Thanks, B.
Hey,
The only way I can think of would be to put everything in a list and going calcs on the list. Its much harder to write to a list in random access. [route 0 1 2 3 4 ... n] where n could be 1000 with a matching [pack 0 1 2 3 4 ... n]. Then The table has little purpose, as I'm using the list as the main storage mechanism.
I would think calcs on a table would be faster than calcs on a list?
Maybe there should be some math objects that operate on tables?
Wait, there is that expr for tables right... hmmm...
Seems expr just works on individual table elements.
I dream that I could do math on anything in PD...
pix_expr, expr for tables, expr for lists, expr for everything.
Perhaps its time to get into gridflow...
Thanks, .b.
hard off wrote:
do the calculation as data is written INTO the table?
Hallo, B. Bogart hat gesagt: // B. Bogart wrote:
What is the best (least cpu usage) way to get some basic stats on the content of a table?
Are externals allowed? Then either vasp or the iem_tab externals may be worth a look, i.e.:
iem_tab is written by Thomas Musil from IEM Graz Austria and it is compatible to miller puckette's pd-0.37-3 to pd-0.39-2. see also LICENCE.txt, GnuGPL.txt.
The objects of iem_tab manipulate tables or arrays; you can set constant, copy, fft, ifft, reverse, find minimum or maximum, compare, add, subtract, mul tiplicate, divide arrays.
Frank
On Sat, 2008-10-25 at 00:21 +0200, Frank Barknecht wrote:
Hallo, B. Bogart hat gesagt: // B. Bogart wrote:
What is the best (least cpu usage) way to get some basic stats on the content of a table?
Are externals allowed? Then either vasp or the iem_tab externals may be worth a look, i.e.:
iem_tab is written by Thomas Musil from IEM Graz Austria and it is compatible to miller puckette's pd-0.37-3 to pd-0.39-2. see also LICENCE.txt, GnuGPL.txt.
The objects of iem_tab manipulate tables or arrays; you can set constant, copy, fft, ifft, reverse, find minimum or maximum, compare, add, subtract, mul tiplicate, divide arrays.
There is of course the mighty zexy also. In there you have:
tabminmax: get the minimum and maximum of a table (I think this is what Ben wants to do) tabdump: dump the contents of the table to a list unpack~/pack~ : convert between list and signal
If you want to do complex things, you could unpack~ the table contents into a signal, then get your stats from the signal vector. For example you could use something like xtract~ (from libXtract) to get a whole bunch of different stats from the audio vector if you wanted.
Jamie
Thanks Jamie,
Indeed those objects were very helpful at this stage.
Now I need to do something a little more complex which may need to perform better than unpacking to a list for calcs...
I need to calculate the sum of the differences between two tables (768 elements each).
I suppose the fastest way would be to do it in the signal domain?
Really what I got used to is the amazing and fast vector operations in R.
Seems to me the best thing would be a numpy py external that accesses the tables directly.
I hunger for a unified datatype in PD not tied to data-structures. I mean things like tables of symbols, tables of lists and tables of tables. And, of course, higher math functions on those tables.
Thanks all, B.
Jamie Bullock wrote:
On Sat, 2008-10-25 at 00:21 +0200, Frank Barknecht wrote:
Hallo, B. Bogart hat gesagt: // B. Bogart wrote:
What is the best (least cpu usage) way to get some basic stats on the content of a table?
Are externals allowed? Then either vasp or the iem_tab externals may be worth a look, i.e.:
iem_tab is written by Thomas Musil from IEM Graz Austria and it is compatible to miller puckette's pd-0.37-3 to pd-0.39-2. see also LICENCE.txt, GnuGPL.txt.
The objects of iem_tab manipulate tables or arrays; you can set constant, copy, fft, ifft, reverse, find minimum or maximum, compare, add, subtract, mul tiplicate, divide arrays.
There is of course the mighty zexy also. In there you have:
tabminmax: get the minimum and maximum of a table (I think this is what Ben wants to do) tabdump: dump the contents of the table to a list unpack~/pack~ : convert between list and signal
If you want to do complex things, you could unpack~ the table contents into a signal, then get your stats from the signal vector. For example you could use something like xtract~ (from libXtract) to get a whole bunch of different stats from the audio vector if you wanted.
Jamie
On Wed, 2008-11-05 at 09:49 -0800, B. Bogart wrote:
I need to calculate the sum of the differences between two tables (768 elements each).
Does the attached do what you want?
BTW, I also sometimes yearn things like tables of lists etc, but OTOH, I wonder if trying to impose paradigms from 'traditional' languages on Pd is a bad idea. If I start to think differently (more of a dataflow/control flow mentality), things get a bit easier.
best,
Jamie