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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ad3b8638a6e09884 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!news.uni-weimar.de!not-for-mail From: stefan-lucks@see-the.signature Newsgroups: comp.lang.ada Subject: Re: Incorrect error? Date: Mon, 18 Jul 2011 11:45:37 +0200 Organization: Bauhaus-Universitaet Weimar Message-ID: References: <4e23f350$0$2573$703f8584@news.kpn.nl> Reply-To: stefan-lucks@see-the.signature NNTP-Posting-Host: medsec1.medien.uni-weimar.de Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: tigger.scc.uni-weimar.de 1310981113 1226 141.54.178.228 (18 Jul 2011 09:25:13 GMT) X-Complaints-To: news@tigger.scc.uni-weimar.de NNTP-Posting-Date: Mon, 18 Jul 2011 09:25:13 +0000 (UTC) X-X-Sender: lucks@medsec1.medien.uni-weimar.de In-Reply-To: <4e23f350$0$2573$703f8584@news.kpn.nl> Xref: g2news1.google.com comp.lang.ada:20213 Date: 2011-07-18T11:45:37+02:00 List-Id: On Mon, 18 Jul 2011, ldries46 wrote: [...] > a : Real_Vector(0 .. 2); > b : Real_Vector(0 .. 2); > cross : Real_Vector(0 .. 2); > begin [...] > Cross := a * b; -- VecCross( a, b, Cross ); <---------------- line 65 the Why do you expect the product of two vectors to be an vector? Mathematical convention knows the "inner product" of two vectors (a single real value) and the "outer product" (a matrix). Ada.Numerics.Generic_Real_Arrays actually provides both: function "*" (Left, Right : Real_Vector) return Real'Base; function "*" (Left, Right : Real_Vector) return Real_Matrix; So if M is a Real_Matrix(0..2,0..2) and F a float, you can write either M := a * b; -- outer product or F := a * b; -- inner product but not Cross := a * b; -- there is no such "*" defined in Ada.Num.Gen_Re_Arr. Please don't ask me why the inner product is of type "Real'Base", instead of "Real". I'd like to know that myself. ;-) BTW, the error messages are not very helpful (at least not until you have seen many of them and are able to translate them for yourself): >65:21 expected type "Ada.Numerics.Generic_Real_Arrays.Real_Vector" > from instance at line 6 >65:21 found type "Ada.Numerics.Generic_Real_Arrays.Real_Matrix" from > instance at line 6 This really means is that there is no function "*" with two Real_Vector parameters as the input and returning a Real_Vector in scope. -- ------ Stefan Lucks -- Bauhaus-University Weimar -- Germany ------ Stefan dot Lucks at uni minus weimar dot de ------ I love the taste of Cryptanalysis in the morning! ------