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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1540032852ee6d61 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!m58g2000cwm.googlegroups.com!not-for-mail From: "Jerry" Newsgroups: comp.lang.ada Subject: Re: Why does this work? (overloads) Date: 8 Feb 2007 02:40:28 -0800 Organization: http://groups.google.com Message-ID: <1170931228.165961.8170@m58g2000cwm.googlegroups.com> References: <1170823163.681564.186260@s48g2000cws.googlegroups.com> <1170881623.149455.139410@j27g2000cwj.googlegroups.com> NNTP-Posting-Host: 67.40.87.12 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1170931260 6373 127.0.0.1 (8 Feb 2007 10:41:00 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 8 Feb 2007 10:41:00 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/420+ (KHTML, like Gecko, Safari/420) OmniWeb/v607.16,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: m58g2000cwm.googlegroups.com; posting-host=67.40.87.12; posting-account=Ax24hA0AAABV39UFqUVhb0kauOuAbI3T Xref: g2news2.google.com comp.lang.ada:9131 Date: 2007-02-08T02:40:28-08:00 List-Id: Jeffrey R. Carter wrote: > Jerry wrote: > > > Yes, but time series are usually indexed from 0. Sometimes, the FFT > > of a time series is indexed from 0 and sometimes -NN/2 .. NN/2-1. When > > one uses a time series in a vector or matrix, conundrums obviously > > arise, not only in computer code but in print. I once figured out how > > to make Pascal let me have it both ways by declaring both types, one > > type indexed 0..NN-1 and the other 1..NN, and then I set a pointer of > > one type to an array originally declared with another type. I'm > > guessing that Ada doesn't allow this, however. > > No pointers needed: > > A : Vector (0 .. N - 1); > B : Vector (1 .. A'Length); > > A := B; > B := A; > > This is called sliding. > Good point. However, it uses twice the memory, and worse, changes made in A are not reflected in B without repeating the assignment A := B (correct?) and vice versa. My Pascal trick had neither of these problems yet carried boundary checking using either name. Maybe there's a way to do this using unrestricted_access variables of GNAT. Jerry