Classes (excluding class C):

AFFINE_VECTOR_MAP, ANY_OB, ARRAY, ARRAY2, ARRAY3, ARRAY4, ARRAY_TEST,
BACK_PROP, BACK_PROP_TEST, BASE_CLASSES_TEST, BASE_TEST, BASIC,
BINARY_TREE_NODE, BINARY_TREE_P_NODE, BINARY_TREE_TEST, BIT_VECTOR,
BIT_VECTOR_CURSOR, BIT_VECTOR_TEST, BOOL, BOOL_OB, CELL, CHAR,
CHAR_OB, COMB_RANDOM_GEN, COMPARABLE_INT, COMPOSITION_VECTOR_MAP,
CONFORMS_TO, CONNECTIONIST_CLASSES_TEST, CONSTANT_VECTOR_MAP,
DATA_STRUCTURE_CLASSES_TEST, DOUBLE, DOUBLE_OB, EMPTY_CLASS, ERR,
FAST_BIT_VECTOR, FAST_QUEUE, FEED_FORWARD_NET, FEED_FORWARD_NET_TEST,
FILE, FOREIGN, FOREIGN_TYPE_TEST, FRAME_GRAPHICS_OUT, GAP_LIST,
GAP_LIST_CURSOR, GAP_LIST_TEST, GENERAL_HASH, GENERAL_HASH_CURSOR,
GEOMETRY_CLASSES_TEST, GRAPHICS_OUT, GRAPHICS_OUT_TEST, IN, INT,
INT_HASH_MAP, INT_HASH_MAP_CURSOR, INT_HASH_SET, INT_HASH_SET_CURSOR,
INT_HASH_TEST, INT_OB, LEARNED_VECTOR_MAP, LINEAR_VECTOR_MAP, LIST,
LIST_CURSOR, LIST_TEST, MATH, MATH_TEST, MATRIX, MATRIX_TEST,
MS_RANDOM_GEN, NR_SVD, OB_HASH_MAP, OB_HASH_MAP_CURSOR, OB_HASH_SET,
OB_HASH_SET_CURSOR, OB_HASH_TEST, OB_TYPE_TEST, OUT, PERM_RANDOM_GEN,
PMS_RANDOM_GEN, POSTSCRIPT_GRAPHICS_OUT, PRIORITY_QUEUE,
PRIORITY_QUEUE_TEST, PRODUCT_VECTOR_MAP, QUEUE, QUEUE_TEST, QUICKSORT,
RANDOM, RANDOM_GEN, RANDOM_TEST, RANGE_VECTOR_MAP, REAL, REAL_OB,
SORT_TEST, STACK, STACK_TEST, STR, STR_CURSOR, STR_FORMATTER,
STR_FORMATTER_TEST, STR_HASH_MAP, STR_HASH_MAP_CURSOR,
STR_HASH_MAP_ELT, STR_HASH_SET, STR_HASH_SET_CURSOR, STR_HASH_SET_ELT,
STR_HASH_TEST, STR_SORT, STR_TEST, SUBSET_VECTOR_MAP, SUNWIND,
SUNWIND_GRAPHICS_TEST, SUNWIND_TEST, SYS, SYS_TEST, SYS_TEST_CLASS,
TAGGED_FOB1, TAGGED_FOB2, TEST, TEST_FOB1, TEST_FOB2, TEST_OB1,
TEST_TEST, TIME, TIME_TEST, TYPE, TYPE_TEST, UF_HASH_ELT, UNION_FIND,
UNION_FIND_TEST, UNIX, UNIX_CODES, UNIX_MESSAGES, UNIX_TEST, VECTOR,
VECTOR_2, VECTOR_2_LIST, VECTOR_3, VECTOR_3_LIST, VECTOR_LIST,
VECTOR_LOW_TEST, VECTOR_MAP, VECTOR_MAP_TEST, VECTOR_TEST.

Excluding matches to doc-tag-table-classes-exclude =
""

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

AFFINE_VECTOR_MAP is                                           [class]

   Maps whose output is an affine transformation of the input.


Public definitions of class AFFINE_VECTOR_MAP: 

Inherits from: LEARNED_VECTOR_MAP

m:MATRIX;
   The matrix defining the affine map.

create(in_dim,out_dim:INT):SELF_TYPE is
   A new affine map with given dimensions.

create_with_matrix(m:MATRIX):SELF_TYPE is
   A new affine map with matrix `m'.

map_in(vi,vo:VECTOR) is
   Evaluate the affine map `m' on `vi' and put the results in `vo'.

in_dim:INT is
   The input dimension.

out_dim:INT is
   The output dimension.

train(in,out:VECTOR_LIST) is
   Use the corresponding vectors in the lists `in' and `out' to
   train the map.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ANY_OB is                                                      [class]

   the root of the fully tagged type hierarchy.


Public definitions of class ANY_OB: 

Inherits from: TYPE

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ARRAY{T} is                                                    [class]

   asize:INT: Implemented by the compiler.


Public definitions of class ARRAY: 

clear is
   Clear out the array. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ARRAY2{T} is                                                   [class]

   asize1:INT, asize2:INT: Implemented by the compiler.


Public definitions of class ARRAY2: 

asize:INT is
   Undocumented.

clear is
   Clear out the array. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ARRAY3{T} is                                                   [class]

   asize1:INT, asize2:INT, asize3:INT: Implemented by the compiler.


Public definitions of class ARRAY3: 

asize:INT is
   Undocumented.

clear is
   Clear out the array. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ARRAY4{T} is                                                   [class]

   asize1:INT,asize2:INT, asize3:INT, asize4:INT: Implemented
   by the compiler.


Public definitions of class ARRAY4: 

asize:INT is
   Undocumented.

clear is
   Clear out the array. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ARRAY_TEST is                                                  [class]

   A quick check that the array classes work.


Public definitions of class ARRAY_TEST: 

main is
   Undocumented.

array_test is
   Test of one-dimensional arrays.

array2_test is
   Test of two-dimensional arrays.

array3_test is
   Test of three-dimensional arrays.

array4_test is
   Test of four-dimensional arrays. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BACK_PROP is                                                   [class]

   Implements the back propagation learning algorithm on
   `FEED_FORWARD_NET's. Inherits from `LEARNED_VECTOR_MAP'.


Public definitions of class BACK_PROP: 

Inherits from: LEARNED_VECTOR_MAP

Inherits from: FEED_FORWARD_NET

train_in:VECTOR_LIST;
   List of training/teacher vectors.

train_out:VECTOR_LIST;
  
   List of training/teacher vectors.

teacher:VECTOR;
   Current teacher vector.

n_train:INT;
   Number of training patterns.

max_iter:INT;
   Maximum # of training iterations (1000).

cwts_every:INT;
   How often to change weights (1).

learn_rate:REAL;
   Step size (0.5) and momentum (0.9).

momentum:REAL;
  
   Step size (0.5) and momentum (0.9).

train(in,out:VECTOR_LIST) is
   Use the vectors `in' and `out' to train the map.

train_network(maxi:INT) is
   Train net for `maxi' iterations.

clamp(i:INT) is
   Clamp network with input/teacher pattern `i'.

back_pass is
   Compute error gradient

compute_gradient(l:INT) is
   Compute delta's for layer `l'.

update_weights (chng:BOOL) is
   Update each weights' acumulated gradient.  If `chng'=`true'
   then also update weights.

init_defaults is
   Undocumented.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BACK_PROP_TEST is                                              [class]

   Undocumented.


Public definitions of class BACK_PROP_TEST: 

Inherits from: TEST

main is
  - Test of BACK_PROP

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BASE_CLASSES_TEST is                                           [class]

   This puts tests of all the base classes into a
   single program. If output of this program is redirected to
   a file, only a summary of whether each class passed or did
   not pass its tests will be seen. See
   "sather/etc/test/base_test.sather" for an appropriate
   ".sather" file to use.


Public definitions of class BASE_CLASSES_TEST: 

main is
   Run all tests of the base classes.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BASE_TEST is                                                   [class]

   Test of the base classes.


Public definitions of class BASE_TEST: 

Inherits from: TEST

main is
   Test `BOOL', `CHAR', `INT', `REAL', and `DOUBLE'.

bool_test is
   Test `BOOL'.

char_test is
   Test `CHAR'.

int_test is
   Test `INT'.

real_test is
   Test `REAL'.

double_test is
   Test `DOUBLE'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BASIC is                                                       [class]

   the supertype of all basic types.


Public definitions of class BASIC: 

Inherits from: ANY_OB

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BINARY_TREE_NODE is                                            [class]

   Binary tree nodes, not necessarily any parent pointers.   


Public definitions of class BINARY_TREE_NODE: 

lt:SELF_TYPE;
   Left and right pointers.

rt:SELF_TYPE;
  
   Left and right pointers.

create:SELF_TYPE is
   A new leaf node.

is_leaf:BOOL is
   True if node is a leaf of the tree.

depth:INT is
   The depth of subtree rooted at this node.

number_of_leaves:INT is
   The number of leaves in subtree rooted at this node.

nodes_at_depth(d:INT):INT is
   The number of nodes at depth `d' from this node.

total_depth:INT is
   Sum of the depths of all the leaves.

total_depth_helper(d:INT):INT is
   The contribution of the leaves beneath this root which is at
   depth d, to the total depth.

width:INT is
   The maximum width of the tree rooted at `self'.

leftmost_leaf:SELF_TYPE is
   The leftmost leaf in the tree.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BINARY_TREE_P_NODE is                                          [class]

   Binary tree nodes with parent pointers.


Public definitions of class BINARY_TREE_P_NODE: 

Inherits from: BINARY_TREE_NODE

par:SELF_TYPE;
   parent pointer

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BINARY_TREE_TEST is                                            [class]

   Test of `BINARY_TREE_NODE' and `BINARY_TREE_P_NODE'.


Public definitions of class BINARY_TREE_TEST: 

Inherits from: TEST

main is
   Test of `BINARY_TREE_NODE' and `BINARY_TREE_P_NODE'.

balanced_tree(d:INT):BINARY_TREE_NODE is
   Create a balanced tree of depth `d'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BIT_VECTOR is                                                  [class]

   Automatically expandable bit vectors. 


Public definitions of class BIT_VECTOR: 

fbv: FAST_BIT_VECTOR;
   Undocumented.

create: SELF_TYPE is
   Make a new empty `BIT_VECTOR'.

test(i: INT): BOOL is
   True if `i'th bit is set.

insert(i: INT) is
   Set the `i'th bit, extending if beyond the end.

delete(i: INT) is
   Unset the `i'th bit.

size: INT is
   Number of elements which are set.

clear is
   Clear out all the bits.

cursor: BIT_VECTOR_CURSOR is
   Use the same kind of cursor as in `BIT_VECTOR'.

union(s: BIT_VECTOR): BIT_VECTOR is
   A new set with the elements in the union of `self' and `s'.

intersection(s: BIT_VECTOR): BIT_VECTOR is
   A new set with the elements in the intersection of `self' and `s'.

difference(s: BIT_VECTOR): BIT_VECTOR is
   A new set with the elements in the difference of `self' and `s'.

sym_difference(s: BIT_VECTOR): BIT_VECTOR is
   A new set with the elements in the symmetric difference of
   `self' and `s' (ie. in one but not both).

