How to use the discretize.Tests.getQuadratic function in discretize

To help you get started, we’ve selected a few discretize examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github simpeg / simpeg / tests / base / test_optimizers.py View on Github external
def test_ProjGradient_quadraticBounded(self):
        PG = Optimization.ProjectedGradient(debug=True)
        PG.lower, PG.upper = -2, 2
        xopt = PG.minimize(getQuadratic(self.A,self.b),np.array([0,0]))
        x_true = np.array([2.,2.])
        print('xopt: ', xopt)
        print('x_true: ', x_true)
        self.assertTrue(np.linalg.norm(xopt-x_true,2) < TOL, True)
github simpeg / simpeg / tests / base / test_optimizers.py View on Github external
def test_GN_quadratic(self):
        GN = Optimization.GaussNewton()
        xopt = GN.minimize(getQuadratic(self.A,self.b),np.array([0,0]))
        x_true = np.array([5.,5.])
        print('xopt: ', xopt)
        print('x_true: ', x_true)
        self.assertTrue(np.linalg.norm(xopt-x_true,2) < TOL, True)
github simpeg / simpeg / tests / base / test_optimizers.py View on Github external
def test_ProjGradient_quadratic1Bound(self):
        myB = np.array([-5,1])
        PG = Optimization.ProjectedGradient()
        PG.lower, PG.upper = -2, 2
        xopt = PG.minimize(getQuadratic(self.A,myB),np.array([0,0]))
        x_true = np.array([2.,-1.])
        print('xopt: ', xopt)
        print('x_true: ', x_true)
        self.assertTrue(np.linalg.norm(xopt-x_true,2) < TOL, True)