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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8c424d8135e68278 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-22 13:41:45 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.direct.ca!look.ca!brick.direct.ca!brie.direct.ca.POSTED!not-for-mail Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii; format=flowed From: FGD MIME-Version: 1.0 Message-ID: <3C24FFAD.4010002@look.ca> NNTP-Posting-Date: Sat, 22 Dec 2001 13:38:35 PST NNTP-Posting-Host: 209.148.72.159 Newsgroups: comp.lang.ada Organization: Look Communications - http://www.look.ca References: <9v4jsj$bd1$1@infosun2.rus.uni-stuttgart.de> <9vt3vi$dmd$1@nh.pace.co.uk> <3C22468C.30901@look.ca> <9vti0r$jrj$1@nh.pace.co.uk> <3C236F94.7020101@look.ca> <9vvtrf$iqq$1@nh.pace.co.uk> Subject: Re: Math Libraries (was Re: Ada2005) User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1 X-Accept-Language: en-us X-Complaints-To: abuse@look.ca X-Trace: brie.direct.ca 1009057115 209.148.72.159 (Sat, 22 Dec 2001 13:38:35 PST) Date: Sat, 22 Dec 2001 16:48:29 -0500 Xref: archiver1.google.com comp.lang.ada:18251 Date: 2001-12-22T16:48:29-05:00 List-Id: I'm not completely for extending Ada to include new math types. As I stressed earlier such extensions would generally be useless for most people. The only possible exception I can see is linear algebra... Marin David Condic wrote: > "FGD" wrote in message news:3C236F94.7020101@look.ca... > >>I agree that linear algebra types such as vector and matrix would be a >>nice language extension. These would benefit the most from hardware >> > > I don't know that it needs to be a language extension. That starts asking > for something that is harder to do than simply providing a package and I > don't see an enormous amount of utility to it. Most Ada programmers would > probably easily comprehend and work with a package that defined "+" and so > on for a vector or matrix type so I think you could get the features (albeit > maybe not quite as cleanly) without forcing the compiler writers to make the > language itself more complex. The reason why I mentionned it as a language extension is that the "matrix type" is simply not efficient when represented as an array of coefficients. Having a language defined matrix type acting on vector types leaved the compiler writers free to use whatever internal representation they like. >>extensions such as SIMD, and having them within the language would >>ensure that all target machines are exploited to their full potential. >> >> > Obviously, it would be advantageous for a compiler writer to take advantage > of any underlying hardware rather than rely strictly on Ada syntax to > implement the type. The nice thing about implementing it as a package is > that the body could be implementation dependent, but the spec could be > portable. If you've got the hardware, implement it in assembler. Of course, that's what we currently do---in Ada and all other general-purpose languages. But one of the main advantages of Ada is low maintenace cost. I, for one, write and maintain a lot of such packages but almost all of my maintenance work goes into code that looks like: procedure Whatever ... begin case Machine is when Alpha_EV4 => Asm(.... when X86_Pentium_3 => Asm(.... when others => .... end case; end Whatever; For example, when Intel released the Pentum 4, I spent weeks rewrite and test asm code for relatively basic little things. I still have months to go writing and testing new code for the Itanium chip... and then the AMD-64... Sigh! :-( For such code, Ada doesn't present any more advantages than any other language. Of course, that only leaves the burden of asm maintenance to compiler writers. Still having a few non-elementary types such as matrix and vector would make my life a lot simpler sometimes. >>I'm not too sure about stats. Basic stats can be handled with linear >>algebra and elementary math. The problem is that it's not clear where to >>stop. It's something to think about... >> >> > I'm thinking that some packages to get you things like mean, variance, > standard deviation, etc., from arrays of various numeric types would be > enough - for now. :-) (I've got some packages that do this already - it > really isn't that hard to implement.) Sure, you could imagine all kinds of > wonerful sophistication that one might get from a true statistical package, > but why push our luck? Settle for some nice, basic statistics that let > people throw some analysis into their run-of-the-mill apps rather than shoot > for something that would satisfy the full-blown statisticians. It would > still be ahead of most other languages I'm aware of and wouldn't require > some major revision to the language syntax or semantics. There are already lots of stuff out there to satisfy "full-blown" statisticians and mathematicians. Ada has no business there. We should focus on stuff that is useful to a great deal of people. As far as I can tell, linear algebra with all of its applications is the only branch of math which is useful to a great deal of people. BTW mean, variance and standard deviation are all linear algebra except maybe for a few square roots here and there. -- Frank