33.5 Real double vectors

Module: sage.modules.real_double_vector

Real double vectors

Author Log:

TESTS:

sage: v = vector(RDF, [1,2,3,4])
sage: loads(dumps(v)) == v
True

Module-level Functions

unpickle_v0( )

unpickle_v1( )

Class: RealDoubleVectorSpaceElement

class RealDoubleVectorSpaceElement

Functions: change_ring,$ \,$ complex_vector,$ \,$ fft,$ \,$ mean,$ \,$ n,$ \,$ numpy,$ \,$ prod,$ \,$ standard_deviation,$ \,$ stats_kurtosis,$ \,$ stats_lag1_autocorrelation,$ \,$ stats_skew,$ \,$ sum,$ \,$ variance

change_ring( )

sage: v = vector(RDF,4,range(4)); v
(0.0, 1.0, 2.0, 3.0)
sage: v.change_ring(CC)
(0, 1.00000000000000, 2.00000000000000, 3.00000000000000)
sage: v.change_ring(CDF)
(0, 1.0, 2.0, 3.0)
sage: v.change_ring(RR)
(0.000000000000000, 1.00000000000000, 2.00000000000000, 3.00000000000000)  

sage: v = vector(RDF,0)
sage: v.change_ring(CC)
()

complex_vector( )

Return the associated complex vector, i.e., this vector but with coefficients viewed as complex numbers.

sage: v = vector(RDF,4,range(4)); v
(0.0, 1.0, 2.0, 3.0)
sage: v.complex_vector()
(0, 1.0, 2.0, 3.0)
sage: v = vector(RDF,0)
sage: v.complex_vector()
()

fft( )

Return the fast Fourier transform of this vector over the complex numbers.

Input:

direction
- 'forward' (default) or 'backward'

sage: v = vector(RDF,4,range(4)); v
(0.0, 1.0, 2.0, 3.0)
sage: v.fft()
(6.0, -2.0 + 2.0*I, -2.0, -2.0 - 2.0*I)
sage: v.fft(direction='backward')
(1.5, -0.5 - 0.5*I, -0.5, -0.5 + 0.5*I)
sage: v.fft(direction='backward').fft()     # random low order bits
(0, 1.0 - 5.74627151417e-18*I, 2.0, 3.0 + 5.74627151417e-18*I)

n( )

Returns a numerical approximation of self by calling the n() method on all of its entries.

sage: v = vector(RDF, [1,2,3])
sage: v.n()
(1.00000000000000, 2.00000000000000, 3.00000000000000)
sage: _.parent()
Vector space of dimension 3 over Real Field with 53 bits of precision
sage: v.n(prec=75)
(1.000000000000000000000, 2.000000000000000000000, 3.000000000000000000000)
sage: _.parent()
Vector space of dimension 3 over Real Field with 75 bits of precision

numpy( )

Return numpy array corresponding to this vector.

sage: v = vector(RDF,4,range(4))
sage: v.numpy()
array([ 0.,  1.,  2.,  3.])
sage: v = vector(RDF,0)
sage: v.numpy()
array([], shape=(1, 0), dtype=float64)

prod( )

Return the product of the entries of self.

Output: RealDoubleElement

sage: v = vector(RDF,[1,2,3,-5])
sage: v.prod()
-30.0

standard_deviation( )

sage: v = vector(RDF, 5, [1,2,3,4,5])
sage: v.standard_deviation()
1.5811388300841898

sum( )

Return the sum of the entries of self.

Output: RealDoubleElement

sage: v = vector(RDF,[1,2,3,-5])
sage: v.sum()
1.0

Special Functions: __copy__,$ \,$ __delitem__,$ \,$ __getitem__,$ \,$ __init__,$ \,$ __len__,$ \,$ __reduce__,$ \,$ __setitem__,$ \,$ _replace_self_with_numpy

__copy__( )

__getitem__( )

Return the ith entry of self.

sage: v = vector(RDF, [1, sqrt(2), -1]); v
(1.0, 1.41421356237, -1.0)
sage: a = v[1]; a
1.41421356237
sage: v[-2]
1.41421356237
sage: parent(a)
Real Double Field
sage: v[5]
Traceback (most recent call last):
...
IndexError: index out of range
sage: v[-5]
Traceback (most recent call last):
...
IndexError: index out of range

__reduce__( )

_replace_self_with_numpy( )

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