steepest_descent.py 382 Bytes
Newer Older
1
2
3
4
5
6
# -*- coding: utf-8 -*-

from .quasi_newton_minimizer import QuasiNewtonMinimizer


class SteepestDescent(QuasiNewtonMinimizer):
7
8
    def _get_descend_direction(self, energy):
        descend_direction = energy.gradient
9
10
11
12
13
        norm = descend_direction.norm()
        if norm != 1:
            return descend_direction / -norm
        else:
            return descend_direction * -1