ATSLIB/libats/ML/matrix0

The functions declared in this package are primarily for supporting ML-style processing of persistent matrices. Note that a plain matrix (as is in C) is not available in languages such as Java and ML due to the need for performing matrix-bounds checking at run-time. Instead, matrices in these languages are always bundled together with their dimensions. In ATS, the type matrix0(T) is for a matrix paired with its dimension in which elements of the type T are stored.
  • matrix0
  • matrix0_vt0ype_type
  • matrix0_of_mtrxszref
  • mtrxszref_of_matrix0
  • matrix0_get_nrow
  • matrix0_get_ncol
  • matrix0_make_elt
  • matrix0_get_at
  • matrix0_get_at_int
  • matrix0_set_at
  • matrix0_set_at_int
  • matrix0_tabulate
  • matrix0_foreach
  • matrix0_iforeach
  • matrix0_foldleft
  • matrix0_ifoldleft
  • Overloaded Symbols
  • []
  • .nrow
  • .ncol
  • fprint

  • matrix0

    Synopsis

    stadef matrix0 = matrix0_vt0ype_type

    matrix0_vt0ype_type

    Synopsis

    abstype
    matrix0_vt0ype_type
      (a: vt@ype(*invariant*)) = ptr

    matrix0_of_mtrxszref

    Synopsis

    fun{}
    matrix0_of_mtrxszref
      {a:vt0p}(mtrxszref(a)):<> matrix0(a)

    mtrxszref_of_matrix0

    Synopsis

    fun{}
    mtrxszref_of_matrix0
      {a:vt0p}(M: matrix0(a)):<> mtrxszref(a)

    matrix0_get_nrow

    Synopsis

    fun{}
    matrix0_get_nrow{a:vt0p}(M: matrix0 a):<> size_t

    Description

    This function returns the number of rows of the matrix associated with a given matrix0-value.

    matrix0_get_ncol

    Synopsis

    fun{}
    matrix0_get_ncol{a:vt0p}(M: matrix0 a):<> size_t

    Description

    This function returns the number of columns of the matrix associated with a given matrix0-value.

    matrix0_make_elt

    Synopsis

    overload matrix0_make_elt with matrix0_make_elt_int
    overload matrix0_make_elt with matrix0_make_elt_size

    Description

    This function creates a matrix0-value of a given dimension in which each matrix-cell is initialized with a given value (3rd argument).

    matrix0_get_at

    Synopsis

    overload matrix0_get_at with matrix0_get_at_int
    overload matrix0_get_at with matrix0_get_at_size

    matrix0_get_at_int

    Synopsis

    fun{a:t0p}
    matrix0_get_at_int
      (M: matrix0(a), i: int, j: int):<!exnref> a

    Description

    Given an matrix0-value M of dimension m by n and two indices i and j, this function returns M[i,j] if i and j are valid (that is, 0 <= i < m and 0 <= j < n), or it raises the exception MatrixSubscriptExn.

    matrix0_set_at

    Synopsis

    overload matrix0_set_at with matrix0_set_at_int
    overload matrix0_set_at with matrix0_set_at_size

    matrix0_set_at_int

    Synopsis

    fun{a:t0p}
    matrix0_set_at_int
      (M: matrix0(a), i: int, j: int, x: a):<!exnrefwrt> void

    Description

    Given an matrix0-value M of dimension m by n, two indicies i and j, and a value x, this function assigns x to M[i,j] if i and j are valid (that is, 0 <= i < m and 0 <= j < n), or it raises the exception MatrixSubscriptExn.

    matrix0_tabulate

    Synopsis

    fun
    {a:vt0p}
    matrix0_tabulate
      {m,n:int}
    ( nrow: size_t(m)
    , ncol: size_t(n)
    , fopr: cfun(sizeLt(m), sizeLt(n), a)
    ) : matrix0(a) // end of [matrix0_tabulate]

    Description

    Given sizes nrow and ncol and a function f, this function returns a matrix0-value M of dimension nrow by ncol such that each M[i,j] is initialized with the value returned by f(i,j), where i ranges from 0 until nrow-1, inclusive, and j from 0 until ncol-1, inclusive.

    matrix0_foreach

    Synopsis

    fun
    {a:vt0p}
    matrix0_foreach
    (
    M : matrix0(a), fwork: (&a >> _) -<cloref1> void
    ) : void // end of [matrix0_foreach]

    Description

    Given a matrix0-value M and a closure-function f, matrix0_foreach applies f to each matrix-cell contained in M.

    matrix0_iforeach

    Synopsis

    fun
    {a:vt0p}
    matrix0_iforeach
    (
    M : matrix0(a), fwork: (size_t, size_t, &a >> _) -<cloref1> void
    ) : void // end of [matrix0_iforeach]

    Description

    Given a matrix0-value M of dimension m by n and a closure-function f, matrix0_iforeach applies f to i, j and the matrix-cell (i, j), where i ranges from 0 to m-1, inclusive, and j from 0 to n-1, inclusive.

    matrix0_foldleft

    Synopsis

    fun{
    res:vt0p}{a:vt0p
    } matrix0_foldleft
    (
      M: matrix0(a), ini: res, fopr: (res, &a) -<cloref1> res
    ) : res // end of [matrix0_foldleft]

    matrix0_ifoldleft

    Synopsis

    fun{
    res:vt0p}{a:vt0p
    } matrix0_ifoldleft
    (
      M: matrix0(a), ini: res, fopr: (res, size_t, size_t, &a) -<cloref1> res
    ) : res // end of [matrix0_ifoldleft]

    Overloaded Symbols


    []

    Synopsis

    overload [] with matrix0_get_at_int of 0
    overload [] with matrix0_set_at_int of 0
    overload [] with matrix0_get_at_size of 0
    overload [] with matrix0_set_at_size of 0

    .nrow

    Synopsis

    overload .nrow with matrix0_get_nrow

    .ncol

    Synopsis

    overload .ncol with matrix0_get_ncol

    fprint

    Synopsis

    overload fprint with fprint_matrix0
    overload fprint with fprint_matrix0_sep

    This page is created with ATS by Hongwei Xi and also maintained by Hongwei Xi. SourceForge.net Logo