def __init__(self,attrNames,lea1): ''' each value of lea1 is a tuple having same cardinality as attrNames ''' self._attrNames = attrNames self._buildClass() Flea.__init__(self,self._class,lea1)
def _genVPs(self, nTimes=None): if nTimes is None: nTimes = self._nTimes lea1 = self._lea1.getAleaClone() if nTimes == 1: return lea1.genVPs() # nTimes >= 2 : use dichotomic algorithm nTimes1 = nTimes // 2 tlea = Tlea(self._op, lea1, nTimes1) alea = tlea.getAlea() # alea = tlea flea = Flea.build(self._op, (alea, alea.clone())) if nTimes % 2 == 1: # nTimes is odd : nTimes = 2*nTimes1 + 1 # operate with one more lea1 on the current result flea = Flea.build(self._op, (flea, self._lea1)) return flea.genVPs()