Dear all,

In writing a routine for QR decomposition of matrices 
(http://rosettacode.org/wiki/QR_decomposition#Axiom), I needed a domain that 
combined Fields (+,-,*,/), RadicalCategory (sqrt - for normed length of a 
vector) and OrderedRing (sign). I satisfied this using:

    if not(R has OrderedRing) and R has ConvertibleTo(Float) then
      sign(x:R):Integer == sign(convert(x)$R @ Float)

Pleasantly, this allows a QR decomposition using Integers, Fractions or 
AlgebraicNumbers (as well as Float and DoubleFloat):

m := matrix [[12, -51, 4], [6, 167, -68], [-4, 24, -41]];
qr m

             +  6    69     58 +
             |- -   ---    --- |
             |  7   175    175 |
             |                 |    +- 14  - 21    14 +
             |  3    158     6 |    |                 |
   (2)  [q= |- -  - ---  - ---|,r= | 0    - 175   70 |]
             |  7    175    175|    |                 |
             |                 |    + 0      0    - 35+
             | 2      6    33  |
             | -   - --    --  |
             + 7     35    35  +

          Type: Record(q: Matrix(AlgebraicNumber),r: Matrix(AlgebraicNumber))

Is there a better solution to this problem? 

Kindly, Mark.

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to