PreviousUpNext

15.3.487  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 Matrix(X);

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

    Traversal = ROW_MAJOR | COLUMN_MAJOR;

    make_matrix: (Int, Int, X) -> Matrix(X);
    from_list:  List( List(X) ) -> Matrix(X);
    from_fn:    Traversal -> (Int, Int, (Int, Int) -> X) -> Matrix(X);
    get:        (Matrix(X), Int, Int) -> X;
    set:        (Matrix(X), Int, Int, X) -> Void;
    dimensions:  Matrix(X) -> (Int, Int);
    columns:     Matrix(X) -> Int;
    rows:        Matrix(X) -> Int;
    row:        (Matrix(X), Int) -> vector::Vector(X);
    column:     (Matrix(X), Int) -> vector::Vector(X);

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

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

    keyed_apply:        Traversal -> ((Int, Int, X) -> Void) -> Region(X) -> Void;
    apply:              Traversal -> (X -> Void) -> Matrix(X) -> Void;

    keyed_map_in_place: Traversal -> ((Int, Int, X) -> X) -> Region(X) -> Void;
    map_in_place:       Traversal -> (X -> X) -> Matrix(X) -> Void;

    foldi:              Traversal -> ((Int, Int, X, Y) -> Y) -> Y -> Region(X) -> Y;
    fold:               Traversal -> ((X, Y) -> Y) -> Y -> Matrix(X) -> Y;

  };



## COPYRIGHT (c) 1997 AT&T Research.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2013,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext