[Cs-dev] should += work on an array?
Date | 2013-07-17 10:13 |
From | joachim heintz |
Subject | [Cs-dev] should += work on an array? |
Attachments | Array_Math.csd None None |
i was expecting to be able to add (subtract, multiply, divide) a number to an array. but it is not working, so i am wondering whether my expectation was wrong, or there is a bug. if a bug, it may be related to the one i reported about genarray (some time ago here, and in a ticket, too). example and output below. best - joachim |
Date | 2013-07-17 10:32 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] should += work on an array? |
I don't think array op scalar is implemented. You would need to loop over the array: instr 1 kArr[] fillarray 1,2,3 kndx init 0 until kndx > 2 do kArr[kndx] = kArr[kndx] + 10 printk2 kArr[kndx] kndx += 1 od endin Victor On 17 Jul 2013, at 10:13, joachim heintz wrote: > i was expecting to be able to add (subtract, multiply, divide) a number to an array. but it is not working, so i am wondering whether my expectation was wrong, or there is a bug. if a bug, it may be related to the one i reported about genarray (some time ago here, and in a ticket, too). example and output below. > best - > joachim > > > |
Date | 2013-07-17 10:46 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] should += work on an array? |
Sorry, I just had a look and you can indeed do kArr = kArr + 10 but not kArr += 10 Array ops are implemented alright. Victor On 17 Jul 2013, at 10:32, Victor Lazzarini wrote: > I don't think array op scalar is implemented. You would need to loop over > the array: > > instr 1 > kArr[] fillarray 1,2,3 > kndx init 0 > > until kndx > 2 do > kArr[kndx] = kArr[kndx] + 10 > printk2 kArr[kndx] > kndx += 1 > od > > endin > > Victor > On 17 Jul 2013, at 10:13, joachim heintz wrote: > >> i was expecting to be able to add (subtract, multiply, divide) a number to an array. but it is not working, so i am wondering whether my expectation was wrong, or there is a bug. if a bug, it may be related to the one i reported about genarray (some time ago here, and in a ticket, too). example and output below. >> best - >> joachim >> >> >> |
Date | 2013-07-17 10:51 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] should += work on an array? |
actuallly, scrap that. kArr += 10 works as expected here. On 17 Jul 2013, at 10:46, Victor Lazzarini wrote: > Sorry, I just had a look and you can indeed do > > kArr = kArr + 10 > > but not > > kArr += 10 > > Array ops are implemented alright. > > Victor > On 17 Jul 2013, at 10:32, Victor Lazzarini wrote: > >> I don't think array op scalar is implemented. You would need to loop over >> the array: >> >> instr 1 >> kArr[] fillarray 1,2,3 >> kndx init 0 >> >> until kndx > 2 do >> kArr[kndx] = kArr[kndx] + 10 >> printk2 kArr[kndx] >> kndx += 1 >> od >> >> endin >> >> Victor >> On 17 Jul 2013, at 10:13, joachim heintz wrote: >> >>> i was expecting to be able to add (subtract, multiply, divide) a number to an array. but it is not working, so i am wondering whether my expectation was wrong, or there is a bug. if a bug, it may be related to the one i reported about genarray (some time ago here, and in a ticket, too). example and output below. >>> best - >>> joachim >>> >>> >>> |
Date | 2013-07-17 11:07 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] should += work on an array? |
I think there is a problem when the same array is used on both sides kArr += 10 gives the wrong answer but kArr1[] = kArr + 10 is correct. So there's a bug there after all. Victor On 17 Jul 2013, at 10:51, Victor Lazzarini wrote: > actuallly, scrap that. > > kArr += 10 > > works as expected here. > On 17 Jul 2013, at 10:46, Victor Lazzarini wrote: > >> Sorry, I just had a look and you can indeed do >> >> kArr = kArr + 10 >> >> but not >> >> kArr += 10 >> >> Array ops are implemented alright. >> >> Victor >> On 17 Jul 2013, at 10:32, Victor Lazzarini wrote: >> >>> I don't think array op scalar is implemented. You would need to loop over >>> the array: >>> >>> instr 1 >>> kArr[] fillarray 1,2,3 >>> kndx init 0 >>> >>> until kndx > 2 do >>> kArr[kndx] = kArr[kndx] + 10 >>> printk2 kArr[kndx] >>> kndx += 1 >>> od >>> >>> endin >>> >>> Victor >>> On 17 Jul 2013, at 10:13, joachim heintz wrote: >>> >>>> i was expecting to be able to add (subtract, multiply, divide) a number to an array. but it is not working, so i am wondering whether my expectation was wrong, or there is a bug. if a bug, it may be related to the one i reported about genarray (some time ago here, and in a ticket, too). example and output below. >>>> best - >>>> joachim >>>> >>>> >>>> |
Date | 2013-07-17 11:39 |
From | joachim heintz |
Subject | Re: [Cs-dev] should += work on an array? |
thanks, victor: yes, this works. as you said, there must be a bug anywhere - perhaps similar to the genarray bug. best - joachim Am 17.07.2013 12:07, schrieb Victor Lazzarini: > I think there is a problem when the same array is used on both sides > > kArr += 10 > > gives the wrong answer > > but > > kArr1[] = kArr + 10 > > is correct. So there's a bug there after all. > > Victor > On 17 Jul 2013, at 10:51, Victor Lazzarini wrote: > >> actuallly, scrap that. >> >> kArr += 10 >> >> works as expected here. >> On 17 Jul 2013, at 10:46, Victor Lazzarini wrote: >> >>> Sorry, I just had a look and you can indeed do >>> >>> kArr = kArr + 10 >>> >>> but not >>> >>> kArr += 10 >>> >>> Array ops are implemented alright. >>> >>> Victor >>> On 17 Jul 2013, at 10:32, Victor Lazzarini wrote: >>> >>>> I don't think array op scalar is implemented. You would need to loop over >>>> the array: >>>> >>>> instr 1 >>>> kArr[] fillarray 1,2,3 >>>> kndx init 0 >>>> >>>> until kndx > 2 do >>>> kArr[kndx] = kArr[kndx] + 10 >>>> printk2 kArr[kndx] >>>> kndx += 1 >>>> od >>>> >>>> endin >>>> >>>> Victor >>>> On 17 Jul 2013, at 10:13, joachim heintz wrote: >>>> >>>>> i was expecting to be able to add (subtract, multiply, divide) a number to an array. but it is not working, so i am wondering whether my expectation was wrong, or there is a bug. if a bug, it may be related to the one i reported about genarray (some time ago here, and in a ticket, too). example and output below. >>>>> best - >>>>> joachim >>>>> >>>>> >>>>> |
Date | 2013-07-17 12:07 |
From | jpff@cs.bath.ac.uk |
Subject | Re: [Cs-dev] should += work on an array? |
It is supposed to be there > I don't think array op scalar is implemented. You would need to loop over > the array: > ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2013-07-17 12:17 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] should += work on an array? |
yes, the problem isn't that. It turns out that there is some issue (possibly at the parser/compiler stage) with the same array name being on both sides of an expression as in kArr += 10 or kArr = kArr + 10 but kArr1[] = kArr + 10 works. I was trying to track it down, but I am getting confused as the pointers should be the same but are not (kArr should be the same ptr on both sides), but it could be that there is a synthetic variable in the middle that is confusing things for me. On 17 Jul 2013, at 12:07, jpff@cs.bath.ac.uk wrote: > It is supposed to be there > >> I don't think array op scalar is implemented. You would need to loop over >> the array: >> > > > > > ------------------------------------------------------------------------------ > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2013-07-17 12:23 |
From | jpff@cs.bath.ac.uk |
Subject | Re: [Cs-dev] should += work on an array? |
I suspect a conflict in the ensure pass. Will cxheck after breakfast > yes, the problem isn't that. It turns out that there is some issue > (possibly at the parser/compiler stage) with > the same array name being on both sides of an expression as in > > kArr += 10 > > or > > kArr = kArr + 10 > > but > > kArr1[] = kArr + 10 > > works. > > I was trying to track it down, but I am getting confused as the pointers > should be the same but are not > (kArr should be the same ptr on both sides), but it could be that there is > a synthetic variable in the middle > that is confusing things for me. > > > On 17 Jul 2013, at 12:07, jpff@cs.bath.ac.uk wrote: > >> It is supposed to be there >> >>> I don't think array op scalar is implemented. You would need to loop >>> over >>> the array: >>> >> >> >> >> >> ------------------------------------------------------------------------------ >> See everything from the browser to the database with AppDynamics >> Get end-to-end visibility with application monitoring from AppDynamics >> Isolate bottlenecks and diagnose root cause in seconds. >> Start your free trial of AppDynamics Pro today! >> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk >> _______________________________________________ >> Csound-devel mailing list >> Csound-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/csound-devel > > Dr Victor Lazzarini > Senior Lecturer > Dept. of Music > NUI Maynooth Ireland > tel.: +353 1 708 3545 > Victor dot Lazzarini AT nuim dot ie > > > > > ------------------------------------------------------------------------------ > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel > > > ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2013-07-17 12:29 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] should += work on an array? |
Actually, with -v it's clearer, for kArr = kArr + 10, we have ##add.[i args: #k0[] kArr 10 =.t args: kArr #k0[] =. seems to overwrite kArr before any operation is made. Victor On 17 Jul 2013, at 12:17, Victor Lazzarini wrote: > yes, the problem isn't that. It turns out that there is some issue (possibly at the parser/compiler stage) with > the same array name being on both sides of an expression as in > > kArr += 10 > > or > > kArr = kArr + 10 > > but > > kArr1[] = kArr + 10 > > works. > > I was trying to track it down, but I am getting confused as the pointers should be the same but are not > (kArr should be the same ptr on both sides), but it could be that there is a synthetic variable in the middle > that is confusing things for me. > > > On 17 Jul 2013, at 12:07, jpff@cs.bath.ac.uk wrote: > >> It is supposed to be there >> >>> I don't think array op scalar is implemented. You would need to loop over >>> the array: >>> >> >> >> >> >> ------------------------------------------------------------------------------ >> See everything from the browser to the database with AppDynamics >> Get end-to-end visibility with application monitoring from AppDynamics >> Isolate bottlenecks and diagnose root cause in seconds. >> Start your free trial of AppDynamics Pro today! >> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk >> _______________________________________________ >> Csound-devel mailing list >> Csound-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/csound-devel > > Dr Victor Lazzarini > Senior Lecturer > Dept. of Music > NUI Maynooth Ireland > tel.: +353 1 708 3545 > Victor dot Lazzarini AT nuim dot ie > > > > > ------------------------------------------------------------------------------ > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2013-07-17 12:43 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] should += work on an array? |
Maybe tabcopy_set should not do any copying of data, because all other operations only work at perf-time, so to be in line with them. Or perhaps tabcopy_set should not be called for k[] only for i[]? On 17 Jul 2013, at 12:29, Victor Lazzarini wrote: > Actually, with -v it's clearer, > for > > kArr = kArr + 10, > > we have > > ##add.[i args: #k0[] kArr 10 > =.t args: kArr #k0[] > > =. seems to overwrite kArr before any operation is made. > > Victor > On 17 Jul 2013, at 12:17, Victor Lazzarini wrote: > >> yes, the problem isn't that. It turns out that there is some issue (possibly at the parser/compiler stage) with >> the same array name being on both sides of an expression as in >> >> kArr += 10 >> >> or >> >> kArr = kArr + 10 >> >> but >> >> kArr1[] = kArr + 10 >> >> works. >> >> I was trying to track it down, but I am getting confused as the pointers should be the same but are not >> (kArr should be the same ptr on both sides), but it could be that there is a synthetic variable in the middle >> that is confusing things for me. >> >> >> On 17 Jul 2013, at 12:07, jpff@cs.bath.ac.uk wrote: >> >>> It is supposed to be there >>> >>>> I don't think array op scalar is implemented. You would need to loop over >>>> the array: >>>> >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> See everything from the browser to the database with AppDynamics >>> Get end-to-end visibility with application monitoring from AppDynamics >>> Isolate bottlenecks and diagnose root cause in seconds. >>> Start your free trial of AppDynamics Pro today! >>> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk >>> _______________________________________________ >>> Csound-devel mailing list >>> Csound-devel@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/csound-devel >> >> Dr Victor Lazzarini >> Senior Lecturer >> Dept. of Music >> NUI Maynooth Ireland >> tel.: +353 1 708 3545 >> Victor dot Lazzarini AT nuim dot ie >> >> >> >> >> ------------------------------------------------------------------------------ >> See everything from the browser to the database with AppDynamics >> Get end-to-end visibility with application monitoring from AppDynamics >> Isolate bottlenecks and diagnose root cause in seconds. >> Start your free trial of AppDynamics Pro today! >> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk >> _______________________________________________ >> Csound-devel mailing list >> Csound-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/csound-devel > > Dr Victor Lazzarini > Senior Lecturer > Dept. of Music > NUI Maynooth Ireland > tel.: +353 1 708 3545 > Victor dot Lazzarini AT nuim dot ie > > > > > ------------------------------------------------------------------------------ > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2013-07-17 12:59 |
From | jpff@cs.bath.ac.uk |
Subject | Re: [Cs-dev] should += work on an array? |
I had just come to a similar conclusion. > Maybe tabcopy_set should not do any copying of data, because all other > operations only work at perf-time, > so to be in line with them. Or perhaps tabcopy_set should not be called > for k[] only for i[]? > > On 17 Jul 2013, at 12:29, Victor Lazzarini wrote: > >> Actually, with -v it's clearer, >> for >> >> kArr = kArr + 10, >> >> we have >> >> ##add.[i args: #k0[] kArr 10 >> =.t args: kArr #k0[] >> >> =. seems to overwrite kArr before any operation is made. >> ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2013-07-17 13:32 |
From | jpff@cs.bath.ac.uk |
Subject | Re: [Cs-dev] should += work on an array? |
Believed fixed > I had just come to a similar conclusion. > > >> Maybe tabcopy_set should not do any copying of data, because all other >> operations only work at perf-time, >> so to be in line with them. Or perhaps tabcopy_set should not be called >> for k[] only for i[]? ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2013-07-17 15:00 |
From | joachim heintz |
Subject | Re: [Cs-dev] should += work on an array? |
yes, works now -- thanks. looks like only the genarray bug is to fix (there is a ticket). best - joachim Am 17.07.2013 14:32, schrieb jpff@cs.bath.ac.uk: > Believed fixed > > >> I had just come to a similar conclusion. >> >> >>> Maybe tabcopy_set should not do any copying of data, because all other >>> operations only work at perf-time, >>> so to be in line with them. Or perhaps tabcopy_set should not be called >>> for k[] only for i[]? > > > > ------------------------------------------------------------------------------ > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > _______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel > ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |