zonopy.batchPolyZonotope#
- class zonopy.batchPolyZonotope(Z, n_dep_gens=0, expMat=None, id=None, copy_Z=True, dtype=None, device=None)[source]#
Bases:
objectBatched 1D polynomial zonotope
Batched form of the
polyZonotopeclass. 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 thepolyZonotopeclass as thebatchZonotopeclass did fromzonotope.This results in a tensor
Refer to the
polyZonotopeclass 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 where are the batch dimensions, is the number of dependent generators, is the number of independent generators, and 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: Noneid (torch.Tensor, optional) – The integer identifiers for the dependent generators. If
None, it will be the range of the number of dependent generators. Default: Nonecopy_Z (bool, optional) – If
True, it will copy the inputZvalue. Default:Truedtype (torch.dtype, optional) – The data type of the polynomial zonotope. If
None, it will be inferred. Default:Nonedevice (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_interval([method])zeros(batch_size, dims[, dtype, device])Attributes
- property G#
- property Grest#
- property batch_shape#
- property c#
- property device#
- property dimension#
- property dtype#
- property input_pairs#
- property itype#
- property n_generators#
- property n_indep_gens#
- 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]