code stringlengths 17 6.64M |
|---|
class MultiFilteredVectorSpace_class(FreeModule_ambient_field):
def __init__(self, base_ring, dim, filtrations, check=True):
'\n Python constructor.\n\n .. warning::\n\n Use :func:`MultiFilteredVectorSpace` to construct\n multi-filtered vector spaces.\n\n INPUT:... |
class QuotientModule_free_ambient(Module_free_ambient):
'\n Quotients of ambient free modules by a submodule.\n\n INPUT:\n\n - ``module`` -- an ambient free module\n\n - ``sub`` -- a submodule of ``module``\n\n EXAMPLES::\n\n sage: S.<x,y,z> = PolynomialRing(QQ)\n sage: M = S**2\n ... |
class FreeModule_ambient_field_quotient(FreeModule_ambient_field):
"\n A quotient `V/W` of two vector spaces as a vector space.\n\n To obtain `V` or `W` use ``self.V()`` and ``self.W()``.\n\n EXAMPLES::\n\n sage: # needs sage.rings.number_field\n sage: k.<i> = QuadraticField(-1)\n sa... |
class Submodule_free_ambient(Module_free_ambient):
'\n Base class of submodules of ambient modules.\n\n The ambient module is either a free module or a quotient of a free module\n by a submodule.\n\n Note that if the ambient module is a quotient module, submodules\n of the quotient module are calle... |
def symmetrized_coordinate_sums(dim, n):
'\n Return formal symmetrized sum of multi-indices\n\n INPUT:\n\n - ``dim`` -- integer. The dimension (range of each index).\n\n - ``n`` -- integer. The total number of indices.\n\n OUTPUT:\n\n A symmetrized formal sum of multi-indices (tuples of integers... |
def antisymmetrized_coordinate_sums(dim, n):
'\n Return formal anti-symmetrized sum of multi-indices\n\n INPUT:\n\n - ``dim`` -- integer. The dimension (range of each index).\n\n - ``n`` -- integer. The total number of indices.\n\n OUTPUT:\n\n An anti-symmetrized formal sum of multi-indices (tup... |
class VectorCollection(FreeModule_ambient_field):
"\n An ordered collection of generators of a vector space.\n\n This is like a list of vectors, but with extra argument checking.\n\n .. warning::\n\n This class is only used as a base class for filtered vector\n spaces. You should not use it... |
class TensorOperation(VectorCollection):
'\n Auxiliary class to compute the tensor product of two\n :class:`VectorCollection` objects.\n\n .. warning::\n\n This class is only used as a base class for filtered vector\n spaces. You should not use it yourself.\n\n INPUT:\n\n - ``vector_c... |
class Vector_callable_symbolic_dense(free_module_element.FreeModuleElement_generic_dense):
def _repr_(self):
'\n Returns the string representation of the vector\n\n EXAMPLES::\n\n sage: f(u,v,w) = (2*u+v,u-w,w^2+u)\n sage: f\n (u, v, w) |--> (2*u + v, u - w,... |
def is_VectorSpaceHomspace(x):
"\n Return ``True`` if ``x`` is a vector space homspace.\n\n INPUT:\n\n ``x`` - anything\n\n EXAMPLES:\n\n To be a vector space morphism, the domain and codomain must both be\n vector spaces, in other words, modules over fields. If either\n set is just a module... |
class VectorSpaceHomspace(sage.modules.free_module_homspace.FreeModuleHomspace):
def __call__(self, A, check=True, **kwds):
'\n INPUT:\n\n - ``A`` - one of several possible inputs representing\n a morphism from this vector space homspace.\n\n - a vector space morphism in t... |
def linear_transformation(arg0, arg1=None, arg2=None, side='left'):
'\n Create a linear transformation from a variety of possible inputs.\n\n FORMATS:\n\n In the following, ``D`` and ``C`` are vector spaces over\n the same field that are the domain and codomain\n (respectively) of the linear transf... |
def is_VectorSpaceMorphism(x):
"\n Returns ``True`` if ``x`` is a vector space morphism (a linear transformation).\n\n INPUT:\n\n ``x`` - anything\n\n OUTPUT:\n\n ``True`` only if ``x`` is an instance of a vector space morphism,\n which are also known as linear transformations.\n\n EXAMPLES::... |
class VectorSpaceMorphism(free_module_morphism.FreeModuleMorphism):
def __init__(self, homspace, A, side='left'):
"\n Create a linear transformation, a morphism between vector spaces.\n\n INPUT:\n\n - ``homspace`` - a homspace (of vector spaces) to serve\n as a parent for ... |
def apply_map(phi):
'\n Returns a function that applies phi to its argument.\n\n EXAMPLES::\n\n sage: from sage.modules.vector_symbolic_dense import apply_map\n sage: v = vector([1,2,3])\n sage: f = apply_map(lambda x: x+1)\n sage: f(v)\n (2, 3, 4)\n\n '
def apply(... |
class Vector_symbolic_dense(free_module_element.FreeModuleElement_generic_dense):
pass
|
def apply_map(phi):
'\n Returns a function that applies phi to its argument.\n\n EXAMPLES::\n\n sage: from sage.modules.vector_symbolic_sparse import apply_map\n sage: v = vector([1,2,3], sparse=True)\n sage: f = apply_map(lambda x: x+1)\n sage: f(v)\n (2, 3, 4)\n\n '
... |
class Vector_symbolic_sparse(free_module_element.FreeModuleElement_generic_sparse):
pass
|
class CellModule(CombinatorialFreeModule):
'\n A cell module.\n\n Let `R` be a commutative ring. Let `A` be a cellular `R`-algebra\n with cell datum `(\\Lambda, i, M, C)`. A *cell module* `W(\\lambda)`\n is the `R`-module given by `R\\{C_s \\mid s \\in M(\\lambda)\\}` with\n an action of `a \\in A`... |
class SimpleModule(QuotientModuleWithBasis):
'\n A simple module of a cellular algebra.\n\n Let `W(\\lambda)` denote a cell module. The simple module `L(\\lambda)`\n is defined as `W(\\lambda) / \\operatorname{rad}(\\lambda)`,\n where `\\operatorname{rad}(\\lambda)` is the radical of the\n bilinear... |
class FiniteDimensionalInvariantModule(SubmoduleWithBasis):
"\n The invariant submodule under a semigroup action.\n\n When a semigroup `S` acts on a module `M`, the invariant module is the\n set of elements `m \\in M` such that `s \\cdot m = m` for all `s \\in S`:\n\n .. MATH::\n\n M^S := \\{m ... |
class FiniteDimensionalTwistedInvariantModule(SubmoduleWithBasis):
"\n Construct the `\\chi`-twisted invariant submodule of `M`.\n\n When a group `G` acts on a module `M`, the `\\chi`-*twisted invariant\n submodule* of `M` is the isotypic component of the representation `M`\n corresponding to the irre... |
class ModuleMorphism(Morphism):
'\n The top abstract base class for module with basis morphisms.\n\n INPUT:\n\n - ``domain`` -- a parent in ``ModulesWithBasis(...)``\n - ``codomain`` -- a parent in ``Modules(...)``;\n - ``category`` -- a category or ``None`` (default: `None``)\n - ``affine`` -- ... |
class ModuleMorphismFromFunction(ModuleMorphism, SetMorphism):
'\n A class for module morphisms implemented by a plain function.\n\n INPUT:\n\n - ``domain``, ``codomain``, ``category`` -- as for :class:`ModuleMorphism`\n\n - ``function`` -- any function or callable from domain to codomain\n\n .. SE... |
class ModuleMorphismByLinearity(ModuleMorphism):
'\n A class for module morphisms obtained by extending a function by linearity.\n\n INPUT:\n\n - ``domain``, ``codomain``, ``category`` -- as for :class:`ModuleMorphism`\n - ``on_basis`` -- a function which accepts indices of the basis of\n ``domai... |
class TriangularModuleMorphism(ModuleMorphism):
'\n An abstract class for triangular module morphisms\n\n Let `X` and `Y` be modules over the same base ring, with\n distinguished bases `F` indexed by `I` and `G` indexed by `J`,\n respectively.\n\n A module morphism `\\phi` from `X` to `Y` is *trian... |
class TriangularModuleMorphismByLinearity(ModuleMorphismByLinearity, TriangularModuleMorphism):
'\n A concrete class for triangular module morphisms obtained by extending a function by linearity.\n\n .. SEEALSO::\n\n - :meth:`ModulesWithBasis.ParentMethods.module_morphism` for\n usage inform... |
class TriangularModuleMorphismFromFunction(ModuleMorphismFromFunction, TriangularModuleMorphism):
'\n A concrete class for triangular module morphisms implemented by a function.\n\n .. SEEALSO::\n\n - :meth:`ModulesWithBasis.ParentMethods.module_morphism` for\n usage information and examples... |
class ModuleMorphismFromMatrix(ModuleMorphismByLinearity):
'\n A class for module morphisms built from a matrix in the\n distinguished bases of the domain and codomain.\n\n .. SEEALSO::\n\n - :meth:`ModulesWithBasis.ParentMethods.module_morphism`\n - :meth:`ModulesWithBasis.FiniteDimensiona... |
class DiagonalModuleMorphism(ModuleMorphismByLinearity):
'\n A class for diagonal module morphisms.\n\n See :meth:`ModulesWithBasis.ParentMethods.module_morphism`.\n\n INPUT:\n\n - ``domain``, ``codomain`` -- two modules with basis `F` and `G`,\n respectively\n - ``diagonal`` -- a function `d`... |
def pointwise_inverse_function(f):
'\n Return the function `x \\mapsto 1 / f(x)`.\n\n INPUT:\n\n - ``f`` -- a function\n\n EXAMPLES::\n\n sage: from sage.modules.with_basis.morphism import pointwise_inverse_function\n sage: def f(x): return x\n sage: g = pointwise_inverse_function... |
class PointwiseInverseFunction(SageObject):
'\n A class for pointwise inverse functions.\n\n The pointwise inverse function of a function `f` is the function\n sending every `x` to `1 / f(x)`.\n\n EXAMPLES::\n\n sage: from sage.modules.with_basis.morphism import PointwiseInverseFunction\n ... |
class Representation_abstract(CombinatorialFreeModule):
'\n Abstract base class for representations of semigroups.\n\n INPUT:\n\n - ``semigroup`` -- a semigroup\n - ``base_ring`` -- a commutative ring\n '
def __init__(self, semigroup, base_ring, *args, **opts):
'\n Initialize ``... |
class Representation(Representation_abstract):
'\n Representation of a semigroup.\n\n INPUT:\n\n - ``semigroup`` -- a semigroup\n - ``module`` -- a module with a basis\n - ``on_basis`` -- function which takes as input ``g``, ``m``, where\n ``g`` is an element of the semigroup and ``m`` is an e... |
class RegularRepresentation(Representation):
'\n The regular representation of a semigroup.\n\n The left regular representation of a semigroup `S` over a commutative\n ring `R` is the semigroup ring `R[S]` equipped with the left\n `S`-action `x b_y = b_{xy}`, where `(b_z)_{z \\in S}` is the natural\n ... |
class TrivialRepresentation(Representation_abstract):
'\n The trivial representation of a semigroup.\n\n The trivial representation of a semigroup `S` over a commutative ring\n `R` is the `1`-dimensional `R`-module on which every element of `S`\n acts by the identity.\n\n This is simultaneously a l... |
class SignRepresentation_abstract(Representation_abstract):
'\n Generic implementation of a sign representation.\n\n The sign representation of a semigroup `S` over a commutative ring\n `R` is the `1`-dimensional `R`-module on which every element of `S`\n acts by 1 if order of element is even (includi... |
class SignRepresentationPermgroup(SignRepresentation_abstract):
'\n The sign representation for a permutation group.\n\n EXAMPLES::\n\n sage: G = groups.permutation.PGL(2, 3)\n sage: V = G.sign_representation()\n sage: TestSuite(V).run()\n '
def _default_sign(self, elem):
... |
class SignRepresentationMatrixGroup(SignRepresentation_abstract):
'\n The sign representation for a matrix group.\n\n EXAMPLES::\n\n sage: G = groups.permutation.PGL(2, 3)\n sage: V = G.sign_representation()\n sage: TestSuite(V).run()\n '
def _default_sign(self, elem):
'... |
class SignRepresentationCoxeterGroup(SignRepresentation_abstract):
'\n The sign representation for a Coxeter group.\n\n EXAMPLES::\n\n sage: G = WeylGroup(["A", 1, 1])\n sage: V = G.sign_representation()\n sage: TestSuite(V).run()\n '
def _default_sign(self, elem):
'\n ... |
class QuotientModuleWithBasis(CombinatorialFreeModule):
'\n A class for quotients of a module with basis by a submodule.\n\n INPUT:\n\n - ``submodule`` -- a submodule of ``self``\n - ``category`` -- a category (default: ``ModulesWithBasis(submodule.base_ring())``)\n\n ``submodule`` should be a free... |
class SubmoduleWithBasis(CombinatorialFreeModule):
'\n A base class for submodules of a ModuleWithBasis spanned by a\n (possibly infinite) basis in echelon form.\n\n INPUT:\n\n - ``basis`` -- a family of elements in echelon form in some\n :class:`module with basis <ModulesWithBasis>` `V`, or data... |
class AutomaticSemigroup(UniqueRepresentation, Parent):
'\n Semigroups defined by generators living in an ambient semigroup.\n\n This implementation lazily constructs all the elements of the\n semigroup, and the right Cayley graph relations between them, and\n uses the latter as an automaton.\n\n E... |
class AutomaticMonoid(AutomaticSemigroup):
def one(self):
'\n Return the unit of ``self``.\n\n EXAMPLES::\n\n sage: from sage.monoids.automatic_semigroup import AutomaticSemigroup\n sage: R = IntegerModRing(21)\n sage: M = R.submonoid(())\n sage: ... |
class FreeAbelianMonoidFactory(UniqueFactory):
'\n Create the free abelian monoid in `n` generators.\n\n INPUT:\n\n\n - ``n`` - integer\n\n - ``names`` - names of generators\n\n\n OUTPUT: free abelian monoid\n\n EXAMPLES::\n\n sage: FreeAbelianMonoid(0, \'\')\n Free abelian monoi... |
def FreeAbelianMonoid(index_set=None, names=None, **kwds):
"\n Return a free abelian monoid on `n` generators or with the generators\n indexed by a set `I`.\n\n We construct free abelian monoids by specifing either:\n\n - the number of generators and/or the names of the generators\n - the indexing ... |
def is_FreeAbelianMonoid(x):
"\n Return True if `x` is a free abelian monoid.\n\n EXAMPLES::\n\n sage: from sage.monoids.free_abelian_monoid import is_FreeAbelianMonoid\n sage: is_FreeAbelianMonoid(5)\n False\n sage: is_FreeAbelianMonoid(FreeAbelianMonoid(7,'a'))\n True\n ... |
class FreeAbelianMonoid_class(Parent):
'\n Free abelian monoid on `n` generators.\n '
Element = FreeAbelianMonoidElement
def __init__(self, n, names):
"\n Initialize ``self``.\n\n EXAMPLES::\n\n sage: F = FreeAbelianMonoid(6,'b')\n sage: TestSuite(F).run(... |
def is_FreeMonoid(x):
"\n Return ``True`` if `x` is a free monoid.\n\n EXAMPLES::\n\n sage: from sage.monoids.free_monoid import is_FreeMonoid\n sage: is_FreeMonoid(5)\n False\n sage: is_FreeMonoid(FreeMonoid(7,'a'))\n True\n sage: is_FreeMonoid(FreeAbelianMonoid(7,... |
class FreeMonoid(Monoid_class, UniqueRepresentation):
"\n Return a free monoid on `n` generators or with the generators\n indexed by a set `I`.\n\n We construct free monoids by specifing either:\n\n - the number of generators and/or the names of the generators\n - the indexing set for the generator... |
def is_FreeMonoidElement(x):
return isinstance(x, FreeMonoidElement)
|
class FreeMonoidElement(MonoidElement):
"\n Element of a free monoid.\n\n EXAMPLES::\n\n sage: a = FreeMonoid(5, 'a').gens()\n sage: x = a[0]*a[1]*a[4]**3\n sage: x**3\n a0*a1*a4^3*a0*a1*a4^3*a0*a1*a4^3\n sage: x**0\n 1\n sage: x**(-1)\n Traceback (mos... |
@cached_function
def HeckeMonoid(W):
"\n Return the `0`-Hecke monoid of the Coxeter group `W`.\n\n INPUT:\n\n - `W` -- a finite Coxeter group\n\n Let `s_1,\\ldots,s_n` be the simple reflections of `W`. The 0-Hecke\n monoid is the monoid generated by projections `\\pi_1,\\ldots,\\pi_n`\n satisfyi... |
class IndexedMonoidElement(MonoidElement):
'\n An element of an indexed monoid.\n\n This is an abstract class which uses the (abstract) method\n :meth:`_sorted_items` for all of its functions. So to implement an\n element of an indexed monoid, one just needs to implement\n :meth:`_sorted_items`, wh... |
class IndexedFreeMonoidElement(IndexedMonoidElement):
'\n An element of an indexed free abelian monoid.\n '
def __init__(self, F, x):
"\n Create the element ``x`` of an indexed free abelian monoid ``F``.\n\n EXAMPLES::\n\n sage: F = FreeMonoid(index_set=tuple('abcde'))\... |
class IndexedFreeAbelianMonoidElement(IndexedMonoidElement):
'\n An element of an indexed free abelian monoid.\n '
def __init__(self, F, x):
'\n Create the element ``x`` of an indexed free abelian monoid ``F``.\n\n EXAMPLES::\n\n sage: F = FreeAbelianMonoid(index_set=ZZ... |
class IndexedMonoid(Parent, IndexedGenerators, UniqueRepresentation):
'\n Base class for monoids with an indexed set of generators.\n\n INPUT:\n\n - ``indices`` -- the indices for the generators\n\n For the optional arguments that control the printing, see\n :class:`~sage.structure.indexed_generato... |
class IndexedFreeMonoid(IndexedMonoid):
"\n Free monoid with an indexed set of generators.\n\n INPUT:\n\n - ``indices`` -- the indices for the generators\n\n For the optional arguments that control the printing, see\n :class:`~sage.structure.indexed_generators.IndexedGenerators`.\n\n EXAMPLES::\... |
class IndexedFreeAbelianMonoid(IndexedMonoid):
"\n Free abelian monoid with an indexed set of generators.\n\n INPUT:\n\n - ``indices`` -- the indices for the generators\n\n For the optional arguments that control the printing, see\n :class:`~sage.structure.indexed_generators.IndexedGenerators`.\n\n... |
def is_Monoid(x):
"\n Returns True if ``x`` is of type ``Monoid_class``.\n\n EXAMPLES::\n\n sage: from sage.monoids.monoid import is_Monoid\n sage: is_Monoid(0)\n False\n sage: is_Monoid(ZZ) # The technical math meaning of monoid has\n ....: # no bearing ... |
class Monoid_class(Parent):
def __init__(self, names):
"\n EXAMPLES::\n\n sage: from sage.monoids.monoid import Monoid_class\n sage: Monoid_class(('a','b'))\n <sage.monoids.monoid.Monoid_class_with_category object at ...>\n\n TESTS::\n\n sage: F.<... |
class StringMonoid_class(FreeMonoid):
'\n A free string monoid on `n` generators.\n '
def __init__(self, n, alphabet=()):
'\n Create free binary string monoid on `n` generators.\n\n INPUT:\n\n - ``n`` -- Integer\n\n - ``alphabet`` -- String or tuple whose characters ... |
class BinaryStringMonoid(StringMonoid_class):
'\n The free binary string monoid on generators `\\{ 0, 1 \\}`.\n '
def __init__(self):
"\n Create free binary string monoid on generators `\\{ 0, 1 \\}`.\n\n EXAMPLES::\n\n sage: S = BinaryStrings(); S\n Free bin... |
class OctalStringMonoid(StringMonoid_class):
'\n The free octal string monoid on generators `\\{ 0, 1, \\dots, 7 \\}`.\n '
def __init__(self):
'\n Create free octal string monoid on generators `\\{ 0, 1, \\dots, 7 \\}`.\n\n EXAMPLES::\n\n sage: S = OctalStrings(); S\n ... |
class HexadecimalStringMonoid(StringMonoid_class):
'\n The free hexadecimal string monoid on generators\n `\\{ 0, 1, \\dots, 9, a, b, c, d, e, f \\}`.\n '
def __init__(self):
'\n Create free hexadecimal string monoid on generators\n `\\{ 0, 1, \\dots, 9, a, b, c, d, e, f \\}`.\... |
class Radix64StringMonoid(StringMonoid_class):
'\n The free radix 64 string monoid on 64 generators.\n '
def __init__(self):
'\n Create free radix 64 string monoid on 64 generators.\n\n EXAMPLES::\n\n sage: S = Radix64Strings(); S\n Free radix 64 string monoi... |
class AlphabeticStringMonoid(StringMonoid_class):
'\n The free alphabetic string monoid on generators A-Z.\n\n EXAMPLES::\n\n sage: S = AlphabeticStrings(); S\n Free alphabetic string monoid on A-Z\n sage: S.gen(0)\n A\n sage: S.gen(25)\n Z\n sage: S([ i for ... |
def is_StringMonoidElement(x):
'\n '
return isinstance(x, StringMonoidElement)
|
def is_AlphabeticStringMonoidElement(x):
'\n '
from .string_monoid import AlphabeticStringMonoid
return (isinstance(x, StringMonoidElement) and isinstance(x.parent(), AlphabeticStringMonoid))
|
def is_BinaryStringMonoidElement(x):
'\n '
from .string_monoid import BinaryStringMonoid
return (isinstance(x, StringMonoidElement) and isinstance(x.parent(), BinaryStringMonoid))
|
def is_OctalStringMonoidElement(x):
'\n '
from .string_monoid import OctalStringMonoid
return (isinstance(x, StringMonoidElement) and isinstance(x.parent(), OctalStringMonoid))
|
def is_HexadecimalStringMonoidElement(x):
'\n '
from .string_monoid import HexadecimalStringMonoid
return (isinstance(x, StringMonoidElement) and isinstance(x.parent(), HexadecimalStringMonoid))
|
def is_Radix64StringMonoidElement(x):
'\n '
from .string_monoid import Radix64StringMonoid
return (isinstance(x, StringMonoidElement) and isinstance(x.parent(), Radix64StringMonoid))
|
class StringMonoidElement(FreeMonoidElement):
'\n Element of a free string monoid.\n '
def __init__(self, S, x, check=True):
'\n Create the element ``x`` of the StringMonoid ``S``.\n\n This should typically be called by a StringMonoid.\n '
FreeMonoidElement.__init__... |
def strip_encoding(S):
'\n The upper case string of S stripped of all non-alphabetic characters.\n\n EXAMPLES::\n\n sage: S = "The cat in the hat."\n sage: strip_encoding(S)\n \'THECATINTHEHAT\'\n '
if (not isinstance(S, str)):
raise TypeError('Argument S (= %s) must be a... |
def frequency_distribution(S, n=1, field=None):
'\n The probability space of frequencies of n-character substrings of S.\n '
if isinstance(S, tuple):
S = list(S)
elif isinstance(S, (str, StringMonoidElement)):
S = [S[i:(i + n)] for i in range(((len(S) - n) + 1))]
if (field is Non... |
def coincidence_index(S, n=1):
'\n The coincidence index of the string S.\n\n EXAMPLES::\n\n sage: S = strip_encoding("The cat in the hat.")\n sage: coincidence_index(S)\n 0.120879120879121\n '
if (not isinstance(S, str)):
try:
S.coincidence_index(n)
e... |
def coincidence_discriminant(S, n=2):
'\n Input: A tuple of strings, e.g. produced as decimation of transposition\n ciphertext, or a sample plaintext.\n Output: A measure of the difference of probability of association of\n character pairs, relative to their independent one-character probabilities.\n\... |
class TraceMonoidElement(ElementWrapper, MonoidElement):
"\n Element of a trace monoid, also known as a trace.\n\n Elements of trace monoid is actually a equivalence classes\n of related free monoid over some equivalence relation\n that in the case is presented as independence relation.\n\n .. RUBR... |
class TraceMonoid(UniqueRepresentation, Monoid_class):
"\n Return a free partially commuting monoid (trace monoid) on `n` generators\n over independence relation `I`.\n\n We construct a trace monoid by specifing:\n\n - a free monoid and independence relation\n - or generator names and independence ... |
class TestCVXOPTBackend(GenericBackendTests):
@pytest.fixture
def backend(self) -> GenericBackend:
return MixedIntegerLinearProgram(solver='CVXOPT').get_backend()
def test_sage_unittest_testsuite(self, sage_object: SageObject):
from sage.misc.sage_unittest import TestSuite
TestSu... |
@pytest.importorskip('cvxpy')
class TestCVXPYBackend(GenericBackendTests):
@pytest.fixture
def backend(self) -> GenericBackend:
return MixedIntegerLinearProgram(solver='CVXPY').get_backend()
|
class GenericBackendTests(SageObjectTests):
@pytest.fixture
def backend(self, *args, **kwargs) -> GenericBackend:
raise NotImplementedError
@pytest.fixture
def sage_object(self, backend) -> SageObject:
return backend
def test_ncols_nonnegative(self, backend: GenericBackend):
... |
class TestGLPKBackend(GenericBackendTests):
@pytest.fixture
def backend(self) -> GenericBackend:
return MixedIntegerLinearProgram(solver='GLPK').get_backend()
|
class TestGLPKExactBackend(GenericBackendTests):
@pytest.fixture
def backend(self) -> GenericBackend:
return MixedIntegerLinearProgram(solver='GLPK/exact').get_backend()
|
class TestInteractiveLPBackend(GenericBackendTests):
@pytest.fixture
def backend(self) -> GenericBackend:
return MixedIntegerLinearProgram(solver='InteractiveLP').get_backend()
|
def _format_function_call(fn_name, *v, **k):
'\n Return a Python function call as a string.\n\n EXAMPLES::\n\n sage: from sage.numerical.backends.logging_backend import _format_function_call\n sage: _format_function_call(\'foo\', 17, hellooooo=\'goodbyeeee\')\n "foo(17, hellooooo=\'good... |
def _make_wrapper(backend, attr):
"\n Return a wrapper for the backend method named by ``attr`` that does the logging.\n\n Documentation and other metadata is copied from the `backend` method named ``attr``.\n\n EXAMPLES::\n\n sage: from sage.numerical.backends.generic_backend import get_solver\n ... |
class LoggingBackend(GenericBackend):
'\n See :class:`LoggingBackendFactory` for documentation.\n\n EXAMPLES::\n\n sage: import sage.numerical.backends.logging_backend\n sage: from sage.numerical.backends.logging_backend import LoggingBackend\n sage: from sage.numerical.backends.generic... |
def _override_attr(attr):
'\n Override a method by a delegating method.\n '
a = getattr(LoggingBackend, attr)
if callable(a):
m = _make_wrapper(GenericBackend(), attr)
setattr(LoggingBackend, attr, m)
|
def LoggingBackendFactory(solver=None, printing=True, doctest_file=None, test_method_file=None, test_method=None, base_ring=QQ):
"\n Factory that constructs a :class:`LoggingBackend` for debugging and testing.\n\n An instance of it can be passed as the solver argument of\n :func:`sage.numerical.backends.... |
class TestPPLBackend(GenericBackendTests):
@pytest.fixture
def backend(self) -> GenericBackend:
return MixedIntegerLinearProgram(solver='PPL').get_backend()
|
@pytest.importorskip('pyscipopt')
class TestSCIPBackend(GenericBackendTests):
@pytest.fixture
def backend(self) -> GenericBackend:
return MixedIntegerLinearProgram(solver='SCIP').get_backend()
|
def _assemble_arrayl(lines, stretch=None):
'\n Return ``lines`` assembled in a left-justified array.\n\n INPUT:\n\n - ``lines`` -- a list of strings suitable for math mode typesetting\n\n - ``stretch`` -- (default: None) if given, a command setting\n ``\\arraystretch`` to this value will be added... |
def _latex_product(coefficients, variables, separator=None, head=None, tail=None, drop_plus=True, allow_empty=False):
'\n Generate LaTeX code for a linear function.\n\n This function is intended for internal use by LaTeX methods of LP problems\n and their dictionaries.\n\n INPUT:\n\n - ``coefficien... |
@cached_function
def variable(R, v):
'\n Interpret ``v`` as a variable of ``R``.\n\n INPUT:\n\n - ``R`` -- a polynomial ring\n\n - ``v`` -- a variable of ``R`` or convertible into ``R``, a string\n with the name of a variable of ``R`` or an index of a variable in ``R``\n\n OUTPUT:\n\n - a v... |
def default_variable_name(variable):
'\n Return default variable name for the current :func:`style`.\n\n INPUT:\n\n - ``variable`` - a string describing requested name\n\n OUTPUT:\n\n - a string with the requested name for current style\n\n EXAMPLES::\n\n sage: sage.numerical.interactive_... |
def style(new_style=None):
"\n Set or get the current style of problems and dictionaries.\n\n INPUT:\n\n - ``new_style`` -- a string or ``None`` (default)\n\n OUTPUT:\n\n - a string with current style (same as ``new_style`` if it was given)\n\n If the input is not recognized as a valid style, a ... |
class InteractiveLPProblem(SageObject):
'\n Construct an LP (Linear Programming) problem.\n\n .. NOTE::\n\n This class is for **educational purposes only**: if you want to solve\n Linear Programs efficiently, use :class:`MixedIntegerLinearProgram`\n instead.\n\n This class supports L... |
class InteractiveLPProblemStandardForm(InteractiveLPProblem):
'\n Construct an LP (Linear Programming) problem in standard form.\n\n .. NOTE::\n\n This class is for **educational purposes only**: if you want to solve\n Linear Programs efficiently, use :class:`MixedIntegerLinearProgram`\n ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.