# Path: cmepy/domain.py
# def from_rect(shape, slices=None, origin=None):
# def from_iter(state_iter):
# def from_mapping(state_mapping):
# def to_iter(state_array):


import itertools
import operator
import numpy
from cmepy import domain
        Returns variance of the Distribution d, provided dimension == 1.
        """
        assert self.dimension == 1
        return variance(self)
    
    def covariance(self):
        """
        d.covariance() -> cov
        
        Returns covariance of the distribution d, provided dimension == 2.
        """
        assert self.dimension == 2
        return covariance(self)
    
    def standard_deviation(self):
        """
        d.standard_deviation() -> sigma
        
        Returns std deviation of the Distribution d, provided dimension == 1.
        """
        return numpy.sqrt(self.variance())
    
    def to_dense(self, shape, origin=None):
        """
        Returns dense version of distribution for given array shape and origin
        """
        
        if origin is None:
            origin = (0, )*len(shape)


# Path: cmepy/domain.py
# def from_rect(shape, slices=None, origin=None):
# def from_iter(state_iter):
# def from_mapping(state_mapping):
# def to_iter(state_array):


# Path: cmepy/statistics.py
import itertools
import operator
import numpy
from cmepy import domain

        Returns variance of the Distribution d, provided dimension == 1.
        """
        assert self.dimension == 1
        return variance(self)
    
    def covariance(self):
        """
        d.covariance() -> cov
        
        Returns covariance of the distribution d, provided dimension == 2.
        """
        assert self.dimension == 2
        return covariance(self)
    
    def standard_deviation(self):
        """
        d.standard_deviation() -> sigma
        
        Returns std deviation of the Distribution d, provided dimension == 1.
        """
        return numpy.sqrt(self.variance())
    
    def to_dense(self, shape, origin=None):
        """
        Returns dense version of distribution for given array shape and origin
        """
        
        if origin is None:
            origin = (0, )*len(shape)


        states = set(domain.to_iter(domain.from_rect(shape, origin=origin)))