Article View: comp.lang.misc
Article #1086Re: Scientists as Programmers (was Re: Small Language Wanted)
From: Stephen J Bevan
Date: Sat, 29 Aug 1992 18:15
Date: Sat, 29 Aug 1992 18:15
41 lines
1962 bytes
1962 bytes
In article <17n6fjINNhvt@network.ucsd.edu> mbk@lyapunov.ucsd.edu (Matt Kennel) writes:
I have no idea what Mr Rubin really wants but here are a couple of
easy ones of the top of my head:
P, D, Q <- singular_value_decomposition(A);
How about :-
(p,d,q) = singular_value_decomposition A
Array index notation:
for all i <= j: a(i,j) <- sum over (k) ( b(i,k)*c(j,N,k) )
I'm not _exactly_ sure what the above does (e.g. is N constant?), so
the following may be wrong (but it is better than my previous attempt
which I hopefully cancelled correctly :-)
foo b c = array bds vs
where
vs = [ (i,j) := f i j | (i,j) <- range bds, i <= j ]
f i j = sum [ b!(i,k)*c!(j,n,k) | k <- range (klb,kub) ]
bds = ((ilb,jlb),(iub,jub))
((ilb,klb),(iub,kub)) = bounds b
((jlb,_,_),(jub,n,_)) = bounds c
An alternative (and possibly more efficient) version of _vs_ is :-
vs = [ (i,j) := f i j | i <- range (ilb,iub), j <- range (i,jub) ]
Note this is untested as I currently don't have a compiler installed.
As to the notation, I'll do you a deal: you explain the one you're
using and I'll explain the one I'm using :-)
I won't bore you with the obvious complex numbers, exponentiation, etc.
Why not, you may be pleasantly suprised.
bevan
Technical Details
Message-ID:
<BEVAN.92Aug29191507@tiger.cs.man.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!kithrup!stanford.edu!ames!haven.umd.edu!darwin.sura.net!gatech!bloom-beacon!eru.mt.luth.se!lunic!sunic!mcsun!uknet!mucs!m1!bevanReferences:
<BEVAN.92Aug28195448@tiger.cs.man.ac.uk> <17n6fjINNhvt@network.ucsd.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!kithrup!stanford.edu!ames!haven.umd.edu!darwin.sura.net!gatech!bloom-beacon!eru.mt.luth.se!lunic!sunic!mcsun!uknet!mucs!m1!bevan From: bevan@cs.man.ac.uk (Stephen J Bevan) Newsgroups: comp.lang.misc Subject: Re: Scientists as Programmers (was Re: Small Language Wanted) Message-ID: <BEVAN.92Aug29191507@tiger.cs.man.ac.uk> Date: 29 Aug 92 18:15:07 GMT References: <BEVAN.92Aug28195448@tiger.cs.man.ac.uk> <17n6fjINNhvt@network.ucsd.edu> Sender: news@cs.man.ac.uk Organization: Department of Computer Science, University of Manchester Lines: 41 In-reply-to: mbk@lyapunov.ucsd.edu's message of 29 Aug 92 06:46:11 GMT