zonopy.batchPolyZonotope#

class zonopy.batchPolyZonotope(Z, n_dep_gens=0, expMat=None, id=None, copy_Z=True, dtype=None, device=None)[source]#

Bases: object

Batched 1D polynomial zonotope

Batched form of the polyZonotope class. This class is used to represent a batch of polynomial zonotopes over the same domain with arbitrary batch dimensions. It follows a similar formulation from the polyZonotope class as the batchZonotope class did from zonotope.

This results in a ZRB1×B2××Bb×(N+M+1)×d\mathbf{Z} \in \mathbb{R}^{B_1 \times B_2 \times \cdots \times B_b \times (N+M+1) \times d} tensor

Refer to the polyZonotope class for more information polynomial zonotops.

__init__(Z, n_dep_gens=0, expMat=None, id=None, copy_Z=True, dtype=None, device=None)[source]#

Constructor for the batchPolyZonotope class

Parameters:
  • Z (torch.Tensor) – The center and generator matrix of the polynomial zonotope. The shape of Z should be (B1,B2,,Bb,N+M+1,d)(B_1, B_2, \cdots, B_b, N+M+1, d) where B1,B2,,BbB_1, B_2, \cdots, B_b are the batch dimensions, NN is the number of dependent generators, MM is the number of independent generators, and dd is the dimension of the zonotope.

  • n_dep_gens (int, optional) – The number of dependent generators in the polynomial zonotope. Default is 0.

  • expMat (torch.Tensor, optional) – The exponent matrix of the dependent generators. If None, it will be the identity matrix. Default: None

  • id (torch.Tensor, optional) – The integer identifiers for the dependent generators. If None, it will be the range of the number of dependent generators. Default: None

  • copy_Z (bool, optional) – If True, it will copy the input Z value. Default: True

  • dtype (torch.dtype, optional) – The data type of the polynomial zonotope. If None, it will be inferred. Default: None

  • device (torch.device, optional) – The device of the polynomial zonotope. If None, it will be inferred. Default: None

Raises:
  • AssertionError – If the dimension of Z input is not 3 or more.

  • AssertionError – If the exponent matrix does not seem to be valid for the given dependent generators or ids.

  • AssertionError – If the number of dependent generators does not match the number of ids.

  • AssertionError – If the exponent matrix is not a non-negative integer matrix.

Methods

__init__(Z[, n_dep_gens, expMat, id, ...])

Constructor for the batchPolyZonotope class

center_slice_all_dep(val_slc)

combine_bpz(bpzlist, idxs)

compress(compression_level)

cpu()

deleteZerosGenerators([eps])

exactCartProd(other)

self: <polyZonotope> other: <polyZonotope> return <polyZonotope>

from_pzlist(pzlist[, batch_shape])

grad_center_slice_all_dep(val_slc)

hess_center_slice_all_dep(val_slc)

ones(batch_size, dims[, dtype, device])

project([dim])

reduce(order[, option])

reduce_indep(order[, option])

slice_all_dep(val_slc)

Slice polynomial zonotpe in depdent generators id_slc: id to slice val_slc: indeterminant to slice c: <torch.Tensor>, shape [b1,b2,...,nx] grad_c: <torch.Tensor>, d c/d val_slc shape [b1,b2,...,nx,n_ids]

slice_dep(id_slc, val_slc)

Slice polynomial zonotpe in depdent generators id_slc: id to dlice val_slc: indeterminant to slice

split_dep_indep([center_on_dep])

to([dtype, itype, device])

to_batchZonotope()

to_interval([method])

zeros(batch_size, dims[, dtype, device])

Attributes

G

Grest

batch_shape

c

device

dimension

dtype

input_pairs

itype

n_generators

n_indep_gens

shape

property G#
property Grest#
property batch_shape#
property c#
center_slice_all_dep(val_slc)[source]#
static combine_bpz(bpzlist, idxs)[source]#
compress(compression_level)[source]#
cpu()[source]#
deleteZerosGenerators(eps=0)[source]#
property device#
property dimension#
property dtype#
exactCartProd(other)[source]#

self: <polyZonotope> other: <polyZonotope> return <polyZonotope>

static from_pzlist(pzlist, batch_shape=None)[source]#
grad_center_slice_all_dep(val_slc)[source]#
hess_center_slice_all_dep(val_slc)[source]#
property input_pairs#
property itype#
property n_generators#
property n_indep_gens#
static ones(batch_size, dims, dtype=None, device=None)[source]#
project(dim=[0, 1])[source]#
reduce(order, option='girard')[source]#
reduce_indep(order, option='girard')[source]#
property shape#
slice_all_dep(val_slc)[source]#

Slice polynomial zonotpe in depdent generators id_slc: id to slice val_slc: indeterminant to slice c: <torch.Tensor>, shape [b1,b2,…,nx] grad_c: <torch.Tensor>, d c/d val_slc shape [b1,b2,…,nx,n_ids]

slice_dep(id_slc, val_slc)[source]#

Slice polynomial zonotpe in depdent generators id_slc: id to dlice val_slc: indeterminant to slice

split_dep_indep(center_on_dep=True)[source]#
to(dtype=None, itype=None, device=None)[source]#
to_batchZonotope()[source]#
to_interval(method='interval')[source]#
static zeros(batch_size, dims, dtype=None, device=None)[source]#