Skip to content

Commit 8e995dc

Browse files
committed
Added the lbfgs library the hard way (which should atleast be compatible with
pip).
1 parent 1f1669f commit 8e995dc

23 files changed

+5216
-0
lines changed

liblbfgs/AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Naoaki Okazaki <okazaki at chokkan org>

liblbfgs/COPYING

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License
2+
3+
Copyright (c) 1990 Jorge Nocedal
4+
Copyright (c) 2007-2010 Naoaki Okazaki
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a
7+
copy of this software and associated documentation files (the "Software"),
8+
to deal in the Software without restriction, including without limitation
9+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
10+
and/or sell copies of the Software, and to permit persons to whom the
11+
Software is furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.

liblbfgs/ChangeLog

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
2010-xx-xx Naoaki Okazaki <okazaki at chokkan org>
2+
3+
* libLBFGS 1.10:
4+
- Fixed compiling errors on Mac OS X; this patch was kindly submitted by Nic Schraudolph.
5+
- Reduced compiling warnings on Mac OS X; this patch was kindly submitted by Tamas Nepusz.
6+
7+
8+
2010-01-29 Naoaki Okazaki <okazaki at chokkan org>
9+
10+
* libLBFGS 1.9:
11+
- Fixed a mistake in checking the validity of the parameters "ftol" and "wolfe"; this mistake was discovered by Kevin S. Van Horn.
12+
13+
14+
2009-07-13 Naoaki Okazaki <okazaki at chokkan org>
15+
16+
* libLBFGS 1.8:
17+
- Accepted the patch submitted by Takashi Imamichi; the backtracking method now has three criteria for choosing the step length.
18+
- Updated the documentation to explain the above three criteria.
19+
20+
21+
2009-02-28 Naoaki Okazaki <okazaki at chokkan org>
22+
23+
* libLBFGS 1.7:
24+
- Improved OWL-QN routines for stability.
25+
- Removed the support of OWL-QN method in MoreThuente algorithm
26+
because it accidentally fails in early stages of iterations for some
27+
objectives. Because of this change, the OW-LQN method must be used
28+
with the backtracking algorithm (LBFGS_LINESEARCH_BACKTRACKING), or
29+
the library returns LBFGSERR_INVALID_LINESEARCH.
30+
- Renamed line search algorithms as follows:
31+
- LBFGS_LINESEARCH_BACKTRACKING: regular Wolfe condition.
32+
- LBFGS_LINESEARCH_BACKTRACKING_LOOSE: regular Wolfe condition.
33+
- LBFGS_LINESEARCH_BACKTRACKING_STRONG: strong Wolfe condition.
34+
- Source code clean-up.
35+
36+
37+
2008-11-02 Naoaki Okazaki <okazaki at chokkan org>
38+
39+
* libLBFGS 1.6:
40+
- Improved line-search algorithm with strong Wolfe condition, which
41+
was contributed by Takashi Imamichi. This routine is now default for
42+
LBFGS_LINESEARCH_BACKTRACKING. The previous line search algorithm
43+
with regular Wolfe condition is still available as
44+
LBFGS_LINESEARCH_BACKTRACKING_LOOSE.
45+
- Configurable stop index for L1-norm computation. A member variable
46+
lbfgs_parameter_t::orthantwise_end was added to specify the index
47+
number at which the library stops computing the L1 norm of the
48+
variables. This is useful to prevent some variables from being
49+
regularized by the OW-LQN method.
50+
- A sample program written in C++ (sample/sample.cpp).
51+
52+
53+
2008-07-10 Naoaki Okazaki <okazaki at chokkan org>
54+
55+
* libLBFGS 1.5:
56+
- Configurable starting index for L1-norm computation. A member
57+
variable lbfgs_parameter_t::orthantwise_start was added to specify
58+
the index number from which the library computes the L1 norm of the
59+
variables.
60+
- Fixed a zero-division error when the initial variables have already
61+
been a minimizer (reported by Takashi Imamichi). In this case, the
62+
library returns LBFGS_ALREADY_MINIMIZED status code.
63+
- Defined LBFGS_SUCCESS status code as zero; removed unused constants,
64+
LBFGSFALSE and LBFGSTRUE.
65+
- Fixed a compile error in an implicit down-cast.
66+
67+
68+
2008-04-25 Naoaki Okazaki <okazaki at chokkan org>
69+
70+
* libLBFGS 1.4:
71+
- Configurable line search algorithms. A member variable
72+
lbfgs_parameter_t::linesearch was added to choose either MoreThuente
73+
method (LBFGS_LINESEARCH_MORETHUENTE) or backtracking algorithm
74+
(LBFGS_LINESEARCH_BACKTRACKING).
75+
- Fixed a bug: the previous version did not compute psuedo-gradients
76+
properly in the line search routines for OW-LQN. This bug might quit
77+
an iteration process too early when the OW-LQN routine was activated
78+
(0 < lbfgs_parameter_t::orthantwise_c).
79+
- Configure script for POSIX environments.
80+
- SSE/SSE2 optimizations with GCC.
81+
- New functions lbfgs_malloc and lbfgs_free to use SSE/SSE2 routines
82+
transparently. It is uncessary to use these functions for libLBFGS
83+
built without SSE/SSE2 routines; you can still use any memory
84+
allocators if SSE/SSE2 routines are disabled in libLBFGS.
85+
86+
87+
2007-12-16 Naoaki Okazaki <okazaki at chokkan org>
88+
89+
* libLBFGS 1.3:
90+
- An API change. An argument was added to lbfgs() function to receive
91+
the final value of the objective function. This argument can be set
92+
to NULL if the final value is unnecessary.
93+
- Fixed a null-pointer bug in the sample code (reported by Takashi
94+
Imamichi).
95+
- Added build scripts for Microsoft Visual Studio 2005 and GCC.
96+
- Added README file.
97+
98+
99+
2007-12-13 Naoaki Okazaki <okazaki at chokkan org>
100+
101+
* libLBFGS 1.2:
102+
- Fixed a serious bug in orthant-wise L-BFGS. An important variable
103+
was used without initialization.
104+
- Configurable L-BFGS parameters (number of limited memories, epsilon).
105+
106+
107+
2007-12-01 Naoaki Okazaki <okazaki at chokkan org>
108+
109+
* libLBFGS 1.1:
110+
- Implemented orthant-wise L-BFGS.
111+
- Implemented lbfgs_parameter_init() function.
112+
- Fixed several bugs.
113+
- API documentation.
114+
115+
116+
2007-09-20 Naoaki Okazaki <okazaki at chokkan org>
117+
118+
* libLBFGS 1.0
119+
- Initial release.
120+