duplicate: BIT_VECTOR is
   A duplicate bit vector (same as `deep_copy' but faster).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BIT_VECTOR_CURSOR is                                           [class]

   A cursor into `BIT_VECTOR''s for stepping through all entries.


Public definitions of class BIT_VECTOR_CURSOR: 

fbv: FAST_BIT_VECTOR;
   pointer to bit vector

ind: INT;
   bit index into vector

is_done: BOOL;
   true if all entries finished

create(t: FAST_BIT_VECTOR): SELF_TYPE is
   A cursor into `t' which is initialized to the first entry. 

first: INT is
   Set the cursor to the first location, if any.

item: INT is
   The current key.

next: INT is
   Move the cursor to the next location.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BIT_VECTOR_TEST is                                             [class]

   Test of `FAST_BIT_VECTOR', `BIT_VECTOR_CURSOR', and `BIT_VECTOR'.


Public definitions of class BIT_VECTOR_TEST: 

Inherits from: TEST

main is
   Test of `FAST_BIT_VECTOR', `BIT_VECTOR_CURSOR', and `BIT_VECTOR'.
   Testing `BIT_VECTOR' tests the other two classes.

str_of_bv(bv: BIT_VECTOR): STR is
   A string representation of the elements in `bv'.
   Of the form `"1, 4, 5, 9"'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BOOL is                                                        [class]

   `BOOL' defines the routines which are applicable to boolean expressions.
   In addition to `and', `or' and `not' which are built into the Sather
   language, it defines several additional standard binary operations.


Public definitions of class BOOL: 

xor(b:BOOL):BOOL is
   The truth value of `self' exclusive or `b'.

xnor(b:BOOL):BOOL is
   The truth value of `self' exclusive nor `b'.

nand(b:BOOL):BOOL is
   The truth value of `self' nand `b'.

nor(b:BOOL):BOOL is
   The truth value of `self' nor `b'.

implies(b:BOOL):BOOL is
   The truth value of `self' implies `b'.

to_s:STR is
   The string representation of `self'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BOOL_OB is                                                     [class]

   typed BOOL.


Public definitions of class BOOL_OB: 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CELL{T} is                                                     [class]

   simple container.


Public definitions of class CELL: 

val: T;
   Undocumented.

create(v: T): SELF_TYPE is
   creates a cell containing `v'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CHAR is                                                        [class]

   `CHAR' defines operations on characters. The operations with names of
   the form `is_foo' are predicates which return a boolean value
   depending on whether the character has the specified characteristic.
   This is a general naming convention throughout the Sather libraries.
   As in C, white space characters include space, tab, carriage return,
   newline, vertical tab, or form feed. Printing characters are all
   characters except control characters. Punctuation characters are those
   which are neither control characters nor alphanumeric characters. The
   function `to_i' returns the ASCII value corresponding the character.
   The case conversion routines `to_upper_case' and `to_lower_case' work
   on all characters unlike the versions in many C libraries.


Public definitions of class CHAR: 

is_alphabetic:BOOL is
   True if `self' is an alphabetic character.

is_upper_case:BOOL is
   True if `self' is uppercase.

is_lower_case:BOOL is
   True if `self' is lowercase.

is_digit:BOOL is
   True if `self' is a digit.

is_alphanumeric:BOOL is
   True if `self' is alphanumeric.

is_space:BOOL is
   True if `self' is whitespace.

is_print:BOOL is
   True if `self' is a printing character.

is_punctuation:BOOL is
   True if `self' is punctuation.

is_control:BOOL is
   True if `self' is a control character.

to_i:INT is
   Convert `self' to an integer.

to_s:STR is
   The string representation of `self'.

to_upper_case:CHAR is
   Convert `self' to upper case (always works, unlike the C library).

to_lower_case:CHAR is
   Convert `self' to lower case (always works, unlike the C library).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CHAR_OB is                                                     [class]

   typed CHAR.


Public definitions of class CHAR_OB: 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

COMB_RANDOM_GEN{G1,G2} is                                      [class]

   A RANDOM_GEN whose samples are a combination of the two generators
   G1 and G2. These must be descendents of RANDOM_GEN and should be
   independent of one another.


Public definitions of class COMB_RANDOM_GEN: 

Inherits from: RANDOM_GEN

g1:G1;
   The two generators.

g2:G2;
   Undocumented.

create:SELF_TYPE is
   A new combo generator.

init(nseed:INT) is
   Initialize the two generators with nseed.

get:DOUBLE is
   Pseudo-random value in [0.,1.) constructed from g1 and g2.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

COMPARABLE_INT is                                              [class]

   Ints that define `is_less_than'.


Public definitions of class COMPARABLE_INT: 

Inherits from: INT

is_less_than(i:INT):BOOL is
   True if `self' is less than `i'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

COMPOSITION_VECTOR_MAP{M1,M2} is                               [class]

   The composition of maps of type `M1' and `M2'.


Public definitions of class COMPOSITION_VECTOR_MAP: 

Inherits from: VECTOR_MAP

m1:M1;
   The two maps.

v:VECTOR;
   Used to hold the intermediate result.

create(m1:M1; m2:M2):SELF_TYPE is
   A map which is the composition of `m1' and `m2', computes
   `m1(m2(x))'.

map_in(vi,vo:VECTOR) is
   Evaluate the composition of `m1' and `m2' on `vi' and put the
   result into `vo'.

in_dim:INT is
   The dimension of the input space.

out_dim:INT is
   The dimension of the output space.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CONFORMS_TO{X,Y} is                                            [class]

   let compiler check conformance
   by including a construct that requires that `X' conforms to `Y'.


Public definitions of class CONFORMS_TO: 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CONNECTIONIST_CLASSES_TEST is                                  [class]

   This puts tests of all the connectionist classes into a
   single program. If output of this program is redirected to
   a file, only a summary of whether each class passed or did
   not pass its tests will be seen. See
   "sather/etc/test/connectionist_test.sather" for an appropriate
   ".sather" file to use.


Public definitions of class CONNECTIONIST_CLASSES_TEST: 

main is
   Run all tests of the connectionist classes.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CONSTANT_VECTOR_MAP is                                         [class]

   The output is a constant vector, independent of the input.


Public definitions of class CONSTANT_VECTOR_MAP: 

Inherits from: VECTOR_MAP

in_d:INT;
   The input dimension.

v:VECTOR;
   The constant output vector.

create(ind:INT; v:VECTOR):SELF_TYPE is
   A new map with input dimension `ind' and constant output value `v'.

map_in(vi,vo:VECTOR) is
   Fill `vo' with the constant vector value.

in_dim:INT is
   The input dimension.

out_dim:INT is
   The output dimension.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DATA_STRUCTURE_CLASSES_TEST is                                 [class]

   This puts tests of all the data structure classes into a
   single program. If output of this program is redirected to
   a file, only a summary of whether each class passed or did
   not pass its tests will be seen. See
   "sather/etc/test/data_structure_test.sather" for an appropriate
   ".sather" file to use.


Public definitions of class DATA_STRUCTURE_CLASSES_TEST: 

main is
   Run all tests of the data_structure classes.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DOUBLE is                                                      [class]

   `DOUBLE' defines operations on double-precision real numbers.
   It has routines corresponding to those in `REAL' and they obey
   the same restrictions.
   More exotic special functions are defined in the `MATH' class.
   `REAL''s and `DOUBLE''s are generally interchangable and the compiler
   will properly convert between them. `pow(x)' computes `self' raised to
   the power of `x'. It requires that `x' be larger than `0' if `self' is
   equal to zero and that `self' be non-negative if `x' is not an
   integer. `sqrt' computes the square root and requires that `self'
   be non-negative. `to_i', `floor', `ceiling', and `round' compute
   the four natural ways to approximate a floating point value by an
   integer. `mod(x)' computes the floating point remainder of `self'
   divided by `x' and has the same sign as self.


Public definitions of class DOUBLE: 

to_r:REAL is
   Convert to a `REAL'.

to_i:INT is
   Nearest integer toward zero (sometimes called "truncate").

to_s:STR is
   The string representation of `self'.

max(r:DOUBLE):DOUBLE is
   The maximum of `self' and `r'.

min(r:DOUBLE):DOUBLE is
   The minimum of `self' and `r'.

pow(x:DOUBLE):DOUBLE is
    Returns `self' raised to the power of `x'. Error if
   `self=0' and `x<=0' or if `self<0' and `x' is not an `INT'.

sqrt:DOUBLE is
   The square root of `self', `self>=0'.

floor:INT is
   Largest integer not greater than `self'.

ceiling:INT is
   Smallest integer not less than `self'.

round:INT is
   Closest integer to `self'.

abs:DOUBLE is
   The absolute value of `self'.

mod(x:DOUBLE):DOUBLE is
   The floating point remainder of `self/x' with the same sign
   as `self'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DOUBLE_OB is                                                   [class]

   typed DOUBLE.


Public definitions of class DOUBLE_OB: 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

EMPTY_CLASS is                                                 [class]

   Empty class to be used in SYS_TEST.


Public definitions of class EMPTY_CLASS: 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ERR is                                                         [class]

   Direct access to stderr.


Public definitions of class ERR: 

file:FILE := FILE::err;                                       [shared]
   A file object for stderr.

b(bo:BOOL):ERR is
   Undocumented.

c(ch:CHAR):ERR is
   Undocumented.

i(in:INT):ERR is
   Undocumented.

s(st:STR):ERR is
   Undocumented.

r(re:REAL):ERR is
   Undocumented.

d(do:DOUBLE):ERR is
   Undocumented.

nl:ERR is
   Undocumented.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

FAST_BIT_VECTOR is                                             [class]

   Fast low level bit vectors.


Public definitions of class FAST_BIT_VECTOR: 

Inherits from: ARRAY

create(n: INT): SELF_TYPE is
   A bit vector capable of holding next multiple of `32' over `n' bits.

limit: INT is
   The largest allowed entry.

new_limit(l: INT): FAST_BIT_VECTOR is
   A new vector with limit `l' with the same bits as `self'.

test(i: INT): BOOL is
   True if the `i'th bit is set.

insert(i: INT) is
   Set the `i'th bit.

size: INT is
   Number of entries, (not cheap).

delete(i: INT) is
   Unset the `i'th bit.

cursor: BIT_VECTOR_CURSOR is
   Return a cursor into vector.

union(s: FAST_BIT_VECTOR): FAST_BIT_VECTOR is
   A new set with the elements in the union of `self' and `s'.

intersection(s: FAST_BIT_VECTOR): FAST_BIT_VECTOR is
   A new set with the elements in the intersection of `self' and `s'.

difference(s: FAST_BIT_VECTOR): FAST_BIT_VECTOR is
   A new set with the elements in the difference of `self' and `s'.

sym_difference(s: FAST_BIT_VECTOR): FAST_BIT_VECTOR is
   A new set with the elements in the symmetric difference of
   `self' and `s' (ie. in one but not both).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

FAST_QUEUE{T} is                                               [class]

   Low-level queues (actually deques).


Public definitions of class FAST_QUEUE: 

Inherits from: ARRAY

t:INT;
   Indices of the queue top and bottom.
   `t' is where next element comes from.
   `b' is where next insertion goes. 

b:INT;
  
   Indices of the queue top and bottom.
   `t' is where next element comes from.
   `b' is where next insertion goes. 

create:SELF_TYPE is
   An emtpy queue.

is_empty:BOOL is
   True if queue is empty.

size:INT is
   Number of elements currently in queue.

double_size:FAST_QUEUE{T} is
   Double the size of `self', copy the elements over. 

insert_bottom(e:T):FAST_QUEUE{T} is
   Insert an element at the bottom, expand if necessary.

insert_top(e:T):FAST_QUEUE{T} is
   Insert an element at the top, (really a deque operation).

top:T is
   The top of the queue.

bottom:T is
   The bottom of the queue.

pop_top:T is
   Pop the top and return it.

pop_bottom:T is
   The bottom of the queue (really a deque operation).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

FEED_FORWARD_NET is                                            [class]

   Feed forward connectionist networks.
  
   The representation of networks in FEED_FORWARD_NET is designed to be
   flexible enough to represent all possible network topologies, without
   sacrificing efficiency for the most widely used network types.  The
   network is represented as an array of units. The bias is represented
   as the `0''th unit; its state is always `1'.  The units are partitioned
   into a disjoint set of layers. Each layer is simply a range of unit
   numbers.
  
   The connectivity of the network is specified as an array of groups.
   Each group is simply a pair of layers (source and destination) which
   are fully connected.  This also allows a compact representation of the
   weights.  They are stored as an array of matrices, with one matrix for
   each group.
  
   Any network topology can be specified. (In the worst case,
   each unit may need to be in a separate layer.) The representation and
   update algorithms are near optimal (in space and time complexity) for
   large back-propagation networks which typically have a very small
   number of fully connected layers.


Public definitions of class FEED_FORWARD_NET: 

Inherits from: VECTOR_MAP

rand_min: REAL;
   Range of initial random weights (-0.5,0.5).

rand_max: REAL;
  
   Range of initial random weights (-0.5,0.5).

n_units: INT;
   Total number of units.

n_inps: INT;
   Number of input and output units.

n_outs: INT;
  
   Number of input and output units.

n_hiddens: INT;
   Number of hidden units.

first_out: INT;
   Index of first output unit.

state: ARRAY2{REAL};
   Unit states:
     `state[0,i]' - Output of `i''th unit.
     `state[1,i]' - Net input (weighted sum).
     `state[2,i]' - Error value (delta).

weight: ARRAY2{MATRIX};
   Matrix of weights for each group:
     `weight[0,g]' - Weight values for group `g'.
     `weight[1,g]' - Last weight update (delta w)
     `weight[2,g]' - Changes since last update

layers: ARRAY2{INT};
   Range of layer `l' is `layer[0,l]'...`layer[1,l]'

groups: ARRAY2{INT};
   Ranges for the 2 layers in each group:
     `groups[0,g]'...`groups[1,g]' (source layer)
     `groups[2,g]'...`groups[3,g]' (dest layer)

create:SELF_TYPE is
   A new network.

create_sized(inps,hids,outs:INT):SELF_TYPE is
   Returns a basic network with `inps' input units,
   `hids' hidden units, and `outs' output units.
   Weights are randomized.

map_in(vi,vo:VECTOR) is
   Put the value of the map on `vi' into `vo'.

in_dim:INT is
   Dimension of the input space.

out_dim:INT is
   Dimension of the output space.

clamp_net(i1,i2:INT; vec:VECTOR) is
   Clamps units `i1' thru `i2' with `vec'.

forward is
   Propagate input through all layers.

randomize_weights is
   Use uniform distribution on `[rand_min,rand_max]' to initialize
   weights.

get_weight(i,j:INT):REAL is
   Return the value of the weight from unit `i' to unit `j'.
   Return `0' if there is no such connection.

set_weight(i,j:INT; r:REAL) is
   Set the weight from unit `i' to `j' to be `r'.

layer_of(i:INT):INT is
   Returns unit `i''s layer number (`-1' if none).

outfun(x:REAL):REAL is
   Unit output function. Default is `sigmoid(x)'.

d_outfun(x:REAL):REAL is
   Returns derivative of output function at `x'.
   Default derivative of sigmoid is f'(x) = f(x)*(1-f(x)).

structure: INT;
   1 => Standard one layer perceptron.
   2 => Standard 2 layer net.
   0 => Anything.
   Used to optimize propagation routines.

outfun_table:ARRAY{REAL};
   Undocumented.

half_table:INT;
   1/2 of the number of table entries.

init_outfun (ts:INT) is
   Initialize table of function values.

init_defaults is
   Initialize the default values.

init_1_layer(inps,outs:INT) is
   Create a 1 layer perceptron.

init_2_layer(inps,hids,outs:INT) is
   Create a 2 layer net.

init_units is
   Undocumented.

set_layer(l,b,e:INT) is
   Undocumented.

set_group(g,beg1,end1,beg2,end2:INT) is
   Undocumented.

compute_output(l:INT) is
   Compute the output for all units in layer `l'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

FEED_FORWARD_NET_TEST is                                       [class]

   Undocumented.


Public definitions of class FEED_FORWARD_NET_TEST: 

Inherits from: TEST

main is
  --- Test of FEED_FORWARD_NET

clamp_test(net:$FEED_FORWARD_NET; v1:VECTOR) is
   Undocumented.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

FILE is                                                        [class]

   Sather representation of Unix file structure.


Public definitions of class FILE: 

fp:F_OB;
   A C pointer to the file

name:STR;
   The name of the file.

eof:INT:=-1;                                                [constant]
   C marker for end of file.

error_val:INT;                                                [shared]
   Error code for Sather read errors.

read_error:INT := 1;                                        [constant]
   Error while attempting to read.

eof_error:INT := 2;                                         [constant]
   Hit end of file while attempting to read.

open_error:INT := 3;                                        [constant]
   Error in opening file.

error:INT is
   0 if no error on last operation. Error code otherwise. Clears err.

create:SELF_TYPE is
   A new unitialized file object.

in:SELF_TYPE is
   A FILE object for stdin.

out:SELF_TYPE is
   A FILE object for stdout.

err:SELF_TYPE is
   A FILE object for stderr.

check_eof:BOOL is
   True if eof has been previously read. Clear the status.

get_c:CHAR is
   Read a character. No checking for eof. Must use check_eof.

get_ci:INT is
   Read a character as an integer. 

get_b:BOOL is
   Read "T" or "F". False and error if neither.

get_i:INT is
   Read an integer.

get_r:REAL is
   Read a real number.

get_d:DOUBLE is
   Read a double.

get_s:STR is
   Read a string up to the next \n.

get_s_up_to(c0:CHAR):STR is
   Read a string up to (but excluding) the next character given
   by c0.

unget_c(ch:CHAR) is
   Unget the last character.

b(bo:BOOL):SELF_TYPE is
   Output "T" or "F" and return the file.

c(ch:CHAR):SELF_TYPE is
   Output a character.

i(in:INT):SELF_TYPE is
   Output an int.

s(st:STR):SELF_TYPE is
   Output a string.

r(re:REAL):SELF_TYPE is
   Output a real.

d(do:DOUBLE):SELF_TYPE is
   Output a double.

nl:SELF_TYPE is
   Undocumented.

open_for_read(nm:STR) is
   Open the named file for reading.

open_for_write(nm:STR) is
   Open the named file for writing.

open_for_append(nm:STR) is
   Open the named file for appending.

close is
   Close the file.

get_s_of_len(n:INT):STR is
   Read at most n characters.

flush is
   Flush the buffer.

open_pipe_for_read(command:STR) is
   Open a pipe for reading with given sh shell command line.

open_pipe_for_write(command:STR) is
   Open a pipe for writing with given sh shell command line.

close_pipe is
   Close a pipe.

seek_relative(n:INT) is
   Move in the file relative to current location.

seek_from_front(n:INT) is
   Move relative to front of file.

seek_from_end(n:INT) is
   Move relative to end of file.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

FOREIGN{T} is                                                  [class]

   typed F_OB. Avoid $F_OB with x.val.
   One should create only `FOREIGN{FOO}'s rather than `FOREIGN{$FOO}'s.
   So the type tag is exactly `FOREIGN{FOO}::type' and one lets
   the compiler assign a type tag representing the foreign type`FOO'.
   `x.is_of(FOREIGN{$FOO})' then is a safe and portable conformance check.


Public definitions of class FOREIGN: 

Inherits from: CELL

Inherits from: ANY_OB

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

FOREIGN_TYPE_TEST is                                           [class]

   Undocumented.


Public definitions of class FOREIGN_TYPE_TEST: 

Inherits from: TEST

Inherits from: TYPE

main is
   Undocumented.

tagged_object_test is
   Undocumented.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

FRAME_GRAPHICS_OUT is                                          [class]

   Framemaker graphics ouput in Marker Interchange Format (MIF).


Public definitions of class FRAME_GRAPHICS_OUT: 

Inherits from: GRAPHICS_OUT

scale:REAL;
   The amount by which to scale output.

file:FILE;
   The file to put the output.

create(file:FILE):SELF_TYPE is
   Initialize to make figures in Framemaker documents. Put output in 
   `file'.

draw_point (x,y:REAL) is
   Draw a single point at the location `(x,y)'.

draw_line (x1,y1,x2,y2:REAL) is
   Draw a line segment from `(x1,y1)' to `(x2,y2)'.

draw_polyline (l:LIST{VECTOR_2}) is
   Draw a series of segments given by the points in `l'.

draw_closed_polyline (l:LIST{VECTOR_2}) is
   Draw the closed shape defined by the points in `l'. Respects
   `filled'.

draw_rect (x1,y1,x2,y2:REAL) is
   Draw a rectangle with diagonally opposite corners `(x1,y1)' and
   `(x2,y2)'. Respects the status of `filled'.

draw_circle (x,y,r:REAL) is
   Draw a circle centered at `(x,y)' of radius `r'. Respects `filled'.

draw_str (x,y:REAL; s:STR) is
   Draw the string `s' with location (specified by `str_loc')
   at `(x,y)'.

init is
   Header information for mif file.

finish is
   Close the file.

comment (s:STR) is
   Put a comment into the output.

line_width_out is
   Output line_width information.

line_gray_out is
   Output `line_gray' information, code between `0' and `7'.

fill_gray_out is
   Output `fill_gray' information, code between `0' and `7'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GAP_LIST{T} is                                                 [class]

   An array replacement for linked lists.
   The class `GAP_LIST{T}' is an array based list structure like `LIST{T}'
   but it supports insertions and deletions from the middle of the list
   as well as the end.  This structure consists of an extensible array
   with a "gap" region in the middle. When an insertion or deletion is
   required, the gap is first moved to the proper location by moving
   elements around.  Element access is by index and skips over the gap
   wherever it may lie. As long as most insertions and deletions are
   fairly close in location to the preceding one, the movement of
   elements accross the gap will not be extensive. Algorithms which are
   based on doubly linked lists often have a single pointer which moves
   up and down the list inserting and deleting elements as it moves. Such
   algorithms will also operate efficiently with gap lists.  Sometimes
   this structure is refered to as a "double stack" since it may be
   viewed as two stack which approach one another. It has found wide use
   in text editors (such as GNU Emacs) and turns out to be much more
   efficient in practice than more obvious structures such as a linked
   list of strings for each line.


Public definitions of class GAP_LIST: 

Inherits from: ARRAY

gap_start: INT;
   Start of gap and size of gap.

gap_size: INT;
  
   Start of gap and size of gap.

create: SELF_TYPE is
   A new `GAP_LIST' with default `size=5'.

create_sized(n: INT): SELF_TYPE is
   A new `GAP_LIST' with `size=n'.

insert(i: INT; e: T): SELF_TYPE is
   Insert element `e' at location `i' pushing later elements forward.
   Usage: `l:=l.insert(5,e)'. Destructive.

delete(i: INT) is
   Delete the `i'th element.

move_gap(l: INT) is
   Move the gap to start at `l'. Must have `l<=size'.

get(i: INT): T is
   Retrieve the `i'th element.

size: INT is
   The total number of elements.

replace(i: INT; e: T) is
   Replace the `i'th element by `e'.

is_empty: BOOL is
   True if `self' is empty.

clear is
   Clear the list.

cursor: GAP_LIST_CURSOR{T} is
   A cursor into `self'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GAP_LIST_CURSOR{T} is                                          [class]

   Cursors into `GAP_LIST{T}' for stepping through all entries.
   Since the elements in a `GAP_LIST' structure are accessible by index it
   is often convenient to directly step through the elements. This cursor
   class is provided for consistency with other classes,
   however. The way one would print each element in `l' a `GAP_LIST{INT}'
   without using a `GAP_LIST_CURS' object is:
   `
      i:INT; until i=l.size loop
         OUT::i(l[i]).s(" ");
         i:=i+1
      end;
   '
   Using a cursor this would look like:
   `
      lc:GAP_LST_CURS:=l.cursor; until lc.is_done loop
         OUT::i(lc.item).s(" ");
         lc.next;
      end;
   '


Public definitions of class GAP_LIST_CURSOR: 

l: GAP_LIST{T};
   The list pointed into.

index: INT;
   The index into the list.

create(l: GAP_LIST{T}): SELF_TYPE is
   A cursor into `l' which is initialized to the first element. 

is_done: BOOL is
   True if all entries have been visited.

first: T is
   Set the cursor to the first location, if any.

item: T is
   The current entry or `void' if `is_done'.

next: T is
   Move the cursor to the next location.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GAP_LIST_TEST is                                               [class]

   Test of `GAP_LIST{T}'.


Public definitions of class GAP_LIST_TEST: 

Inherits from: TEST

main is
   Test of `GAP_LIST{T}'.

str_of_list(l: GAP_LIST{INT}): STR is
   A string containing the elements of `l' of the form `"1, 2, 3"'.

list_of_range(l,h: INT): GAP_LIST{INT} is
   A gap list containing `l,...,h'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GENERAL_HASH{T} is                                             [class]

   General hash tables which hold elements of type `T'.
   Type `T' must define `hash:INT' and `is_equal(e:T):BOOL'.
   The table is always at least twice as large as the number of
   elements. `void' elements are used for empty
   entries. The size of the table is always of the form `2^n+1' and nearly
   doubles on each expansion. The last entry is a sentinel element 
   which holds `void' (to avoid testing for the end of array in the loop).
   The hash function defined in `T' returns an `INT', the last `n' bits of
   which are used to index the table.


Public definitions of class GENERAL_HASH: 

size: INT;
   Number of entries stored.

tbl: ARRAY{T};
   Storage for the elements.

mask: INT;
   Mask for hash function.
   If table is of size `2^n+1' then mask will have last `n' bits on.

create: SELF_TYPE is
   An emtpy hash table.

get(e: T): T is
   The stored element which `is_equal(e)' or `void' if absent.

double_size is
   Resize tbl to double. Copy entries over.

insert(e: T) is
   Insert element `e'. Overwrite an `is_equal' entry if present.

delete(e: T) is
   Delete element `e' if present.

clear is
   Clear the tables.

cursor: GENERAL_HASH_CURSOR{T} is
   A cursor into the table.

is_empty: BOOL is
   True if `self' is empty.

union(s: GENERAL_HASH{T}): GENERAL_HASH{T} is
   A new table whose keys are the union of those in `self' and
   in `s'. In case of equality, the elements in `self' are used.

intersection(s: GENERAL_HASH{T}): GENERAL_HASH{T} is
   A new table whose keys are the intersection of those in `self'
   and `s' and whose elements are taken from `self'.

difference(s: GENERAL_HASH{T}): GENERAL_HASH{T} is
   A new table with the items in `self' which are not contained in `s'.

sym_difference(s: GENERAL_HASH{T}): GENERAL_HASH{T} is
   A new table with the elements which are in `self' or `s' but
   not both.

is_a_subset_of(s: GENERAL_HASH{T}): BOOL is
   True if the keys in `self' are a subset of those in `s'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GENERAL_HASH_CURSOR{T} is                                      [class]

   A cursor into `GENERAL_HASH{T}' tables for stepping through
   all elements.


Public definitions of class GENERAL_HASH_CURSOR: 

t: GENERAL_HASH{T};
   The pointer to the table.

index: INT;
   The index into the table.

is_done: BOOL;
   True if all entries have been visited.

create(nt: GENERAL_HASH{T}): SELF_TYPE is
   A cursor into `nt' which is initialized to the first element. 

first: T is
   Set the cursor to the first location, if any.

item: T is
   The current element.

next: T is
   Move the cursor to the next location.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GEOMETRY_CLASSES_TEST is                                       [class]

   This puts tests of all the geometry classes into a
   single program. If output of this program is redirected to
   a file, only a summary of whether each class passed or did
   not pass its tests will be seen. See
   "sather/etc/test/geometry_test.sather" for an appropriate
   ".sather" file to use.


Public definitions of class GEOMETRY_CLASSES_TEST: 

main is
   Run all tests of the geometry classes.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GRAPHICS_OUT is                                                [class]

   Specification class to be inherited by classes which support basic
   drawing primitives. Drawing is in the unit square. All
   coordinates are reals in `[0.,1.]'. The origin `(0.,0.)' is the lower 
   left corner and coordinates increase upward and rightward.
   If a particular output device doesn't support a call, it should make
   its best attempt (eg. if gray lines aren't supported, it should draw
   them in black).


Public definitions of class GRAPHICS_OUT: 

line_width:REAL;
   The width of the next line.

point_diameter:REAL;
   The diameter of the next point.

filled:BOOL;
   Whether the next figure should be filled.

no_line:BOOL;
   True if no bounding line should appear.
   Gray levels represent black by `0.' and white by `1.'

line_gray:REAL;
   The next line's gray level (default black).

fill_gray:REAL;
   If filled, the next fill's gray level.
   Locations in a string.

str_l:INT:=0;                                               [constant]
   The bottom left of a string (the default).

str_c:INT:=1;                                               [constant]
   The bottom center of a string.

str_r:INT:=2;                                               [constant]
   The bottom right of a string.

str_loc:INT;
   The part of a string used to locate it.

font:INT;
   The font to use in drawing strings.

draw_point(x,y:REAL) is
   Draw a single point at the location `(x,y)'.

draw_line(x1,y1,x2,y2:REAL) is
   Draw a line segment from `(x1,y1)' to `(x2,y2)'.

draw_polyline(l:LIST{VECTOR_2}) is
   Draw a series of segments given by the points in `l'.

draw_closed_polyline(l:LIST{VECTOR_2}) is
   Draw the closed shape defined by the points in `l'. Should respect
   the status of `filled'. Default just draws lines.

draw_rect(x1,y1,x2,y2:REAL) is
   Draw a rectangle with diagonally opposite corners `(x1,y1)' and
   `(x2,y2)'. Should respect the status of `filled'.
   Default just draws lines.

draw_circle (x,y,r:REAL) is
   Draw a circle centered at (x,y) of radius r. Respects "filled".
   Default just draws `20' segments.

draw_str (x,y:REAL; s:STR) is
   Draw the string `s' with location (specified by `str_loc')
   at `(x,y)'.

init is
   Start up a graphic, for devices which need it.

finish is
   Finish up a graphic, for devices which need it.

comment (s:STR) is
   Put a comment into the output, for devices which support it.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GRAPHICS_OUT_TEST is                                           [class]

   Test of FRAME_GRAPHICS_OUT.


Public definitions of class GRAPHICS_OUT_TEST: 

main is
   Undocumented.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

IN is                                                          [class]

   Direct access to stdin.


Public definitions of class IN: 

file:FILE := FILE::in;                                        [shared]
   A file object for stdin.

get_c:CHAR is
   Undocumented.

get_b:BOOL is
   Undocumented.

get_i:INT is
   Undocumented.

get_r:REAL is
   Undocumented.

get_d:DOUBLE is
   Undocumented.

get_s:STR is
   Undocumented.

unget_c(ch:CHAR) is
   Undocumented.

check_eof:BOOL is
   Undocumented.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

INT is                                                         [class]

   `INT' defines operations on integers. The operations built
   into Sather include addition, subtraction, multiplication, and
   division. The syntax of a dotted routine call makes it natural for
   infix operations (eg. `15.mod(8)'). The `mod' routine produces the
   mathematical modulo operation on arbitrary integers. The `u_mod'
   operation agrees with it on positive integers and executes more
   quickly. The `to_s' routine produces a string representation of self,
   but it is more common to append an integer to an existing string as in
   `my_string.i(15)'. The routines with name of the form `bit_foo'
   perform boolean operations bitwise on the integer. `lshift' and
   `rshift' insert 0's into locations shifted from the edge of the
   integer. `arith_rshift' inserts 1's in case the integer is negative.
   The `sqrt' routine must be applied to a non-negative argument.
   Many of these operations are implemented as macros and do not have
   the overhead of a function call.


Public definitions of class INT: 

u_mod(i:INT):INT is
   Fast version of modulo `i'. Always ends up in range [0, i) but 
   on negatives the value is shifted by (2^32 mod i) from true modulo.

mod(i:INT):INT is
   Remainder when `self' is divided by `i' (works on negative `INT''s). 

to_r:REAL is
   Convert to `REAL'.

to_d:DOUBLE is
   Convert to `DOUBLE'.

to_c:CHAR is
   Convert to `CHAR'.

to_s:STR is
   The string representation of `self'.

bit_and(i:INT):INT is
   The bitwise "and" of `self' and `i'.

bit_or(i:INT):INT is
   The bitwise "or" of `self' and `i'.

bit_xor(i:INT):INT is
   The bitwise "exclusive or" of `self' and `i'.

bit_not:INT is
   Return `self' with its bits inverted.

lshift(i:INT):INT is
   The bits of `self' shifted left `i' places.

rshift(i:INT):INT is
   The bits of `self' shifted right `i' places.

arith_rshift(i:INT):INT is
   The bits of `self' arithmetically shifted right `i' places.
   If `i' is negative, inserts ones.

abs:INT is
   Absolute value.

nth_bit(n:INT):BOOL is
   True if the `n'th bit of `self' is 1.

set_nth_bit(n:INT):INT is
   Return `self' with the `n'th bit set.

unset_nth_bit(n:INT):INT is
   Return `self' with the `n'th bit unset.

max(i:INT):INT is
   The maximum of `self' and `i'.

min(i:INT):INT is
   The minimum of `self' and `i'.

pow(i:INT):INT is
   Integer approximation of `self' to the `i'th power.

sqrt:INT is
   Integer approximation of the square root of `self'.

to_octal:STR is
   The octal representation of `self' of the form `"015"'.
   `self' is interpreted as an unsigned integer.

to_binary:STR is
   The binary representation of `self' of the form `"100100"'.
   `self' is interpreted as an unsigned integer.

to_hex:STR is
   The hexadecimal representation of `self' of the form `"0x5A"'.
   `self' is interpreted as an unsigned integer.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

INT_HASH_MAP{T} is                                             [class]

   Hash tables which associate elements of type `T' to non-negative
   `INT' keys. The table is always at least twice as large as number
   of ints (plus the number of deletes since last expansion).
   The key `-1' is used for empty entries, `-2' for deleted ones.
   The size of the table is always one greater than a power of two and
   nearly doubles on each expansion. The last entry is a sentinel element
   which always holds `-1' (to avoid testing for end of array in loop).
   The hash function is just the last `n' bits of the 
   `INT' key.The extra serial search this simple function sometimes 
   entails is still cheaper than more typical functions which use a
   multiply and a modulo operation. 


Public definitions of class INT_HASH_MAP: 

hsize: INT;
   Number of entries stored.

key_tbl: ARRAY{INT};
   Storage for the keys.

ent_tbl: ARRAY{T};
   Storage for the entries.

mask: INT;
   Mask for the hash function
   If table is of size `2^n+1' then mask will have last `n' bits on.

create: SELF_TYPE is
   An empty hash table.

get(k: INT): T is
   The entry associated with key `k' or `void' if absent.

double_size is
   Resize `self' to double. Copy non-deleted entries over.

insert(k: INT; e: T) is
   Insert key `k' with entity `e'. Overwrite if present.

delete(k: INT) is
   Delete entry `k' if present.

size: INT is
   Number of entries stored, (not fast).

clear is
   Clear the tables.

cursor: INT_HASH_MAP_CURSOR{T} is
   A cursor into the table.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

INT_HASH_MAP_CURSOR{T} is                                      [class]

   A cursor into `INT_HASH_MAP{T}' tables for stepping through all keys.


Public definitions of class INT_HASH_MAP_CURSOR: 

tbl: INT_HASH_MAP{T};
   The pointer to the table.

index: INT;
   The index into the table.

is_done: BOOL;
   True if all entries have been visited.

create(t: INT_HASH_MAP{T}): SELF_TYPE is
   A cursor into `t' which is initialized to the first element. 

first: T is
   Set the cursor to the first location, if any.

key: INT is
   The current key.

item: T is
   The item associated with the current key.

next: T is
   Move the cursor to the next location.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

INT_HASH_SET is                                                [class]

   Sets of non-negative integers represented by extendible hash tables.
   The table is always at least twice as large as number of `INT''s (plus
   number of deletes since last expansion). The key `-1' is used for empty
   entries, `-2' for deleted ones. The size of the table is always of the
   form `2^n+1' and nearly doubles on each expansion. The last entry is 
   a sentinel element which always holds `-1' (to avoid testing for end of
   array in loop). The hash function is just the last `n' bits of the 
   `INT' key.The extra serial search this simple function sometimes 
   entails is still cheaper than more typical functions which use a
   multiply and a mod.


Public definitions of class INT_HASH_SET: 

hsize: INT;
   Number stored (including deletes!).

mask: INT;
   Mask for the hash function.

Inherits from: ARRAY

create: SELF_TYPE is
   An empty `INT_HASH_SET'.

get(k: INT): BOOL is
   True if `k' is in the stored set.

double_size: INT_HASH_SET is
   Resize `self' to double. Copy non-deleted entries over.

insert(k: INT): INT_HASH_SET is
   Insert key `k'. Usage: `s:=s.insert(k)'.

delete(k: INT) is
   Delete entry `k' if it is in the table.

size: INT is
   Number of entries, (not cheap).

clear is
   Empty the table out.

cursor: INT_HASH_SET_CURSOR is
   Return a cursor into the table.

union(s: INT_HASH_SET): INT_HASH_SET is
   A new set whose elements are the union of `self' and `s'.

intersection(s: INT_HASH_SET): INT_HASH_SET is
   A new set whose elements are the intersection of `self' and `s'.

difference(s: INT_HASH_SET): INT_HASH_SET is
   A new set whose elements are those in `self' which are not in `s'.

sym_difference(s: INT_HASH_SET): INT_HASH_SET is
   A new set whose elements are those in `self' or `s' but not both.

is_a_subset_of(s: INT_HASH_SET): BOOL is
   True if `self' is a subset of `s'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

INT_HASH_SET_CURSOR is                                         [class]

   A cursor into `INT_HASH_SET''s for stepping through all keys.


Public definitions of class INT_HASH_SET_CURSOR: 

tbl: INT_HASH_SET;
   The pointer to the table.

index: INT;
   The index into the table.

is_done: BOOL;
   True if all entries finished.

create(t: INT_HASH_SET): SELF_TYPE is
   A cursor into `t' which is initialized to the first element. 

first: INT is
   Set the cursor to the first location, if any.

item: INT is
   The current item in the set.

next: INT is
   Move the cursor to the next location.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

INT_HASH_TEST is                                               [class]

   Test the classes `INT_HASH_MAP', `INT_HASH_MAP_CURSOR',
   `INT_HASH_SET', and `INT_HASH_SET_CURSOR'.


Public definitions of class INT_HASH_TEST: 

Inherits from: TEST

main is
   Test the classes `INT_HASH_MAP', `INT_HASH_MAP_CURSOR',
   `INT_HASH_SET', and `INT_HASH_SET_CURSOR'.

int_hash_map_test is
   Test of `INT_HASH_MAP' and `INT_HASH_MAP_CURSOR'.

str_of_map(h: INT_HASH_MAP{INT}): STR is
   A string with the contents of `h' of the form "4:34, 7:34" where
   the key is followed by a colon and the corresponding item. 

evenly_spaced_map(start,step,num: INT): INT_HASH_MAP{INT} is
   An `INT_HASH_MAP{INT}' containing `num' `INT''s starting at `start'
   and with spacing `step', each is paired with itself plus 1000.

int_hash_set_test is
   Test of `INT_HASH_SET' and `INT_HASH_SET_CURSOR'.

evenly_spaced_set(start,step,num: INT): INT_HASH_SET is
   An `INT_HASH_SET' containing `num' `INT''s starting at `start' and
   with spacing `step'.

str_of_set(s: INT_HASH_SET): STR is
   A string containing the elements of `s' separated by commas.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

INT_OB is                                                      [class]

   typed INT.


Public definitions of class INT_OB: 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LEARNED_VECTOR_MAP is                                          [class]

   A `VECTOR_MAP' which is learned from examples.


Public definitions of class LEARNED_VECTOR_MAP: 

Inherits from: VECTOR_MAP

train(in,out:VECTOR_LIST) is
   Use the corresponding vectors in the lists `in' and `out' to
   train the map.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LINEAR_VECTOR_MAP is                                           [class]

   Maps whose output is a linear transformation of the input.


Public definitions of class LINEAR_VECTOR_MAP: 

Inherits from: LEARNED_VECTOR_MAP

m:MATRIX;
   The matrix defining the linear map.

create(in_dim,out_dim:INT):SELF_TYPE is
   A new linear map with given dimensions.

create_with_matrix(m:MATRIX):SELF_TYPE is
   A new linear map with matrix `m'.

map_in(vi,vo:VECTOR) is
   Evaluate the linear map `m' on `vi' and put the result in `vo'.

in_dim:INT is
   The input dimension.

out_dim:INT is
   The output dimension.

train(in,out:VECTOR_LIST) is
   Use the corresponding vectors in the lists `in' and `out' to
   train the map.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LIST{T} is                                                     [class]

   The class `LIST{T}' defines what is perhaps the most widely
   useful data structure in the Sather libraries. They are
   extensible stacks based on amortized doubling. In some ways they
   may be thought of as replacements for linked lists. Like linked
   lists (which are widely used as containers in languages like
   LISP), they serve as general container objects for holding
   collections of other objects. They are often a more efficient
   abstraction, however, because less allocation and deallocation
   must occur, because they keep successive elements in successive
   memory locations, they don't require storage for the links in a
   linked list, and they support efficient access by array index.
   Linked lists also support insertion and deletion into the middle
   of the list. A variant of the `LIST' class called `GAP_LIST' will
   often be useful in applications which require these operations.
   The set operations `union', `intersection', `difference', and
   `sym_difference' and the searching operation `index_of' are
   implemented by brute force search. If extensive use is made of
   these operations, one should consider the use of other data
   structures such as `INT_HASH_SET', `OB_HASH_SET', or `BIT_VECTOR'.


Public definitions of class LIST: 

Inherits from: ARRAY

size: INT;
   The current insertion location.

create: SELF_TYPE is
   A new list with default `size=5'.

create_sized(n: INT): SELF_TYPE is
   A new list with `size=n' (minimum of `1').

push(e: T): SELF_TYPE is
   Add a new element to the end of the list, extending if necessary.
   Usage: `l:=l.push(e)'. Destructive.

push_if_new(e: T): SELF_TYPE is
   Push `e' if not already present in the list.
   Usage is: `l:=l.push_if_new(e)'. Destructive.

is_empty: BOOL is
   True if the list is empty.

safe_is_empty: BOOL is
   True if `self' is `void' or empty.

pop: T is
   Return the top element and shrink the list. `void' if empty.

top: T is
   The value of the top of the list. `void' if empty.

append(l: SELF_TYPE): SELF_TYPE is
   Append the `l' to the end of `self' and return the result.
   Destructive.

union(s: SELF_TYPE): SELF_TYPE is
   A new list containing the elements in `self' union `s'.
   Consider `INT_HASH_SET' or `OB_HASH_SET' for better performance.

intersection(s: SELF_TYPE): SELF_TYPE is
   A new list containing the elements in both `self' and `s'.
   Consider `INT_HASH_SET' or `OB_HASH_SET' for better performance.

difference(s: SELF_TYPE): SELF_TYPE is
   A new list containing the elements of `self' not in `s'.
   Consider `INT_HASH_SET' or `OB_HASH_SET' for better performance.

sym_difference(s: SELF_TYPE): SELF_TYPE is
   A new list containing the elements in `self' or `s' but not both.
   Consider `INT_HASH_SET' or `OB_HASH_SET' for better performance.

range(i,j: INT): SELF_TYPE is
   A new list whose elements are `[i],..,[j]'.

reverse: SELF_TYPE is
   Reverse the order of the elements in `self'. Return `self'.

index_of(e: T): INT is
   Index of element `e' if contained in `self', `-1' if not (not fast).
   Consider using `INT_HASH_SET' or `OB_HASH_SET'.

delete(i: INT) is
   Delete the `i'th element, move the last element in its place.

clear is
   Clear the list.

cursor: LIST_CURSOR{T} is
   A cursor into the list.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LIST_CURSOR{T} is                                              [class]

   Cursors into `LIST{T}' for stepping through all entries.
   Since the elements in a `LIST' structure are accessible by index it is
   often convenient to directly step through the elements. The cursor
   class `LIST_CURSOR' is provided for consistency with other classes,
   however. The way one would print each element in `l' a `LIST{INT}'
   without using a `LIST_CURS' object is:
   `
      i:INT; until i=l.size loop
         OUT::i(l[i]).s(" ");
         i:=i+1
      end;
   '
   Using a cursor this would look like:
   `
      lc:LIST_CURS:=l.cursor; until lc.is_done loop
         OUT::i(lc.item).s(" ");
         lc.next;
      end;
   '


Public definitions of class LIST_CURSOR: 

l: LIST{T};
   The list pointed into.

index: INT;
   The index into the list.

create(l: $LIST{T}): SELF_TYPE is
   A cursor into `l' which is initialized to the first element. 

is_done: BOOL is
   True if all entries have been visited.

first: T is
   Set the cursor to the first location, if any.

item: T is
   The current item in the list or `void' if `is_done'.

next: T is
   Move the cursor to the next location.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

LIST_TEST is                                                   [class]

   Test of `LIST{INT}'.


Public definitions of class LIST_TEST: 

Inherits from: TEST

main is
   Test of `LIST{INT}'.

str_of_list(l: LIST{INT}): STR is
   A string containing the elements of `l' of the form `"1, 2, 3"'.

list_of_range(l,h: INT): LIST{INT} is
   A list containing `l,...,h'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MATH is                                                        [class]

   Mathematical operations (eg. trig and special functions, etc.).
   All routines are declared to be `DOUBLE' but may be
   applied to `REAL' arguments, and results may be used as `REAL''s.


Public definitions of class MATH: 

error:INT;                                                    [shared]
   Non-zero is an error condition key.
   This should be set with `MATH::error', so it works with inheritance.

sin(x:DOUBLE):DOUBLE is
   Sine of `x'.

cos(x:DOUBLE):DOUBLE is
   Cosine of `x'.

tan(x:DOUBLE):DOUBLE is
   Tangent of `x'.

arc_sin(x:DOUBLE):DOUBLE is
   `sin^-1(x)' in the range `[-pi/2, pi/2]', `x' must be in `[-1.,1.]'.

arc_cos(x:DOUBLE):DOUBLE is
   `cos^-1(x)' in the range `[0., pi]', `x' must be in `[-1.,1.]'.

arc_tan(x:DOUBLE):DOUBLE is
   `tan^-1(x)' in the range `[-pi/2, pi/2]'.

arc_tan2(x,y:DOUBLE):DOUBLE is
   `tan^-1(y/x)' in the range `[-pi/2, pi/2]'. Gets sign right.

sinh(x:DOUBLE):DOUBLE is
   Hyperbolic sine of `x'.

cosh(x:DOUBLE):DOUBLE is
   Hyperbolic cosine of `x'.

tanh(x:DOUBLE):DOUBLE is
   Hyperbolic tangent of `x'.

exp(x:DOUBLE):DOUBLE is
   Exponential function `e^x'.

log(x:DOUBLE):DOUBLE is
   Natural logarithm `ln(x)', `x>0'.

log10(x:DOUBLE):DOUBLE is
   Base `10' logarithm of `x', `x>0'.

epsilon:DOUBLE:=.0000001;                                     [shared]
   Error tolerance for equality tests.

is_epsilon_less_than(x,y:DOUBLE):BOOL is
   `True' if `x' is less than `y+epsilon'.

is_epsilon_equal(x,y:REAL):BOOL is
   `True' if `x' is within epsilon of `y'.

pi:DOUBLE:=3.141592653;                                     [constant]
   Circle circumference/diameter.

e:DOUBLE:=2.718281828;                                      [constant]
   The base of the natural logarithms.

maxreal:REAL:=1.0E30;                                       [constant]
   Used as upper limit.

log_gamma(x:DOUBLE):DOUBLE is
   The log of the Gamma function of `x', for `x>0'. 
   Lanczos approx. Derived from Numerical Recipes in C, Press, p. 168. 

factorial_cache:ARRAY{DOUBLE};                                [shared]
   Cache for small values of `n!'.

factorial(n:INT):DOUBLE is
   The factorial `n!' as a double. Builds a cache of small values.
   Based on Numerical Recipes in C, p. 169.

log_factorial_cache:ARRAY{DOUBLE};                            [shared]
   Cache the first 100 log_factorials.

log_factorial(n:INT):DOUBLE is
   The log of the factorial of `n'. Creates a cache table when
   first used. Based on Numerical Recipes in C, p. 170.

binomial_coefficient(n,k:INT):DOUBLE is
   The binomial coefficient `(n k)=n!/(k!(n-k)!)' as a `DOUBLE'.
   Based on Numerical Recipes in C, p. 169.

beta(z,w:DOUBLE):DOUBLE is
   The beta function. Based on Numerical Recipes in C. p. 170.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MATH_TEST is                                                   [class]

   Test of `MATH'.


Public definitions of class MATH_TEST: 

Inherits from: MATH

main is
   Perform the tests.

log_gamma_test is
   Test the log_gamma function.

factorial_test is
   Test the factorial function.

log_factorial_test is
   Test of log_factorial.

binomial_coefficient_test is
   Test of binomial_coefficient.

beta_test is
   Test of beta.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MATRIX is                                                      [class]

   Matrices with real entries.


Public definitions of class MATRIX: 

Inherits from: ARRAY2

nr:INT is
   Number of rows.

nc:INT is
   Number of columns.

create(nr,nc:INT):SELF_TYPE is
   A new matrix.

to(m:MATRIX):MATRIX is
   Copy `m' into `self' and return it.

to_s:STR is
   A string representation of `self' of the form:
   "((1.00, 2.33), (4.5, 2.8), (9.7, 3.2))" giving succesive rows.

create_from_s(s:STR):MATRIX is
   Create a new matrix from a string of the form:
   "((1.00, 2.33), (4.5, 2.8), (9.7, 3.2))" giving succesive rows.
   Returns `void' if not of this form (extra white space is ignored).
   Must be at least one entry.

to_portion_of(m:MATRIX):MATRIX is
   Copy into `self' as much of `m' as will fit and return it.

to_zero:MATRIX is
   Set `self' to the zero matrix and return it.

to_identity:MATRIX is
   Set `self' to the identity matrix and return it.
   (Extra zeroes if non-square).

plus(m:MATRIX):MATRIX is
   The sum of `self' and `m'.

to_sum_with(m:MATRIX):MATRIX is
   Set `self' to its sum with `m' and return it.

minus(m:MATRIX):MATRIX is
   `Self' minus `m'.

scale_by(s:REAL):MATRIX is
   Scale `self' by `s' and return it.

times(m:MATRIX):MATRIX is
   `Self' times `m'.

to_product_of(a,b:MATRIX):MATRIX is
   Set `self' to the matrix product of `a' and `b' and return it.

to_product_with_diagonal(d:VECTOR):MATRIX is
   Set `self' to be the product of itself with a diagonal matrix whose
   diagonal entries are the components of `d' truncated or extended
   with zeroes to be the correct size. Return `self'.

act_on(v:VECTOR):VECTOR is
   A new vector equal to `self' times `v'.

act_on_in(v,vr:VECTOR) is
   Set `vr' to the result of `self' acting on `v'.

affine_act_on_in(v1,v2:VECTOR) is
   Set `v2' to the result of `self' acting affinely on `v1'.
   i.e. the same effect as adding an extra `1' to the end of `v1'.

transpose:MATRIX is
   The transpose of `self'.

to_transpose_of(m:MATRIX):MATRIX is
   Set `self' to the matrix transpose of `m' and return it.

transpose_act_on(v:VECTOR):VECTOR is
   The transpose of `self' times `v'.

transpose_act_on_in(v,vr:VECTOR) is
   Set `vr' to the result of the transpose of `self' acting on `v'.

column(j:INT):VECTOR is
   The `j'th column of `self'.

column_in(j:INT; v:VECTOR) is
   Copy as much of the `j'th column of `self' into `v' as will fit.

column_from(j:INT; v:VECTOR):MATRIX is
   Copy as much of `v' as will fit into the `j'th column of `self' and
   return it.

row(i:INT):VECTOR is
   The `i'th row of `self'.

row_in(i:INT; v:VECTOR) is
   Copy as much of the `i'th row of `self' into `v' as will fit.

row_from(i:INT; v:VECTOR):MATRIX is
   Copy as much of `v' as will fit into the `i'th row of `self' and
   return it. 

diagonal_in(v:VECTOR) is
   Copy as much of the diagonal of `self' into `v' as will fit.

trace:REAL is
   The trace of `self'. Sum of diagonal if not square.

svd_in(a:MATRIX; w:VECTOR; v:MATRIX) is
   Computes the singular value decomposition of `self = a w v^T'.
   `a' must be `max(nr,nc)' by `nc', `w' length `nc', `v' is `nc' by
   `nc'. `Self' is unchanged, `a', `w', `v' are altered.

svd_back_sub(u:MATRIX; w:VECTOR; v:MATRIX; b,x:VECTOR) is
   Solves `a.x=b' for `x' when `a=u.d.v^T' is the svd of `a'.

to_linear_fit_of(in,out:VECTOR_LIST):MATRIX is
   Fill in `self' to be the least squares best linear approximation
   relating `in' to `out' by: `out[i]=self.act_on(in[i])'.
   Return `self'.

to_affine_fit_of(in,out:VECTOR_LIST):MATRIX is
   Fill in `self' to be the best least squares affine map relating 
   `in' to `out' by: `out[i]=self.affine_act_on(in[i])'.
   Return `self'.

to_weighted_linear_fit_of(in,out:VECTOR_LIST; wt:LIST{REAL}):MATRIX is
   Fill in `self' to be the least squares best linear approximation
   relating `in' to `out' by: `out[i]=self.act_on(in[i])'. `wt[i]'
   gives the weight which should be given to the ith example.
   (typically in `[0.,1.]' (`0.' means ignore, `1.' means full weight).
   Return `self'.

to_weighted_affine_fit_of(in,out:VECTOR_LIST; wt:LIST{REAL}):MATRIX is
   Fill in `self' to be the least squares best affine approximation
   relating `in' to `out' by: `out[i]=self.affine_act_on(in[i])'. 
   `wt[i]' gives the weight which should be given to the `i'th example. 
   (typically in `[0.,1.]' (`0.' means ignore, `1.' means full weight).

is_epsilon_equal(m:MATRIX):BOOL is
   True if `self' is within `epsilon' of `m'.

to_uniform_random:MATRIX is
   Make `self''s entries uniform in `[0.,1.]' and return it;

jacobi_sym_eigen(d:VECTOR; v:MATRIX) is
   Computes the eigenvectors and eigenvalues of symmetric matrices
   by the Jacobi method. `self' must be a symmetric matrix, `d' will
   be filled with its eigenvalues and the columns of `v' will be
   the eigenvectors. Entries above the diagonal are destroyed.
   Based on Numerical Recipes.

jacobi_sort_sym_eigen(d:VECTOR; v:MATRIX) is
   Computes the eigenvalues and eigenvectors of a symmetric matrix
   in sorted order by the Jacobi method.
   Self must be a symmetric matrix, d will be filled with its
   eigenvalues in sorted order and the columns of v will be
   the eigenvectors. Entries above the diagonal are destroyed.
   Based on Numerical Recipes.

symmetrize:MATRIX is
   Symmetrize `self' by averaging opposing entries and return it.

to_outer_product_of(u,v:VECTOR):MATRIX is
   Set `self[i,j]' to `u.i * v.j' (like `u v^T') and return it.

