next | previous | forward | backward | up | top | index | toc | Macaulay2 website
AdjointIdeal :: forwardSubstitution

forwardSubstitution -- Forward substitution.

Synopsis

Description

Solves the system L*x=b via forward substitution.

i1 : A=random(QQ^3,QQ^3)

o1 = | 9/2 1/2 3/2 |
     | 1/2 1   3/4 |
     | 9/4 3/4 7/4 |

              3        3
o1 : Matrix QQ  <--- QQ
i2 : (perm,LR)=LRdecomposition(A,j->-j);
i3 : LR

o3 = | 9/2 1/2   3/2   |
     | 1/9 17/18 7/12  |
     | 1/2 9/17  47/68 |

              3        3
o3 : Matrix QQ  <--- QQ
i4 : P=transpose (id_(QQ^3))_perm

o4 = | 1 0 0 |
     | 0 1 0 |
     | 0 0 1 |

              3        3
o4 : Matrix QQ  <--- QQ
i5 : R=extractRightUpper(LR)

o5 = | 9/2 1/2   3/2   |
     | 0   17/18 7/12  |
     | 0   0     47/68 |

              3        3
o5 : Matrix QQ  <--- QQ
i6 : L=extractLeftLower(LR)

o6 = | 1   0    0 |
     | 1/9 1    0 |
     | 1/2 9/17 1 |

              3        3
o6 : Matrix QQ  <--- QQ
i7 : L*R==P*A

o7 = true
i8 : b=random(QQ^3,QQ^1);

              3        1
o8 : Matrix QQ  <--- QQ
i9 : y=forwardSubstitution(LR,P*b)

o9 = | 7/9      |
     | 497/810  |
     | -109/510 |

              3        1
o9 : Matrix QQ  <--- QQ
i10 : x=backwardSubstitution(LR,y)

o10 = | 386/2115  |
      | 1778/2115 |
      | -218/705  |

               3        1
o10 : Matrix QQ  <--- QQ
i11 : inverse(A)*b==x

o11 = true

See also

Ways to use forwardSubstitution :

For the programmer

The object forwardSubstitution is a method function.