Module: sage.modules.free_module_element
Module-level Functions
R, elts) |
Return a vector over R with given entries.
INPUT: R -- ring elts -- entries of a vector OUTPUT: An element of the free module over R of rank len(elts).
sage: v = Vector(Rationals(), [1,1]); v (1, 1)
v, w) |
v and w are dictionaries with integer keys.
x) |
Class: FreeModuleElement
self, parent) |
Functions: additive_order,
change_ring,
copy,
degree,
denominator,
dict,
dot_product,
element,
entries,
get,
inner_product,
is_dense,
is_sparse,
is_vector,
lift,
list,
Mod,
nonzero_positions,
set,
support
self, 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 = FreeModule(ZZ, 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 other order.
sage: v.dot_product(w) 2
self, i) |
get is meant to be more efficient than getitem, because it does not do any error checking.
self, right) |
Returns the inner product of self and other, with respect to the inner product defined on the parent of self.
todo
self) |
sage: V = Vector(ZZ/7, [5, 9, 13, 15]) ; V (5, 2, 6, 1) sage: V.lift() (5, 2, 6, 1) sage: parent(V.lift()) Ambient free module of rank 4 over the principal ideal domain Integer Ring
self, p) |
sage: V = Vector(ZZ, [5, 9, 13, 15]) sage: V.Mod(7) (5, 2, 6, 1) sage: parent(V.Mod(7)) Vector space of dimension 4 over Ring of integers modulo 7
self) |
Return the sorted list of integers i such that self[i] != 0.
self, i, x) |
set is meant to be more efficient than setitem, because it does not do any error checking or coercion. Use with care.
self) |
Return the sorted list of integers i such that self[i] != 0.
Special Functions: __abs__,
__add__,
__cmp__,
__div__,
__getitem__,
__invert__,
__len__,
__mod__,
__mul__,
__neg__,
__pos__,
__pow__,
__setitem__,
__sub__,
_latex_,
_matrix_multiply,
_repr_,
_scalar_multiply,
_vector_
self, right) |
sage: V = Q^5 sage: W = V.span([V.1, V.2]) sage: W.0 + V.0 (1, 1, 0, 0, 0) sage: V.0 + W.0 (1, 1, 0, 0, 0)
self, p) |
sage: V = Vector(ZZ, [5, 9, 13, 15]) sage: V % 7 (5, 2, 6, 1) sage: parent(V % 7) Ambient free module of rank 4 over the principal ideal domain Integer Ring
self) |
sage: V = QQ^3 sage: v = V([1,2,3]) sage: v.__neg__() (-1, -2, -3)
self) |
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).
self, A) |
Return the product self*A.
sage: MS = MatrixSpace(QQ,3) sage: A = MS([0,1,0,1,0,0,0,0,1]) sage: V = QQ^3 sage: v = V([1,2,3]) sage: v._matrix_multiply(A) (2, 1, 3)
The multiplication operator also just calls _matrix_multiply
:
sage: v*A (2, 1, 3)
self, s) |
return the product s*self.
Class: FreeModuleElement_generic_dense
self, parent, entries, [coerce_entries=True], [copy=True]) |
Functions: entries,
list
Special Functions: __getitem__,
__setitem__
self, i) |
self, i, value) |
Set entry i of self to value.
Class: FreeModuleElement_generic_sparse
self, parent, [entries=True], [coerce_entries=True], [copy=0]) |
Functions: denominator,
dict,
entries,
get,
nonzero_positions,
set
self, i) |
Like __getitem__ but with no type or bounds checking. Returns 0 if access is out of bounds.
self) |
Returns the set of pairs (i,j) such that self[i,j] != 0.
self, i, x) |
Like __setitem__ but with no type or bounds checking.
Special Functions: __getitem__,
__setitem__
self, i, value) |
See About this document... for information on suggesting changes.