# Last edited on 2021-08-01 20:36:43 by jstolfi import rn def basis_sampled_residuals_compute(F, C, w): # Assumes {F} is a list of vectors of some size {ns}. # Assumes {C} is a list of orthonormal vectors of the same size. # Projects each element {F[i]} onto the space {}, # # Returns the list {R} such that {R[i]} is the residual vectors # of that projection. R = [] for Fi in F: Ri = Fi.copy() for Cj in C: c = rn.wdot(Ri, Cj, w) Ri = rn.mix(1, Ri, -c, Cj); R.append(Ri) return R # ----------------------------------------------------------------------