Matrix

public class Matrix

Matrix of Double values

  • Number of rows in Matrix.

    Declaration

    Swift

    public var rows: Int
  • Number of columns in Matrix.

    Declaration

    Swift

    public var cols: Int
  • Create new Matrix by copying existing.

    Declaration

    Swift

    public init(_ M: Matrix)
  • Create 1-column Matrix (transposed Vector)

    Declaration

    Swift

    public init(_ v: Vector)
  • Create Matrix from array of Vectors (two-dimensional array)

    Declaration

    Swift

    public init(_ data: [Vector])
  • Get M(row, column) element of Matrix.

    Declaration

    Swift

    public subscript(_ row: Int, _ col: Int ) -> Double

    Parameters

    row

    row position of element (0-based)

    col

    col position of element (0-based)

  • Get M(index) element of row-major represented Matrix.

    Declaration

    Swift

    public subscript(_ index: Int) -> Double

    Parameters

    index

    index of element (0-based, 0 <= index < M.rows * M.cols)

  • Get M(row) row of Matrix.

    Declaration

    Swift

    public subscript(row row: Int) -> Vector

    Parameters

    row

    row index (0-based)

  • Get M(col) column of Matrix.

    Declaration

    Swift

    public subscript(col col: Int) -> Vector

    Parameters

    col

    column index (0-based)

  • Construct new matrix from source using specified extractor.

    Alternatively, m[e] can be executed with m ?? e or slice(m, e)

    Declaration

    Swift

    public subscript(_ e: (er: Extractor, ec: Extractor)) -> Matrix

    Return Value

    extracted matrix

  • Iterate through matrix by rows

    Declaration

    Swift

    public func makeIterator() -> MatrixIterator
  • Declaration

    Swift

    public var description: String