Article View: comp.lang.misc
Article #1204The number of aliasing patterns for N arrays
From: brnstnd
Date: Thu, 12 Apr 1990 21:38
Date: Thu, 12 Apr 1990 21:38
22 lines
1782 bytes
1782 bytes
In article <14332@lambda.UUCP> jlg@lambda.UUCP (Jim Giles) writes: > From article <20080@megaron.cs.arizona.edu>, by gudeman@cs.arizona.edu (David Gudeman): > > Actually, it increases exponentially with the number of aliasing > > patterns in the arguments of the functions. For a function of 3 > > array arguments, the maximum number of versions needed is 2^3 = 8. > No, the number increases combinatorially. Aliasing occurs pairwise > between arguments (an/or global data). So, the number of potentially > aliased pairs is N choose 2, ie. a binomial coefficient. [ implying that the number of versions is 2^(N choose 2), not 2^N ] Hmmm, this doesn't sound right. After all, if A and B could be aliased, and B and C could be aliased, then A and C could be aliased. (This is why the natural keyword is ``alias,'' not ``noalias.'') I count 2 for 2, 5 for 3, 15 for 4, 52 for 5, 218 for 6. Go figure. Anyway, this is all irrelevant, because as Jim loves to remind us, aliasing is rarely useful. (It can't be---otherwise Fortran would allow it.) Therefore you only need two versions: the amazingly fast one for no aliasing, and the slow one for the rare cases. Right, Jim? ---Dan
Technical Details
Message-ID:
<548:Apr1221:38:3790@stealth.acf.nyu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!samsung!zaphod.mps.ohio-state.edu!rpi!sci.ccny.cuny.edu!phri!cmcl2!stealth.acf.nyu.edu!brnstndReferences:
<20080@megaron.cs.arizona.edu> <14332@lambda.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!samsung!zaphod.mps.ohio-state.edu!rpi!sci.ccny.cuny.edu!phri!cmcl2!stealth.acf.nyu.edu!brnstnd From: brnstnd@stealth.acf.nyu.edu Newsgroups: comp.lang.misc Subject: The number of aliasing patterns for N arrays Message-ID: <548:Apr1221:38:3790@stealth.acf.nyu.edu> Date: 12 Apr 90 21:38:37 GMT References: <20080@megaron.cs.arizona.edu> <14332@lambda.UUCP> Reply-To: brnstnd@stealth.acf.nyu.edu (Dan Bernstein) Distribution: usa Organization: IR Lines: 22 X-Original-Subject: Re: Pointers as 3-tuples