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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,99a6311c4195e21b X-Google-Attributes: gid103376,public From: Gautier Subject: Re: Matrix Multiplication Date: 1999/12/15 Message-ID: <3857B51F.4B1E0F1E@maths.unine.ch>#1/1 X-Deja-AN: 560995550 Content-Transfer-Encoding: 7bit References: <385699B5.59C14D03@lmco.com> <3856C9A1.F89EFD8@maths.unine.ch> <5l1f5s4kck891a2s6o8bhvkirm4q79hm6c@4ax.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Universite de =?iso-8859-1?Q?Neuch=E2tel?= MIME-Version: 1.0 Reply-To: Gautier.deMontmollin@maths.unine.ch Newsgroups: comp.lang.ada Date: 1999-12-15T00:00:00+00:00 List-Id: > Intrigued about the 'renames' bit. I thought the renames was just a > compiler overhead and had no run-time effect at all. IIRC the renames takes `aliases' the its target its present state. E.g. declare x: thing renames complicated(i,j).k; begin -- i,j could change, doesn't affect x The ARM gurus will comment better... Anyway it is a way to obtain a direct pointer to `complicated(i,j).k', not just a syntaxic alias. On my tests with sparse matrices, `renames' in the matrix-vector multiplication simply *halves* the computation time of the whole BiCGStab algorithm (compiled on Compaq (DEC) Ada)! The `renames' are procedure Mult( A: in out CRS_matrix; u: vector; w: in out vector ) is deb, fin, jaj: index; ui, wi, wi_sum: real; rows: constant index:= A.rows; val: vector renames A.val; col_ind: index_array renames A.col_ind; row_ptr: index_array renames A.row_ptr; begin if not A.symmetric then -- *** la matrice est memorisee sous forme non symetrique for i in 1..rows loop deb := row_ptr(i); fin := row_ptr(i + 1) - 1; wi_sum := 0.0; for j in deb .. fin loop wi_sum := wi_sum + val(j) * u(col_ind(j)); end loop; w(i) := wi_sum; end loop; ... GNAT optimizer (-O2) is smarter for memorizing these addresses, but sometimes one has to help it too with a small `renames' (testings for textured 3D)... -- Gautier _____\\________________\_______\_________ http://members.xoom.com/gdemont/gsoft.htm