Path: | rdoc/vector_complex.rdoc |
Last Update: | Sun Nov 14 22:53:48 +0000 2010 |
Constructors.
>> re = Vector[0..3] >> im = Vector[5..8] >> z = Vector::Complex[re, im] [ [0.000e+00 5.000e+00] [1.000e+00 6.000e+00] [2.000e+00 7.000e+00] [3.000e+00 8.000e+00] ]
>> z = Vector::Complex.alloc([0, 1], [2, 5], [-3, 4]) [ [0.000e+00 1.000e+00] [2.000e+00 5.000e+00] [-3.000e+00 4.000e+00] ]
Creates a complex vector of length n and initializes all the elements of the vector to zero.
Returns elements(s) of the complex vector self if args is a single Fixnum, a single Array of Fixnums, or a single GSL::Permutation (or GSL::Index). For all other args, the parameters are treated as with Vector#subvector and a Vector::View is returned.
Example:
>> z [ [0.000e+00 1.000e+00] [2.000e+00 5.000e+00] [-3.000e+00 4.000e+00] ] => #<GSL::Vector::Complex:0x6c5b9c> >> z[1] => GSL::Complex [ 2.000000 5.000000 ] >> z[-1] => GSL::Complex [ -3.000000 4.000000 ] >> z[0, 2] [ [0.000e+00 1.000e+00] [-3.000e+00 4.000e+00] ] => #<GSL::Vector::Complex:0x6bfbac>
If args is empty, behaves as set_all and val must be a [re,im] Array, Float, Integer, or GSL::Complex.
If args is a single Fixnum, i, sets the i-th element of the vector self to val, which must be a [re,im] Array, Float, Integer, or GSL::Complex.
All other args specify a subvector (as with subvector) whose elements are assigned from val. In this case, val can be an Array, Range, GSL::Vector::Complex, or one of the classes listed in the previous cases.
NOTE: GSL does not provide a vector copy function that properly copies data across overlapping memory regions, so watch out if assigning to part of a Vector from another part of itself (see set example of GSL::Vector).
Sets all the elements of the complex vector self to the complex z.
Sets all the elements of the vector self to zero.
Sets the real component of all elements of the vector self to x. Currently, x must be a scalar, but a future Ruby GSL version could accept a GSL::Vector.
Sets the imaginary component of all elements of the vector self to x. Currently, x must be a scalar, but a future Ruby GSL version could accept a GSL::Vector.
Return the vector length.
Return the vector stride.
GSL::Vector::Complex provides four methods for shifting the frequency domain data between FFT order, shown in the table in the ((<Overview of complex data FFTs|URL:fft.html#2.1>)), and natural order, which has the most negative freqeuncy component first, the zero frequency component in the middle, and the most positive frequency component last. For more information on Ruby/GSL and FFTs, see Fast Fourier Transforms.
Shifts the data of self from FFT order to natural order. The fftshift method leaves self unmodified and returns a new GSL::Vector::Complex object containing the shifted data. The fftshift! method modifies self in-place and returns self. Note that fftshift and ifftshift are equivalent for even lengths, but not for odd lengths.
Shifts the data of self from natural order to FFT order. The ifftshift method leaves self unmodified and returns a new GSL::Vector::Complex object containing the shifted data. The ifftshift! method modifies self in-place and returns self. Note that fftshift and ifftshift are equivalent for even lengths, but not for odd lengths.
Returns a new GSL::Vector::Complex instance containing the result of the appropriate arithmetic operation on self and other. The inputs are unchanged. The other parameter may be a scalar, GSL::Vector, or GSL::Vector::Complex.
Modifies self in place to contain the result of the appropriate arithmetic operation on self and other. The other parameter may be a scalar, GSL::Vector, or GSL::Vector::Complex.
Returns a new GSL::Vector::Complex that is the complex conjugate of self.
Conjugates self in-place and returns self.
Calculates the argument (i.e. phase angle in radians) of each of the complex elements of the vector self and returns a real vector.
Calculates the squared magnitude of the complex elements of the vector self and returns a real vector.
Calculates the magnitude of the complex elements of the vector self and returns a real vector.
Calculates the natural logarithm of the magnitude of the complex elements of the vector self and returns a real vector.
Calculates the square root of the complex elements of the vector self and returns a new complex vector.
Returns a GSL::Complex object representing the sum of all elements of self.
Returns a GSL::Complex object representing the mean of all elements of self.
Returns the total sum of squares about self.mean. This is a real number, i.e. a Float.
Returns the total sum of squares about mean. This is a real number, i.e. a Float.
Returns the variance of self. This is a real number, i.e. a Float.
Returns the variance of self around mean. This is a real number, i.e. a Float.
Returns the variance of self around the fixed mean mean. This is a real number, i.e. a Float.
Returns the standard deviation of self. This is a real number, i.e. a Float.
Returns the standard deviation of self around mean. This is a real number, i.e. a Float.
Returns the standard deviation of self around the fixed mean mean. This is a real number, i.e. a Float.
Create a complex vector from a real vector.
>> v = Vector[1..4] => GSL::Vector [ 1.000e+00 2.000e+00 3.000e+00 4.000e+00 ] >> v.to_complex [ [1.000e+00 0.000e+00] [2.000e+00 0.000e+00] [3.000e+00 0.000e+00] [4.000e+00 0.000e+00] ] => #<GSL::Vector::Complex:0x6d7d24> >> v.to_complex2 [ [1.000e+00 2.000e+00] [3.000e+00 4.000e+00] ] => #<GSL::Vector::Complex:0x6d6424>