MCPcopy Create free account
hub / github.com/numpy/numpy / as_terms

Function as_terms

numpy/f2py/symbolic.py:1059–1071  ·  view source on GitHub ↗

Return expression as TERMS expression.

(obj)

Source from the content-addressed store, hash-verified

1057
1058
1059def as_terms(obj):
1060 """Return expression as TERMS expression.
1061 """
1062 if isinstance(obj, Expr):
1063 obj = normalize(obj)
1064 if obj.op is Op.TERMS:
1065 return obj
1066 if obj.op is Op.INTEGER:
1067 return Expr(Op.TERMS, {as_integer(1, obj.data[1]): obj.data[0]})
1068 if obj.op is Op.REAL:
1069 return Expr(Op.TERMS, {as_real(1, obj.data[1]): obj.data[0]})
1070 return Expr(Op.TERMS, {obj: 1})
1071 raise OpError(f'cannot convert {type(obj)} to terms Expr')
1072
1073
1074def as_factors(obj):

Callers 3

test_sanityMethod · 0.90
__add__Method · 0.85
__mul__Method · 0.85

Calls 5

normalizeFunction · 0.85
ExprClass · 0.85
as_integerFunction · 0.85
as_realFunction · 0.85
OpErrorClass · 0.85

Tested by 1

test_sanityMethod · 0.72