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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,690ce1f62160d05a X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,690ce1f62160d05a X-Google-Attributes: gid1014db,public X-Google-Thread: 1094ba,690ce1f62160d05a X-Google-Attributes: gid1094ba,public X-Google-Thread: 103376,690ce1f62160d05a X-Google-Attributes: gid103376,public From: "E. Robert Tisdale" Subject: Re: How to Design an Application Programmers' Interface (API) Date: 2000/08/11 Message-ID: <399433F8.A56A2C9C@netwood.net>#1/1 X-Deja-AN: 657249002 Content-Transfer-Encoding: 7bit References: <39921178.819F6DCB@netwood.net> <399386EF.4F2AA3E6@netwood.net> <39940E84.B3115EFC@maths.unine.ch> <3994158E.150D1FDA@netwood.net> <39943057.78926BBC@maths.unine.ch> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: newsabuse@supernews.com Organization: Posted via Supernews, http://www.supernews.com MIME-Version: 1.0 Newsgroups: comp.lang.c++,comp.lang.c,comp.lang.fortran,comp.lang.ada Date: 2000-08-11T00:00:00+00:00 List-Id: Gautier wrote: > > I think that Ada numerical application programmers should be able to write > > > C := alpha*product(A, B) + beta*C; > > > and let the compiler resolve the expression to a DGEMM procedure call. > > For scalar things or usage with small vectors > or matrices as output of functions, I would do so. > For bigger structures the procedure is better > - no temporary object in expressions. > In my own (partial) bindings I have both approaches. Why do you assume that the above expression involves temporaries? C++ programmers can implement libraries which resolve this expression to a DGEMM subroutine call. Why can't Ada 95 programmers do the same? > > Calling DGEMM directly from an Ada application program > > abrogates all of the safety feature built into the Ada language. > > It depends on the ratio of BLAS/LAPACK calls in the Ada code. > For my finite element program the "adapter" fits: > there are a few calls that well separate the 1960s programming models > from my year 2000 sources... > It firewalls efficiently the weak-typing headaches > and I can add degrees of complexity with joy and decontraction... > > Anyway you can wrap the adapter into some "Multiply" etc. procedures - > as well as "*" etc. functions. But now you have two interfaces. Wouldn't it have been better to redesign the API and implement it with calls to the BLAS Fortran language binding? > Seems very elegant, but it might be not very efficient > - functional-only, and things like "RESULT := (others => (others => 0.0));" > I don't know of a compiler that just zeroes rapidly RESULT > (also a temp. variable BTW)... We can nitpick forever about the implementation of the API. The question is whether the API will permit us to substitute a better implementation or not. A good API will. A bad API won't.