Vectors with integer entries

AUTHOR:

  • William Stein (2007)

EXAMPLES:

sage: v = vector(ZZ, [1,2,3,4,5])
sage: v
(1, 2, 3, 4, 5)
sage: 3*v
(3, 6, 9, 12, 15)
sage: v*7
(7, 14, 21, 28, 35)
sage: -v
(-1, -2, -3, -4, -5)
sage: v - v
(0, 0, 0, 0, 0)
sage: v + v
(2, 4, 6, 8, 10)
sage: v * v   # dot product.
55
>>> from sage.all import *
>>> v = vector(ZZ, [Integer(1),Integer(2),Integer(3),Integer(4),Integer(5)])
>>> v
(1, 2, 3, 4, 5)
>>> Integer(3)*v
(3, 6, 9, 12, 15)
>>> v*Integer(7)
(7, 14, 21, 28, 35)
>>> -v
(-1, -2, -3, -4, -5)
>>> v - v
(0, 0, 0, 0, 0)
>>> v + v
(2, 4, 6, 8, 10)
>>> v * v   # dot product.
55
v = vector(ZZ, [1,2,3,4,5])
v
3*v
v*7
-v
v - v
v + v
v * v   # dot product.

We make a large zero vector:

sage: k = ZZ^100000; k
Ambient free module of rank 100000 over the principal ideal domain Integer Ring
sage: v = k(0)
sage: v[:10]
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
>>> from sage.all import *
>>> k = ZZ**Integer(100000); k
Ambient free module of rank 100000 over the principal ideal domain Integer Ring
>>> v = k(Integer(0))
>>> v[:Integer(10)]
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
k = ZZ^100000; k
v = k(0)
v[:10]
class sage.modules.vector_integer_dense.Vector_integer_dense[source]

Bases: FreeModuleElement

list(copy=True)[source]

The list of entries of the vector.

INPUT:

  • copy – ignored optional argument

EXAMPLES:

sage: v = vector([1,2,3,4])
sage: a = v.list(copy=False); a
[1, 2, 3, 4]
sage: a[0] = 0
sage: v
(1, 2, 3, 4)
>>> from sage.all import *
>>> v = vector([Integer(1),Integer(2),Integer(3),Integer(4)])
>>> a = v.list(copy=False); a
[1, 2, 3, 4]
>>> a[Integer(0)] = Integer(0)
>>> v
(1, 2, 3, 4)
v = vector([1,2,3,4])
a = v.list(copy=False); a
a[0] = 0
v
sage.modules.vector_integer_dense.unpickle_v0(parent, entries, degree)[source]
sage.modules.vector_integer_dense.unpickle_v1(parent, entries, degree, is_mutable)[source]