Did I find the right examples for you? yes no

All Samples(86)  |  Call(80)  |  Derive(0)  |  Import(6)
Constructs and holds the fitting of the diagram into a grid.

The mission of this class is to analyse the structure of the
supplied diagram and to place its objects on a grid such that,
when the objects and the morphisms are actually drawn, the diagram
would be "readable", in the sense that there will not be many
intersections of moprhisms.  This class does not perform any
actual drawing.  It does strive nevertheless to offer sufficient
metadata to draw a diagram.
(more...)

src/s/y/sympy-0.7.5/sympy/categories/tests/test_drawing.py   sympy(Download)
from sympy.categories.diagram_drawing import _GrowableGrid, ArrowStringDescription
from sympy.categories import (DiagramGrid, Object, NamedMorphism,
                              Diagram, XypicDiagramDrawer, xypic_draw_diagram)
from sympy import FiniteSet
 
    # A one-morphism diagram.
    d = Diagram([f])
    grid = DiagramGrid(d)
 
    assert grid.width == 2
    # A triangle.
    d = Diagram([f, g], {g * f: "unique"})
    grid = DiagramGrid(d)
 
    assert grid.width == 2
    l_A = NamedMorphism(A, A, "l_A")
    d = Diagram([f, g, l_A])
    grid = DiagramGrid(d)
 
    assert grid.width == 2
    # A simple diagram.
    d = Diagram([f, g, h, k])
    grid = DiagramGrid(d)
 
    assert grid.width == 3

src/s/y/sympy-HEAD/sympy/categories/tests/test_drawing.py   sympy(Download)
from sympy.categories.diagram_drawing import _GrowableGrid, ArrowStringDescription
from sympy.categories import (DiagramGrid, Object, NamedMorphism,
                              Diagram, XypicDiagramDrawer, xypic_draw_diagram)
from sympy import FiniteSet
 
    # A one-morphism diagram.
    d = Diagram([f])
    grid = DiagramGrid(d)
 
    assert grid.width == 2
    # A triangle.
    d = Diagram([f, g], {g * f: "unique"})
    grid = DiagramGrid(d)
 
    assert grid.width == 2
    l_A = NamedMorphism(A, A, "l_A")
    d = Diagram([f, g, l_A])
    grid = DiagramGrid(d)
 
    assert grid.width == 2
    # A simple diagram.
    d = Diagram([f, g, h, k])
    grid = DiagramGrid(d)
 
    assert grid.width == 3

src/s/y/sympy-0.7.5/sympy/printing/tests/test_latex.py   sympy(Download)
def test_categories():
    from sympy.categories import (Object, IdentityMorphism,
        NamedMorphism, Category, Diagram, DiagramGrid)
 
    A1 = Object("A1")
    g = NamedMorphism(B, C, "g")
    d = Diagram([f, g])
    grid = DiagramGrid(d)
 
    assert latex(grid) == "\\begin{array}{cc}\n" \

src/s/y/sympy-HEAD/sympy/printing/tests/test_latex.py   sympy(Download)
def test_categories():
    from sympy.categories import (Object, IdentityMorphism,
        NamedMorphism, Category, Diagram, DiagramGrid)
 
    A1 = Object("A1")
    g = NamedMorphism(B, C, "g")
    d = Diagram([f, g])
    grid = DiagramGrid(d)
 
    assert latex(grid) == "\\begin{array}{cc}\n" \

src/s/y/sympy-0.7.5/sympy/printing/pretty/tests/test_pretty.py   sympy(Download)
def test_categories():
    from sympy.categories import (Object, IdentityMorphism,
        NamedMorphism, Category, Diagram, DiagramGrid)
 
    A1 = Object("A1")
        " ══▶ {f₂∘f₁:A₁——▶A₃: {unique}}")
 
    grid = DiagramGrid(d)
    assert pretty(grid) == "A1  A2\n      \nA3    "
    assert upretty(grid) == u("A₁  A₂\n      \nA₃    ")

src/s/y/sympy-HEAD/sympy/printing/pretty/tests/test_pretty.py   sympy(Download)
def test_categories():
    from sympy.categories import (Object, IdentityMorphism,
        NamedMorphism, Category, Diagram, DiagramGrid)
 
    A1 = Object("A1")
        " ══▶ {f₂∘f₁:A₁——▶A₃: {unique}}")
 
    grid = DiagramGrid(d)
    assert pretty(grid) == "A1  A2\n      \nA3    "
    assert upretty(grid) == u("A₁  A₂\n      \nA₃    ")