NumVector Overview

a Number Vector (NumVector) is a Heap object containing zero or more IEEE 64 bit double precision real numbers.A Number Vector allow access to stored number (floating point) values using an integer key. A NumVector is a data structure composed of an arbitrary number of Numbers. Assuming there are n elements in a vector, the elements of the vector are accessed as elements 0 thru n-1. A NumVector also has a tail in the same sense that a Pair has a tail.

This sets a NumVector of four number values.

(setq X (new Vector: number: 4 5 -2 11.03 4))


The NumVector is a dynamic data type: it can grow to containing new elements or contract as elements are deleted. An element is accessed by an index from 0 to n-1 where n is the number of elements in the NumVector. When an element is added, it is appended to the end.


Or we might sort the vector


Or we might delete a key by specify the index of the item to be deleted (2)


When to Use

The NumVector is a subtype of the Vector Data Type. The NumVector object is useful for storing numbers. The NumVector object is very fast and has minimum memory overhead due to the indexed access of its values. If you require a random access strategy or a keyed access strategy see the Dictionary or Structure data types.

Visual Basic Comparison

An Analytic Information Server NumVector is similar to the single dimensioned dynamic array in Visual Basic. The Visual Basic array is created at compile time (the Visual Basic Array still requires a "ReDim" to specify a dimension), whereas the Analytic Information Server structure is created, expanded, or contracted dynamically at run time.

Dim DayArray(50)

DayArray is an array of Variants with 51 elements indexed, from 0 thru 50.

Constant Form

The NumVector native data type has a constant form. A NumVector constant is enclosed in brackets and preceded by the sharp symbol #(num| ).

For Example:

#(num| 0 1 2 3 4 5 6 7 8 9)

Object Data Types

The NumVector 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.


Data Type Functions

The NumVector object can be demonstrated by the following functions.

addMethod append apply binaryInsert
binarySearch bitToNumberVector cdr compareEQ
compareGT compareLE compareLT compareNE
compare comparison copy defmethod
delete insert inside isAtom
isEqual isIdentical isInside isMember
isNumberVector isObject isType length
map mapc member methodsOf
new objectToNumVector ref remove
resize reverse send setCdr
setLastCdr setq sizeof sort
type uniqueInsert vectorBinaryInnerProduct vectorBipolarInnerProduct
vectorCosineInnerProduct vectorCubeInnerProduct vectorExpInnerProduct vectorFill
vectorInnerProduct vectorLogInnerProduct vectorQuartInnerProduct vectorQuintInnerProduct
vectorSigmoidInnerProduct vectorSineInnerProduct vectorSquareInnerProduct vectorTanInnerProduct


Data Type Examples

The NumVector object can be demonstrated by the following examples.

Example_NumVector_addMethod_021 Example_NumVector_append_008 Example_NumVector_apply_007 Example_NumVector_binaryInsert_006
Example_NumVector_binarySearch_007 Example_NumVector_bitToNumVector_002 Example_NumVector_bitToNumberVector_002 Example_NumVector_cdr_008
Example_NumVector_compareEQ_014 Example_NumVector_compareGE_014 Example_NumVector_compareGT_014 Example_NumVector_compareLE_014
Example_NumVector_compareLT_014 Example_NumVector_compareNE_014 Example_NumVector_compare_016 Example_NumVector_comparison_014
Example_NumVector_copy_008 Example_NumVector_defmethod_019 Example_NumVector_delete_011 Example_NumVector_insert_007
Example_NumVector_inside_006 Example_NumVector_isAtom_007 Example_NumVector_isEqual_015 Example_NumVector_isIdentical_014
Example_NumVector_isInside_006 Example_NumVector_isMember_006 Example_NumVector_isNumberVector_001 Example_NumVector_isObject_009
Example_NumVector_isType_018 Example_NumVector_length_010 Example_NumVector_map_007 Example_NumVector_mapc_007
Example_NumVector_member_006 Example_NumVector_methodsOf_019 Example_NumVector_new_011 Example_NumVector_objectToNumVector_001
Example_NumVector_ref_024 Example_NumVector_remove_006 Example_NumVector_resize_0008 Example_NumVector_resize_008
Example_NumVector_reverse_005 Example_NumVector_send_017 Example_NumVector_setCdr_008 Example_NumVector_setLastCdr_008
Example_NumVector_setq_021 Example_NumVector_sizeof_016 Example_NumVector_sort_015 Example_NumVector_svmRegression_001
Example_NumVector_type_018 Example_NumVector_uniqueInsert_006 Example_NumVector_vectorBinaryInnerProduct_001 Example_NumVector_vectorBipolarInnerProduct_001
Example_NumVector_vectorCosineInnerProduct_001 Example_NumVector_vectorCubeInnerProduct_001 Example_NumVector_vectorExpInnerProduct_001 Example_NumVector_vectorFill_005
Example_NumVector_vectorInnerProduct_001 Example_NumVector_vectorLogInnerProduct_001 Example_NumVector_vectorQuartInnerProduct_001 Example_NumVector_vectorQuintInnerProduct_001
Example_NumVector_vectorSigmoidInnerProduct_001 Example_NumVector_vectorSineInnerProduct_001 Example_NumVector_vectorSquareInnerProduct_001 Example_NumVector_vectorTanInnerProduct_001