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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2a34b7ad6c6a0774 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!g17g2000yqe.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Elias_Salom=E3o_Helou_Neto?= Newsgroups: comp.lang.ada Subject: Re: Efficiency of code generated by Ada compilers Date: Wed, 18 Aug 2010 07:00:56 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <1jn1a4o.1dfllwo1uin3imN%csampson@inetworld.net> <1jn36d6.se2f0g1edjjnyN%csampson@inetworld.net> <61f149b9-00ff-40cd-9698-01e69fdc5c0f@v15g2000yqe.googlegroups.com> <1fwir3k681b8x.unwo52g4gt32.dlg@40tude.net> <1etv7lg9vhv75$.1wsmzfmjtatxz$.dlg@40tude.net> NNTP-Posting-Host: 143.107.183.162 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1282140057 13756 127.0.0.1 (18 Aug 2010 14:00:57 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 18 Aug 2010 14:00:57 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: g17g2000yqe.googlegroups.com; posting-host=143.107.183.162; posting-account=8auP9QoAAACkSx2qxJhP83KA6-tg78E8 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.99 Safari/533.4,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:13486 Date: 2010-08-18T07:00:56-07:00 List-Id: > Well, maybe, but it is already done in Ada. Really? This is great. Also, Ada compile-time checking features are (seem to be) truly impressive, but I did not feel compelled to learn a whole new language only because of them. Furthermore, C++ can use so many numeric libraries which I am not sure would be available in Ada that I tend to stay here in my comfort zone. > I don't see any gain, because this is trivial compared to the real > challenges of modeling linear algebraic types. Consider description of th= e > types on which the matrix multiplication is defined. E.g.: NxMxK * KxM = =3D N. > Here NxM denotes matrix with dimensions N and M. Is it one type or many > types or many subtypes? Templates give no choice but many different > unrelated types, when dimensionality is a parameter. Not my choice. Now y= ou > have a combinatorial explosion of overloaded variants. Generate them, all > possible multiplication operation profiles for 4D, 3D, 2D, 1D matrices. > Make the constraint on matrix size in given dimension statically enforced > with an appropriate (understandable!) error messages when sizes are > statically known. Not quite, because you could possibly write a templated operator* that could make use of inhomogeneous operands (by that I mean different types on each side of the operator call). To be honest, I am not sure about how I would fill in the details, nor this is my concern now. But I tend to believe it could be possibly done with compiler generated code in C++0x (thanks to specialization, templates are also Turing complete in that language!). > Allow unconstrained matrices as well. Generate aggregates > for each matrix type. Provide matrix slicing operations for all types of > matrices (e.g. column from matrix, row from matrix, submatrix from matrix > etc). Have fun! I guess I will have! Really, this is fun. Just kidding, but I do not actually see that amount of trouble if you could write a "slice indexing" class that could be passed to some slicing operator (this may not even be needed at all). It would be the proverbial "extra layer of indirection" required to make the job easier, but let us not delve in such details. I really appreciate your interest and would be pleased to go on with our conversation, even though it has gone off-topic. Elias Salom=E3o Helou Neto