A Complex Vector (CpxVector) is an object containing zero or more Complex number data items. Each Complex number data item is two IEEE 64 bit double precision real numbers, the real and the imaginary elements. Since complex numbers require room for two doubles, both complex numbers and complex number vectors are heap objects.
The real part and the imaginary part of a complex number are stored as doubles in a heap object. A heap object consists of a Virtual Machine Container which holds a pointer to a data structure in the heap and the data type, in this case, complex. The data structure on the heap contains the object id, the data type, the real part and the imaginary part of the complex number.
Complex numbers support both literals and dynamic creation using new:
(setq X #c1.0+2.0i)
(setq X (new Complex: 1.0 2.0))
The first line creates a literal value embedded in the code. The real part is a double of value 1.0 and the imaginary part is a double of value 2.0. The second line dynamically creates a complex number at run time of the same value. Either case requires the same amount of storage.
When to Use
CpxVectors store zero or more complex numbers as a pair of 64-bit floating-point numbers (doubles) in the heap. The first number of each pair represents the real part of the complex number and the second number represents the imaginary part. Each complex number may be fetched using an integer index. Assuming there are n elements in a vector, the elements of the vector are accessed as elements 0 thru n-1. A CpxVector also has a tail in the same sense that a Pair has a tail. The tail may be any type of variable, but most often, it is a complex number.
Use complex vector to store a sequence of complex numbers for use with the Lambda Information Server statistical and matrix analysis routines.
Object Data Types
The CpxVector is a Heap Object or an Object Data Type. The Analytic Information Server Object Types are stored in the Heap and are managed by the Heap manager. The Analytic Information Server Heap manager supports object resizing, garbage collection, and anti-fragmentation algorithms so that the user may concentrate on the analysis and modeling of data rather than on memory management. Without exception, all of the Object types are identified by an object id. The object id identifies a block of memory, managed by the Lambda Information Server memory manager, in which the Object's data is stored.
The Analytic Information Server Heap Object and Native Data types can be saved and loaded to and from persistent (disk file) storage at any time. Containers with immediate data are saved on disk in fixed length records equal to the size of the container. Containers with Heap object references are saved in fixed length records, which are automatically expanded to include the contents of the Heap object, and any objects referenced by the Heap object, etc. This feature is called Object Closure Management and is automatic with every Analytic Information Server container database save.
Analytic Information Server containers may be loaded from any database repository record at any time. If the data in the record is immediate, the database load fills the container with the immediate data. If the data in the record is an object closure, the database load fills the container with a Heap object reference, and all of the objects in the record are loaded back into the Heap with the same referential relationships they had when they were saved in the repository.
The CpxVector object can be demonstrated by the following functions.
The CpxVector object can be demonstrated by the following examples.