Home · Pages · Index · Overviews

AForm Class Reference

An Array, a Slice, or a Frame. More...

 #include <array.h>

Enumerated Scalars

  Form_Class : { ARRAY_CLASS, SLICE_CLASS, FRAME_CLASS }
 

Descriptive Types

  AForm : union { Array; Slice; Frame }
 
 
  APart : union { Array; Slice }
 

Routines

Form_Class AForm_Class (AForm *form)
boolean Is_Slice (AForm *form)
boolean Is_Frame (AForm *form)
boolean Is_Array (AForm *form)

Array * AForm_Array (AForm *form)
Size_Type AForm_Size (AForm *form)
Array_Kind AForm_Kind (AForm *form)
Coordinate * AForm_ShapeG (AForm *form)

boolean Same_Shape (AForm *a, AForm *b)
boolean Same_Type (AForm *a, AForm *b)

Detailed Description

Arrays, Slices, and Frames are all "array-like" in that they represent an n-dimensional lattice of values of a given type and scale, where the inner or outer dimension may have a special interpretation depending on the objects kind. An AForm represents the union of these three types of objects, and this page describes the routines common to an AForm object.

Most routines in the Mylib library that take an Array as a read-only argument can equally well operate on a Slice or Frame, and indeed most routines in the library will accept an AForm in such cases. Other routines that only modify the elements of the array, but not the shape, type, scale, etc., can equally well take a Slice (but not a Frame as its window may not be withiin its underlying array), and so to distinguish that case, the APart type is the union of an Array and a Slice.

The are routines AForm_Class, Is_Slice, Is_Frame, and Is_Array can all be used to distinguish which type of object an AForm happens to be. Same_Shape and Same_Type determine if two array forms have the same shape and type. The size, kind, and shape of an array form are returned by AForm_Size, AForm_Kind, AForm_Shape. Lastly the underlying array for an array form is returned by AForm_Array. If the array form is an Array then it is returned (as it is its own "underlying array").


Enumerated Scalars Documentation

Form_Class: { ARRAY_CLASS, SLICE_CLASS, FRAME_CLASS }

The three "classes" of objects that an AForm can be.


Routine Documentation

Form_Class AForm_Class (AForm *form)

Returns the Form_Class value that identifies the class form belongs to.

boolean Is_Slice (AForm *form)

Return true if and only if form is a Slice.

boolean Is_Frame (AForm *form)

Return true if and only if form is a Frame.

boolean Is_Array (AForm *form)

Return true if and only if form is an Array.

Array * AForm_Array (AForm *form)

Return a pointer to the underlying array of form. For an array this is the array itself.

Size_Type AForm_Size (AForm *form)

Return the number of elements in the shape of form.

Array_Kind AForm_Kind (AForm *form)

Return the AForm_Class value that identifies which class of object form is.

Coordinate * AForm_ShapeG (AForm *form)

Generate a coordinate that models the shape of the object form. For frames notice that while the coordinate is the same as that returned by Frame_Shape, there is the subtle difference that the later is owned by the Frame whereas the result of this routine is a newly generated Coordinate, i.e. it is equivalent to Copy_Array(Frame_Shape(form)).

boolean Same_Shape (AForm *a, AForm *b)

Return true if and only the shape of a and b are the same.

boolean Same_Type (AForm *a, AForm *b)

Return true if and only the shape and the type of a and b are the same.