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)])
def __ifloordiv__(self, other): # self //= other raise errors.InvalidOperation("DGSolution", "//=")
def __imatmul__(self, other): # self @= other raise errors.InvalidOperation("DGSolution", "@=")
def __ror__(self, other): # other | self raise errors.InvalidOperation("DGSolution", "|")
def __rxor__(self, other): # other ^ self raise errors.InvalidOperation("DGSolution", "^")
def __lt__(self, other): raise errors.InvalidOperation("DGSolution", "<")
def __ixor__(self, other): # self ^= other raise errors.InvalidOperation("DGSolution", "^=")
def __irshift__(self, other): # self >>= other raise errors.InvalidOperation("DGSolution", ">>=")
def __rpow__(self, other): # other ** self raise errors.InvalidOperation("DGSolution", "**")
def __rdivmod(self, other): # divmod(other, self) raise errors.InvalidOperation("DGSolution", "divmod")
def __rmod__(self, other): # other % self raise errors.InvalidOperation("DGSolution", "%")
def __rfloordiv__(self, other): # other // self raise errors.InvalidOperation("DGSolution", "//")
def __rtruediv__(self, other): # other / self raise errors.InvalidOperation("DGSolution", "/")
def __rmatmul__(self, other): # other @ self raise errors.InvalidOperation("DGSolution", "@")
def __ge__(self, other): raise errors.InvalidOperation("DGSolution", ">=")
def __imod__(self, other): # self %= other raise errors.InvalidOperation("DGSolution", "%=")
def __ilshift__(self, other): # self <<= other raise errors.InvalidOperation("DGSolution", "<<=")
def __rlshift__(self, other): # other << self raise errors.InvalidOperation("DGSolution", "<<")
def __iand__(self, other): # self &= other raise errors.InvalidOperation("DGSolution", "&=")
def __rrshift__(self, other): # other >> self raise errors.InvalidOperation("DGSolution", ">>")
def __ior__(self, other): # self |= other raise errors.InvalidOperation("DGSolution", "|=")
def __rand__(self, other): # other & self raise errors.InvalidOperation("DGSolution", "&")