From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,NICE_REPLY_A,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Rod Kay Newsgroups: comp.lang.ada Subject: Re: Real_Arrays on heap with overloaded operators and clean syntax Date: Mon, 23 Jan 2023 10:18:52 +1100 Organization: A noiseless patient Spider Message-ID: References: <9c7cccd9-733f-49a8-b482-087ccb14b58dn@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 22 Jan 2023 23:18:32 -0000 (UTC) Injection-Info: reader01.eternal-september.org; posting-host="f2406f80d8a139156a3308bf3c4cc5d0"; logging-data="3472609"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19gxrg6hVICueuiSiIQaOWXZ12tmilR+BM=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.0 Cancel-Lock: sha1:f0HsiPl9kRo/l3ekZRyCx9ons1U= In-Reply-To: <9c7cccd9-733f-49a8-b482-087ccb14b58dn@googlegroups.com> Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:64858 List-Id: On 23/1/23 08:34, Jim Paloander wrote: > Dear ADA lovers, > with stack allocation of Real_Vector ( 1 .. N ) when N >= 100,000 I get STACK_OVERFLOW ERROR while trying to check how fast operator overloading is working for an expression > > X := A + B + C + C + A + B, where > A,B,C,X are all Real_Vector ( 1 .. N ). > > So my only option was to allocate on the heap using new. But then I lost the clean syntax > > X := A + B + C + C + A + B > > and I had to write instead: > > X.all := A.all + B.all + C.all + C.all + A.all + B.all. > > This is really ugly and annoying because when you are using Real_Arrays for implementing some linear algebra method who relies heavilly on matrix vector products and vector updates, you do need to allocate on the heap (sizes are determined in runtime) and you do need a clean syntax. So, is there any way to simplify my life without using the .all or even without declaring A,B,C,X as access Real_Vector? > Thanks for your time! If you are on linux, then you could set the stack size with $ ulimit -s unlimited $ launch_my_app Regards.