# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/04_polytope_examples.ipynb.

# %% auto 0
__all__ = ['Hypercube', 'Simplex']

# %% ../nbs/04_polytope_examples.ipynb 2
import torch

from .polytope import Polytope, NFDPolytope
from .inner_point import ChebyshevCenter

# %% ../nbs/04_polytope_examples.ipynb 3
class Hypercube(Polytope):
    
    def __init__(self,
                 n:int=None,
                 dtype=torch.float16, 
                 device=None,
                 copy: bool = False, 
                 requires_grad: bool = False) -> None:
        device = 'cpu' if device is None else device
        A_in = torch.cat((torch.eye(n), torch.eye(n) * -1.0), dim=0).to(dtype)
        b_in = torch.ones(2 * n, dtype=dtype).view(-1, 1)        
        super().__init__(A_in, b_in, dtype,device, copy, requires_grad)

# %% ../nbs/04_polytope_examples.ipynb 5
class Simplex(NFDPolytope):
    
    def __init__(self,
                 n:int=None,
                 dtype=torch.float16, 
                 device=None,
                 copy: bool = False, 
                 requires_grad: bool = False) -> None:
        device = 'cpu' if device is None else device
        A_in = torch.eye(n).to(dtype) * -1.0
        b_in = torch.empty(n, 1, dtype=dtype)
        b_in.fill_(0.0)

        # Create Equalities
        A_eq = torch.empty(1, n, dtype=dtype)
        A_eq.fill_(1.0)
        b_eq = torch.empty(1, 1, dtype=dtype)
        b_eq.fill_(1.0) 
             
        super().__init__(A_in, b_in, A_eq, b_eq,dtype, device,copy, requires_grad)
