API Reference

dhllinalg.bla

Basic linear algebra module

class dhllinalg.bla.Vector
__add__(self: dhllinalg.bla.Vector, other: dhllinalg.bla.Vector) dhllinalg.bla.Vector

Vector addition

__getitem__(self: dhllinalg.bla.Vector, index: int) float

Get value of item with index “index”

__init__(self: dhllinalg.bla.Vector, size: int) None

Create vector of length “size”

__len__(self: dhllinalg.bla.Vector) int

Return length of vector

__mul__(self: dhllinalg.bla.Vector, other: dhllinalg.bla.Vector) float

Vector product

__rmul__(self: dhllinalg.bla.Vector, scal: float) dhllinalg.bla.Vector

Vector scaling

__setitem__(*args, **kwargs)

Overloaded function.

  1. __setitem__(self: dhllinalg.bla.Vector, index: int, value: float) -> None

Set value of item with index “index”

  1. __setitem__(self: dhllinalg.bla.Vector, indices: slice, value: float) -> None

Set value of items with index in “indices”

__str__(self: dhllinalg.bla.Vector) str

Print vector elements.

class dhllinalg.bla.Matrix
I(self: dhllinalg.bla.Matrix) dhllinalg.bla.Matrix

Matrix inverse.

T(self: dhllinalg.bla.Matrix) dhllinalg.bla.Matrix

Matrix transpose.

__add__(self: dhllinalg.bla.Matrix, other: dhllinalg.bla.Matrix) dhllinalg.bla.Matrix

Matrix addition

__getitem__(*args, **kwargs)

Overloaded function.

  1. __getitem__(self: dhllinalg.bla.Matrix, index: Tuple[int, int]) -> float

Get value of item with index “index”

  1. __getitem__(self: dhllinalg.bla.Matrix, indices: Tuple[int, slice]) -> dhllinalg.bla.Vector

Get values of items with index in “indices”

  1. __getitem__(self: dhllinalg.bla.Matrix, indices: Tuple[slice, int]) -> dhllinalg.bla.Vector

Get values of items with index in “indices”

  1. __getitem__(self: dhllinalg.bla.Matrix, indices: Tuple[slice, slice]) -> dhllinalg.bla.Matrix

Get values of items with index in “indices”

__init__(self: dhllinalg.bla.Matrix, rows: int, cols: int) None

Create matrix of “rows” rows and “cols” columns.

__mul__(*args, **kwargs)

Overloaded function.

  1. __mul__(self: dhllinalg.bla.Matrix, scal: float) -> dhllinalg.bla.Matrix

Matrix scaling

  1. __mul__(self: dhllinalg.bla.Matrix, other: dhllinalg.bla.Matrix) -> dhllinalg.bla.Matrix

Matrix multipliaction (deprecated, use InnerProduct instead)

  1. __mul__(self: dhllinalg.bla.Matrix, vec: dhllinalg.bla.Vector) -> dhllinalg.bla.Vector

Matrix vector multipliaction

__rmul__(*args, **kwargs)

Overloaded function.

  1. __rmul__(self: dhllinalg.bla.Matrix, scal: float) -> dhllinalg.bla.Matrix

Matrix scaling

  1. __rmul__(self: dhllinalg.bla.Matrix, vec: dhllinalg.bla.Vector) -> dhllinalg.bla.Vector

Matrix vector multipliaction

__setitem__(*args, **kwargs)

Overloaded function.

  1. __setitem__(self: dhllinalg.bla.Matrix, index: Tuple[int, int], value: float) -> None

Set value of item with index “index” to “value”

  1. __setitem__(self: dhllinalg.bla.Matrix, indices: Tuple[int, slice], value: float) -> None

Set value of items with index “indices” to “value”

  1. __setitem__(self: dhllinalg.bla.Matrix, indices: Tuple[slice, int], value: float) -> None

Set value of items with index “indices” to “value”

  1. __setitem__(self: dhllinalg.bla.Matrix, indices: Tuple[slice, slice], value: float) -> None

Set value of items with index “indices” to “value”

__str__(self: dhllinalg.bla.Matrix) str

Print matrix elements.

property ncols

Get number of columns.

property nrows

Get number of rows.

property shape

Get matrix shape as tuple[rows, cols].

class dhllinalg.bla.ParallelComputing
__enter__(self: dhllinalg.bla.ParallelComputing) None

Start parallel computing (multithreading).

__exit__(self: dhllinalg.bla.ParallelComputing, arg0: object, arg1: object, arg2: object) None

Stop parallel computing (multithreading).

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: dhllinalg.bla.ParallelComputing) -> None

Set number of threads to hardware concurrency.

  1. __init__(self: dhllinalg.bla.ParallelComputing, nThreads: int) -> None

Set number of threads to “nThreads”.

  1. __init__(self: dhllinalg.bla.ParallelComputing, Trace: bool) -> None

Set number of threads to hardware concurrency and prepare to write trace file.

  1. __init__(self: dhllinalg.bla.ParallelComputing, nThreads: int, Trace: bool) -> None

Set number of threads to “nThreads” and prepare to write trace file.

dhllinalg.bla.InnerProduct(u: bla::Matrix<double, (bla::ORDERING)1>, v: bla::Matrix<double, (bla::ORDERING)1>) bla::Matrix<double, (bla::ORDERING)1>

Matrix multiplication of u and v.

dhllinalg.bla.NumThreads() int

Get number of threads in use