Example #1
0
    def divergence(self, x):
        # x.shape (num_dims, points.shape)
        # return shape (sub_output_shape, points.shape)
        num_dims = x.shape[0]
        if num_dims != self.num_eqns:
            raise errors.InvalidOperation("XFunction", "divergence")

        # jacobian shape (num_eqns, sub_output_shape, num_dims, points.shape)
        jacobian = self.jacobian(x)
        index = (slice(o) for o in self.sub_output_shape)
        return sum([jacobian[(i,) + index + (i,)] for i in range(num_dims)])
Example #2
0
 def __ifloordiv__(self, other):
     # self //= other
     raise errors.InvalidOperation("DGSolution", "//=")
Example #3
0
 def __imatmul__(self, other):
     # self @= other
     raise errors.InvalidOperation("DGSolution", "@=")
Example #4
0
 def __ror__(self, other):
     # other | self
     raise errors.InvalidOperation("DGSolution", "|")
Example #5
0
 def __rxor__(self, other):
     # other ^ self
     raise errors.InvalidOperation("DGSolution", "^")
Example #6
0
 def __lt__(self, other):
     raise errors.InvalidOperation("DGSolution", "<")
Example #7
0
 def __ixor__(self, other):
     # self ^= other
     raise errors.InvalidOperation("DGSolution", "^=")
Example #8
0
 def __irshift__(self, other):
     # self >>= other
     raise errors.InvalidOperation("DGSolution", ">>=")
Example #9
0
 def __rpow__(self, other):
     # other ** self
     raise errors.InvalidOperation("DGSolution", "**")
Example #10
0
 def __rdivmod(self, other):
     # divmod(other, self)
     raise errors.InvalidOperation("DGSolution", "divmod")
Example #11
0
 def __rmod__(self, other):
     # other % self
     raise errors.InvalidOperation("DGSolution", "%")
Example #12
0
 def __rfloordiv__(self, other):
     # other // self
     raise errors.InvalidOperation("DGSolution", "//")
Example #13
0
 def __rtruediv__(self, other):
     # other / self
     raise errors.InvalidOperation("DGSolution", "/")
Example #14
0
 def __rmatmul__(self, other):
     # other @ self
     raise errors.InvalidOperation("DGSolution", "@")
Example #15
0
 def __ge__(self, other):
     raise errors.InvalidOperation("DGSolution", ">=")
Example #16
0
 def __imod__(self, other):
     # self %= other
     raise errors.InvalidOperation("DGSolution", "%=")
Example #17
0
 def __ilshift__(self, other):
     # self <<= other
     raise errors.InvalidOperation("DGSolution", "<<=")
Example #18
0
 def __rlshift__(self, other):
     # other << self
     raise errors.InvalidOperation("DGSolution", "<<")
Example #19
0
 def __iand__(self, other):
     # self &= other
     raise errors.InvalidOperation("DGSolution", "&=")
Example #20
0
 def __rrshift__(self, other):
     # other >> self
     raise errors.InvalidOperation("DGSolution", ">>")
Example #21
0
 def __ior__(self, other):
     # self |= other
     raise errors.InvalidOperation("DGSolution", "|=")
Example #22
0
 def __rand__(self, other):
     # other & self
     raise errors.InvalidOperation("DGSolution", "&")