Csound Csound-dev Csound-tekno Search About

[Cs-dev] arrays of arrays

Date2013-09-10 19:34
Fromjoachim heintz
Subject[Cs-dev] arrays of arrays
not sure if this has been discussed already -- are arrays of arrays 
possible in csound6? or planned to be in future?

something like this:

kArr[] init 3
kArr1[] array 1, 2, 3
kArr2[] array 4, 5, 6
kArr3[] array 7, 8, 9
kArr[0] = kArr1
kArr[1] = kArr2
kArr[2] = kArr3

not working yet, if i am not overseeing anything.

best -

	joachim
	

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-09-15 18:38
FromSteven Yi
SubjectRe: [Cs-dev] arrays of arrays
Hi Joachim,

There is no support for array of arrays at this time. I think that
there's a difference between multi-dimensional array implementations,
where something like C requires arrays lengths to be equal while
something like Java does not (each sub-array could have it's own
length).

Now, I think currently we do not have array_get/array_set operations
where the dimensions are different in size.  We could though. For
example, code like:

kArr[][] init 3, 3
kArr1[] array 1, 2, 3
kArr2[] array 4, 5, 6
kArr3[] array 7, 8, 9
kArr[0] = kArr1
kArr[1] = kArr2
kArr[2] = kArr3

could be supported if array_set ("kArr[0] = kArr1" would get modified
to be array_set kArr1, kArr, 0) would go and check dimensions on the
incoming array, the destination array, and could then do a memcpy.
We'd have to do some extra OENTRY's so that we'd have something like:

array_set "" ".[].[][]k"

array_get could also be modified to have additional oentries to get
sub-dimensions, copied by value.  So you could for example do:

k1[][] init 3,3
... do some initialization ...
k2[] = k1[0]

and the last line would copy the values from k1 into a 3 element array
(k2).  To note, k2 would be a copy, not a reference, so modifications
to k2 would not affect k1.  This would be different from how coding is
generally done in C, where you'd get a reference.

steven


On Tue, Sep 10, 2013 at 2:34 PM, joachim heintz  wrote:
> not sure if this has been discussed already -- are arrays of arrays
> possible in csound6? or planned to be in future?
>
> something like this:
>
> kArr[] init 3
> kArr1[] array 1, 2, 3
> kArr2[] array 4, 5, 6
> kArr3[] array 7, 8, 9
> kArr[0] = kArr1
> kArr[1] = kArr2
> kArr[2] = kArr3
>
> not working yet, if i am not overseeing anything.
>
> best -
>
>         joachim
>
>
> ------------------------------------------------------------------------------
> How ServiceNow helps IT people transform IT departments:
> 1. Consolidate legacy IT systems to a single system of record for IT
> 2. Standardize and globalize service processes across IT
> 3. Implement zero-touch automation to replace manual, redundant tasks
> http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=64545871&iu=/4140/ostg.clktrk
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net