affine_column_from(j:INT; v:VECTOR):MATRIX is
   Copy `v' into the `j'th column of `self' and add a `1' at the end.
   Return `self'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MATRIX_TEST is                                                 [class]

   Test of `MATRIX' and `NR_SVD'.


Public definitions of class MATRIX_TEST: 

Inherits from: TEST

main is
   Test of `MATRIX' and `NR_SVD'.

svd_matrix_test(n:INT; a:MATRIX) is
   Test the singular value decomposition of `a' labelling the test
   by `n'.

svd_back_sub_test(n:INT; a:MATRIX; b:VECTOR) is
   Test `svd_back_sub' on the problem `a.x=b', label with `n'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MS_RANDOM_GEN is                                               [class]

   Keith Miller, Communications of the ACM, October 1988, Volume 
   31, Number 10, p. 1192. Linear congruential, produces a value
   in [0.,1.) including 0. but not 1. Any seed value in
   the range [1,2147483646] is equally good. 


Public definitions of class MS_RANDOM_GEN: 

Inherits from: RANDOM_GEN

ms_a:DOUBLE:=16807.0;                                       [constant]
   7^5

ms_m:DOUBLE:=2147483647.0;                                  [constant]
   (2^31)-1, prime

ms_md:DOUBLE:=ms_m-1.; -- to avoid continual recomputation
   
   seed:INT; [constant]
   Current state of generator.

ms_md:DOUBLE:=ms_m-1.; -- to avoid continual recomputation
   
   seed:INT; [constant]
   Current state of generator.

create:SELF_TYPE is
   A minimal standard generator with seed=1.

init(nseed:INT) is
   Initialize the generator.

get:DOUBLE is
   Pseudo-random value in [0.,1.) generated by minimal
   standard generator.

test:BOOL is
   True if generator is performing correctly. 
   On failure try PMS_RANDOM_GEN.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

NR_SVD is                                                      [class]

   Singular value decomposition derived from Numerical Recipes.
   This algorithm is known to have a problem with an obscure case (but
   works almost all of the time). Better algorithms are being worked on.


Public definitions of class NR_SVD: 

pythag(a,b:REAL):REAL is
   Square root of a^2+b^2 without destructive overflow or underflow.

svd(a:MATRIX; w:VECTOR; v:MATRIX) is
   Computes the singular value decomposition of a. When finished,
   a w v^T equals the old a. Must have a.nr>=a.nc.
   Based on Numerical Recipes in C, p. 68.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

OB_HASH_MAP{T} is                                              [class]

   Hash tables which associate entities of type `T' to arbitrary objects.
   The table is always at least twice as large as number of objects.
   The key `0' is used for empty entries. The size of the table is
   always of the form `2^n+1' and nearly doubles on each expansion.
   The last entry is a sentinel element which holds `0' (to avoid
   testing for the end of array in the loop). The 
   hash function is just the last n bits of the pointer of the object 
   shifted right by `2' (since the last two bits are always zero).
   The extra serial search this simple function sometimes entails is 
   still cheaper than more typical functions using a multiply and a
   modulo operation. 


Public definitions of class OB_HASH_MAP: 

size: INT;
   Number of entries stored.

ob_tbl: ARRAY{$OB};
   Storage for the key objects.

ent_tbl: ARRAY{T};
   Storage for the associated entities.

mask: INT;
   Mask for hash function.
   If table is of size `2^n+1' then mask will have last `n' bits on.

create: SELF_TYPE is
   An emtpy hash table.

get(o: $OB): T is
   The entry associated with object `o' or `void' if absent.

test(o: $OB): BOOL is
   True if `o' is stored in the table.

double_size is
   Resize `self' to double. Copy entries over.

insert(o: $OB; e: T) is
   Insert ob `o' paired with entity `e'. Overwrite if present.

delete(o: $OB) is
   Delete entry `o' if present.

clear is
   Clear the tables.

cursor: OB_HASH_MAP_CURSOR{T} is
   A cursor into the table.

is_empty: BOOL is
   True if `self' is empty.

rehash is
   Make sure each entry is correctly hashed. (Used after moves.)

after_deep_copy is
   Must rehash after a deep copy since pointers are changed.

after_deep_save is
   Must rehash after a deep save since pointers are changed.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

OB_HASH_MAP_CURSOR{T} is                                       [class]

   A cursor into `OB_HASH_MAP{T}' tables for stepping through all objects.


Public definitions of class OB_HASH_MAP_CURSOR: 

tbl: OB_HASH_MAP{T};
   The pointer to the table.

index: INT;
   The index into the table.

is_done: BOOL;
   True if all entries have been visited.

create(t: OB_HASH_MAP{T}): SELF_TYPE is
   A cursor into `t' which is initialized to the first element. 

first: T is
   Set the cursor to the first location, if any.

key: $OB is
   The current ob key.

item: T is
   The item associated with the current ob.

next: T is
   Move the cursor to the next location.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

OB_HASH_SET is                                                 [class]

   Sets of objects represented by extendible hash tables.
   The table is always at least twice as large as the number of obs
   The key `0' is used for empty entries. The size of the table is
   always of the form `2^n+1' and nearly doubles on each expansion.
   The last entry is a sentinel element which holds `0' (to avoid
   testing for the end of the array in the loop). The hash function
   is just the last `n' bits of the 
   object pointer shifted two bits to the right. The extra serial search
   that this simple function sometimes entails is still cheaper than 
   more typical functions which use a multiply and a modulo operation.
   Keeping it only half full saves us from disaster even with such
   a simple hash function.


Public definitions of class OB_HASH_SET: 

size: INT;
   Number of entries stored.

mask: INT;
   Mask for the hash function.

Inherits from: ARRAY

create: SELF_TYPE is
   An empty `OB_HASH_SET'.

get(o: $OB): BOOL is
   True if `o' is in the stored set.

double_size: OB_HASH_SET is
   Resize `self' to double. Copy non-deleted entries over.

insert(o: $OB): OB_HASH_SET is
   Insert object `o'.

delete(o: $OB) is
   Delete object `o' if present.

clear is
   Clear the table.

cursor: OB_HASH_SET_CURSOR is
   A cursor into the table.

union(s: OB_HASH_SET): OB_HASH_SET is
   A new set whose elements are the union of `self' and `s'.

intersection(s: OB_HASH_SET): OB_HASH_SET is
   A new set whose elements are the intersection of `self' and `s'.

difference(s: OB_HASH_SET): OB_HASH_SET is
   A new set whose elements are those in `self' which are not in `s'.

sym_difference(s: OB_HASH_SET): OB_HASH_SET is
   A new set whose elements are those in `self' or `s' but not both.

is_a_subset_of(s: OB_HASH_SET): BOOL is
   True if `self' is a subset of `s'.

is_empty: BOOL is
   True if `self' is empty.

rehash is
   Make sure each entry is correctly hashed. (Used after moves.)

after_deep_copy is
   Must rehash after a deep copy since pointers are changed.

after_deep_save is
   Must rehash after a deep save since pointers are changed.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

OB_HASH_SET_CURSOR is                                          [class]

   A cursor into `OB_HASH_SET''s for stepping through all keys.


Public definitions of class OB_HASH_SET_CURSOR: 

tbl: OB_HASH_SET;
   The pointer to the table.

index: INT;
   The index into the table.

is_done: BOOL;
   True if all entries have been visited.

create(t: OB_HASH_SET): SELF_TYPE is
   A cursor into `t' which is initialized to the first element. 

first: $OB is
   Set the cursor to the first location, if any.

item: $OB is
   The current object.

next: $OB is
   Move the cursor to the next location.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

OB_HASH_TEST is                                                [class]

   Test the classes `OB_HASH_MAP', `OB_HASH_MAP_CURSOR', `OB_HASH_SET'
   and `OB_HASH_SET_CURSOR'.


Public definitions of class OB_HASH_TEST: 

Inherits from: TEST

ob_array: ARRAY{STR};                                         [shared]
   Array of objects to use in tests.

main is
   Test the classes `OB_HASH_MAP', `OB_HASH_MAP_CURSOR', `OB_HASH_SET'
   and `OB_HASH_SET_CURSOR'.

init_ob_array is
   Put strings for the 26 letters of the alphabet in `ob_array'.

ob_hash_set_test is
   Test of `OB_HASH_SET' and `OB_HASH_SET_CURSOR'.

set_from_range(l,h: INT): OB_HASH_SET is
   Make a set of `STR' objects from the letters in the alphabet
   between `l' and `h'. Must be in range `[0,25]'.

str_of_set(s: OB_HASH_SET): STR is
   A string containing the elements of `s' in alphabetical order
   separated by commas.

ob_hash_map_test is
   Test the classes `OB_HASH_MAP' and `OB_HASH_MAP_CURSOR'.

map_from_range(l,h: INT): OB_HASH_MAP{INT} is
   Make a map from `STR' objects which are letters in the alphabet
   between `l' and `h' to corresopnding `INT''s.
   Must be in range `[0,25]'.

str_of_map(s: OB_HASH_MAP{INT}): STR is
   A string containing the elements of `s' in alphabetical order
   separated by commas. Of the form `"b:1, c:2"'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

OB_TYPE_TEST is                                                [class]

   Undocumented.


Public definitions of class OB_TYPE_TEST: 

Inherits from: TEST

Inherits from: TYPE

main is
   Undocumented.

poly_type_test is
   poly_types: non-dispatched vs. dispatched      

basic_type_test is
   Undocumented.

ob_type_test is
   OB types      

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

OUT is                                                         [class]

   Direct access to stdout.


Public definitions of class OUT: 

file:FILE := FILE::out;                                       [shared]
   A file object for stdout.

b(bo:BOOL):OUT is
   Undocumented.

c(ch:CHAR):OUT is
   Undocumented.

i(in:INT):OUT is
   Undocumented.

s(st:STR):OUT is
   Undocumented.

r(re:REAL):OUT is
   Undocumented.

d(do:DOUBLE):OUT is
   Undocumented.

nl:OUT is
   Undocumented.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PERM_RANDOM_GEN{G} is                                          [class]

   A generator which randomly permutes the outputs of generator G 
   (which should be a descendent of RANDOM_GEN) to break up serial
   correlations.


Public definitions of class PERM_RANDOM_GEN: 

Inherits from: RANDOM_GEN

g:G;
   The generator whose output we permute.

tbl:ARRAY{DOUBLE};
   The permutation table.

create:SELF_TYPE is
   A new permutation generator.

init(nseed:INT) is
   Initialize both the generator g and the table using nseed.

get:DOUBLE is
   Pseudo-random value in [0.,1.) constructed from g by permutation.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PMS_RANDOM_GEN is                                              [class]

   A slower but portable version of MS_RANDOM_GEN. (See its description.)


Public definitions of class PMS_RANDOM_GEN: 

Inherits from: RANDOM_GEN

ms_a:DOUBLE:=16807.0;                                       [constant]
   7^5

ms_m:DOUBLE:=2147483647.0;                                  [constant]
   (2^31)-1, prime

ms_md:DOUBLE:=ms_m-1.; -- to avoid continual recomputation
   constant ms_q:DOUBLE:=127773.0; [constant]
   (ms_m/ms_a).floor

ms_md:DOUBLE:=ms_m-1.; -- to avoid continual recomputation
   constant ms_q:DOUBLE:=127773.0; [constant]
   (ms_m/ms_a).floor

ms_r:DOUBLE:=2836.0;                                        [constant]
   ms_m.mod(ms_a)

seed:INT;
   Current state of generator.

create:SELF_TYPE is
   A new generator with seed=1.

init(nseed:INT) is
   Initialize the generator.

get:DOUBLE is
   A pseudo-random value in [0.,1.). Won't overflow on most machines.

test:BOOL is
   True if generator is performing correctly. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

POSTSCRIPT_GRAPHICS_OUT is                                     [class]

   Postscript output.


Public definitions of class POSTSCRIPT_GRAPHICS_OUT: 

Inherits from: GRAPHICS_OUT

scale:REAL;
   The amount by which to scale output.

file:FILE;
   The file in which to put the output.

create(file:FILE):SELF_TYPE is
   Initialize reasonable defaults. Put output in `file'.

draw_point (x,y:REAL) is
   Draw a single point.

draw_line (x1,y1,x2,y2:REAL) is
   Draw a line segment from `(x1,y1)' to `(x2,y2)'.

draw_polyline (l:LIST{VECTOR_2}) is
   Draw a series of segments given by the points in `l'.

draw_closed_polyline (l:LIST{VECTOR_2}) is
   Draw the closed figure defined by `l'.

draw_rect (x1,y1,x2,y2:REAL) is
   Draw a rectangle. Respects `filled'.

draw_circle (x,y,r:REAL) is
   Draw a circle centered at `(x,y)' of radius `r'. Respects `filled'.

draw_str (x,y:REAL; s:STR) is
   Draw the string `s' with location (specified by `str_loc') at
   `(x,y)'. Still needs to deal with centering etc.

init is
   Header information for postscript file.

finish is
   Close the file.

comment (s:STR) is
   Put a comment into the output.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PRIORITY_QUEUE{T} is                                           [class]

   Priority queues.  Retrieves maximal elements first.
   `T' must define `is_less_than' which is used to define the ordering.
   `COMPARABLE_INT' defines this for `INT''s.


Public definitions of class PRIORITY_QUEUE: 

arr:ARRAY{T};
   Undocumented.

size:INT;
   Bottom of queue, = number of elements.

create:SELF_TYPE is
   A new empty priority queue.

create_sized(n:INT):SELF_TYPE is
   A new empty priority queue, initially sized to hold `n' elements.

insert (e:T) is
   Insert `e' into priority queue.

sift_up (l,u:INT) is
   Makes an `l,u' heap from a `l,u-1' heap in area.

sift_dn (l,u:INT) is
   Make an `l,u' heap from an `l+1,u' heap in area.

is_empty:BOOL is
   True if queue is empty.

pop:T is
   Pops off the first element or `void' if empty.

top:T is
   Top element or `void' if empty.

clear is
   Clear the queue.

check_heap:BOOL is
   True if `self' is a legal heap.

bounded_insert (e:T; bnd:INT) is
   Insert `e', then pop enough so that `size<=bnd'.
   The queue retains the smallest `bnd' elements and the operation
   is cheaper than building a priority queue for all the elements.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PRIORITY_QUEUE_TEST is                                         [class]

   Test of PRIORITY_QUEUE{COMPARABLE_INT}.


Public definitions of class PRIORITY_QUEUE_TEST: 

Inherits from: TEST

main is
   Test of PRIORITY_QUEUE{COMPARABLE_INT}.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PRODUCT_VECTOR_MAP{M1,M2} is                                   [class]

   The product of two mappings of types `M1' and `M2'.


Public definitions of class PRODUCT_VECTOR_MAP: 

Inherits from: VECTOR_MAP

m1:M1;
   The two maps.

v1i:VECTOR;
   Used to hold intermediates.

v2i:VECTOR;
  
   Used to hold intermediates.

v1o:VECTOR;
  
  
   Used to hold intermediates.

v2o:VECTOR;
  
  
  
   Used to hold intermediates.

create(m1:M1; m2:M2):SELF_TYPE is
   A map whose input space and output spaces are the products of
   those of `m1' and `m2' (ie. the dimensions are the sums of the 
   corresponding dimensions).

map_in(vi,vo:VECTOR) is
   Evaluate the product of `m1' and `m2' on `vi' and put the result
   into `vo'.

in_dim:INT is
   The input dimension of the map.

out_dim:INT is
   The output dimension of the map.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

QUEUE{T} is                                                    [class]

   Queues (actually deques).
   The `QUEUE{T}' class has a similar interface to `FAST_QUEUE' but
   is slightly less efficient and supports insertions of the form
   `q.insert_top(e)' rather than `q:=q.insert_top(e)'.


Public definitions of class QUEUE: 

q:ARRAY{T};
   Undocumented.

t:INT;
   Indices of the top and bottom of the queue.
   `t' is where next element comes from.
   `b' is where next insertion goes. 

b:INT;
  
   Indices of the top and bottom of the queue.
   `t' is where next element comes from.
   `b' is where next insertion goes. 

create:SELF_TYPE is
   An emtpy queue.

is_empty:BOOL is
   True if queue is empty.

size:INT is
   Number of elements currently in queue.

double_size is
   Double the size of q, copy the elements over. 

insert_bottom(e:T) is
   Insert an element at the bottom, expand if necessary.

top:T is
   The top of the queue.

bottom:T is
   The bottom of the queue.

pop_top:T is
   Pop the top and return it.

pop_bottom:T is
   The bottom of the queue (really a deque operation).

insert_top(e:T) is
   Insert an element at the top, (really a deque operation).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

QUEUE_TEST is                                                  [class]

   Test `FAST_QUEUE' and `QUEUE'.


Public definitions of class QUEUE_TEST: 

Inherits from: TEST

main is
   Test `FAST_QUEUE' and `QUEUE'.

fast_queue_test is
   Test `FAST_QUEUE'.

queue_test is
   Test `QUEUE'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

QUICKSORT{T} is                                                [class]

   An empty class for sorting `LIST{T}'.  `T' may be `INT', `REAL', or 
   `DOUBLE'. By inheriting `QUICKSORT{T}' and redefining `compare',
   `LIST''s of elements of other types may be sorted as demonstrated
   in `STR_SORT'.


Public definitions of class QUICKSORT: 

qs_lim:INT:=10;                                             [constant]
   When to stop the quicksort recursion.

compare(a,b:T):BOOL is
   Comparison for `INT', `REAL' and `DOUBLE'. Redefine for others. 

insertion_sort_range(ls:LIST{T}; l,u:INT) is
   Stably sort the elements in the range `[i,j]' of `l' by insertion
   sort.

insertion_sort(ls:LIST{T}) is
   Sort `ls' by insertion sort.

quicksort_range(ls:LIST{T}; l,u:INT) is
   Use quicksort to sort the range `[l,u]' of `ls'.

quicksort(ls:LIST{T}) is
   Sort `ls' by quicksort.

is_sorted(ls:LIST{T}):BOOL is
   Trueif `ls' is sorted.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

RANDOM is                                                      [class]

   Generate random numbers from different distributions.
   Tries to satisfy a number of needs. In the most common situation,
   a single generator will supply all random numbers for the system.
   Calls of the form: RANDOM::uniform will use this shared generator 
   (as will r.uniform where r:RANDOM is void). To use multiple generators
   (perhaps of different kinds) one creates object instances of type
   RANDOM. These objects have an attribute "gen" of type $RANDOM_GEN
   which holds the actual generator. Several types of generator
   are provided and new ones may be added by having them inherit
   the specification class RANDOM_GEN. Classes are provided to combine
   generators and to randomly permute the output of a generator.


Public definitions of class RANDOM: 

Inherits from: MATH

sgen:$RANDOM_GEN:=MS_RANDOM_GEN::create;                      [shared]
   The shared generator.

gen:$RANDOM_GEN;
   The individual generator if self/=void.

create:SELF_TYPE is
   A new RANDOM object initialized with a standard generator.

init(nseed:INT) is
   Initialize generator with nseed. 
   Apply to sgen if self=void, otherwise apply it to gen.

init_with_time is
   Initialize using the time as a seed. Call twice to mix up the time
   a bit.

set_gen(g:$RANDOM_GEN) is
   Change the generator sgen or gen to g.

uniform:DOUBLE is
   A uniformly distributed double in [0.,1.).
   Uses default generator if self=void (as in RANDOM::uniform) else gen.

uniform_range (l,u:DOUBLE):DOUBLE is
   A uniformly distributed double in the range [l,u).

int_range (l,u:INT):INT is
   A uniform random member of {l,...,u}.

bit(p:DOUBLE):BOOL is
   True with probability p.

normal(m,s:DOUBLE):DOUBLE is
   A normally distributed double with mean m and standard deviation s.

norm_cache:DOUBLE;
   Cache of normal deviate generated earlier.

snorm_cache:DOUBLE;                                           [shared]
   Shared version of above.

norm_cache_valid:BOOL;
   True if a value is cached.

snorm_cache_valid:BOOL;                                       [shared]
   Shared version of above.

standard_normal:DOUBLE is
   A normally distributed double with mean 0. and unit variance.
   Uses Box-Muller method which generates two normal deviates and
   requires two calls to uniform. One of these is cached for the next
   call. Based on Knuth, Vol. 2, p. 117.

exponential(m:DOUBLE):DOUBLE is
   Samples from an exponential distribution: p(x)=e^(-x/m)/m.
   Mean is m. Eg: Time between emissions when one per m secs on 
   average. Based on Knuth, Vol. 2, p. 128.

gamma(a:INT):DOUBLE is
   Samples from the Gamma distribution: p(x)=(x^(a-1)e^(-x))/G(a).
   Mean is a. Based on Knuth, Vol. 2, p. 129. and
   Numerical Recipes in C, Press et. al. p. 220.
   Waiting time for ath event in Poisson process of unit mean.
   Require a>=1.

beta(a,b:INT):DOUBLE is
   Samples from the Beta distribution 
   p(x)=(G(a+b)/(G(a)G(b)))x^(a-1)(1-x)^(b-1), 0<x<1, a,b>0
   Mean is a/(a+b). Knuth, Vol. 2, p. 129.

chi_square(v:INT):DOUBLE is
   Samples from the Chi-Square distribution:
   p(x)=e^(-x/2)x^((v/2)-1)/(2^(v/2)G(v/2)). Mean is v. x>=0.
   Based on Knuth, Vol. 2, p. 130.

f_dist(v1,v2:INT):DOUBLE is
   Samples from the F-distribution with v1 and v2 degrees of freedom
   (see any statistics text). Based on Knuth, Vol. 2, p. 130.

t_dist(v:INT):DOUBLE is
   Samples from the t-distribution with v degrees of freedom (see
   any statistics text). Based on Knuth, Vol. 2, p. 130.

geometric(p:DOUBLE):INT is
   Samples from the geometric distribution. Is the number of trials
   needed until an event of prob. p first occurs. P(n)=(1-p)^(n-1)p.
   Mean is 1/p. Based on Knuth, Vol. 2, p. 131.

binomial(n:INT; p:DOUBLE):INT is
   Samples from the binomial distribution: P(t)=(n t) p^t (1-p)^(n-t).
   Mean is np. Is number of occurances of prob. p event in n trials.
   Based on Knuth, Vol. 2, p. 131. and Numerical Recipes in C, p. 223.

poisson(x:DOUBLE):INT is
   Samples from the Poisson distribution: p(j)=x^j e^(-x)/j!.
   Mean is x. Is number of events in time interval x.
   Based on Numerical Recipes in C, p. 221.

cauchy:DOUBLE is
   Samples from the Cauchy distribution: p(x)=1/pi(1+x^2).
   (Also called the Lorentzian.) No mean. Based on NR in C. p. 220.

cantor(s:DOUBLE):DOUBLE is
   A uniform random sample from a Cantor set with scaling s.

standard_cantor:DOUBLE is
   A uniform random sample from the canonical Cantor set in [0,1).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

RANDOM_GEN is                                                  [class]

   Shell class to be inherited by different random number generators.
   Each descendent should also define a "create" routine with no arguments
   which returns an initialized generator of the corresponding type.


Public definitions of class RANDOM_GEN: 

init(nseed:INT) is
   Initialize the generator using nseed. Any int value should be legal.

get:DOUBLE is
   The next random value. Should be in [0.,1.).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

RANDOM_TEST is                                                 [class]

   Test of RANDOM.


Public definitions of class RANDOM_TEST: 

main is
   Perform tests.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

RANGE_VECTOR_MAP is                                            [class]

   The output is just a given range of indices of input.


Public definitions of class RANGE_VECTOR_MAP: 

Inherits from: VECTOR_MAP

in_d:INT;
   Undocumented.

l:INT;
  
   Undocumented.

u:INT;
  
  
   Undocumented.

create(in_d,l,u:INT):SELF_TYPE is
   A map on vectors of dimension `in_d' defined by extracting
   components `l' through `u'.

map_in(vi,vo:VECTOR) is
   Put components `l' through `u' of `vi' into `vo'.

in_dim:INT is
   The input dimension.

out_dim:INT is
   The output dimension.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

REAL is                                                        [class]

   `REAL' defines operations on single-precision real numbers.
   More exotic special functions are defined in the `MATH' class.
   `REAL''s and `DOUBLE''s are generally interchangable and the compiler
   will properly convert between them. `pow(x)' computes `self' raised to
   the power of `x'. It requires that `x' be larger than 0 if `self' is
   equal to zero and that `self' be non-negative if `x' is not an integer.
   `sqrt' computes the square root and requires that `self' be
   non-negative. `to_i', `floor', `ceiling', and `round' compute the four
   natural ways to approximate a floating point value by an integer.
   `mod(x)' computes the floating point remainder of `self' divided by
   `x' and has the same sign as `self'.


Public definitions of class REAL: 

to_d:DOUBLE is
   Convert to a `DOUBLE'.

to_i:INT is
   Nearest integer toward zero (sometimes called "truncate").

to_s:STR is
   The string representation of `self'.

max(r:REAL):REAL is
   The maximum of `self' and `r'.

min(r:REAL):REAL is
   The minimum of `self' and `r'.

pow(x:REAL):DOUBLE is
    Returns `self' raised to the power of `x'. Error if
   `self=0' and `x<=0' or if `self<0' and `x' is not an `INT'.

sqrt:DOUBLE is
   The square root of `self', `self>=0'.

floor:INT is
   Largest integer not greater than `self'.

ceiling:INT is
   Smallest integer not less than `self'.

round:INT is
   Closest integer to `self'.

abs:DOUBLE is
   The absolute value of `self'.

mod(x:DOUBLE):DOUBLE is
   The floating point remainder of `self/x' with the same sign as
   `self'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

REAL_OB is                                                     [class]

   typed REAL.


Public definitions of class REAL_OB: 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SORT_TEST is                                                   [class]

   Test `QUICKSORT{INT}', `QUICKSORT{REAL}', and `STR_SORT'.


Public definitions of class SORT_TEST: 

Inherits from: TEST

main is
   Test `QUICKSORT{INT}', `QUICKSORT{REAL}', and `STR_SORT'.

isort_test is
   Test QUICKSORT{INT}.

rsort_test is
   Test QUICKSORT{REAL}.

ssort_test is
   Test STR_SORT.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STACK{T} is                                                    [class]

   Stacks.
   The `LIST{T}' class provides a low level efficient stack based
   structure. The `STACK{T}' class is less efficient in space and time
   but provides a better encapsulated interface. To push an element `e'
   onto a stack `s' one simply says `s.push(e)' whereas for a
   `LIST{T}' one must use `s:=s.push(e)'.


Public definitions of class STACK: 

s:ARRAY{T};
   Holds the stack elements.

size:INT;
   The current insertion location.

create:SELF_TYPE is
   An empty stack.

push(e:T) is
   Push `e' onto the stack.

is_empty:BOOL is
   True if stack is empty.

pop:T is
   Return the top element and remove it. Void if empty.

top:T is
   The value of the top of the stack. Void if empty.

clear is
   Empty the stack.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STACK_TEST is                                                  [class]

   Test of `STACK{INT}'.


Public definitions of class STACK_TEST: 

Inherits from: TEST

main is
   Test of `STACK{INT}'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STR is                                                         [class]

   Sather strings are simply arrays of characters in which all characters
   following the last character of the string are equal to `\000'.  Each
   string must have at least one such character for compatibility with C
   strings. The primary means for constructing strings in Sather is to
   append strings constructed from entities to the end of existing
   strings. The amortized doubling technique is used to automatically
   allocate space for strings. This means that if there is not room in a
   string for the characters which need to be appended, a new string with
   twice as many characters is allocated and the original characters are
   copied over. By the time a string constructed by repeated appending
   gets to be of length n, at most O(log n) such extensions will have
   been made, the total number of copied characters is O(n) as is the
   amount of wasted space and garbage to be collected by the collector.
   Thus the costs per character are constant when amortized over the
   construction of an entire string. Because all characters following the
   end of a string are equal to 0, the end of the string is found by
   binary search. This allows the system to determine the length of
   strings in O(log n) time without the space and time overhead of
   explictly storing and updating the length.
   
   Most strings are constructed by appending component strings together.
   For example,
   
   ``s:STR:="The floor of ".r(15.3).s(" is ").i(15).c('.').nl;''
   
   sets the string `s' to `"The floor of 15.3 is 12.\n"'. Each of the
   appending routines: `b', `c', `s', `i', `r', `d', and `nl' return
   the new string. These operations work by amortized doubling and
   potentially destroy the original string. To append to an existing
   string without destroying it, one may use `copy' in an expression like:
   
   `s2:=s1.copy.s(" appended part")'.
   
   Reals and doubles are converted to strings with a precision given by
   the shared integer `precision'. If `precision' is equal to `0' then
   only the integer part of a `REAL' is put into the string. Whenever this
   variable is set, future constructions use the new value until it is
   changed again. In strings, the boolean values `true' and `false' are
   represented by `"T"' and `"F"'. `cursor' produces an object of type
   `STR_CURSOR' which points at the head of the string and is used to
   sequentially read out its components.


Public definitions of class STR: 

Inherits from: ARRAY

precision: INT := 6;                                          [shared]
   Digits of precision in printing `REAL''s.
   If `precision=0', then print `REAL''s as `INT''s.

create: SELF_TYPE is
   An empty string.

create_sized(n: INT): SELF_TYPE is
   An empty string with room for `n' characters (including the end
   terminator).

b(bo: BOOL): STR is
   A string with 'T' or 'F' appended according to the value of `bo'.

c(ch: CHAR): STR is
   A string with character `ch' appended.

s(st: STR): STR is
   A string with `st' appended.

i(in: INT): STR is
   A string with integer `in' appended.

r(re: REAL): STR is
   A string with the `REAL' `re' appended.

d(do: DOUBLE): STR is
   A string with the `DOUBLE' `do' appended.

nl: STR is
   A string with a newline character appended to `self'.

is_equal(st: STR): BOOL is
   True if `self' is the same string as `st'.

is_less_than(st: STR): BOOL is
   True if `self' is lexicographically before `st'.

to_upper_case: STR is
   Converts all characters in `self' to upper case.

to_lower_case: STR is
   Converts all characters in `self' to lower case.

capitalize: STR is
   Capitalize all the words in `self'.

is_upper_case: BOOL is
   True if all alphabetic characters in `self' are capitalized.

head(n: INT): STR is
   A new string consisting of the first `n' letters of `self'.

tail(n: INT): STR is
   A new string consisting of the last `n' letters of `self'.

length: INT is
   The current length of `self' (not including trailing '\0').

substring(n,m: INT): STR is
   The substring between characters `n' and `m' inclusive. (`n<=m').

index_of_char(ch: CHAR): INT is
   The index of the first appearance of `ch' in `self' or `-1' if
   absent.

reverse: STR is
   Reverse the order of the characters in `self'. Return `self'.

is_empty: BOOL is
   True if `self' has no characters.

to_i: INT is
   The `INT' of which `self' is a representation.

to_r: REAL is
   The `REAL' of which `self' is a representation.

to_d: DOUBLE is
   The `DOUBLE' of which `self' is a representation.

to_b: BOOL is
   The `BOOL' of which `self' is a representation.
   (ie. has value `true' if `"T"' and `false' if `"F"').

to_c: CHAR is
   The `CHAR' of which `self' is a representation.

from_c_str(st: F_OB): STR is
   Returns a Sather string corresponding to the C string whose 
   pointer is `st'. Used internally.

cursor: STR_CURSOR is
   A cursor into `self'.

hash: INT is
   An inexpensive to compute hash function of `self'.
   Gives an `INT' with rightmost 24 bits. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STR_CURSOR is                                                  [class]

   Class for stepping through strings extracting information.
   Throughout the Sather libraries, cursor classes are used to keep
   pointers into container data structures. In each case there is the
   possibility of problems if the the structure is destructively modified
   while a cursor points to its internals. The preferred approach is to
   completely use one or more cursors into a structure before
   destructively modifying it. For strings, cursors are used to
   sequentially read out the components of a string. They may be used to
   perform a similar function to that played by "scanf" in C without need
   for functions with a variable number of arguments.  This approach is
   actually much more general since it allows for testing for the
   presence of an `INT', for example, at a given point in the string.
   
   In typical usage a string cursor pointing to the beginning of the
   string `s' is created by the call `s.cursor' in the string class or by
   `create(st)' in the string cursor class. If the structure of the
   string is precisely known, then a sequence of calls to `get_foo' will
   allow one to extract the known components. White space is skipped over
   in searching for integers, reals and doubles. For example, if the
   string `s' consists of a boolean, three integers, a real and a string
   then these components may be extracted with:
   
   `sc:STR_CURSOR:=s.cursor; b:BOOL:=sc.get_b; i1:INT:=sc.get_i; 
   i2:INT:=sc.get_i; i3:INT:=sc.get_i; r:REAL:=sc.get_r; s1:STR:=sc.get_s;'
   
   If we were wrong about the structure of the string, then the shared
   variable `error' will be set to a non-zero value. Sometimes we are not
   certain of the structure of a string. For example, we may not know
   whether the next field will contain an integer or a real. In this case
   we may use the routines with names of the form `foo_size'. If there is
   no possible entity of the specified type at the current location, such
   calls will return 0. Otherwise they will return the number of
   characters in the specified entity without moving the cursor forward.


Public definitions of class STR_CURSOR: 

s: STR;
   The string we are scanning.

index: INT;
   The index of the current character.

error: INT;
   0 if no errors, an error code otherwise.

create(st: STR): SELF_TYPE is
   Make a scanner for the string `st'.

get_s: STR is
   A string containing characters up to and including the next newline.

b_size: INT is
   `1' if index points at 'T' or 'F', `0' otherwise.

get_b: BOOL is
   Read `"T"' or `"F"' and return `true' or `false'.

get_c: CHAR is
   Read one character.

digits_size(i: INT): INT is
   Number of `CHAR''s starting at `i' which are digits.

i_size: INT is
   Number of `CHAR''s in an integer at `index', `0' if not present.

get_i: INT is
   Read an integer.

r_size: INT is
   Number of `CHAR''s in a `REAL' or `DOUBLE' at `index', `0'
   if not present. Accepts integers as well.

get_r: REAL is
   Read a `REAL'.

get_d: DOUBLE is
   Read a `DOUBLE'.

item: CHAR is
   the current char or void.

first: CHAR is
   Go to the beginning of the string and return the first char.

next: CHAR is
   Move to the next char and return it or void.

space_size(i: INT): INT is
   Number of space characters, tabs, newlines and other ASCII
   whitespace starting at character `i'.

skip_space: STR_CURSOR is
   Move over space, tabs, newlines and other ASCII whitespace and
   return `self'.

is_done: BOOL is
   True if the cursor is at the end of the string.

reassign (str : STR): STR_CURSOR is
   Change the string that `self' points to, return `self'.

c_equals(c: CHAR): BOOL is
   True if the next character is equal to `c'.

c_accept(c: CHAR): BOOL is
   True if the next char is `c'. If so, skip it and any following
   white space.

get_s_cut(cutset: STR): STR is
   String up to and including the next member of `cutset'.

get_word: STR is
   Return string up to but not including white space. Cursor is
   moved past white space.

update_i(x: INT): INT is
   If `get_i' return it and `skip_space', else return `x'.

update_r(x: REAL): REAL is
   If `get_r' return it and `skip_space', else return `x'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STR_FORMATTER is                                               [class]

   This class is useful for producing output in aligned fields (eg.
   to print out tables of numbers). If `f' is a STR_FORMATTER, then
   to append a series of fields of length `20' to a string you could
   write:
  
   f.set_width(20);
   my_str:=my_str.s(f.i(143)).s(f.s("is bigger than")).s(f.r("36.4")).nl;
  
   It is possible to set the precision of real numbers and whether
   items are left or right justified or centered within their field.
   Multiple formatters may be used for separate fields to avoid having
   to continually change parameters in mid string. Output to files
   works analogously to output to strings. 


Public definitions of class STR_FORMATTER: 

digits:STR:="0123456789";                                   [constant]
   Undocumented.

width:INT;
   The current field size.

precision:INT;
   The current precision.

justification:INT;
   0 for right, 1 for center, 2 for left. 

create(w:INT):SELF_TYPE is
   A new formatted string object for producing fields of width `w'.
   The default is right justification and a precision of `3'.

set_width(w:INT):SELF_TYPE is
   Set field width to `w'. Adjust precision if width is too small.

set_precision(p:INT):SELF_TYPE is
   Set floating point precision (i.e. digits after the decimal) to `p'.

right_justify:SELF_TYPE is
   Produce items abutting the right side of the field.

left_justify:SELF_TYPE is
   Produce items abutting the left side of the field.

center_justify:SELF_TYPE is
   Produce items centered in the field.

insert_blanks(n,loc:INT; s:STR) is
   Insert `n' blanks starting at character `loc' in string `s'.

s(st:STR):STR is
   Output a field containing `st' either truncated or filled to
   the field width with blanks. Filling is done on the left, right,
   or both depending on the justification.

b(x:BOOL):STR is
   Output a field containing `x', filled with blanks to field width.

c(x:CHAR):STR is
   Output a field containing `x', filled with blanks to field width.

i(x:INT):STR is
   Output a field containing the integer `x', filled with blanks to
   field width. If field is too small, fill field with a space
   and then asterisks.

r(x:REAL):STR is
   Output a field containing the real `x', filled with blanks to
   field width. If field is too small, fill field with a space
   and then asterisks. Use the given precision.

d(x:DOUBLE):STR is
   Output a field containing the real `x', filled with blanks to
   field width. If field is too small, fill field with a space
   and then asterisks. Use the given precision.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STR_FORMATTER_TEST is                                          [class]

   Test of `STR_FORMATTER'.


Public definitions of class STR_FORMATTER_TEST: 

Inherits from: TEST

main is
   Test of `STR_FORMATTER'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STR_HASH_MAP{T} is                                             [class]

   Hash tables which associate entities of type `T' to strings.


Public definitions of class STR_HASH_MAP: 

tbl: GENERAL_HASH{STR_HASH_MAP_ELT{T}};
   The table.

tmp: STR_HASH_MAP_ELT{T};
   A temporary element for queries.

create: SELF_TYPE is
   An empty mapping.

size: INT is
   Number of strings in the map.

get(s: STR): T is
   The entry associated with `s' or `void' if absent.

test(s: STR): BOOL is
   True if `s' is stored in the table.

insert(s: STR; v: T) is
   Map `s' into `v', overwriting if there is a previous value.

delete(s: STR) is
   Delete `s' if present.

clear is
   Clear the table.

cursor: STR_HASH_MAP_CURSOR{T} is
   A cursor into the table.
   res := STR_HASH_MAP_CURSOR{T}::create(self);

is_empty: BOOL is
   True if map is empty.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STR_HASH_MAP_CURSOR{T} is                                      [class]

   A cursor into `STR_HASH_MAP{T}' tables for stepping through all
   entries.


Public definitions of class STR_HASH_MAP_CURSOR: 

cursor: GENERAL_HASH_CURSOR{STR_HASH_MAP_ELT{T}};
   The cursor.

create(m: STR_HASH_MAP{T}): SELF_TYPE is
   A cursor into `m' which is initialized to the first element.

is_done: BOOL is
   True if all entries have been visited.

first: T is
   Set the cursor to the first location, if any.

key: STR is
   The current key string.

item: T is
   The item assoicated with the current string.

next: T is
   Move the cursor to the next location

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STR_HASH_MAP_ELT{T} is                                         [class]

   This class is used in implementing `STR_HASH_MAP{T}' and will not
   be directly useful to most people.
   `STR_HASH_MAP{T}' is implemented using `GENERAL_HASH{T}'. This
   class defines an object which packages up a string and an associated
   object.


Public definitions of class STR_HASH_MAP_ELT: 

str: STR;
   The string.

hash: INT;
   The `INT' hash value of `str'.

val: T;
   The entity associated with `str'.

create(str: STR; val: T): SELF_TYPE is
   A new object that associates `val' with `str'.

set_hash is
   Set `hash' to be the hash value corresponding to `str'.

is_equal(e: STR_HASH_MAP_ELT{T}): BOOL is
   True if `self' and `e' have the same string.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STR_HASH_SET is                                                [class]

   Sets of strings represented by extendible hash tables. 


Public definitions of class STR_HASH_SET: 

tbl: GENERAL_HASH{STR_HASH_SET_ELT};
   The table.

tmp: STR_HASH_SET_ELT;
   A temporary element for queries.

create: SELF_TYPE is
   An empty set of strings.

size: INT is
   Number of strings in the set.

test(s: STR): BOOL is
   True if `s' is in the set.

insert(s: STR) is
   Insert `s' into the set.

delete(s: STR) is
   Delete `s' if present.

clear is
   Clear the table.

cursor: STR_HASH_SET_CURSOR is
   A cursor into the table.

is_empty: BOOL is
   True if map is empty.

union(s: STR_HASH_SET): STR_HASH_SET is
   A new set of strings which is the union of `self' and `s'.

intersection(s: STR_HASH_SET): STR_HASH_SET is
   A new set of strings which is the intersection of `self' and `s'.

difference(s: STR_HASH_SET): STR_HASH_SET is
   A new set of strings which is the difference of `self' and `s'.

sym_difference(s: STR_HASH_SET): STR_HASH_SET is
   A new set of strings which is the symmetric difference of
   `self' and `s'.

is_a_subset_of(s: STR_HASH_SET): BOOL is
   True if the strings in `self' are a subset of those in `s'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STR_HASH_SET_CURSOR is                                         [class]

   A cursor into `STR_HASH_SET' tables for stepping through all
   entries.


Public definitions of class STR_HASH_SET_CURSOR: 

cursor: GENERAL_HASH_CURSOR{STR_HASH_SET_ELT};
   The cursor.

create(s: STR_HASH_SET): SELF_TYPE is
   A cursor into `s' which is initialized to the first element.

is_done: BOOL is
   True if all entries have been visited.

first: STR is
   Set the cursor to the first location, if any.

item: STR is
   The current key string.

next: STR is
   Move the cursor to the next location

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STR_HASH_SET_ELT is                                            [class]

   This class is used in the implementation of `STR_HASH_SET' and
   will not be directly useful to most people.
   `STR_HASH_SET' is implemented using `GENERAL_HASH{T}'. This
   class defines an object which packages up a string with its hash value.


Public definitions of class STR_HASH_SET_ELT: 

str: STR;
   The string.

hash: INT;
   The `INT' hash value of `str'.

create(str: STR): SELF_TYPE is
   A new object holding `nst'.

set_hash is
   Set `hash' to be the hash value corresponding to `str'.

is_equal(e: STR_HASH_SET_ELT): BOOL is
   True if `self' and `e' have the same string.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STR_HASH_TEST is                                               [class]

   Test of `STR_HASH_MAP_ELT{T}', `STR_HASH_MAP{T}',
   `STR_HASH_MAP_CURSOR{T}', `STR_HASH_SET_ELT', `STR_HASH_SET',
   `STR_HASH_SET_CURSOR', `GENERAL_HASH{T}', and `GENERAL_HASH_CURSOR{T}'.


Public definitions of class STR_HASH_TEST: 

Inherits from: TEST

main is
   Test of `STR_HASH_MAP_ELT{T}', `STR_HASH_MAP{T}',
   `STR_HASH_MAP_CURSOR{T}', `STR_HASH_SET_ELT', `STR_HASH_SET',
   `STR_HASH_SET_CURSOR', `GENERAL_HASH{T}',
   and `GENERAL_HASH_CURSOR{T}'.

str_hash_map_test is
   Test of classes related to `STR_HASH_MAP{INT}'.

str_of_map(s: STR_HASH_MAP{INT}): STR is
   A string containing the elements of `s' separated by commas.
   Of the form `"one:1, two:2"'.

str_hash_set_test is
   Test of classes related to `STR_HASH_SET'.

str_of_set(s: STR_HASH_SET): STR is
   A string containing the elements of `s' separated by commas.
   Of the form `"one, two"'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STR_SORT is                                                    [class]

   Sort `LIST{STR}' alphabetically. Usage: `STR_SORT::sort(l)'.
   Also supports `STR_SORT::is_sorted(l):BOOL'.


Public definitions of class STR_SORT: 

Inherits from: QUICKSORT

compare(a,b:STR):BOOL is
   Redefined comparison for strings.

sort(l:LIST{STR}) is
   Sort the strings in `l' lexicographically.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

STR_TEST is                                                    [class]

   Test the classes `STR' and `STR_CURSOR'.


Public definitions of class STR_TEST: 

Inherits from: TEST

main is
   Test the classes `STR' and `STR_CURSOR'.

str_test is
   Test `STR'.

str_cursor_test is
   Test `STR_CURSOR'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SUBSET_VECTOR_MAP is                                           [class]

   A map whose output components are a permuted subset of the
   components of the input.


Public definitions of class SUBSET_VECTOR_MAP: 

Inherits from: VECTOR_MAP

perm:LIST{INT};
   The permutation.

in_d:INT;
   The input dimension.

create(in_d:INT; perm:LIST{INT}):SELF_TYPE is
   The input has dimension `in_d'. The output vector will have a
   dimension = `perm.size'. The `i'th component of the output is
   the `p[i]'th component of the input.

map_in(vi,vo:VECTOR) is
   Fill in `vo' with the permuted components of `vi'.

in_dim:INT is
   The input dimension.

out_dim:INT is
   The output dimension.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SUNWIND is                                                     [class]

   Generic sunwindow interface. This class provides a simple user
   interface under SunView which is sufficient for many applications.
   It puts up a window consisting of a graphics output section which
   is a 512 by 512 square and an input section. This consists of a
   variable number of labelled buttons, sliders, and text input
   fields. It also has a region for printing out text messages to
   the user. To use, set `SUNWIND::routine_ob' to an object whose class
   defines `mouse_routine', `button_routine', and `slider_routine'. Then
   call `win_create', then `win_loop'. See the test classes for examples.
   The ".sather" file must include the following entries to allow
   the calling of the appropriate Sather function from the C
   sunwindows code:
   (c_name) mouse_routine SUNWIND::mouse_routine
   (c_name) button_routine SUNWIND::button_routine
   (c_name) slider_routine SUNWIND::slider_routine
   The sunwindow libraries must be linked in by including the line:
   (cc_flags) -lsuntool -lsunwindow -lpixrect -lm
   in your ".sather" file as well. (And don't forget to include
   (c_files) ~/sl/lib/user_interface/C/sunwind_.o)
   An example ".sather" file is in "sather/etc/test/sunwind_test.sather".


Public definitions of class SUNWIND: 

Inherits from: GRAPHICS_OUT

routine_ob:$SUNWIND:=SUNWIND::new;                            [shared]
   Object whose class
  - defines the callbacks.

win_create(butnum,slinum,txtnum:INT) is
   Create a new window and display it, with `butnum' buttons,
   `slinum' sliders, and `txtnum' text input fields. Last button
   will automatically be a quit button.

win_loop is
   Start up the main window loop.

mouse_routine(but,x,y,evt:INT) is
   Just calls the client mouse routine when a mouse button is pressed
   or the mouse is moved with a button depressed (dragging).
   `but' will be set to `1', `2', or `3' depending on the mouse button
   pressed. `x' and `y' will be set to the canvas coordinates of
   the mouse press on the canvas. `evt' will be `1' for a downward
   mouse button press, `2' for button release, and `3' for drag.

button_routine(but:INT) is
   Just calls the client button routine when a button is pressed.
   `but' will be the number of the button which was pressed.

slider_routine(slider,value:INT) is
   Just calls the client slider routine when a slider is moved.
   `slider' will be set to the slider number, `value' to the
   value of that slider.

draw_rect_p(xa,ya,xb,yb:INT) is
   Xor a rectangle with coordinates specified in window pixels.

display_message(message:STR) is
   Put `message' in the message region of the window.

clear_canvas is
   Erase the canvas portion of the window.

set_frame_label(s:STR) is
   Label the frame with the string `s'.

set_button_label(b:INT; s:STR) is
   Label button number `b' with the string `s'.

set_slider_label(sl:INT; s:STR) is
   Label slider number `sl' with the string `s'.

set_slider_params(sl,minval,maxval,val:INT) is
   Set the parameters of slider number `sl'. `minval' is the minimum
   value it can represent, `maxval' is the maximum value, and `val'
   is the current value it should be set to.

slider_val(sli:INT):INT is
   The current setting of slider number `sli'.

set_text_label(t:INT; s:STR) is
   Label text input field number `t' with `s'.

set_text_value(t:INT;s:STR) is
   Set the current value of text input field `t' to `s'.

get_text_value(t:INT):STR is
   The current setting of text input field number `t'.

draw_line_p(xa,ya,xb,yb:INT) is
   Draw a line segment specified in pixels.

draw_circle_p(x,y,r:INT) is
   Draw circle specified in pixels.

draw_line_xor_p(xa,ya,xb,yb:INT) is
   Xor draw a line segment specified in pixels.

draw_line_xor(xa,ya,xb,yb:REAL) is
   Xor draw a line segment with real endpoints.

draw_point_p(x,y:INT) is
   Draw a point with pixel coordinates.

draw_point_xor(x,y:REAL) is
   Xor draw a single point with real coordinates.

draw_box_xor_p(sz,x,y:INT) is
   Xor draw a box with pixel coords and size `sz'. (Good for marking
   points on the screen).

draw_box_p(sz,x,y:INT) is
   Draw a box with pixel coords and size `sz'. (Good for marking
   points on the screen).

draw_point(x,y:REAL) is
   Draw a single point.

draw_line (x1,y1,x2,y2:REAL) is
   Draw a line segment in `0.,1.' coordinates.

draw_rect(x1,y1,x2,y2:REAL) is
   Draw a rectangle in `[0.,1.]' coordinates.

draw_rect_xor(x1,y1,x2,y2:REAL) is
   Xor draw a rectangle in `0.,1.' coordinates.

draw_circle(x,y,r:REAL) is
   Draw a circle centered at `(x,y)' of radius `r'. 

draw_circle_xor(x,y,r:REAL) is
   Xor draw a circle centered at `(x,y)' of radius `r'. 

draw_str (x,y:REAL; s:STR) is
   Draw the string `s' with point specified by `str_loc' at `(x,y)'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SUNWIND_GRAPHICS_TEST is                                       [class]

   Try out SUNWIND version of GRAPHICS_OUT.


Public definitions of class SUNWIND_GRAPHICS_TEST: 

main is
   Undocumented.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SUNWIND_TEST is                                                [class]

   Try out SUNWIND.


Public definitions of class SUNWIND_TEST: 

Inherits from: SUNWIND

xa:INT;
   Undocumented.

ya:INT;
  
   Undocumented.

xb:INT;
  
  
   Undocumented.

yb:INT;
  
  
  
   Undocumented.

main is
   Undocumented.

button_routine(but:INT) is
   Undocumented.

mouse_routine(but,x,y,evt:INT) is
   Undocumented.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SYS is                                                         [class]

   Sather interface to information about the names, numbering, and
   layout of classes. The program must be compiled with the "-info"
   option enabled. This causes the compiler to generate a large table
   of all class and feature names used in the program. When `init'
   is called, this information is read by the system and the other
   routines in this class give access to it.


Public definitions of class SYS: 

class_table:ARRAY{STR} := ARRAY{STR}::new(C::num_classes_);   [shared]
   Undocumented.

class_rtable:STR_HASH_MAP{INT} := STR_HASH_MAP{INT}::create;  [shared]
   Undocumented.

feature_table:ARRAY{STR} := ARRAY{STR}::new(C::max_name_index_); [shared]
   Undocumented.

feature_rtable:STR_HASH_MAP{INT} := STR_HASH_MAP{INT}::create; [shared]
   Undocumented.

initialized:BOOL := false;                                    [shared]
   Set `true' by initialization.

Attribute:INT := 1;                                         [constant]
   Undocumented.

Routine:INT := 2;                                           [constant]
   Undocumented.

Shared:INT := 3;                                            [constant]
   Undocumented.

Constant:INT := 4;                                          [constant]
   Undocumented.

init:BOOL is
   Read the class and feature name to index mapping from the
   generated info file and return `false' if there is an error. 

number_of_classes:INT is
   The number of classes in the system.

class_index(nm:STR):INT is
   The index of the class whose name is `nm' or `0' if none.

class_name(i:INT):STR is
   The name of the class whose index is `i'.

class_base_size(i:INT):INT is
   Size in bytes of objects belonging to the class with index
   `i' not including any extendible array portion.

class_c_type(i:INT):INT is
   C type of basic/non-basic class.
   The values are: 1:ptr, 2:char, 3:int, 4:float, 5:double.

class_number_of_features(i:INT):INT is
   The number of features defined for class `i'.

class_array_dim(i:INT):INT is
   Number of array dimensions of the class with index `i'. Zero
   if `i' is not an array class.

class_array_c_type(i:INT):INT is
   C type of array elements.
   The values are: 1:ptr, 2:char, 3:int, 4:float, 5:double.

class_number_of_attributes(i:INT):INT is
   Number of attributes in class `i'.

class_attribute_c_type(ci,a:INT):INT is
   C type of attribute `a' in the class with index `ci'.
   The values are: 1:ptr, 2:char, 3:int, 4:float, 5:double.

class_array_element_type(i:INT):INT is
   Sather type specified as a class index of the elements of
   the array defined by `i' if it is an array class.

is_a_descendent_of(i,j:INT):BOOL is
   True if class `i' is a descendent of class `j'.

feature_name(ci,f:INT):STR is
   The name of the `f'th feature in the class with index `ci'.

feature_category(ci,f:INT):INT is
   The category of the `f''th feature of the class with index `ci'.
   The values are: 1:attribute, 2:routine, 3:shared, 4:constant.

feature_index(ci:INT; f:STR):INT is
   The index of the feature with name `f' in the class with index
   `ci' if found, `-1' otherwise.

feature_type(ci,f:INT):INT is
   The class index of the type of feature `f' in the class with
   index `ci' if the feature is a shared, constant, or attribute.
   `0' if the feature is a routine.

feature_c_type(ci,f:INT):INT is
   C type of shared/constant/attribute, or `0' if it is a routine.
   The values are: 1:ptr, 2:char, 3:int, 4:float, 5:double.

feature_location(ci,f:INT):INT is
   Returns the following for the `f''th feature of the class with
   index `ci', depending on the category of feature:
   1) Shared/Constant -- Address of global variable
   2) Attribute -- Offset of attribute
   3) Routine -- Address of routine

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SYS_TEST is                                                    [class]

   Test of `SYS' class. This program must be compiled with the
   "-info" option enabled.


Public definitions of class SYS_TEST: 

Inherits from: TEST

d1:SYS_TEST_CLASS;                                            [shared]
   Undocumented.

d2:ARRAY2{$OB};                                               [shared]
   Undocumented.

d3:ARRAY3{$OB};                                               [shared]
   Undocumented.

d4:EMPTY_CLASS;                                               [shared]
   Undocumented.

main is
   Test `SYS'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SYS_TEST_CLASS is                                              [class]

   This is a class defined to be used in SYS_TEST.


Public definitions of class SYS_TEST_CLASS: 

Inherits from: EMPTY_CLASS

x1:CHAR;
   Undocumented.

x2:INT;
   Undocumented.

x3:REAL;
   Undocumented.

x4:DOUBLE;
   Undocumented.

x5:BOOL;
   Undocumented.

foo1 is
   Routine does nothing.

foo2:BOOL is
   Undocumented.

s1:INT := 12;                                                 [shared]
   Undocumented.

c1:STR := "hello world\n";                                  [constant]
   Undocumented.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TAGGED_FOB1 is                                                 [class]

   Undocumented.


Public definitions of class TAGGED_FOB1: 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TAGGED_FOB2 is                                                 [class]

   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 


Public definitions of class TAGGED_FOB2: 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TEST is                                                        [class]

   To be inherited by each testing class. The test routine should
   start with the call `class_name("CLASS_FOO");'. It should then
   have calls to `test' or `unchecked_test' which actually perform
   the test. It should end with `finish' to print out the results.
   The results are sent to both `stderr' and `stdout' so you can
   redirect output to a file and still see whether all tests were
   passed. The routine being tested must return a string. The
   basic classes all have routines named `to_s' to produce string
   representations of themselves. A typical test might look something
   like: `test("sum", (1+1).to_s, "2");'. The tests are numbered and
   the failures are summarized at the end. 


Public definitions of class TEST: 

class_name_str:STR;                                           [shared]
   The name of the tested class.

failures:LIST{INT};                                           [shared]
   The tests which failed.

failure_docs:LIST{STR};                                       [shared]
   The documentation of the failures.

test_number:INT;                                              [shared]
   Which test.

class_name(nm:STR) is
   Specify the name of the class being tested. Must be called first.

test(doc,does,should:STR) is
   Perform the test with the description `doc', return value `does',
   and desired return value `should'. Keep track of failures.

unchecked_test(doc,does,should:STR) is
   Perform the test with the description `doc', return value `does',
   and desired return value `should'. Don't keep track of failures.

finish is
   Complete the testing on the current class.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TEST_FOB1 is                                                   [class]

   Undocumented.


Public definitions of class TEST_FOB1: 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TEST_FOB2 is                                                   [class]

   Undocumented.


Public definitions of class TEST_FOB2: 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TEST_OB1 is                                                    [class]

   Undocumented.


Public definitions of class TEST_OB1: 

Inherits from: LIST

Inherits from: ANY_OB

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TEST_TEST is                                                   [class]

   Test of `TEST'.


Public definitions of class TEST_TEST: 

Inherits from: TEST

main is
   Test of `TEST'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TIME is                                                        [class]

   Timing operations.


Public definitions of class TIME: 

start_clock is
   Start the clock for the timer.

get_clock:REAL is
   Time since clock started.

time:DOUBLE is
   The time in seconds since 00:00:00 GMT, Jan. 1, 1970 as a double
   including milliseconds.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TIME_TEST is                                                   [class]

   Test the TIME class.


Public definitions of class TIME_TEST: 

Inherits from: TIME

main(a:ARRAY{STR}) is
   Undocumented.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TYPE is                                                        [class]

   Ease writing of sybtype predicate and coercions.  Subtype information
   is not included in the Sather binary by default.  A special option
   (currently -bro) needs to be used, if features in this class are used.
   Here we do not refer to the names of classes, though, at runtime, so
   perhaps the browser information -bro includes too much.


Public definitions of class TYPE: 

less(t1,t2: INT): BOOL is
   `TYPE::lseq(t1,t2)=true' iff `t1' < `t2' in the type hierarchy.

lseq(t1,t2: INT): BOOL is
   `TYPE::lseq(t1,t2)=true' iff `t1' <= `t2' in the type hierarchy.

is_of(other_type: INT): BOOL is
   `x.is_of(SOME::type)=true' iff type of `x' <= `other_type'.

as(other_type: INT): $OB is
   Coerce `self' to `other_type' if this is legal.

poly(t: INT): INT is
   the polymorphic (dispatched) version of `t'.

is_mono(t: INT): BOOL is
   is this the monomorphic (non-dispatched) type `t'.

is_poly(t: INT): BOOL is
   is this a polymorphic (dispatched) type `$t'.

is_basic_type(t: INT): BOOL is
   is `t' one of `BOOL', `CHAR', `INT', `REAL' or `DOUBLE'.

is_foreign_type(t: INT): BOOL is
   `t' conforms to $F_OB.
   `lesq(t,F_OB::type)' does not work for now. If foreign type information
   is needed at runtime, you need to provide it using `FOREIGN'.
   For now we only check whether `t' conforms to `$FOREIGN{$F_OB}'.

is_ob_type(t: INT): BOOL is
   `t' conforms to $OB.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TYPE_TEST is                                                   [class]

   Undocumented.


Public definitions of class TYPE_TEST: 

main is
   Undocumented.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

UF_HASH_ELT{T} is                                              [class]

   The hash table elements for `UNION_FIND{T}', for use in
   `GENERAL_HASH{UF_HASH_ELT{T}}'. T cannot be a basic type.
   Won't typically be used elsewhere.


Public definitions of class UF_HASH_ELT: 

m:T;
   The set member.

rank:INT;
   Used to decide new root in unions.

parent:SELF_TYPE;
   Parent pointer, self for roots.

create(m:T):SELF_TYPE is
   A new element holding `m'.

hash:INT is
   The object pointer shifted right by two bits.

is_equal(e:SELF_TYPE):BOOL is
   True if `self' and `e' hold the same member.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

UNION_FIND{T} is                                               [class]

   Collections of sets of elements of type `T' supporting union and find. 
   T cannot be a basic type.


Public definitions of class UNION_FIND: 

t:GENERAL_HASH{UF_HASH_ELT{T}};
   The table.

test_elt:UF_HASH_ELT{T}:=UF_HASH_ELT{T}::create(void);        [shared]
   for tests

create:SELF_TYPE is
   A new set of sets.

test(m:T):BOOL is
   True if `m' is currently contained in one of the sets.

insert(m:T) is
   Add the element `m' as a singleton set (isolate it if present).

find(m:T):UF_HASH_ELT{T} is
   The root of `m''s tree or `void' if absent.
   Consider using `in_same_set' for a cleaner abstraction.

elt_find(e:UF_HASH_ELT{T}):UF_HASH_ELT{T} is
   Internal find given an `e'.

union(m1,m2:T) is
   Union together the sets containing `m1' and `m2'.

in_same_set(m1,m2:T):BOOL is
   True if `m1' and `m2' belong to the same set.

delete(m:T) is
   Delete `m' if present.

clear is
   Eliminate all sets.

list_of_sets:LIST{LIST{T}} is
   A list of lists of the elements in each set.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

UNION_FIND_TEST is                                             [class]

   Test `UNION_FIND{STR}'.


Public definitions of class UNION_FIND_TEST: 

Inherits from: TEST

main is
   Test `UNION_FIND{STR}'.

str_of_sets(t:UNION_FIND{STR}):STR is
   A string displaying the elements of `t'. Each set is listed
   alphabetically in curly brackets and the lists are given
   alphabetically as well. Of the form: "{a, b, c}, {d, e, f, g}, {h}".

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

UNIX is                                                        [class]

   Sather interface to Unix system calls.


Public definitions of class UNIX: 

unix_error:INT := 0;                                          [shared]
   Undocumented.

acct(acctfile:STR):INT is
   Turn accounting on or off.  Write information to `acctfile'.
   -1 is returned if an error occurs; otherwise 0 is returned.

chdir(dirname:STR):INT is
   Change current working directory.
   Returns 0 if successful, -1 otherwise.

chroot(dirname:STR):INT is
   Change root directory.
   Returns 0 if successful, -1 otherwise.      

execve(prog:STR; argv:ARRAY{STR}; envp:ARRAY{STR}):INT is
   Execute a file, by transforming the calling process into a
   new process.  If `execve' returns to the calling process,
   the returned value will be -1, ie an error has occurred.
   `argv', `envp' should have a null pointer as the last pointer.

fork:INT is
   Create a new process.
   Returns 0 to child process and child process ID to parent
     process.  Otherwise, -1 is returned to parent process.

getegid:INT is
   Return group identity.

geteuid:INT is
   Return user identity.

getgid:INT is
   Return real group identity.

gethostid:INT is
   Get unique identifier of current host.

gethostname(name:STR; namelen:INT):INT is
   Get name of current host.  `namelen' species the size of the
   array pointed to by `name'.
   Returns 0 if successful, -1 otherwise.      
   NOTE: The interface may be simplified by requiring only `name'.

getpgrp(pid:INT):INT is
   Get process group.  If `pid' is 0, returns process group of
   calling process.

getpid:INT is
   Return current process identification.

getppid:INT is
   Return parent process identification.

getuid:INT is
   Return real user identity.

ioctl(des, request, arg:INT):INT is
   Control device.
   Returns 0 if successful; -1 otherwise.

link(name1, name2:STR):INT is
   Make a hard link `name2' to an existing file given by `name1'.
   Returns 0 if successful; -1 otherwise.

mkdir(name:STR; mode:INT):INT is
   Make a new directory, with given `mode'.
   Returns 0 if successful; -1 otherwise.

profil(buff:STR; bufsiz, offset, scale:INT) is
   Execution time profile.

rename(from, to:STR):INT is
   Change the name of a file.
   Returns 0 if successful; -1 otherwise.

rmdir(name:STR):INT is
   Remove a directory file.
   Returns 0 if successful, -1 otherwise.      

sethostname(name:STR; namelen:INT):INT is
   Set name of current host.  `namelen' specifies the size of
   string `name'.
   Returns 0 if successful, -1 otherwise.      

setpgrp(pid, pgrp:INT):INT is
   Set process group.

setregid(rgid, egid:INT):INT is
   Set real and effective group IDs.

setreuid(ruid, euid:INT):INT is
   Set real and effective user IDs.

swapon(special:STR):INT is
   Add a swap device for interleaved paging/swapping.
   Returns 0 if successful; -1 otherwise.

symlink(name1,name2:STR):INT is
   Create a symbolic link "name2" to "name1".
   Returns 0 if successful; -1 otherwise.

sync is
   Update super-block.

umask(numask:INT):INT is
   Set file creation mode mask.
   Returns previous value of file mode mask.

unlink(name:STR):INT is
   Remove directory entry.
   Returns 0 if successful; -1 otherwise.

vhangup is
   Virtually "hangup" the current control terminal.

system(com:STR):INT is
   Execute the shell command "com".

getenv(name:STR):STR is
   Return the value of name in the current environment.

putenv(name,val:STR):INT is
   Set the value of name in the current environment.

getcwd:STR is
   Use C library function "getcwd" for compatibility with
   other UNIX operating systems.  Alternative is to use "getwd"
   which is faster.

login_name:STR is
   User's login name.

exit(i:INT) is
   Terminate a process.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

UNIX_CODES is                                                  [class]

   Error codes in UNIX system calls.


Public definitions of class UNIX_CODES: 

EPERM:INT     := C::EPERM;                                  [constant]
   Not owner

ENOENT:INT    := C::ENOENT;                                 [constant]
   No such file or directory

ESRCH:INT     := C::ESRCH;                                  [constant]
   No such process

EINTR:INT     := C::EINTR;                                  [constant]
   Interrupted system call

EIO:INT       := C::EIO;                                    [constant]
   I/O error

ENXIO:INT     := C::ENXIO;                                  [constant]
   No such device or address

E2BIG:INT     := C::E2BIG;                                  [constant]
   Arg list too long

ENOEXEC:INT   := C::ENOEXEC;                                [constant]
   Exec format error

EBADF:INT     := C::EBADF;                                  [constant]
   Bad file number

ECHILD:INT    := C::ECHILD;                                 [constant]
   No children

EAGAIN:INT    := C::EAGAIN;                                 [constant]
   No more processes

ENOMEM:INT    := C::ENOMEM;                                 [constant]
   Not enough memory

EACCES:INT    := C::EACCES;                                 [constant]
   Permission denied

EFAULT:INT    := C::EFAULT;                                 [constant]
   Bad address

ENOTBLK:INT   := C::ENOTBLK;                                [constant]
   Block device required

EBUSY:INT     := C::EBUSY;                                  [constant]
   Device busy

EEXIST:INT    := C::EEXIST;                                 [constant]
   File exists

EXDEV:INT     := C::EXDEV;                                  [constant]
   Cross-device link

ENODEV:INT    := C::ENODEV;                                 [constant]
   No such device

ENOTDIR:INT   := C::ENOTDIR;                                [constant]
   Not a directory

EISDIR:INT    := C::EISDIR;                                 [constant]
   Is a directory

EINVAL:INT    := C::EINVAL;                                 [constant]
   Invalid argument

ENFILE:INT    := C::ENFILE;                                 [constant]
   File table overflow

EMFILE:INT    := C::EMFILE;                                 [constant]
   Too many open files

ENOTTY:INT    := C::ENOTTY;                                 [constant]
   Inappropriate ioctl for device

EFBIG:INT     := C::EFBIG;                                  [constant]
   File too large

ENOSPC:INT    := C::ENOSPC;                                 [constant]
   No space left on device

ESPIPE:INT    := C::ESPIPE;                                 [constant]
   Illegal seek

EROFS:INT     := C::EROFS;                                  [constant]
   Read-only file system

EMLINK:INT    := C::EMLINK;                                 [constant]
   Too many links

EPIPE:INT     := C::EPIPE;                                  [constant]
   Broken piope

EDOM:INT      := C::EDOM;                                   [constant]
   Math argument

ERANGE:INT    := C::ERANGE;                                 [constant]
   Result too large

EWOULDBLOCK:INT := C::EWOULDBLOCK;                          [constant]
   Operation would block

EINPROGRESS:INT := C::EINPROGRESS;                          [constant]
   Operation now in progress

EALREADY:INT  := C::EALREADY;                               [constant]
   Operation already in progress

ENOTSOCK:INT  := C::ENOTSOCK;                               [constant]
   Socket operation on non-socket

EDESTADDRREQ:INT := C::EDESTADDRREQ;                        [constant]
   Destination address required

EMSGSIZE:INT := C::EMSGSIZE;                                [constant]
   Message too long

EPROTOTYPE:INT := C::EPROTOTYPE;                            [constant]
   Protocol wrong type for socket

ENOPROTOOPT:INT := C::ENOPROTOOPT;                          [constant]
   Option not supported by protocol

EPROTONOSUPPORT:INT := C::EPROTONOSUPPORT;                  [constant]
   Protocol not supported

ESOCKTNOSUPPORT:INT := C::ESOCKTNOSUPPORT;                  [constant]
   Socket type not supported

EOPNOTSUPP:INT := C::EOPNOTSUPP;                            [constant]
   Operation not supported on socket

EPFNOSUPPORT:INT := C::EPFNOSUPPORT;                        [constant]
   Protocol family not supported

EAFNOSUPPORT:INT := C::EAFNOSUPPORT;                        [constant]
   Address family not supported by protocol family

EADDRINUSE:INT := C::EADDRINUSE;                            [constant]
   Address already in use

EADDRNOTAVAIL:INT := C::EADDRNOTAVAIL;                      [constant]
   Can't assign requested address

ENETDOWN:INT := C::ENETDOWN;                                [constant]
   Network is down

ENETUNREACH:INT := C::ENETUNREACH;                          [constant]
   Network is unreachable

ENETRESET:INT := C::ENETRESET;                              [constant]
   Network dropped connection on reset

ECONNABORTED:INT := C::ECONNABORTED;                        [constant]
   Software caused connection abort

ECONNRESET:INT := C::ECONNRESET;                            [constant]
   Connection reset by peer

ENOBUFS:INT := C::ENOBUFS;                                  [constant]
   No buffer space available

EISCONN:INT       := C::EISCONN;                            [constant]
   Socket is already connected

ENOTCONN:INT      := C::ENOTCONN;                           [constant]
   Socket is not connected

ESHUTDOWN:INT     := C::ESHUTDOWN;                          [constant]
   Can't send after socket shutdown

ETIMEDOUT:INT     := C::ETIMEDOUT;                          [constant]
   Connection timed out

ECONNREFUSED:INT  := C::ECONNREFUSED;                       [constant]
   Connection refused

ELOOP:INT         := C::ELOOP;                              [constant]
   Too many levels of symbolic links

ENAMETOOLONG:INT  := C::ENAMETOOLONG;                       [constant]
   File name too long

EHOSTDOWN:INT     := C::EHOSTDOWN;                          [constant]
   Host is down

EHOSTUNREACH:INT  := C::EHOSTUNREACH;                       [constant]
   Host is unreachable

ENOTEMPTY:INT     := C::ENOTEMPTY;                          [constant]
   Directory not empty

EDQUOT:INT        := C::EDQUOT;                             [constant]
   Disc quota exceeded

ESTALE:INT        := C::ESTALE;                             [constant]
   Stale NFS file handle

EREMOTE:INT       := C::EREMOTE;                            [constant]
   Too many levels of remote in path

ENOSTR:INT        := C::ENOSTR;                             [constant]
   Not a stream device

ETIME:INT         := C::ETIME;                              [constant]
   Timer expired

ENOSR:INT         := C::ENOSR;                              [constant]
   Out of stream resources

ENOMSG:INT        := C::ENOMSG;                             [constant]
   No message of desired type

EBADMSG:INT       := C::EBADMSG;                            [constant]
   Not a data message

EIDRM:INT         := C::EIDRM;                              [constant]
   Identifier removed

last_unix_code:INT:= EIDRM;                                 [constant]
   Undocumented.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

UNIX_MESSAGES is                                               [class]

   Undocumented.


Public definitions of class UNIX_MESSAGES: 

error_messages:ARRAY{STR};                                    [shared]
   Undocumented.

EPERM          :STR := "Not owner";                         [constant]
   Undocumented.

ENOENT         :STR := "No such file or directory";         [constant]
   Undocumented.

ESRCH          :STR := "No such process";                   [constant]
   Undocumented.

EINTR          :STR := "Interrupted system call";           [constant]
   Undocumented.

EIO            :STR := "I/O error";                         [constant]
   Undocumented.

ENXIO          :STR := "No such device or address";         [constant]
   Undocumented.

E2BIG          :STR := "Arg list too long";                 [constant]
   Undocumented.

ENOEXEC        :STR := "Exec format error";                 [constant]
   Undocumented.

EBADF          :STR := "Bad file number";                   [constant]
   Undocumented.

ECHILD         :STR := "No children";                       [constant]
   Undocumented.

EAGAIN         :STR := "No more processes";                 [constant]
   Undocumented.

ENOMEM         :STR := "Not enough memory";                 [constant]
   Undocumented.

EACCES         :STR := "Permission denied";                 [constant]
   Undocumented.

EFAULT         :STR := "Bad address";                       [constant]
   Undocumented.

ENOTBLK        :STR := "Block device required";             [constant]
   Undocumented.

EBUSY          :STR := "Device busy";                       [constant]
   Undocumented.

EEXIST         :STR := "File exists";                       [constant]
   Undocumented.

EXDEV          :STR := "Cross-device link";                 [constant]
   Undocumented.

ENODEV         :STR := "No such device";                    [constant]
   Undocumented.

ENOTDIR        :STR := "Not a directory";                   [constant]
   Undocumented.

EISDIR         :STR := "Is a directory";                    [constant]
   Undocumented.

EINVAL         :STR := "Invalid argument";                  [constant]
   Undocumented.

ENFILE         :STR := "File table overflow";               [constant]
   Undocumented.

EMFILE         :STR := "Too many open files";               [constant]
   Undocumented.

ENOTTY         :STR := "Inappropriate ioctl for device";    [constant]
   Undocumented.

EFBIG          :STR := "File too large";                    [constant]
   Undocumented.

ENOSPC         :STR := "No space left on device";           [constant]
   Undocumented.

ESPIPE         :STR := "Illegal seek";                      [constant]
   Undocumented.

EROFS          :STR := "Read-only file system";             [constant]
   Undocumented.

EMLINK         :STR := "Too many links";                    [constant]
   Undocumented.

EPIPE          :STR := "Broken piope";                      [constant]
   Undocumented.

EDOM           :STR := "Math argument";                     [constant]
   Undocumented.

ERANGE         :STR := "Result too large";                  [constant]
   Undocumented.

EWOULDBLOCK    :STR := "Operation would block";             [constant]
   Undocumented.

EINPROGRESS    :STR := "Operation now in progress";         [constant]
   Undocumented.

EALREADY       :STR := "Operation already in progress";     [constant]
   Undocumented.

ENOTSOCK       :STR := "Socket operation on non-socket";    [constant]
   Undocumented.

EDESTADDRREQ   :STR := "Destination address required";      [constant]
   Undocumented.

EMSGSIZE       :STR := "Message too long";                  [constant]
   Undocumented.

EPROTOTYPE     :STR := "Protocol wrong type for socket";    [constant]
   Undocumented.

ENOPROTOOPT    :STR := "Option not supported by protocol";  [constant]
   Undocumented.

EPROTONOSUPPORT :STR := "Protocol not supported";           [constant]
   Undocumented.

ESOCKTNOSUPPORT  :STR := "Socket type not supported";       [constant]
   Undocumented.

EOPNOTSUPP       :STR := "Operation not supported on socket"; [constant]
   Undocumented.

EPFNOSUPPORT     :STR := "Protocol family not supported";   [constant]
   Undocumented.

EAFNOSUPPORT:STR
	 := "Address family not supported by protocol family"; [constant]
   Undocumented.

EADDRINUSE       :STR := "Address already in use";          [constant]
   Undocumented.

EADDRNOTAVAIL    :STR := "Can't assign requested address";  [constant]
   Undocumented.

ENETDOWN         :STR := "Network is down";                 [constant]
   Undocumented.

ENETUNREACH      :STR := "Network is unreachable";          [constant]
   Undocumented.

ENETRESET        :STR := "Network dropped connection on reset"; [constant]
   Undocumented.

ECONNABORTED     :STR := "Software caused connection abort"; [constant]
   Undocumented.

ECONNRESET       :STR := "Connection reset by peer";        [constant]
   Undocumented.

ENOBUFS          :STR := "No buffer space available";       [constant]
   Undocumented.

EISCONN          :STR := "Socket is already connected";     [constant]
   Undocumented.

ENOTCONN         :STR := "Socket is not connected";         [constant]
   Undocumented.

ESHUTDOWN        :STR := "Can't send after socket shutdown"; [constant]
   Undocumented.

ETIMEDOUT        :STR := "Connection timed out";            [constant]
   Undocumented.

ECONNREFUSED     :STR := "Connection refused";              [constant]
   Undocumented.

ELOOP            :STR := "Too many levels of symbolic links"; [constant]
   Undocumented.

ENAMETOOLONG     :STR := "File name too long";              [constant]
   Undocumented.

EHOSTDOWN        :STR := "Host is down";                    [constant]
   Undocumented.

EHOSTUNREACH     :STR := "Host is unreachable";             [constant]
   Undocumented.

ENOTEMPTY        :STR := "Directory not empty";             [constant]
   Undocumented.

EDQUOT           :STR := "Disc quota exceeded";             [constant]
   Undocumented.

ESTALE           :STR := "Stale NFS file handle";           [constant]
   Undocumented.

EREMOTE          :STR := "Too many levels of remote in path"; [constant]
   Undocumented.

ENOSTR           :STR := "Not a stream device";             [constant]
   Undocumented.

ETIME            :STR := "Timer expired";                   [constant]
   Undocumented.

ENOSR            :STR := "Out of stream resources";         [constant]
   Undocumented.

ENOMSG           :STR := "No message of desired type";      [constant]
   Undocumented.

EBADMSG          :STR := "Not a data message";              [constant]
   Undocumented.

EIDRM            :STR := "Identifier removed";              [constant]
   Undocumented.

init is
   Undocumented.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

UNIX_TEST is                                                   [class]

   Test of `UNIX' class.


Public definitions of class UNIX_TEST: 

Inherits from: TEST

tester_name:STR := "clim";                                  [constant]
   Whoever is testing `UNIX'.

tester_home_name:STR := "/n/icsib19/da/clim";               [constant]
   Home directory of tester.

main is
   Test `UNIX_MESSAGES' and `UNIX'.

test_unix is
   Test `UNIX' system calls.

test_unix_messages is
   Test `UNIX_MESSAGES' to make sure the array containing
   messages is initialized correctly.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

VECTOR is                                                      [class]

   Real vectors.


Public definitions of class VECTOR: 

Inherits from: ARRAY

create(n:INT):SELF_TYPE is
   A zero initialized vector of dimension `n'.

dim:INT is
   The dimension of `self'.

to_s:STR is
   A string representation of `self' of the form:
   "(2.34, 4.56, 8.76)".

create_from_s(s:STR):VECTOR is
   Create a new vector from a string of the form:
   "(2.34, 4.56, 8.76)". Returns `void' if not of this form (extra
   white space is ignored). Must be at least one component.

plus(v:VECTOR):VECTOR is
   The sum of `self' and `v'.

minus(v:VECTOR):VECTOR is
   `Self' minus `v'.

dot(v:VECTOR):REAL is
   Dot product of `self' and `v'.

scale_by(s:REAL):VECTOR is
   Scale `self' by `s' and return it.

to(v:VECTOR):VECTOR is
   Make `self' equal to `v' and return it.

to_sum_with(v:VECTOR):VECTOR is
   Make `self' be the sum with `v' and return it.

to_scaled_sum_with(v:VECTOR; s:REAL):VECTOR is
   Make `self' be the sum with `s' times `v' and return it.

to_sum_of(v1,v2:VECTOR):VECTOR is
   Make `self' be the sum of `v1' and `v2' and return it.

to_difference_of(v1,v2:VECTOR):VECTOR is
   Make `self' be `v1-v2' and return it.

to_difference_with(v:VECTOR):VECTOR is
   Subtract `v' from `self' and return it.

to_constant(c:REAL):VECTOR is
   Make each component of `self' be `c' and return it.

to_zero:VECTOR is
   Make `self' be the `origin' and return it.

to_ones:VECTOR is
   Make `self' be all ones and return it.

length:REAL is
   Euclidean length of `self'.

square_length:REAL is
   The square of the Euclidean length of `self'.

normalize:VECTOR is
   If not 0, then scale `self' to length `1' and return it.

is_normalized:BOOL is
   True if `self' is within `epsilon' of being normalized.