liblbfgs/Makefile.am

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# $Id$
2+
3+
SUBDIRS = lib sample
4+
5+
docdir = $(prefix)/share/doc/@PACKAGE@
6+
doc_DATA = README INSTALL COPYING AUTHORS ChangeLog NEWS
7+
8+
EXTRA_DIST = \
9+
autogen.sh \
10+
lbfgs.sln

liblbfgs/NEWS

Whitespace-only changes.

liblbfgs/README

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
2+
libLBFGS: C library of limited-memory BFGS (L-BFGS)
3+
4+
Copyright (c) 1990, Jorge Nocedal
5+
Copyright (c) 2007-2010, Naoaki Okazaki
6+
7+
=========================================================================
8+
1. Introduction
9+
=========================================================================
10+
libLBFGS is a C port of the implementation of Limited-memory
11+
Broyden-Fletcher-Goldfarb-Shanno (L-BFGS) method written by Jorge Nocedal.
12+
The original FORTRAN source code is available at:
13+
http://www.ece.northwestern.edu/~nocedal/lbfgs.html
14+
15+
The L-BFGS method solves the unconstrainted minimization problem:
16+
minimize F(x), x = (x1, x2, ..., xN),
17+
only if the objective function F(x) and its gradient G(x) are computable.
18+
19+
Refer to the libLBFGS web site for more information.
20+
http://www.chokkan.org/software/liblbfgs/
21+
22+
23+
24+
=========================================================================
25+
2. How to build
26+
=========================================================================
27+
[Microsoft Visual Studio 2008]
28+
Open the solution file "lbfgs.sln" and build it.
29+
30+
[GCC]
31+
$ ./configure
32+
$ make
33+
$ make install # To install libLBFGS library and header.
34+
35+
36+
37+
=========================================================================
38+
3. Note on SSE/SSE2 optimization
39+
=========================================================================
40+
This library has SSE/SSE2 optimization routines for vector arithmetic
41+
operations on Intel/AMD processors. The SSE2 routine is for 64 bit double
42+
values, and the SSE routine is for 32 bit float values. Since the default
43+
parameters in libLBFGS are tuned for double precision values, it may need
44+
to modify these parameters to use the SSE optimization routines.
45+
46+
To use the SSE2 optimization routine, specify --enable-sse2 option to the
47+
configure script.
48+
49+
$ ./configure --enable-sse2
50+
51+
To build libLBFGS with SSE2 optimization enabled on Microsoft Visual
52+
Studio 2005, define USE_SSE and __SSE2__ symbols.
53+
54+
Make sure to run libLBFGS on processors where SSE2 instrunctions are
55+
available. The library does not check the existence of SSE2 instructions.
56+
57+
To package maintainers,
58+
59+
Please do not enable SSE/SSE2 optimization routine. The library built
60+
with SSE/SSE2 optimization will crash without any notice when necessary
61+
SSE/SSE2 instructions are unavailable on CPUs.
62+
63+
64+
65+
=========================================================================
66+
4. License
67+
=========================================================================
68+
libLBFGS is distributed under the term of the MIT license.
69+
Please refer to COPYING file in the distribution.
70+
71+
$Id$

liblbfgs/autogen.sh

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/sh
2+
# $Id$
3+
4+
if [ "$1" = "--force" ];
5+
then
6+
FORCE=--force
7+
NOFORCE=
8+
FORCE_MISSING=--force-missing
9+
else
10+
FORCE=
11+
NOFORCE=--no-force
12+
FORCE_MISSING=
13+
fi
14+
15+
libtoolize --copy $FORCE 2>&1 | sed '/^You should/d' || {
16+
echo "libtoolize failed!"
17+
exit 1
18+
}
19+
20+
aclocal $FORCE || {
21+
echo "aclocal failed!"
22+
exit 1
23+
}
24+
25+
autoheader $FORCE || {
26+
echo "autoheader failed!"
27+
exit 1
28+
}
29+
30+
automake -a -c $NOFORCE || {
31+
echo "automake failed!"
32+
exit 1
33+
}
34+
35+
autoconf $FORCE || {
36+
echo "autoconf failed!"
37+
exit 1
38+
}

liblbfgs/configure.in

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
dnl $Id$
2+
dnl
3+
dnl
4+
dnl Exported and configured variables:
5+
dnl CFLAGS
6+
dnl LDFLAGS
7+
dnl INCLUDES
8+
9+
10+
dnl ------------------------------------------------------------------
11+
dnl Initialization for autoconf
12+
dnl ------------------------------------------------------------------
13+
AC_PREREQ(2.59)
14+
AC_INIT
15+
AC_CONFIG_SRCDIR([lib/lbfgs.c])
16+
17+
18+
dnl ------------------------------------------------------------------
19+
dnl Initialization for automake
20+
dnl ------------------------------------------------------------------
21+
AM_INIT_AUTOMAKE(liblbfgs, 1.10)
22+
AC_CONFIG_HEADERS(config.h)
23+
AM_MAINTAINER_MODE
24+
25+
26+
dnl ------------------------------------------------------------------
27+
dnl Checks for program
28+
dnl ------------------------------------------------------------------
29+
AC_PROG_LIBTOOL
30+
AC_PROG_INSTALL
31+
AC_PROG_LN_S
32+
AC_PROG_MAKE_SET
33+
34+
35+
dnl ------------------------------------------------------------------
36+
dnl Initialization for variables
37+
dnl ------------------------------------------------------------------
38+
CFLAGS="${ac_save_CFLAGS} -Wall"
39+
LDFLAGS="${ac_save_LDFLAGS}"
40+
INCLUDES="-I\$(top_srcdir) -I\$(top_srcdir)/include"
41+
42+
43+
44+
dnl ------------------------------------------------------------------
45+
dnl Checks for header files.
46+
dnl ------------------------------------------------------------------
47+
AC_HEADER_STDC
48+
AC_CHECK_HEADERS(xmmintrin.h emmintrin.h)
49+
50+
51+
52+
dnl ------------------------------------------------------------------
53+
dnl Checks for debugging mode
54+
dnl ------------------------------------------------------------------
55+
AC_ARG_ENABLE(
56+
debug,
57+
[AS_HELP_STRING(
58+
[--enable-debug],
59+
[build for debugging]
60+
)],
61+
[CFLAGS="-DDEBUG -O -g ${CFLAGS}"],
62+
[CFLAGS="-O3 -ffast-math ${CFLAGS}"]
63+
)
64+
65+
dnl ------------------------------------------------------------------
66+
dnl Checks for profiling mode
67+
dnl ------------------------------------------------------------------
68+
AC_ARG_ENABLE(
69+
profile,
70+
[AS_HELP_STRING(
71+
[--enable-profile],
72+
[build for profiling]
73+
)],
74+
[CFLAGS="-DPROFILE -pg ${CFLAGS}"]
75+
)
76+
77+
dnl ------------------------------------------------------------------
78+
dnl Checks for SSE2 build
79+
dnl ------------------------------------------------------------------
80+
AC_ARG_ENABLE(
81+
sse2,
82+
[AS_HELP_STRING(
83+
[--enable-sse2],
84+
[enable SSE2 optimization routines]
85+
)],
86+
[CFLAGS="-msse2 -DUSE_SSE ${CFLAGS}"]
87+
)
88+
89+
dnl ------------------------------------------------------------------
90+
dnl Checks for library functions.
91+
dnl ------------------------------------------------------------------
92+
AC_CHECK_LIB(m, fabs)
93+
94+
95+
96+
dnl ------------------------------------------------------------------
97+
dnl Export variables
98+
dnl ------------------------------------------------------------------
99+
AC_SUBST(CFLAGS)
100+
AC_SUBST(LDFLAGS)
101+
AC_SUBST(INCLUDES)
102+
103+
dnl ------------------------------------------------------------------
104+
dnl Output the configure results.
105+
dnl ------------------------------------------------------------------
106+
AC_CONFIG_FILES(Makefile lib/Makefile sample/Makefile)
107+
AC_OUTPUT

0 commit comments

Comments
 (0)