OONSTD: Standard Names

E. Robert Tisdale (edwin@maxwell.hrl.hac.com)
Fri, 10 Jul 1998 13:23:05 -0700 (PDT)

Eventually, we must agree upon standard names for classes and functions.
Then, once we have decided the meaning of each standard class and function,
the library developer will be able to provide a reliable interface
to the application programmer. No matter how we choose these names,
no application programmer will ever be totally pleased with them. That's OK.
The application programmer will simply include a header file which uses
typedef to rename the classes and inline functions to rename the functions.

I propose class names which are composed of three parts:

<Type><System><Class>

The third part is the basic class name

<Class> | relation
-------------------------------------------------------------------|--------
Handle SubScalar SubVector SubMatrix SubTensor | base
Vector Matrix Tensor | derived
----------------------------------------------------------------------------

The second part is an empty character string for real number systems
or the character string Complex for complex number systems

<System>| number system
--------|----------------------
| real
Complex | complex
-------------------------------

The first part is a character string which identifies
one of the built-in C types, bool or offset

<Type> |
-------------------------------------------------------------------|---------
long_double double float | floating
signed_long_int signed_int signed_short_int signed_char | integral
unsigned_long_int unsigned_int unsigned_short_int unsigned_char | integral
bool | boolean
offset | Offset
-----------------------------------------------------------------------------

For example:

doubleComplexVector v(n);
floatMatrix M(m, n);
doubleTensor T(l, m, n);
boolVector b(n);

The library developer provides definitions
for integral types Offset, Stride and Length.
An Offset or Length could be an unsigned type
since they can never have negative values
but a Stride must be a signed integral type.

It is probably best to begin with the names of member functions
which access the attributes of scalar, vector, matrix and tensor objects:

SubScalar SubVector SubMatrix SubTensor | return type
-----------------------------------------------------------|------------
handle() handle() handle() handle() | Handle
offset() offset() offset() offset() | Offset
stride() stride1() stride1() | Stride
length() length1() length1() | Length
stride2() stride2() | Stride
length2() length2() | Length
stride3() | Stride
length3() | Length
------------------------------------------------------------------------

After the declaration

doubleMatrix A(m, n);

A.handle() references a 1D array with length m*n
of double precision floating-point numbers.
The actual representation of the 1D array
is determined by the library developer.
A.handle() may contain a pointer to an ordinary 1D C array,
a valarray, or some other representation.

A.offset() returns the location of element A[0][0] within the 1D array
and A.offset() == 0 in this case.

A.stride1() == 1, A.length1() == n, A.stride2() == n and A.length2() == m
so A is stored in "row major order"
if you think m is the number of rows and n is the number of columns.

After the declaration

doubleSubMatrix B = A.t();

where member function t(void) is the "transpose" operator,
B references the same 1D array as A but
B.stride2() == A.stride1(), B.stride1() == A.stride2(),
B.length2() == A.length1() and B.length1() == A.length2()
so B appears to be stored in "column major order". Bob Tisdale