|
Boost : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-03-25 22:49:15
Too bad we can't overload operator,() for integers. There is no way we can
write A[1,2,3]. Though, we may be able to get something close to it...
On Sun, 25 Mar 2001, Doug Gregor wrote:
gregod>
gregod> A[1 <= stride(1) < 2, 2 <= stride(2) <= 8]
gregod>
gregod> Specifying intervals using function notation is unfortunate in C++ because
gregod> the use of parentheses or brackets doesn't match the mathematical notation.
gregod> The range (a, b) expressed mathematically is unambiguous, but if we have a
gregod> C++ functoin call interval(a, b) the user will always be sent back to the
gregod> documentation to figure out what happens at the endpoints. Using relational
gregod> operators it is unambiguous.
gregod>
gregod> While I'm throwing out random syntax, an interface between the lambda library
gregod> and the multidim array/matrix/linear algebra library could allow for some
gregod> really nice code:
gregod>
gregod> // A is M x N, B is N x R
gregod> indexer<int> i, j, k;
gregod> C[i, j] = sum(A[i, k] * B[k, j], for_all(0 <= k < N)),
gregod> for_all(0 <= i < M, 0 <= j < R);
gregod>
gregod> And for a really neat trick, have the library tile this loop nest :)
gregod>
gregod> Doug
gregod>
gregod> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
gregod>
gregod>
gregod> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
gregod>
gregod>
gregod>
----------------------------------------------------------------------
Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
Ph.D. Candidate email: jsiek_at_[hidden]
Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk