Skip to content

Commit

Permalink
upgrade optimtool
Browse files Browse the repository at this point in the history
  • Loading branch information
linjing-lab committed Oct 22, 2023
1 parent 04ba290 commit c29e960
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion optimtool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
from ._version import __version__

if sys.version_info < (3, 7, 0):
raise OSError(f'optimtool-2.6.0 requires Python >=3.7, but yours is {sys.version}')
raise OSError(f'optimtool-2.6.1 requires Python >=3.7, but yours is {sys.version}')
2 changes: 1 addition & 1 deletion optimtool/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

__version__ = '2.6.0'
__version__ = '2.6.1'
3 changes: 3 additions & 0 deletions optimtool/example/Lasso.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def gradient(A: NDArray,
:return: final convergenced point and iterative times, (iterative values in a list).
'''
assert delta > 0
assert alp > 0
from .._drive import get_f_delta_gradient
args = a2m(args)
funcs = sp.Matrix([0.5*((A*args - b).T)*(A*args - b)])
Expand Down Expand Up @@ -107,6 +109,7 @@ def subgradient(A: NDArray,
:return: final convergenced point and iterative times, (iterative values in a list).
'''
assert alphak > 0
from .._drive import get_subgradient
args = a2m(args)
funcs = sp.Matrix([0.5*((A*args - b).T)*(A*args - b)])
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from setuptools import setup

if sys.version_info < (3, 7, 0):
raise OSError(f'optimtool-2.6.0 requires Python >=3.7, but yours is {sys.version}')
raise OSError(f'optimtool-2.6.1 requires Python >=3.7, but yours is {sys.version}')

if (3, 7, 0) <= sys.version_info < (3, 8, 0):
# https://github.com/pypa/setuptools/issues/926#issuecomment-294369342
Expand Down
11 changes: 11 additions & 0 deletions test_L_BFGS.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import optimtool.unconstrain as ou
from optimtool.base import sp
x = sp.symbols("x1:5")
f = 100 * (x[1] - x[0]**2)**2 + \
(1 - x[0])**2 + \
100 * (x[3] - x[2]**2)**2 + \
(1 - x[2])**2
x_0 = (-1.2, 1, -1.2, 1)
lbfgs = ou.newton_quasi.L_BFGS
lbfgs(f, x, x_0, verbose=True, draw=False, m=2)
# lbfgs(f, x, x_0, verbose=True, draw=False, m=6)

0 comments on commit c29e960

Please sign in to comment.