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

forwardSubstitution -- Forward substitution.

Synopsis

Description

Solves the system L*x=b via forward substitution.
i1 : A=random(QQ^3,QQ^3)

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

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

o3 = | 8    5/2    4         |
     | 3/40 25/16  11/30     |
     | 7/72 61/225 1727/3375 |

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

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

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

o5 = | 8 5/2   4         |
     | 0 25/16 11/30     |
     | 0 0     1727/3375 |

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

o6 = | 1    0      0 |
     | 3/40 1      0 |
     | 7/72 61/225 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/4        |
     | 1419/160   |
     | -9671/9000 |

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

o10 = | -9105/13816  |
      | 1937/314     |
      | -29013/13816 |

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

o11 = true

See also

Ways to use forwardSubstitution :