Esempio n. 1
0
 def __init__(self, mu, covar=None, icovar=None):
     self.mu = mu
     self.ndim = len(mu)
     if covar is None and icovar is None:  # unit covar if unspecified
         covar = diag(ones(self.ndim))
     if covar != None:
         if icovar != None:
             raise ValueError('Specify only one of covar/icovar!')
         self.covar = covar
         ccopy, self.L, self.norm, err = _mvnt.mvnini(covar, 0)
     else:
         self.icovar = icovar
         self.covar, self.L, self.norm, err = _mvnt.mvnini(covar, 1)
     if err != 0: raise RuntimeError('Linear algebra failure in MVN init!')
     self.work = zeros(self.ndim, float)  # workspace for density calc'n
Esempio n. 2
0
 def __init__(self, mu, covar=None, icovar=None):
     self.mu = mu
     self.ndim = len(mu)
     if covar is None and icovar is None:  # unit covar if unspecified
         covar = diag(ones(self.ndim))
     if covar != None:
         if icovar != None:
             raise ValueError, 'Specify only one of covar/icovar!'
         self.covar = covar
         ccopy, self.L, self.norm, err = _mvnt.mvnini(covar, 0)
     else:
         self.icovar = icovar
         self.covar, self.L, self.norm, err = _mvnt.mvnini(covar, 1)
     if err != 0: raise RuntimeError, 'Linear algebra failure in MVN init!'
     self.work = zeros(self.ndim, float)  # workspace for density calc'n
Esempio n. 3
0
 def __init__(self, nodes, scale, covar=None, icovar=None):
     if covar is None and icovar is None:
         raise ValueError('Must specify covar or icovar!')
     self.nodes = nodes.copy()
     self.tnodes = nodes.transpose().copy()
     self.nnodes, self.ndim = nodes.shape
     self.scale = scale
     if covar != None:
         if icovar != None:
             raise ValueError('Specify only one of covar/icovar!')
         self.covar = covar
         ccopy, self.L, self.norm, err = _mvnt.mvnini(covar, 0)
     else:
         self.icovar = icovar
         self.covar, self.L, self.norm, err = _mvnt.mvnini(covar, 1)
     if err != 0: raise RuntimeError('Linear algebra failure in MVN init!')
     self.work = zeros(self.ndim, float)  # workspace for density calc'n
     self.origin = zeros(self.ndim, float)
     self.randint = randint(0, self.nnodes)
Esempio n. 4
0
 def __init__(self, nodes, scale, covar=None, icovar=None):
     if covar is None and icovar is None:
         raise ValueError, 'Must specify covar or icovar!'
     self.nodes = nodes.copy()
     self.tnodes = nodes.transpose().copy()
     self.nnodes, self.ndim = nodes.shape
     self.scale = scale
     if covar != None:
         if icovar != None:
             raise ValueError, 'Specify only one of covar/icovar!'
         self.covar = covar
         ccopy, self.L, self.norm, err = _mvnt.mvnini(covar, 0)
     else:
         self.icovar = icovar
         self.covar, self.L, self.norm, err = _mvnt.mvnini(covar, 1)
     if err != 0: raise RuntimeError, 'Linear algebra failure in MVN init!'
     self.work = zeros(self.ndim, float)  # workspace for density calc'n
     self.origin = zeros(self.ndim, float)
     self.randint = randint(0, self.nnodes)