From: Jim Paloander <dhmos.altiotis@gmail.com> Subject: Re: Real_Arrays on heap with overloaded operators and clean syntax Date: Wed, 25 Jan 2023 01:50:56 -0800 (PST) [thread overview] Message-ID: <d3371ebb-d11e-4515-88fb-2ba7714d0eaan@googlegroups.com> (raw) In-Reply-To: <f0be0bc2-179a-4935-a0d9-15ec48c337ebn@googlegroups.com> Dear Gautier, thank you for the draft. Indeed something like that would be great possibly without polynomials or rational numbers etc. You just need doubles and/or floats and complex numbers. Sparse matrices are another animal, and once adopted they are another dimension of complexity. This is because apart from the triplet format which is easily expandable, one may also need to convert the triplet to CSR and there multiple entries with same row and column index need first to be summed so we have a single entry (i, j, value) for each (i, j) before converting to CSR. So I mean, one would like to build a library then and I am not so sure how easy would be to hardcode this library so that operations on matrices/vectors are as efficient as in Fortran. For Dense matrices it may still be possible to support mathematical expressions without introducing temporary objects. But if you also bring sparse into the game then? (alpha,beta,gamma scalars, while x,y,z,w vectors, A, B_sparse matrices) does this have a chance to be executed without temporaries? y := alpha*x + beta*A*x + gamma*B_sparse*(z-w) this has a chance to be executed without temporaries Fortran already does it. y := alpha*x + beta*A*x I would create a SparseMatrix library and break the statement above in 2 y1 := B_sparse*(z-w) y := alpha*x + beta*A*x + gamma*y1; I could survive with that. The problem dear Gautier is the temporary objects in such libraries. Very correctly J.P.Rosen suggested BLAS. The problem is that for simple vector operations (BLAS1) there is no speedup at all and the operations of BLAS1 cannot be executed for the whole expression, just in an `axpy (a*x+y)` manner one by one. This would require transversal of the arrays many times in a long expression involving vectors as (y := x1 + x2*alpha + beta*(x3-gamma*x4) + alpha*beta*(x1-x2)). For BLAS2 operations (matrix times vector) you may see a performance gain using BLAS but for large matrices, very large. Where you definitely see such a performance gain is for BLAS3 and there we definitely need something like that. This discussion started about techniques to avoid generation of temporaries. Even when you manipulate complex numbers you introduce temporaries. I need to come back to you guys with some number to understand the problem better. I will be back with these numbers. But until then, please let me know, do you feel that there is a need of a performance uplifting and mathematics enabling ADA library which is not Real_Arrays or Containers, but a real Math library allowing Real and Complex math manipulation and integrating possibly some Lapack routines as Real_Arrays do at the moment?

next prev parent reply other threads:[~2023-01-25 9:50 UTC|newest]Thread overview:34+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-22 21:34 Real_Arrays on heap with overloaded operators and clean syntax Jim Paloander 2023-01-22 21:56 ` Joakim Strandberg 2023-01-22 22:07 ` Jim Paloander 2023-01-22 22:42 ` Joakim Strandberg 2023-01-22 22:49 ` Jim Paloander 2023-01-22 23:11 ` Joakim Strandberg 2023-01-22 23:14 ` Gautier write-only address 2023-01-23 1:14 ` Leo Brewin 2023-01-23 6:01 ` Jim Paloander 2023-01-23 8:39 ` G.B. 2023-01-22 22:13 ` Dmitry A. Kazakov 2023-01-22 22:36 ` Jim Paloander 2023-01-23 8:28 ` Dmitry A. Kazakov 2023-01-24 1:04 ` Jim Paloander 2023-01-24 10:42 ` J-P. Rosen 2023-01-25 9:52 ` Jim Paloander 2023-01-25 12:21 ` J-P. Rosen 2023-01-25 22:41 ` Gautier write-only address 2023-01-26 19:08 ` Jim Paloander 2023-01-22 23:18 ` Rod Kay 2023-01-22 23:20 ` Jim Paloander 2023-01-22 23:34 ` Rod Kay 2023-01-22 23:53 ` Joakim Strandberg 2023-01-23 7:50 ` Egil H H 2023-01-23 8:51 ` J-P. Rosen 2023-01-23 6:34 ` Rod Kay 2023-01-23 6:56 ` Jim Paloander 2023-01-23 7:31 ` Rod Kay 2023-01-24 19:47 ` Gautier write-only address 2023-01-24 23:02 ` Gautier write-only address2023-01-25 9:50 ` Jim Paloander [this message]2023-01-26 20:39 ` Jerry 2023-01-26 21:52 ` Jim Paloander 2023-02-02 21:59 ` Jerry

replies disabled

This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox