From: Andrew Rieck (arieck_at_[hidden])
Date: 2005-07-11 20:14:13
would provide a very clean solution for selecting specializations based on
In this case the above library relies on the SFINAE principle.
ublas-bounces_at_[hidden] wrote on 12/07/2005 09:29:46 AM:
> > The use of "abs" etc. in traits class may be worth, if you decide to
> > enable "contexts" in calls to ublas:
> > May be this example is too "corner case" , but anyway :) .
> > Suppose that I have a "scalar" class C , which is internally
> > to 2x2 matrix.
> Your example reminds me of a few points I have raised before, which
> I re-state
> in a different context. If your C class is isomorphic to a 2x2 matrix,
> make it a little more concrete and consider a 2x2 matrix of double.
> You want to use C as a scalar class with uBLAS. It would not be safe to
> this if:
> 1) uBLAS assumed that every non-zero element of class C has a
> inverse. See http://mathworld.wolfram.com/DivisionAlgebra.html
> Your class C would have to cope with elements of C which do not have an
> inverse. Maybe it would return a NaN result, or throw an exception when
> for 1/c, where c is in C and c has no inverse. Then uBLAS would have to
> with NaN (or an exception) as a result of 1/c.
> 2) uBLAS assumed that multiplication is commutative.
> See http://mathworld.wolfram.com/CommutativeRing.html
> If you hand uBLAS two scalars, a and b of type C, where a*b != b*a, then
> would want to be sure that there are no places in uBLAS which assume
> a*b == b*a.
> Then again, maybe either or both of these assumptions allow some
> optimization somewhere in uBLAS. In this case, you would want uBLAS to
> provide some sort of ring_traits, such as is_division_ring<T>,
> is_commutative_ring<T>. Then uBLAS would be able to have different code
> the different cases, allowing both correct operation and optimization
> The same ideas apply to the other field and ring axioms, although I
> personally draw the line at addition. AFAICT, it is reasonable to assume
> any scalar class K used with addition in uBLAS would be such that K
> Abelian group under addition (possibly subject to IEEE arithmetic and
> rounding error).
> Maybe the best idea would be to assume that any scalar class K which is
> with the algebraic operations of uBLAS would be such that K models a
> and then supply ring_traits to cover the extra axioms between ring and
> See http://mathworld.wolfram.com/Ring.html
Please consider our environment before printing this email.
WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately.
It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments.
This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision.
Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency.
Westpac Banking Corporation ABN 33 007 457 141.