Ticket #11556: trac_11556-linear-transformations-edits.patch

File trac_11556-linear-transformations-edits.patch, 4.2 KB (added by rbeezer, 10 years ago)
  • sage/modules/free_module_morphism.py

    # HG changeset patch
    # User Rob Beezer <beezer@ups.edu>
    # Date 1313688964 25200
    # Node ID 44dfe7a600516cfc4051881ebd22efddb72d13c6
    # Parent  38e10ea9217da3c58ad8982db3fba77b67228f03
    11556: linear transformations edits
    
    diff -r 38e10ea9217d -r 44dfe7a60051 sage/modules/free_module_morphism.py
    a b  
    529529        else:
    530530            raise TypeError, "not an endomorphism"
    531531
    532     minpoly = minimal_polynomial
    533  No newline at end of file
     532    minpoly = minimal_polynomial
     533   
     534 No newline at end of file
  • sage/modules/vector_space_morphism.py

    diff -r 38e10ea9217d -r 44dfe7a60051 sage/modules/vector_space_morphism.py
    a b  
    328328import sage.modules.matrix_morphism as matrix_morphism
    329329import sage.modules.free_module_morphism as free_module_morphism
    330330import vector_space_homspace
     331from sage.matrix.matrix import is_Matrix
    331332
    332333def linear_transformation(arg0, arg1=None, arg2=None, side='left'):
    333334    r"""
     
    346347    the vector on the left, or the vector on the right.
    347348    The default is 'left'. Internally representations are
    348349    always carried as the 'left' version, and the default
    349     text representation is this version.
     350    text representation is this version.  However, the matrix
     351    representation may be obtained as either version, no matter
     352    how it is created.
    350353
    351354    - ``linear_transformation(A, side='left')``
    352355
     
    472475    the domain's basis elements, and this mapping can be extended to
    473476    a unique linear transformation.  The function may be a Python
    474477    function (via ``def`` or ``lambda``) or a Sage symbolic function.
    475     The ```side`` keyword will determine how the linear transformation
    476     will be printed.  ::
     478    The ``side`` keyword determines if the matrix representation prints
     479    as a matrix that acts on a vector placed to the right of the matrix
     480    or acts as on a vector placed to the left of the matrix.  ::
    477481
    478482        sage: def g(x):
    479483        ...     return vector(QQ, [2*x[0]+x[2], 5*x[1]])
     
    636640        element (= [1, 2]) is not in free module
    637641
    638642
    639     Functions may not apply properly to domain elemnets,
     643    Functions may not apply properly to domain elements,
    640644    or return values outside the codomain.  ::
    641645
    642646        sage: f = lambda x: vector(QQ, [x[0], x[4]])
     
    686690        ArithmeticError: some image of the function is not in the codomain, because
    687691        element (= [1, 0]) is not in free module
    688692    """
    689     from sage.matrix.matrix import is_Matrix
    690693    from sage.matrix.constructor import matrix
    691694    from sage.modules.module import is_VectorSpace
    692695    from sage.modules.free_module import VectorSpace
    693     #from sage.modules.vector_space_homspace import VectorSpaceHomspace
    694696    from sage.categories.homset import Hom
    695     from sage.modules.vector_space_morphism import VectorSpaceMorphism
    696697    from sage.symbolic.ring import SymbolicRing
    697698    from sage.modules.vector_callable_symbolic_dense import Vector_callable_symbolic_dense
    698699    from inspect import isfunction
     
    729730    # arg2 might be a matrix that began in arg0
    730731    D = arg0
    731732    C = arg1
    732     # next line must be Hom() to register unique parents?
    733733    H = Hom(D, C, category=None)
    734734
    735735    # Examine arg2 as the "rule" for the linear transformation
     
    769769        raise TypeError(msg.format(arg2))
    770770
    771771    # arg2 now compatible with homspace H call method
    772     # class __init__ will check
    773     #   matrix sizes versus domain/codomain dimensions
     772    # __init__ will check matrix sizes versus domain/codomain dimensions
    774773    return H(arg2)
    775     ## return VectorSpaceMorphism(H, arg2)
    776774
    777775def is_VectorSpaceMorphism(x):
    778776    r"""
     
    853851            sage: type(rho)
    854852            <class 'sage.modules.vector_space_morphism.VectorSpaceMorphism'>
    855853        """
    856         from sage.matrix.matrix import is_Matrix
    857854        if not vector_space_homspace.is_VectorSpaceHomspace(homspace):
    858855            raise TypeError, 'homspace must be a vector space hom space, not {0}'.format(homspace)
    859856        if isinstance(A, matrix_morphism.MatrixMorphism):