distance_to(v:VECTOR):REAL is
   The Euclidean distance from `self' to `v'.

square_distance_to(v:VECTOR):REAL is
   The square of the Euclidean distance from `self' to `v'.

bounded_square_distance_to(v:VECTOR; sbnd:REAL):REAL is
   The square of the Euclidean distance from `self' to `v' if it is
   less than or equal `sbnd', `-1'. if it is greater than it.
   Avoids some of the multiplies and adds if used in a bounding test.

to_midpoint_with(v:VECTOR):VECTOR is
   Make `self' be the midpoint of `self' and `v' and return it.

move_away_from(v:VECTOR; d:REAL):VECTOR is
   Move `self' a distance `d' in the direction away from `v' and
   return it.

move_toward(v:VECTOR; d:REAL):VECTOR is
   Move `self' a distance `d' in the direction toward `v' and
   return it.

to_interpolate_between(v0,v1:VECTOR; t:REAL):VECTOR is
   When `t=0.' make `self=v0', when `t=1.' make `self=v1' and
   return it.

max_index:INT is
   The index of the maximum component in `self'.

max_value:REAL is
   The largest component of `self'.

min_index:INT is
   The index of the minimum component in `self'.

min_value:REAL is
   The smallest component of `self'.

make_orthogonal_to_unit(u:VECTOR):VECTOR is
   Subtract off projection onto unit vector `u' and return `self'.

to_uniform_random:VECTOR is
   Make `self' be a uniformly random vector in `[0,1]^dim' and
   return it.

to_cube_random:VECTOR is
   Make `self' be a uniformly random vector in the cube `[-1,1]^dim'
   and return it.

to_normal_random(s:REAL):VECTOR is
   Make `self' be a normal random vector, mean at the origin, standard
   deviation `s' and return it.

to_standard_normal_random:VECTOR is
   Make `self' be a canonical normal random vector (mean at the origin,
   unit variance) and return it.

to_cantor_random(s:REAL):VECTOR is
   Make `self' be a uniform random Cantor point with scaling `s'
   and return it. (Standard Cantor set has `s=.33333'.)

to_curve_random:VECTOR is
   Make `self' be a random point on a curve in the unit cube with
   torsion in all dimensions and return it.

to_unit_random:VECTOR is
   Make `self' be a unit vector uniformly distributed over the
   unit sphere and return it. Based on Knuth, Vol. 2, p. 130.

to_ball_random:VECTOR is
   Make `self' be a uniformly distributed random vector in the unit
   ball and return it. Based on Knuth, Vol. 2, p. 131.

is_epsilon_equal(v:VECTOR):BOOL is
   True if the components of `self' are within `epsilon' of `v'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

VECTOR_2 is                                                    [class]

   Two-dimensional vectors.


Public definitions of class VECTOR_2: 

x:REAL;
   Components of vector.

y:REAL;
  
   Components of vector.

create:SELF_TYPE is
   A new `VECTOR_2' initialized to the origin. 

in_vector(v:VECTOR) is
   Put `self' into `v'.

from_vector(v:VECTOR):VECTOR_2 is
   Fill in `self' from `v' and return `self'.

create_from_vector(v:VECTOR):VECTOR_2 is
   A new `VECTOR_2' with the elements in `v'.

vector:VECTOR is
   A vector corresponding to `self'. 

to_s:STR is
   A string representation of `self' of the form: "(2.34, 4.56)".

create_from_s(s:STR):VECTOR_2 is
   Create a new `VECTOR_2' from a string of the form:
   "(2.34, 4.56)". Returns `void' if not of this form (extra white 
   space is ignored).

plus(v:VECTOR_2):VECTOR_2 is
   The sum of `self' and `v'.

minus(v:VECTOR_2):VECTOR_2 is
   The difference of `self' and `v'.

dot(v:VECTOR_2):REAL is
   The dot product of `self' and `v'.

to(v:VECTOR_2):VECTOR_2 is
   Make `self' be equal to `v' and return it.

scale_by(s:REAL):VECTOR_2 is
   Scale `self' by `s' and return it.

to_sum_with(v:VECTOR_2):VECTOR_2 is
   Make `self' be sum with `v' and return it.

to_scaled_sum_with(v:VECTOR_2; s:REAL):VECTOR_2 is
   Make `self' be the sum with `s' times `v' and return it.

to_sum_of(v1,v2:VECTOR_2):VECTOR_2 is
   Make `self' be the sum of `v1' and `v2' and return it.

to_difference_of(v1,v2:VECTOR_2):VECTOR_2 is
   Make `self' be `v1-v2' and return it.

to_difference_with(v:VECTOR_2):VECTOR_2 is
   Subtract `v' from `self' and return it.

to_constant(c:REAL):VECTOR_2 is
   Make each component of `self' be `c' and return it.

to_zero:VECTOR_2 is
   Make `self' be the origin and return it.

to_ones:VECTOR_2 is
   Make `self' be all ones and return it.

length:REAL is
   Euclidean length of `self'.

square_length:REAL is
   The square of the Euclidean length of `self'.

normalize:VECTOR_2 is
   If not `0', then scale `self' to length `1' and return it.

is_normalized:BOOL is
   True if `self' is within `epsilon' of being normalized.

distance_to(v:VECTOR_2):REAL is
   The Euclidean distance from `self' to `v'.

square_distance_to(v:VECTOR_2):REAL is
   The square of the Euclidean distance from `self' to `v'.

to_midpoint_with(v:VECTOR_2):VECTOR_2 is
   Make `self' be the midpoint of `self' and `v' and return it.

move_away_from(v:VECTOR_2; d:REAL):VECTOR_2 is
   Move `self' a distance `d' in the direction away from `v' and
   return it.

move_toward(v:VECTOR_2; d:REAL):VECTOR_2 is
   Move `self' a distance `d' in the direction toward `v' and
   return it.

to_interpolate_between(v0,v1:VECTOR_2; t:REAL):VECTOR_2 is
   When `t=0.' make `self=v0', when `t=1.' make `self=v1', and
   return it.

make_orthogonal_to_unit(u:VECTOR_2):VECTOR_2 is
   Subtract off projection onto unit vector `u' and return `self'.

to_uniform_random:VECTOR_2 is
   Make `self' be a uniformly random vector in the unit square and
   return it.

to_normal_random(s:REAL):VECTOR_2 is
   Make `self' be a normal random vector, mean 0, standard deviation
   `s' and return it.

to_unit_random:VECTOR_2 is
   Make `self' be unit vector uniform over the unit circle and
   return it.

to_ball_random:VECTOR_2 is
   Make `self' be uniform in the unit ball and return it.

is_epsilon_equal(v:VECTOR_2):BOOL is
   True if the components of `self' are within `epsilon' of `v'.

reflect:VECTOR_2 is
   Reflect `self' through the origin and return it.

to_perpendicular:VECTOR_2 is
   Rotate `self' counter-clockwise by `pi/2' and return it.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

VECTOR_2_LIST is                                               [class]

   Lists of `VECTOR_2', typically used to hold "polylines" or curves
   for two dimensional graphics.


Public definitions of class VECTOR_2_LIST: 

Inherits from: LIST

vector_list:VECTOR_LIST is
   Make a `VECTOR_LIST' whose vectors are equal to those in `self'.

create_from_vector_list(vl:VECTOR_LIST):SELF_TYPE is
   Given a `VECTOR_LIST' of two-dimensional vectors, make
   a corresponding `VECTOR_2_LIST'.

to_s:STR is
   A string version of `self'. Of the form:
   "((1.0, 2.0), (3.5, 3.7))".

nearest_to(v:VECTOR_2):INT is
   The index of the first closest vector in `self' to `v'.

n_nearest_to(v:VECTOR_2; n:INT):LIST{INT} is
   A list of indices of the `n' closest vectors to `v'.

within_square_distance_of(v:VECTOR_2; sr:REAL):LIST{INT} is
   A list of the indices of the vectors in `self' which are within
   a square distance `sr' of `v'.

create_uniform_random(n:INT):VECTOR_2_LIST is
   A list of `n' uniformly distributed random vectors in the unit
   square of the plane.

create_standard_normal_random(n:INT):VECTOR_2_LIST is
   A list of `n' normally distributed random vectors in the plane
   with mean at the origin and unit variance.

scale_by(s:REAL):VECTOR_2_LIST is
   Scale each vector in `self' by `s' and return it.

translate_by(v:VECTOR_2):VECTOR_2_LIST is
   Translate each vector in `self' by `v' and return it.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

VECTOR_3 is                                                    [class]

   Three-dimensional vectors.


Public definitions of class VECTOR_3: 

x:REAL;
   Components of vector.

y:REAL;
  
   Components of vector.

z:REAL;
  
  
   Components of vector.

create:SELF_TYPE is
   A new `VECTOR_3' initialized to the origin. 

in_vector(v:VECTOR) is
   Put `self' into `v'.

from_vector(v:VECTOR):VECTOR_3 is
   Get `self' from `v' and return it.

create_from_vector(v:VECTOR):VECTOR_3 is
   Undocumented.

to_s:STR is
   A string representation of `self' of the form: "(2.34, 4.56, 3.4)".

create_from_s(s:STR):VECTOR_3 is
   Create a new `VECTOR_3' from a string of the form:
   "(2.34, 4.56, 3.4)". Returns `void' if not of this form (extra white 
   space is ignored).

vector:VECTOR is
   A vector corresponding to `self'. 

plus(v:VECTOR_3):VECTOR_3 is
   The sum of `self' and `v'.

minus(v:VECTOR_3):VECTOR_3 is
   The difference of `self' and `v'.

dot(v:VECTOR_3):REAL is
   The dot product of `self' and `v'.

to(v:VECTOR_3):VECTOR_3 is
   Make `self' be equal to `v' and return it.

scale_by(s:REAL):VECTOR_3 is
   Scale `self' by `s' and return it.

to_sum_with(v:VECTOR_3):VECTOR_3 is
   Make `self' be the sum with `v' and return it.

to_scaled_sum_with(v:VECTOR_3; s:REAL):VECTOR_3 is
   Make `self' be the sum with `s' times `v' and return it.

to_sum_of(v1,v2:VECTOR_3):VECTOR_3 is
   Make `self' be the sum of `v1' and `v2' and return it.

to_difference_of(v1,v2:VECTOR_3):VECTOR_3 is
   Make `self' be `v1-v2' and return it.

to_difference_with(v:VECTOR_3):VECTOR_3 is
   Subtract `v' from `self' and return it.

to_constant(c:REAL):VECTOR_3 is
   Make each component of `self' be `c' and return it.

to_zero:VECTOR_3 is
   Make `self' be the origin and return it.

to_ones:VECTOR_3 is
   Make `self' be all ones and return it.

length:REAL is
   Euclidean length of `self'.

square_length:REAL is
   The square of the Euclidean length of `self'.

normalize:VECTOR_3 is
   If not `0', the scale `self' to length `1' and return it.

is_normalized:BOOL is
   True if `self' is within `epsilon' of being normalized.

distance_to(v:VECTOR_3):REAL is
   The Euclidean distance from `self' to `v'.

square_distance_to(v:VECTOR_3):REAL is
   The square of the Euclidean distance from `self' to `v'.

to_midpoint_with(v:VECTOR_3):VECTOR_3 is
   Make `self' be the midpoint of `self' and `v' and return it.

move_away_from(v:VECTOR_3; d:REAL):VECTOR_3 is
   Move `self' a distance `d' in the direction away from `v' and
   return it.

move_toward(v:VECTOR_3; d:REAL):VECTOR_3 is
   Move `self' a distance `d' in the direction toward `v' and
   return it.

to_interpolate_between(v0,v1:VECTOR_3; t:REAL):VECTOR_3 is
   When `t=0.' make `self=v0', when `t=1.' make `self=v1' and
   return it.

make_orthogonal_to_unit(u:VECTOR_3):VECTOR_3 is
   Subtract off projection onto unit vector `u' from `self' and
   return it.

to_uniform_random:VECTOR_3 is
   Make `self' a uniformly random vector in the unit square and
   return it.

to_normal_random(s:REAL):VECTOR_3 is
   Make `self' be a normal random vector, mean 0, standard deviation
   `s' and return it.

to_unit_random:VECTOR_3 is
   Make `self' be unit vector uniform over the unit circle and
   return it.

to_ball_random:VECTOR_3 is
   Make `self' be uniform in the unit ball and return it.

is_epsilon_equal(v:VECTOR_3):BOOL is
   True if the components of `self' are within `epsilon' of `v'.

reflect:VECTOR_3 is
   Reflect `self' through the origin and return it.

to_cross_product_of(v1,v2:VECTOR_3):VECTOR_3 is
   Set `self' to the cross product of `v1' and `v2' and return it.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

VECTOR_3_LIST is                                               [class]

   Lists of `VECTOR_3', typically used to hold three dimensional curves
   for graphics.


Public definitions of class VECTOR_3_LIST: 

vector_list:VECTOR_LIST is
   Make a `VECTOR_LIST' whose vectors are equal to those in `self'.

create_from_vector_list(vl:VECTOR_LIST):SELF_TYPE is
   Given a `VECTOR_LIST' of two-dimensional vectors, make
   a corresponding `VECTOR_3_LIST'.

to_s:STR is
   A string version of `self' of the form:
   "((1.0, 2.0, 4.5), (3.5, 3.7, 6.8))".

nearest_to(v:VECTOR_3):INT is
   The index of the first closest vector in `self' to `v'.

n_nearest_to(v:VECTOR_3; n:INT):LIST{INT} is
   A list of indices of the `n' closest vectors to `v'.

within_square_distance_of(v:VECTOR_3; sr:REAL):LIST{INT} is
   A list of the indices of the vectors in `self' which are within
   a square distance `sr' of `v'.

create_uniform_random(n:INT):VECTOR_3_LIST is
   A list of `n' uniformly distributed random vectors in the unit
   cube of three-space.

create_standard_normal_random(n:INT):VECTOR_3_LIST is
   A list of `n' normally distributed random vectors in three
   space with mean at the origin and unit variance.

scale_by(s:REAL):VECTOR_3_LIST is
   Scale each vector in `self' by `s' and return it.

translate_by(v:VECTOR_3):VECTOR_3_LIST is
   Translate each vector in `self' by `v' and return it.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

VECTOR_LIST is                                                 [class]

   Lists of vectors.


Public definitions of class VECTOR_LIST: 

Inherits from: LIST

dim:INT is
   The dimension of points in `self'.

to_s:STR is
   A string version of `self' of the form:
   "((1.0, 2.0), (3.5, 3.7))".

sum_in(v:VECTOR) is
   Set `v' to the sum of the vectors in `self'.

mean_in(v:VECTOR) is
   Set `v' to the mean of the vectors in `self'.

nearest_to(v:VECTOR):INT is
   The index of the first closest vector in `self' to `v'.

n_nearest_to(v:VECTOR; n:INT):LIST{INT} is
   A list of indices of the `n' closest vectors to `v'.

within_square_distance_of(v:VECTOR; sr:REAL):LIST{INT} is
   A list of the indices of the vectors in `self' which are within
   a square distance `sr' of `v'.

within_square_distance_of_nearest(v:VECTOR; sr:REAL):LIST{INT} is
   A list of indices of all vectors which are within a square distance
   of `sr' plus the square distance between `v' and the nearest vector
   in `self'.

sort_on_coordinate(c,l,u:INT) is
   Quicksort the nodes between `l' and `u' on the value of
   coordinate `c'.

sorted_on_coordinate(c,l,u:INT):BOOL is
   Test whether `self' is sorted between `l' and `u' on coordinate `c'.

select_on_coordinate(c,k,li,ui:INT) is
   Move elements around between `li' and `ui', so that the `k'th element
   is `>=' those below, `<=' those above, in the coordinate `c'.

selected_on_coordinate(c,k,l,u:INT):BOOL is
   Test whether `c'th comp of `k' is `>=' than below, `<=' those above.

min_in_coordinate(c,l,u:INT):REAL is
   The minimum value of the `c'th coord between `l' and `u'.

max_in_coordinate(c,l,u:INT):REAL is
   The maximum value of the `c'th coord between `l' and `u'.

spread_in_coordinate(c,l,u:INT):REAL is
   The spread in the value of the `c'th coord between `l' and `u'.
   Does it with the minimum possible number of comparisons.

most_spread_coordinate(l,u:INT):INT is
   The index of the most spread out coordinate between `l' and `u'.

create_uniform_random(n,d:INT):VECTOR_LIST is
   A list of `n' uniformly distributed random, `d' dimensional vectors.

create_standard_normal_random(n,d:INT):VECTOR_LIST is
   A list of `n' normal random, `d' dimensional vectors with mean at
   the origin and unit variance.

create_curve_random(n,d:INT):VECTOR_LIST is
   A list of `n' random vectors on a curve in the unit `d'-cube.

create_cantor_random(n,d:INT; s:REAL):VECTOR_LIST is
   A list of `n' random vectors on Cantor set with scaling `s' in
   the unit `d'-cube.

scale_by(s:REAL):VECTOR_LIST is
   Scale each vector in `self' by `s' and return it.

multiply_by_matrix(m:MATRIX):VECTOR_LIST is
   A new vector list whose elements are the vectors in `self'
   acted upon by `m'.

translate_by(v:VECTOR):VECTOR_LIST is
   Translate each vector in `self' by `v' and return it.

covariance_in(c:MATRIX) is
   Put the covariance matrix of the vectors in `self' into `c'.

covariance_diagonal_in(d:VECTOR) is
   Put the diagonal of the covariance matrix of the vectors in
   `self' into `d'.

covariance_trace:REAL is
   The trace of the covariance matrix of the vectors in `self'.

duplicate:VECTOR_LIST is
   A copy of all the vectors in `self'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

VECTOR_LOW_TEST is                                             [class]

   Test of `VECTOR_2', `VECTOR_3', `VECTOR_2_LIST', and `VECTOR_3_LIST'.


Public definitions of class VECTOR_LOW_TEST: 

Inherits from: TEST

main is
   Test of `VECTOR_2', `VECTOR_3', `VECTOR_2_LIST', and `VECTOR_3_LIST'.

vector_2_test is
   Test of `VECTOR_2'.

vector_3_test is
   Test of `VECTOR_3'.

vector_2_list_test is
   Test of `VECTOR_2_LIST'.

vector_3_list_test is
   Test of `VECTOR_3_LIST'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

VECTOR_MAP is                                                  [class]

   A mapping from vectors to vectors. To be inherited.
   Descendents should define `create', `map_in', `in_dim', and `out_dim'.


Public definitions of class VECTOR_MAP: 

map(v:VECTOR):VECTOR is
   The value of the map on `v'. Creates a new vector for output.

map_in(vi,vo:VECTOR) is
   Evaluate the map on `vi' and put the result into `vo'. 
   This is the primitive operation which descendents should define.

map_vector_list(vl:VECTOR_LIST):VECTOR_LIST is
   Apply the mapping in `self' to all vectors in `vl'.

in_dim:INT is
   The dimension of the input space.

out_dim:INT is
   The dimension of the output space.

mse(in,out:VECTOR_LIST):REAL is
   The mean squared error of map on corresponding input/output pairs
   in the lists `in' and `out'.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

VECTOR_MAP_TEST is                                             [class]

   Test of `VECTOR_MAP', `COMPOSITION_VECTOR_MAP{M1,M2}',
   `PRODUCT_VECTOR_MAP{M1,M2}', `SUBSET_VECTOR_MAP', `RANGE_VECTOR_MAP',
   `CONSTANT_VECTOR_MAP', `LEARNED_VECTOR_MAP', `LINEAR_VECTOR_MAP',
   `AFFINE_VECTOR_MAP'.


Public definitions of class VECTOR_MAP_TEST: 

Inherits from: TEST

main is
   Test of `VECTOR_MAP', `COMPOSITION_VECTOR_MAP{M1,M2}',
   `PRODUCT_VECTOR_MAP{M1,M2}', `SUBSET_VECTOR_MAP', `RANGE_VECTOR_MAP',
   `CONSTANT_VECTOR_MAP', `LEARNED_VECTOR_MAP', `LINEAR_VECTOR_MAP',
   `AFFINE_VECTOR_MAP'.

constant_test is
   Test `CONSTANT_VECTOR_MAP'.

range_test is
   Test `RANGE_VECTOR_MAP'.

subset_test is
   Test `SUBSET_VECTOR_MAP'.

composition_test is
   Test of `COMPOSITION_VECTOR_MAP{RANGE_VECTOR_MAP,
   CONSTANT_VECTOR_MAP}'.

product_test is
   Test of `PRODUCT_VECTOR_MAP{RANGE_VECTOR_MAP,
   CONSTANT_VECTOR_MAP}'.

linear_test is
   Test of "LINEAR_VECTOR_MAP".

affine_test is
   Test of "AFFINE_VECTOR_MAP".

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

VECTOR_TEST is                                                 [class]

   Test `VECTOR' and `VECTOR_LIST'.


Public definitions of class VECTOR_TEST: 

Inherits from: TEST

main is
   Test `VECTOR' and `VECTOR_LIST'.

vector_test is
   Test of `VECTOR'.

vector_list_test is
   Test of `VECTOR_LIST'.

n_nearest_test is
   Test `n' nearest neighbor neighbor code.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

