Dense complex double vectors using a NumPy backend#
EXAMPLES:
sage: # needs sage.symbolic
sage: v = vector(CDF, [(1,-1), (2,pi), (3,5)]); v
(1.0 - 1.0*I, 2.0 + 3.141592653589793*I, 3.0 + 5.0*I)
sage: type(v)
<class 'sage.modules.vector_complex_double_dense.Vector_complex_double_dense'>
sage: parent(v)
Vector space of dimension 3 over Complex Double Field
sage: v[0] = 5
sage: v
(5.0, 2.0 + 3.141592653589793*I, 3.0 + 5.0*I)
sage: loads(dumps(v)) == v
True
>>> from sage.all import *
>>> # needs sage.symbolic
>>> v = vector(CDF, [(Integer(1),-Integer(1)), (Integer(2),pi), (Integer(3),Integer(5))]); v
(1.0 - 1.0*I, 2.0 + 3.141592653589793*I, 3.0 + 5.0*I)
>>> type(v)
<class 'sage.modules.vector_complex_double_dense.Vector_complex_double_dense'>
>>> parent(v)
Vector space of dimension 3 over Complex Double Field
>>> v[Integer(0)] = Integer(5)
>>> v
(5.0, 2.0 + 3.141592653589793*I, 3.0 + 5.0*I)
>>> loads(dumps(v)) == v
True
AUTHORS:
- – Jason Grout, Oct 2008: switch to NumPy backend, factored out
Vector_double_dense class
- class sage.modules.vector_complex_double_dense.Vector_complex_double_dense[source]#
Bases:
Vector_double_dense
Vectors over the Complex Double Field. These are supposed to be fast vector operations using C doubles. Most operations are implemented using numpy which will call the underlying BLAS, if needed, on the system.
EXAMPLES:
sage: v = vector(CDF, [(1,-1), (2,pi), (3,5)]); v # needs sage.symbolic (1.0 - 1.0*I, 2.0 + 3.141592653589793*I, 3.0 + 5.0*I) sage: v*v # rel tol 1e-15 # needs sage.symbolic -21.86960440108936 + 40.56637061435917*I
>>> from sage.all import * >>> v = vector(CDF, [(Integer(1),-Integer(1)), (Integer(2),pi), (Integer(3),Integer(5))]); v # needs sage.symbolic (1.0 - 1.0*I, 2.0 + 3.141592653589793*I, 3.0 + 5.0*I) >>> v*v # rel tol 1e-15 # needs sage.symbolic -21.86960440108936 + 40.56637061435917*I
- sage.modules.vector_complex_double_dense.unpickle_v0(parent, entries, degree)[source]#
Create a complex double vector containing the entries.
EXAMPLES:
sage: v = vector(CDF, [1,2,3]) sage: w = sage.modules.vector_complex_double_dense.unpickle_v0(v.parent(), list(v), v.degree()) sage: v == w True
>>> from sage.all import * >>> v = vector(CDF, [Integer(1),Integer(2),Integer(3)]) >>> w = sage.modules.vector_complex_double_dense.unpickle_v0(v.parent(), list(v), v.degree()) >>> v == w True
- sage.modules.vector_complex_double_dense.unpickle_v1(parent, entries, degree, is_mutable=None)[source]#
Create a complex double vector with the given parent, entries, degree, and mutability.
EXAMPLES:
sage: v = vector(CDF, [1,2,3]) sage: w = sage.modules.vector_complex_double_dense.unpickle_v1(v.parent(), list(v), v.degree(), v.is_immutable()) sage: v == w True
>>> from sage.all import * >>> v = vector(CDF, [Integer(1),Integer(2),Integer(3)]) >>> w = sage.modules.vector_complex_double_dense.unpickle_v1(v.parent(), list(v), v.degree(), v.is_immutable()) >>> v == w True