def __call__(self, vectors): """docstring for __call__""" r = self._call_norm( vectors, self.xi ) r2 = self._function(r) #convert r2 to matrix r2mat = bs.Matrix( bs.make_identity( vectors.length(), self.xi.length() )) count = 0 for x in range(vectors.length()): for y in range(self.xi.length()): r2mat[x][y] = r2[count] count += 1 res = [] for n in range(len(self.nodes)): res.append( r2mat * self.nodes[n] ) return res
def linalg(self, A, di): """docstring for linalg""" #first create matrix! Amat = bs.Matrix( bs.make_identity( self.xi.length(), self.xi.length() )) count = 0 for x in range(self.xi.length()): for y in range(self.xi.length()): Amat[x][y] = A[count] count += 1 #now revert mat AmatInv = Amat.invert() res = [] if isinstance(di[0], list): for d in range( len( di[0] )): #get cols count in di[0] diMat = bs.Matrix( [[di[a][d]] for a in range(len(di))] ) res.append( AmatInv*diMat ) else: diMat = bs.Matrix( [[di[a]] for a in range( len(di))] ) res.append( AmatInv*diMat ) return res