コード例 #1
0
ファイル: rbf.py プロジェクト: anandpratap/speedtmp
def affpoints(xk, D, theta, delta):
    m = len(D)
    n = len(D[0].x)
    Y = [Point(n)]
    Y2 = [xk]
    index = [-1]
    Z = np.matrix(np.identity(n))
    p = int(round(m*random()+0.5))
    if p > 1.0:
        ## indexes check properly
        vec = range(p, m)
        vec.extend(range(0, p-1))
    else:
        vec = range(m)
    if DEBUG:
        print vec
    
    for i in vec:
        if np.linalg.norm(D[i].x - xk.x) <= delta:
            Z = np.matrix(Z)
            proj_z = Z*np.linalg.inv(Z.transpose()*Z)*Z.transpose()*np.matrix(D[i].x-xk.x).transpose()
            if np.linalg.norm(proj_z) >= delta*theta:
                point = Point(n)
                point.x = D[i].x - xk.x
                Y.append(point) 
                Y_matrix = array([])
                for j in range(len(Y)):
                    Y_matrix = np.concatenate((Y_matrix, Y[j].x), 1)
                Z = null(Y_matrix)
                Y2.append(D[i])
                index.append(i)
                print "here"
    if len(Y) == n + 1:
        linear = True
    else:
        linear = False
    return Y2, linear, Z, index
コード例 #2
0
	def _run(self, command) :
		utils.run(
			command%self.__dict__,
			message = None if self._verbose else "",
			log = utils.null(),
			)
コード例 #3
0
	def x(self, command) :
		return utils.run(
			command%self.defs,
			message="" if _quiet else None,
			log = utils.null(),
			)
コード例 #4
0
 def x(self, command):
     return utils.run(
         command % self.defs,
         message="" if _quiet else None,
         log=utils.null(),
     )