MCPcopy Index your code
hub / github.com/numpy/numpy / linear_solve

Method linear_solve

numpy/f2py/symbolic.py:773–787  ·  view source on GitHub ↗

Return a, b such that a * symbol + b == self. If self is not linear with respect to symbol, raise RuntimeError.

(self, symbol)

Source from the content-addressed store, hash-verified

771 return found
772
773 def linear_solve(self, symbol):
774 """Return a, b such that a * symbol + b == self.
775
776 If self is not linear with respect to symbol, raise RuntimeError.
777 """
778 b = self.substitute({symbol: as_number(0)})
779 ax = self - b
780 a = ax.substitute({symbol: as_number(1)})
781
782 zero, _ = as_numer_denom(a * symbol - ax)
783
784 if zero != as_number(0):
785 raise RuntimeError(f'not a {symbol}-linear equation:'
786 f' {a} * {symbol} + {b} == {self}')
787 return a, b
788
789
790def normalize(obj):

Callers 2

analyzevarsFunction · 0.80
test_linear_solveMethod · 0.80

Calls 3

substituteMethod · 0.95
as_numberFunction · 0.85
as_numer_denomFunction · 0.85

Tested by 1

test_linear_solveMethod · 0.64