Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

C is quirky, flawed, and an enormous success -- Dennis M. Ritchie


devel / comp.lang.ada / Implicit_Dereference for Real_Vectors ?

SubjectAuthor
o Implicit_Dereference for Real_Vectors ?Jim Paloander

1
Implicit_Dereference for Real_Vectors ?

<ce32beb1-373d-411a-8b05-2c293df7249dn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9251&group=comp.lang.ada#9251

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:1278:b0:705:74fe:b39a with SMTP id b24-20020a05620a127800b0070574feb39amr1146196qkl.616.1674424356542;
Sun, 22 Jan 2023 13:52:36 -0800 (PST)
X-Received: by 2002:a05:6870:7a10:b0:132:79b1:f85 with SMTP id
hf16-20020a0568707a1000b0013279b10f85mr1997900oab.274.1674424356310; Sun, 22
Jan 2023 13:52:36 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sun, 22 Jan 2023 13:52:36 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=157.143.56.236; posting-account=Wbe3fAoAAAALa8UT9MWTy6mw2ahlRJms
NNTP-Posting-Host: 157.143.56.236
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ce32beb1-373d-411a-8b05-2c293df7249dn@googlegroups.com>
Subject: Implicit_Dereference for Real_Vectors ?
From: dhmos.altiotis@gmail.com (Jim Paloander)
Injection-Date: Sun, 22 Jan 2023 21:52:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2710
 by: Jim Paloander - Sun, 22 Jan 2023 21:52 UTC

Dear ADA experts,
is it possible to extend an inherent ADA package such Real_Arrays with something like this?

type Accessor (Data: not null access Real_Vector) is limited private with Implicit_Dereference => Data;

In the hope that I could somehow declare:
A: Accessor := new Real_Vector ( 1 .. N );
B: Accessor := new Real_Vector ( 1 .. N );
X: Accessor := new Real_Vector ( 1 .. N );

So I could write a statement:
X := A + B;
instead of
X.all := A.all + B.all;
since I am forced to use heap allocation for N > 100,000? Sorry for my ignorance but I am new to ADA and I cannot find enough documentation. Containers seem to be awful in terms of syntax for mathematical programming and linear algebra, and the fact that Real_Arrays allow clean syntax for operator overloading only if allocated on the limited stack is really extremely frustrating. I totally understand the preference for stack over heap for certain applications, but for the applications I have in mind the size of the problem is determined at runtime. There is no way to know it in advance. I tried -D1000m -d1000m in the binder options to no avail. Always I get the STACK_OVERFLOW error. My only option is heap. Moreover, I would expect that ADA's Numerics are as efficient as Fortran's overloaded operators and no temporary objects are generated when you do something like:
X := A + B + C + A + B;

Unfortunately ADA introduces a temporary for every addition that is added to the next creating a 2nd temporary and so on.
temp1 := A+B; temp2 := C+temp1; temp3 := B+temp2; temp4 := A+temp3; X := temp4;


devel / comp.lang.ada / Implicit_Dereference for Real_Vectors ?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor