Table of Contents

Mojo struct

Vec

@memory_only
struct Vec

Fields

  • data (Pointer[Float64, MutUntrackedOrigin])
  • n (Int)
  • stride (Int)
  • owns (Bool)

Implemented traits

AnyType, Deinitable, Movable, Sized

Methods

__init__

fn def __init__(out self, n: Int)

Args:

  • n (Int)
  • self (Self)

Returns:

Self

fn def __init__(out self, data: Pointer[Float64, MutUntrackedOrigin], n: Int, stride: Int)

Args:

  • data (Pointer[Float64, MutUntrackedOrigin])
  • n (Int)
  • stride (Int)
  • self (Self)

Returns:

Self

__deinit__

fn def __deinit__(deinit self)

Args:

  • self (Self)

__getitem__

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

Args:

  • self (Self)
  • i (Int)

Returns:

RealScalar

__setitem__

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

Args:

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

__len__

fn def __len__(self) -> Int

Args:

  • self (Self)

Returns:

Int

segment

fn def segment(self, start: Int, length: Int) -> Self

Args:

  • self (Self)
  • start (Int)
  • length (Int)

Returns:

Self

fn def head(self, length: Int) -> Self

Args:

  • self (Self)
  • length (Int)

Returns:

Self

tail

fn def tail(self, length: Int) -> Self

Args:

  • self (Self)
  • length (Int)

Returns:

Self

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

norm

fn def norm(self) -> RealScalar

Args:

  • self (Self)

Returns:

RealScalar

reverseInPlace

fn def reverseInPlace(mut self)

Args:

  • self (Self)

stableNormalize

fn def stableNormalize(mut self)

Args:

  • self (Self)

Unit

@staticmethod
fn def Unit(n: Int, k: Int) -> Self

Args:

  • n (Int)
  • k (Int)

Returns:

Self