BB.Math.Covariance6 (bb v0.20.0)

Copy Markdown View Source

A 6x6 covariance matrix, backed by an Nx tensor.

Used to express uncertainty over 6-DOF pose or twist estimates (3 translation + 3 rotation, or 3 linear + 3 angular). The matrix is mathematically expected to be symmetric and positive semi-definite; this module does not enforce those invariants on construction.

Follows the same typed-Nx-wrapper pattern as BB.Math.Covariance3.

Examples

iex> c = BB.Math.Covariance6.diagonal([0.01, 0.01, 0.01, 0.001, 0.001, 0.001])
iex> BB.Math.Covariance6.get(c, 3, 3)
0.001

Summary

Functions

Builds a diagonal covariance from a list of six variances or a {6} tensor.

Wraps an existing {6, 6} tensor. Convenience alias for new/1.

Reads a scalar element at row/column (i, j).

Returns the 6x6 identity matrix as a covariance.

Creates a covariance from a {6, 6} tensor.

Returns the underlying tensor.

Returns the zero covariance.

Types

t()

@type t() :: %BB.Math.Covariance6{tensor: Nx.Tensor.t()}

Functions

diagonal(values)

@spec diagonal([number()] | Nx.Tensor.t()) :: t()

Builds a diagonal covariance from a list of six variances or a {6} tensor.

Examples

iex> c = BB.Math.Covariance6.diagonal([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
iex> BB.Math.Covariance6.get(c, 5, 5)
6.0

from_tensor(tensor)

@spec from_tensor(Nx.Tensor.t()) :: t()

Wraps an existing {6, 6} tensor. Convenience alias for new/1.

get(covariance6, i, j)

@spec get(t(), 0..5, 0..5) :: float()

Reads a scalar element at row/column (i, j).

identity()

@spec identity() :: t()

Returns the 6x6 identity matrix as a covariance.

Examples

iex> c = BB.Math.Covariance6.identity()
iex> {BB.Math.Covariance6.get(c, 0, 0), BB.Math.Covariance6.get(c, 0, 1)}
{1.0, 0.0}

new(tensor)

@spec new(Nx.Tensor.t()) :: t()

Creates a covariance from a {6, 6} tensor.

to_tensor(covariance6)

@spec to_tensor(t()) :: Nx.Tensor.t()

Returns the underlying tensor.

zero()

@spec zero() :: t()

Returns the zero covariance.

Examples

iex> c = BB.Math.Covariance6.zero()
iex> BB.Math.Covariance6.get(c, 0, 0)
0.0