Table of Contents

Mojo struct

Mat

@memory_only
struct Mat

Fields

  • data (Pointer[Float64, MutUntrackedOrigin])
  • nrows (Int)
  • ncols (Int)
  • row_stride (Int)
  • col_stride (Int)
  • size (Int)
  • owns (Bool)

Implemented traits

AnyType, Copyable, Deinitable, Movable

Methods

__init__

fn def __init__(out self, rows: Int, cols: Int)

Args:

  • rows (Int)
  • cols (Int)
  • self (Self)

Returns:

Self

fn def __init__(out self, data: Pointer[Float64, MutUntrackedOrigin], rows: Int, cols: Int, row_stride: Int, col_stride: Int)

Args:

  • data (Pointer[Float64, MutUntrackedOrigin])
  • rows (Int)
  • cols (Int)
  • row_stride (Int)
  • col_stride (Int)
  • self (Self)

Returns:

Self

fn def __init__(out self, *, copy: Self)

Args:

  • copy (Self)
  • self (Self)

Returns:

Self

__deinit__

fn def __deinit__(deinit self)

Args:

  • self (Self)

__getitem__

fn def __getitem__(self, i: Int, j: Int) -> RealScalar

Args:

  • self (Self)
  • i (Int)
  • j (Int)

Returns:

RealScalar

__setitem__

fn def __setitem__(mut self, i: Int, j: Int, v: Float64)

Args:

  • self (Self)
  • i (Int)
  • j (Int)
  • v (Float64)

rows

fn def rows(self) -> Int

Args:

  • self (Self)

Returns:

Int

cols

fn def cols(self) -> Int

Args:

  • self (Self)

Returns:

Int

block

fn def block(self, i: Int, j: Int, rows: Int, cols: Int) -> Self

Args:

  • self (Self)
  • i (Int)
  • j (Int)
  • rows (Int)
  • cols (Int)

Returns:

Self

col

fn def col(self, j: Int) -> Vec

Args:

  • self (Self)
  • j (Int)

Returns:

Vec

row

fn def row(self, i: Int) -> Vec

Args:

  • self (Self)
  • i (Int)

Returns:

Vec

diagonal

fn def diagonal(self, k: Int = Int(0)) -> Vec

Args:

  • self (Self)
  • k (Int)

Returns:

Vec

copyFrom

fn def copyFrom(self, other: Self)

Args:

  • self (Self)
  • other (Self)

setZero

fn def setZero(self)

Args:

  • self (Self)

cwiseAbsMax

fn def cwiseAbsMax(self) -> RealScalar

Args:

  • self (Self)

Returns:

RealScalar

swap_cols

fn def swap_cols(mut self, a: Int, b: Int)

Args:

  • self (Self)
  • a (Int)
  • b (Int)

zeros

@staticmethod
fn def zeros(rows: Int, cols: Int) -> Self

Args:

  • rows (Int)
  • cols (Int)

Returns:

Self