8.1.2.1 FreeModuleElement Objects

class FreeModuleElement
An element of a generic free module.
FreeModuleElement( parent)

Instances of class FreeModuleElement have the following methods (in addition to inherited methods and special methods):

additive_order,$  $ copy,$  $ degree,$  $ denominator,$  $ dict,$  $ dot_product,$  $ element,$  $ entries,$  $ get,$  $ inner_product,$  $ is_dense,$  $ is_sparse,$  $ is_vector,$  $ list,$  $ nonzero_positions,$  $ set

Further documentation:

dot_product( right)

Return the dot product of self and right, which is the sum of the product of the corresponding entries.

INPUT:
    right -- vector of the same degree as self.  it need not
             be in the same vector space as self, as long as
             the coefficients can be multiplied.

sage: V = VectorSpace(RationalField(),3)
sage: v = V([1,2,3])
sage: w = V([4,5,6])
sage: v.dot_product(w)
32

sage: W = VectorSpace(GF(3),3)
sage: w = W([0,1,2])
sage: w.dot_product(v)
2
sage: w.dot_product(v).parent()
Finite field of size 3

Implicit coercion is well defined (irregardless of order), so we get 2 even if we do the dot product in the order order.

sage: v.dot_product(w)  
2

get( i)

get is meant to be more efficient than getitem, because it does not do any error checking.

inner_product( right)

Returns the inner product of self and other, with respect to the inner product defined on the parent of self.

nonzero_positions( )

Return the sorted list of integers i such that self[i] != 0.

set( i, x)

set is meant to be more efficient than setitem, because it does not do any error checking or coercion. Use with care.

Instances of class FreeModuleElement also have the following special methods:

__abs__,$  $ __add__,$  $ __cmp__,$  $ __getitem__,$  $ __invert__,$  $ __len__,$  $ __mod__,$  $ __mul__,$  $ __neg__,$  $ __pos__,$  $ __pow__,$  $ __repr__,$  $ __setitem__,$  $ __sub__,$  $ _latex_,$  $ _matrix_multiply,$  $ _scalar_multiply

Further documentation:

_latex_( )

Return a latex representation of self. For example, if self is the free module element (1,2,3,4), then following latex is generated: "(1,2,3,4)" (without the quotes).

_matrix_multiply( A)

Return the product self*A.

_scalar_multiply( s)

return the product s*self.

See About this document... for information on suggesting changes.