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,c370342fe303517b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Newsgroups: comp.lang.ada Subject: Re: C Interface example From: Georg Bauhaus In-Reply-To: <1170526166.831811.237660@h3g2000cwc.googlegroups.com> References: <1170516037.435847.326440@p10g2000cwp.googlegroups.com> <45c4cae7$1_4@news.bluewin.ch> <1170526166.831811.237660@h3g2000cwc.googlegroups.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: # Message-Id: <1170530269.24067.10.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Date: Sat, 03 Feb 2007 20:17:50 +0100 NNTP-Posting-Date: 03 Feb 2007 20:17:43 CET NNTP-Posting-Host: e9f8bf95.newsspool3.arcor-online.net X-Trace: DXC=Um]G:Ff6ejVhFBW4haRP]7aACnH\T<:6Vd X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:8891 Date: 2007-02-03T20:17:43+01:00 List-Id: On Sat, 2007-02-03 at 10:09 -0800, artifact.one@googlemail.com wrote: > On Feb 3, 5:48 pm, Gautier wrote: > > Looking at your code the most simple and portable way will be not to interface > > at all with C! > > > > package Vectors is > > > > type Vector is array(Natural range <>) of Float; > > > > procedure Add(va: in out Vector; vb: in Vector); > > > > end Vectors; In fact, Ada 2007 will provide this in the standard library, with Ada.Numerics.Real_Arrays; va, vb, result: Real_Array(1 .. n); result := va + vb; Not sure whether there is a big performance penalty when not modifying va in place. > Yes this was quite a contrived example because my real version of > vec_add() > actually calls Altivec, SSE, SSE2 or pure C code depending on detected > hardware, > which stretches on to about 300 lines. Any reason to dismiss the BLAS libraries optimized for the respective processors?