Beispiel #1
0
 def _entry(self, i, j):
     if self.diagonal_length is not None:
         if Ge(i, self.diagonal_length) is S.true:
             return S.Zero
         elif Ge(j, self.diagonal_length) is S.true:
             return S.Zero
     eq = Eq(i, j)
     if eq is S.true:
         return self.arg[i, i]
     elif eq is S.false:
         return S.Zero
     return self.arg[i, j]*KroneckerDelta(i, j)
Beispiel #2
0
def test_Relational():
    assert mcode(Eq(x, y)) == "x == y"
    assert mcode(Ne(x, y)) == "x != y"
    assert mcode(Le(x, y)) == "x <= y"
    assert mcode(Lt(x, y)) == "x < y"
    assert mcode(Gt(x, y)) == "x > y"
    assert mcode(Ge(x, y)) == "x >= y"