From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a24:6794:: with SMTP id u142-v6mr8887575itc.9.1538758077475; Fri, 05 Oct 2018 09:47:57 -0700 (PDT) X-Received: by 2002:a9d:4497:: with SMTP id v23mr154298ote.6.1538758077256; Fri, 05 Oct 2018 09:47:57 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.166.215.MISMATCH!z5-v6no86592ite.0!news-out.google.com!n199-v6ni124itn.0!nntp.google.com!z5-v6no86590ite.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 5 Oct 2018 09:47:56 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.18.64.97; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 76.18.64.97 References: <3f2828df-d54a-4427-bc3c-dc5ef0dc8069@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: A little trouble with very large arrays. From: Shark8 Injection-Date: Fri, 05 Oct 2018 16:47:57 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:54483 Date: 2018-10-05T09:47:56-07:00 List-Id: On Friday, October 5, 2018 at 12:20:34 AM UTC-6, Niklas Holsti wrote: > On 18-10-05 00:38 , Shark8 wrote: > > I'm trying to implement a FITS library for work -- see > > https://fits.gsfc.nasa.gov/standard40/fits_standard40aa.pdf -- > > and have come across some rather interesting problems implementing it. > > > > The main-problem right now is the "Primary Data Array" which can > > have a dimensionality in 1..999, each itself with some non-zero range. > > (In the files these are specified by keywords in the file like > > NAXIS = n, NAXIS1 = n_1, NAXIS2 = n_2, and so on until the NAXISn = n_n > > keyword/value pair is encountered.) > > > > Relatively straightforward, no? > > No. Handling arrays with a variable number of dimensions is not simple. > > > Well, I'd thought I could handle everything with a dimensionality-array > > and generic like: > > > > Type Axis_Count is range 0..999 with Size => 10; > > Type Axis_Dimensions is Array (Axis_Count range <>) of Positive > > with Default_Component_Value => 1; > > ... > > Generic > > Type Element is (<>); > > Dim : Axis_Dimensions:= (1..999 => 1); > > Package FITS.Data with Pure is > > > > Type Data_Array is not null access Array( > > 1..Dim( 1),1..Dim( 2),1..Dim( 3),1..Dim( 4), > > 1..Dim( 5),1..Dim( 6),1..Dim( 7),1..Dim( 8), > > --... > > 1..Dim( 997),1..Dim( 998),1..Dim( 999) > > ) of Element > > Give it some thought. Even if each dimension would have the smallest > sensible length, which is two index values, the total number of elements > in that array would be 2**999, somewhat larger than the memories of > current computers. No, the smallest sensible number of indices is 1, for everything except maybe the first two or three dimensions: eg Image data from a camera, or perhaps topological data from a map (longitude, latitude, elevation). FITS was developed for handling "image" transport by the astronomy world, back when there were 9-bit bytes and such.