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

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

    # HG changeset patch
    # User Rob Beezer <beezer@ups.edu>
    # Date 1313770804 25200
    # Node ID 0cffd3dde259d32e17b2c0257ca1e80da0822b90
    # Parent  38e10ea9217da3c58ad8982db3fba77b67228f03
    11556: linear transformations edits
    
    diff -r 38e10ea9217d -r 0cffd3dde259 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 0cffd3dde259 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
     
    392395
    393396    EXAMPLES:
    394397
    395     We can define a linear transformation with just a matrix, acting from
    396     either side of the vector.  The field for the vector spaces used as
    397     domain and codomain is obtained from the base ring of the matrix,
    398     possibly promoting to a fraction field.  ::
     398    We can define a linear transformation with just a matrix, understood to
     399    act on a vector placed one one side or the other.  The field for the
     400    vector spaces used as domain and codomain is obtained from the base
     401    ring of the matrix, possibly promoting to a fraction field.  ::
    399402
    400403        sage: A = matrix(ZZ, [[1, -1, 4], [2, 0, 5]])
    401404        sage: phi = linear_transformation(A)
     
    471474    Functions that act on the domain may be used to compute images of
    472475    the domain's basis elements, and this mapping can be extended to
    473476    a unique linear transformation.  The function may be a Python
    474     function (via ``def`` or ``lambda``) or a Sage symbolic function.
    475     The ```side`` keyword will determine how the linear transformation
    476     will be printed.  ::
     477    function (via ``def`` or ``lambda``) or a Sage symbolic function.  ::
    477478
    478479        sage: def g(x):
    479480        ...     return vector(QQ, [2*x[0]+x[2], 5*x[1]])
     
    636637        element (= [1, 2]) is not in free module
    637638
    638639
    639     Functions may not apply properly to domain elemnets,
     640    Functions may not apply properly to domain elements,
    640641    or return values outside the codomain.  ::
    641642
    642643        sage: f = lambda x: vector(QQ, [x[0], x[4]])
     
    686687        ArithmeticError: some image of the function is not in the codomain, because
    687688        element (= [1, 0]) is not in free module
    688689    """
    689     from sage.matrix.matrix import is_Matrix
    690690    from sage.matrix.constructor import matrix
    691691    from sage.modules.module import is_VectorSpace
    692692    from sage.modules.free_module import VectorSpace
    693     #from sage.modules.vector_space_homspace import VectorSpaceHomspace
    694693    from sage.categories.homset import Hom
    695     from sage.modules.vector_space_morphism import VectorSpaceMorphism
    696694    from sage.symbolic.ring import SymbolicRing
    697695    from sage.modules.vector_callable_symbolic_dense import Vector_callable_symbolic_dense
    698696    from inspect import isfunction
     
    729727    # arg2 might be a matrix that began in arg0
    730728    D = arg0
    731729    C = arg1
    732     # next line must be Hom() to register unique parents?
    733730    H = Hom(D, C, category=None)
    734731
    735732    # Examine arg2 as the "rule" for the linear transformation
     
    769766        raise TypeError(msg.format(arg2))
    770767
    771768    # arg2 now compatible with homspace H call method
    772     # class __init__ will check
    773     #   matrix sizes versus domain/codomain dimensions
     769    # __init__ will check matrix sizes versus domain/codomain dimensions
    774770    return H(arg2)
    775     ## return VectorSpaceMorphism(H, arg2)
    776771
    777772def is_VectorSpaceMorphism(x):
    778773    r"""
     
    853848            sage: type(rho)
    854849            <class 'sage.modules.vector_space_morphism.VectorSpaceMorphism'>
    855850        """
    856         from sage.matrix.matrix import is_Matrix
    857851        if not vector_space_homspace.is_VectorSpaceHomspace(homspace):
    858852            raise TypeError, 'homspace must be a vector space hom space, not {0}'.format(homspace)
    859853        if isinstance(A, matrix_morphism.MatrixMorphism):