File tree Expand file tree Collapse file tree 5 files changed +11
-11
lines changed Expand file tree Collapse file tree 5 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -690,7 +690,7 @@ cdef class LinearFunctionsParent_class(Parent):
690
690
sage: LF_QQ(f) is f
691
691
False
692
692
"""
693
- if is_LinearFunction(x ):
693
+ if isinstance (x, LinearFunction ):
694
694
return LinearFunction(self , (< LinearFunction> x)._f)
695
695
return LinearFunction(self , x)
696
696
@@ -891,7 +891,7 @@ cdef class LinearFunction(LinearFunctionOrConstraint):
891
891
...
892
892
ValueError: x is from a different linear functions module
893
893
"""
894
- if is_LinearFunction(x ):
894
+ if isinstance (x, LinearFunction ):
895
895
if self .parent() != x.parent():
896
896
raise ValueError (' x is from a different linear functions module' )
897
897
if len ((< LinearFunction> x)._f) != 1 :
Original file line number Diff line number Diff line change 99
99
100
100
from sage .structure .parent import Parent
101
101
from sage .misc .cachefunc import cached_function
102
- from sage .numerical .linear_functions import is_LinearFunction , LinearFunctionsParent_class
102
+ from sage .numerical .linear_functions import LinearFunction , LinearFunctionsParent_class
103
103
from sage .numerical .linear_tensor_element import LinearTensor
104
104
105
105
@@ -415,7 +415,7 @@ def _element_constructor_(self, x):
415
415
M = self .free_module ()
416
416
if isinstance (x , LinearTensor ):
417
417
x = x .dict ()
418
- elif is_LinearFunction ( x ):
418
+ elif isinstance ( x , LinearFunction ):
419
419
x = dict ([key , self ._convert_constant (value )] for key , value in x .dict ().items ())
420
420
elif isinstance (x , dict ):
421
421
x = dict ([int (key ), M (value )] for key , value in x .items ())
Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ cdef class LinearTensor(ModuleElement):
169
169
...
170
170
ValueError: x is from a different linear functions module
171
171
"""
172
- if is_LinearFunction(x ):
172
+ if isinstance (x, LinearFunction ):
173
173
if self .parent().linear_functions() != x.parent():
174
174
raise ValueError (' x is from a different linear functions module' )
175
175
if len ((< LinearFunction> x)._f) != 1 :
Original file line number Diff line number Diff line change @@ -2134,12 +2134,12 @@ cdef class MixedIntegerLinearProgram(SageObject):
2134
2134
sage: p. solve( )
2135
2135
6. 0
2136
2136
"""
2137
- from sage.numerical.linear_functions import is_LinearFunction, is_LinearConstraint
2137
+ from sage.numerical.linear_functions import LinearFunction, LinearConstraint
2138
2138
from sage.numerical.linear_tensor import LinearTensor
2139
2139
from sage.numerical.linear_tensor_constraints import LinearTensorConstraint
2140
- if is_LinearFunction (linear_function) or isinstance (linear_function, LinearTensor):
2140
+ if isinstance (linear_function, LinearFunction ) or isinstance (linear_function, LinearTensor):
2141
2141
# Find the parent for the coefficients
2142
- if is_LinearFunction (linear_function):
2142
+ if isinstance (linear_function, LinearFunction ):
2143
2143
M = linear_function.parent().base_ring()
2144
2144
elif isinstance (linear_function, LinearTensor):
2145
2145
if not linear_function.parent().is_vector_space():
@@ -2164,7 +2164,7 @@ cdef class MixedIntegerLinearProgram(SageObject):
2164
2164
except KeyError :
2165
2165
pass
2166
2166
# Send to backend
2167
- if is_LinearFunction (linear_function):
2167
+ if isinstance (linear_function, LinearFunction ):
2168
2168
if self ._check_redundant and self ._is_redundant_constraint(constraint, min , max ):
2169
2169
if return_indices:
2170
2170
return []
Original file line number Diff line number Diff line change @@ -233,7 +233,7 @@ AUTHORS:
233
233
234
234
from sage.structure.parent cimport Parent
235
235
from sage.structure.element cimport Element
236
- from sage.numerical.linear_functions import is_LinearFunction, is_LinearConstraint
236
+ from sage.numerical.linear_functions import LinearFunction, LinearConstraint
237
237
from sage.matrix.constructor import matrix
238
238
from sage.structure.element import Matrix
239
239
@@ -906,7 +906,7 @@ cdef class SemidefiniteProgram(SageObject):
906
906
else:
907
907
self.add_constraint(c.lhs()-c.rhs(), name=name)
908
908
909
- elif is_LinearFunction (linear_function) or isinstance(linear_function, LinearTensor):
909
+ elif isinstance (linear_function, LinearFunction ) or isinstance(linear_function, LinearTensor):
910
910
l = sorted(linear_function.dict().items())
911
911
self._backend.add_linear_constraint(l, name)
912
912
You can’t perform that action at this time.
0 commit comments