Changeset 436 for inundation/ga/storm_surge/pyvolution/least_squares.py
- Timestamp:
- Oct 21, 2004, 5:54:28 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/least_squares.py
r428 r436 25 25 from LinearAlgebra import solve_linear_equations 26 26 from scipy import sparse 27 from cg_solve import conjugate_gradient 27 from cg_solve import conjugate_gradient, VectorShapeError 28 28 29 29 try: … … 130 130 alpha = alpha) 131 131 132 vertex_attributes = interp.fit (point_attributes)132 vertex_attributes = interp.fit_points(point_attributes) 133 133 return vertex_attributes 134 134 … … 212 212 #Build n x m interpolation matrix 213 213 m = self.mesh.coordinates.shape[0] #Nbr of basis functions (1/vertex) 214 n = point_coordinates.shape[0] #Nbr of data points 215 214 n = point_coordinates.shape[0] #Nbr of data points 215 216 216 #self.A = zeros((n,m), Float) 217 217 self.A = sparse.dok_matrix() … … 394 394 #FIXME: Should we store the result here for later use? (ON) 395 395 396 396 def fit_points(self, z): 397 """ 398 Like fit, but more robust when each point has two or more attributes 399 """ 400 try: 401 return self.fit(z) 402 except VectorShapeError, e: 403 # broadcasting is not supported. 404 405 #Convert input to Numeric arrays 406 z = array(z).astype(Float) 407 408 #Build n x m interpolation matrix 409 m = self.mesh.coordinates.shape[0] #Number of vertices 410 n = z.shape[1] #Number of data points 411 412 f = zeros((m,n), Float) 413 #f = sparse.dok_matrix() # even though it wont be sparse? 414 415 for i in range(z.shape[1]): 416 f[:,i] = self.fit(z[:,i]) 417 return f 418 419 397 420 def interpolate(self, f): 398 421 """Compute predicted values at data points implied in self.A.
Note: See TracChangeset
for help on using the changeset viewer.