Commit 34b223f7 authored by Fabien Casenave's avatar Fabien Casenave 🚀
Browse files

robustify RBF by always resorting to least squares

parent 001a50b0
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -815,11 +815,7 @@ def Morphing(mesh: UnstructuredMesh, targetDisplacement, targetDisplacementMask,
            M[:,j]=Phi(d/r)
        op=M
        del M
        try:
            ab=np.linalg.solve(op,rhs)
        except np.linalg.LinAlgError:
            #print('Bad conditioning of RBF operator, using least square solution')
            ab=np.linalg.lstsq(op,rhs,cond=10**(9))
        ab=np.linalg.lstsq(op,rhs,rcond=10**(9))[0]
        del op
        alpha=ab
        ds=np.zeros((nb_nodes,mesh.GetDimensionality()))