PreviousUpNext

15.3.480  src/lib/std/src/matrix.api

## matrix.api
#
# Two-dimensional matrices.

# Compiled by:
#     src/lib/std/src/standard-core.sublib



###                   "If you go on with this nuclear arms race, all
###                    you are going to do is make the rubble bounce."
###
###                                     -- Winston Churchill


# This api is immplemented in:
#
#     src/lib/std/src/matrix.pkg
#
api Matrix {
    #
    eqtype Array(X);

    Region(X)
        =
        {   base:  Array(X),
            row:  Int,
            col:  Int,
            nrows:  Null_Or( Int ),
            ncols:  Null_Or( Int )
          };

    Traversal = ROW_MAJOR | COLUMN_MAJOR;

    array:      (Int, Int, X) -> Array(X);
    from_list:  List( List(X) ) -> Array(X);
    tabulate:   Traversal -> (Int, Int, (Int, Int) -> X) -> Array(X);
    get:        (Array(X), Int, Int) -> X;
    set:        (Array(X), Int, Int, X) -> Void;
    dimensions:  Array(X) -> (Int, Int);
    columns:     Array(X) -> Int;
    rows:        Array(X) -> Int;
    row:        (Array(X), Int) -> vector::Vector(X);
    column:     (Array(X), Int) -> vector::Vector(X);

    copy:
         { src:  Region(X),
           dst:  Array(X),

           dst_row:  Int,
           dst_col:  Int
         }
         ->
         Void;

    keyed_apply:  Traversal -> ((Int, Int, X) -> Void) -> Region(X) -> Void;
    apply:        Traversal -> (X -> Void) -> Array(X) -> Void;
    modifyi:      Traversal -> ((Int, Int, X) -> X) -> Region(X) -> Void;
    modify:       Traversal -> (X -> X) -> Array(X) -> Void;
    foldi:        Traversal -> ((Int, Int, X, Y) -> Y) -> Y -> Region(X) -> Y;
    fold:         Traversal -> ((X, Y) -> Y) -> Y -> Array(X) -> Y;

  };



## COPYRIGHT (c) 1997 AT&T Research.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2012,
## released under Gnu Public Licence version 3.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext