Commit a9446199 authored by Emmanuel Bertin's avatar Emmanuel Bertin
Browse files

Fixed model-fitting issue with empty images in dual-image mode (thanks to V....

Fixed model-fitting issue with empty images in dual-image mode (thanks to V. de Lapparent for reporting).
Updated LevMar to version 2.5.
Updated URLs in various places.
Pushed version number to 2.12.1.
parent 78801391
...@@ -9,9 +9,10 @@ input image is a MEF. ...@@ -9,9 +9,10 @@ input image is a MEF.
configuration files like default.param are still needed, though. configuration files like default.param are still needed, though.
The SExtractor homepage is The SExtractor homepage is
http://terapix.iap.fr/soft/sextractor http://astromatic.net/software/sextractor
In case of problems, questions or suggestions related to the software, please In case of problems, questions or suggestions related to the software, please
refer to the TERAPIX forum: refer to the SExtractor forum:
http://terapix.iap.fr/forum/ http://astromatic.net/forum/forumdisplay.php?fid=4
Emmanuel Bertin. Emmanuel Bertin.
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.63 for sextractor 2.12.0. # Generated by GNU Autoconf 2.63 for sextractor 2.12.1.
# #
# Report bugs to <bertin@iap.fr>. # Report bugs to <bertin@iap.fr>.
# #
...@@ -750,8 +750,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} ...@@ -750,8 +750,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package. # Identity of this package.
PACKAGE_NAME='sextractor' PACKAGE_NAME='sextractor'
PACKAGE_TARNAME='sextractor' PACKAGE_TARNAME='sextractor'
PACKAGE_VERSION='2.12.0' PACKAGE_VERSION='2.12.1'
PACKAGE_STRING='sextractor 2.12.0' PACKAGE_STRING='sextractor 2.12.1'
PACKAGE_BUGREPORT='bertin@iap.fr' PACKAGE_BUGREPORT='bertin@iap.fr'
   
ac_unique_file="src/makeit.c" ac_unique_file="src/makeit.c"
...@@ -1508,7 +1508,7 @@ if test "$ac_init_help" = "long"; then ...@@ -1508,7 +1508,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures sextractor 2.12.0 to adapt to many kinds of systems. \`configure' configures sextractor 2.12.1 to adapt to many kinds of systems.
   
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
   
...@@ -1578,7 +1578,7 @@ fi ...@@ -1578,7 +1578,7 @@ fi
   
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of sextractor 2.12.0:";; short | recursive ) echo "Configuration of sextractor 2.12.1:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
   
...@@ -1711,7 +1711,7 @@ fi ...@@ -1711,7 +1711,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
sextractor configure 2.12.0 sextractor configure 2.12.1
generated by GNU Autoconf 2.63 generated by GNU Autoconf 2.63
   
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
...@@ -1725,7 +1725,7 @@ cat >config.log <<_ACEOF ...@@ -1725,7 +1725,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
   
It was created by sextractor $as_me 2.12.0, which was It was created by sextractor $as_me 2.12.1, which was
generated by GNU Autoconf 2.63. Invocation command line was generated by GNU Autoconf 2.63. Invocation command line was
   
$ $0 $@ $ $0 $@
...@@ -2428,7 +2428,7 @@ fi ...@@ -2428,7 +2428,7 @@ fi
   
# Define the identity of the package. # Define the identity of the package.
PACKAGE='sextractor' PACKAGE='sextractor'
VERSION='2.12.0' VERSION='2.12.1'
   
   
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
...@@ -28593,7 +28593,7 @@ exec 6>&1 ...@@ -28593,7 +28593,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by sextractor $as_me 2.12.0, which was This file was extended by sextractor $as_me 2.12.1, which was
generated by GNU Autoconf 2.63. Invocation command line was generated by GNU Autoconf 2.63. Invocation command line was
   
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
...@@ -28656,7 +28656,7 @@ Report bugs to <bug-autoconf@gnu.org>." ...@@ -28656,7 +28656,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\ ac_cs_version="\\
sextractor config.status 2.12.0 sextractor config.status 2.12.1
configured by $0, generated by GNU Autoconf 2.63, configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
   
......
...@@ -6,7 +6,7 @@ define([AC_CACHE_LOAD],) ...@@ -6,7 +6,7 @@ define([AC_CACHE_LOAD],)
define([AC_CACHE_SAVE],) define([AC_CACHE_SAVE],)
# This is your standard Bertin source code... # This is your standard Bertin source code...
AC_INIT(sextractor, 2.12.0, [bertin@iap.fr]) AC_INIT(sextractor, 2.12.1, [bertin@iap.fr])
AC_CONFIG_SRCDIR(src/makeit.c) AC_CONFIG_SRCDIR(src/makeit.c)
AC_CONFIG_AUX_DIR(autoconf) AC_CONFIG_AUX_DIR(autoconf)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
......
.TH SEXTRACTOR "1" "August 2010" "SWarp 2.12.0" "User Commands" .TH SEXTRACTOR "1" "August 2010" "SWarp 2.12.1" "User Commands"
.SH NAME .SH NAME
sex \- extract a source catalog from an astronomical FITS image sex \- extract a source catalog from an astronomical FITS image
.SH SYNOPSIS .SH SYNOPSIS
...@@ -18,7 +18,7 @@ SExtractor is a program that builds a catalogue of objects from an astronomical ...@@ -18,7 +18,7 @@ SExtractor is a program that builds a catalogue of objects from an astronomical
image. Although it is particularly oriented towards reduction of large scale image. Although it is particularly oriented towards reduction of large scale
galaxy-survey data, it performs rather well on moderately crowded star fields. galaxy-survey data, it performs rather well on moderately crowded star fields.
.RE .RE
See http://terapix.iap.fr/soft/sextractor for more details. See http://astromatic.net/software/sextractor for more details.
.SS "Operation modes:" .SS "Operation modes:"
.TP .TP
\fB\-h\fR, \fB\-\-help\fR \fB\-h\fR, \fB\-\-help\fR
...@@ -43,5 +43,5 @@ Report bugs to <sextractor@iap.fr>. ...@@ -43,5 +43,5 @@ Report bugs to <sextractor@iap.fr>.
.PP .PP
The full documentation for The full documentation for
.B SExtractor .B SExtractor
is maintained as a Postscript manual available at is maintained as a PDF manual available at
.B http://terapix.iap.fr/soft/sextractor .B http://astromatic.net/software/sextractor
...@@ -18,7 +18,7 @@ SExtractor is a program that builds a catalogue of objects from an astronomical ...@@ -18,7 +18,7 @@ SExtractor is a program that builds a catalogue of objects from an astronomical
image. Although it is particularly oriented towards reduction of large scale image. Although it is particularly oriented towards reduction of large scale
galaxy-survey data, it performs rather well on moderately crowded star fields. galaxy-survey data, it performs rather well on moderately crowded star fields.
.RE .RE
See http://terapix.iap.fr/soft/sextractor for more details. See http://astromatic.net/software/sextractor for more details.
.SS "Operation modes:" .SS "Operation modes:"
.TP .TP
\fB\-h\fR, \fB\-\-help\fR \fB\-h\fR, \fB\-\-help\fR
...@@ -43,5 +43,5 @@ Report bugs to <sextractor@iap.fr>. ...@@ -43,5 +43,5 @@ Report bugs to <sextractor@iap.fr>.
.PP .PP
The full documentation for The full documentation for
.B SExtractor .B SExtractor
is maintained as a Postscript manual available at is maintained as a PDF manual available at
.B http://terapix.iap.fr/soft/sextractor .B http://astromatic.net/software/sextractor
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#define MYVERSION VERSION #define MYVERSION VERSION
#endif #endif
#define COPYRIGHT "Emmanuel BERTIN <bertin@iap.fr>" #define COPYRIGHT "Emmanuel BERTIN <bertin@iap.fr>"
#define WEBSITE "http://astromatic.iap.fr/software/sextractor/" #define WEBSITE "http://astromatic.net/software/sextractor/"
#define INSTITUTE "IAP http://www.iap.fr" #define INSTITUTE "IAP http://www.iap.fr"
/*----------------------------- Physical constants --------------------------*/ /*----------------------------- Physical constants --------------------------*/
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include "lm.h" #include "levmar.h"
#include "misc.h" #include "misc.h"
#if !defined(LM_DBL_PREC) && !defined(LM_SNGL_PREC) #if !defined(LM_DBL_PREC) && !defined(LM_SNGL_PREC)
......
This diff is collapsed.
...@@ -5,8 +5,8 @@ PROJECT(LEVMAR) ...@@ -5,8 +5,8 @@ PROJECT(LEVMAR)
#CMAKE_MINIMUM_REQUIRED(VERSION 1.4) #CMAKE_MINIMUM_REQUIRED(VERSION 1.4)
# compiler flags # compiler flags
ADD_DEFINITIONS(-DLINSOLVERS_RETAIN_MEMORY) # do not free memory between linear solvers calls #ADD_DEFINITIONS(-DLINSOLVERS_RETAIN_MEMORY) # do not free memory between linear solvers calls
#REMOVE_DEFINITIONS(-DLINSOLVERS_RETAIN_MEMORY) #REMOVE_DEFINITIONS(-DLINSOLVERS_RETAIN_MEMORY) # free memory between calls
# f2c is sometimes equivalent to libF77 & libI77; in that case, set HAVE_F2C to 0 # f2c is sometimes equivalent to libF77 & libI77; in that case, set HAVE_F2C to 0
SET(HAVE_F2C 1 CACHE BOOL "Do we have f2c or F77/I77?" ) SET(HAVE_F2C 1 CACHE BOOL "Do we have f2c or F77/I77?" )
...@@ -26,17 +26,19 @@ ENDIF(HAVE_F2C) ...@@ -26,17 +26,19 @@ ENDIF(HAVE_F2C)
########################## NO CHANGES BEYOND THIS POINT ########################## ########################## NO CHANGES BEYOND THIS POINT ##########################
INCLUDE_DIRECTORIES(.)
#INCLUDE_DIRECTORIES(/usr/include) #INCLUDE_DIRECTORIES(/usr/include)
LINK_DIRECTORIES(${LAPACKBLAS_DIR})
# levmar library source files # levmar library source files
ADD_LIBRARY(levmar STATIC ADD_LIBRARY(levmar STATIC
lm.c Axb.c misc.c lmlec.c lmbc.c lmblec.c lm.c Axb.c misc.c lmlec.c lmbc.c lmblec.c lmbleic.c
lm.h misc.h compiler.h levmar.h misc.h compiler.h
) )
# demo program # demo program
ADD_EXECUTABLE(lmdemo lmdemo.c lm.h) LINK_DIRECTORIES(${LAPACKBLAS_DIR})
LINK_DIRECTORIES(.)
ADD_EXECUTABLE(lmdemo lmdemo.c levmar.h)
# libraries the demo depends on # libraries the demo depends on
IF(HAVE_F2C) IF(HAVE_F2C)
TARGET_LINK_LIBRARIES(lmdemo levmar ${LAPACK_LIB} ${BLAS_LIB} ${F2C_LIB}) TARGET_LINK_LIBRARIES(lmdemo levmar ${LAPACK_LIB} ${BLAS_LIB} ${F2C_LIB})
......
# Makefile.am for the levmar Levenberg-Marquardt fitting library # Makefile.am for the levmar Levenberg-Marquardt fitting library
# Copyright (C) 2008 Emmanuel Bertin. # Copyright (C) 2007-2010 Emmanuel Bertin.
# levmar code by Manolis Lourakis <lourakis@ics.forth.gr> # levmar code by Manolis Lourakis <lourakis@ics.forth.gr>
# http://www.ics.forth.gr/~lourakis/levmar/ # http://www.ics.forth.gr/~lourakis/levmar/
noinst_LIBRARIES = liblevmar.a noinst_LIBRARIES = liblevmar.a
liblevmar_a_SOURCES = Axb.c lmbc.c lm.c lmblec.c lmlec.c misc.c \ liblevmar_a_SOURCES = Axb.c lmbc.c lm.c lmblec.c lmbleic.c lmlec.c misc.c \
compiler.h lm.h misc.h compiler.h levmar.h misc.h
EXTRA_liblevmar_a_SOURCES = Axb_core.c lmbc_core.c lm_core.c \ EXTRA_liblevmar_a_SOURCES = Axb_core.c lmbc_core.c lm_core.c \
lmblec_core.c lmlec_core.c misc_core.c \ lmblec_core.c lmbleic_core.c lmlec_core.c \
LICENSE README README.txt lmdemo.c misc_core.c \
LICENSE README README.txt \
Makefile.icc Makefile.vc levmar.vcproj lmdemo.vcproj \
expfit.c lmdemo.c lm.h matlab
...@@ -11,8 +11,8 @@ ARCHFLAGS=-march=pentium4 -mcpu=pentium4 ...@@ -11,8 +11,8 @@ ARCHFLAGS=-march=pentium4 -mcpu=pentium4
CFLAGS=$(CONFIGFLAGS) $(ARCHFLAGS) -O3 -tpp7 -xW -ip -ipo -unroll #-g CFLAGS=$(CONFIGFLAGS) $(ARCHFLAGS) -O3 -tpp7 -xW -ip -ipo -unroll #-g
LAPACKLIBS_PATH=/usr/local/lib # WHEN USING LAPACK, CHANGE THIS TO WHERE YOUR COMPILED LIBS ARE! LAPACKLIBS_PATH=/usr/local/lib # WHEN USING LAPACK, CHANGE THIS TO WHERE YOUR COMPILED LIBS ARE!
LDFLAGS=-L$(LAPACKLIBS_PATH) -L. LDFLAGS=-L$(LAPACKLIBS_PATH) -L.
LIBOBJS=lm.o Axb.o misc.o lmlec.o lmbc.o lmblec.o LIBOBJS=lm.o Axb.o misc.o lmlec.o lmbc.o lmblec.o lmbleic.o
LIBSRCS=lm.c Axb.c misc.c lmlec.c lmbc.c lmblec.c LIBSRCS=lm.c Axb.c misc.c lmlec.c lmbc.c lmblec.c lmbleic.c
DEMOBJS=lmdemo.o DEMOBJS=lmdemo.o
DEMOSRCS=lmdemo.c DEMOSRCS=lmdemo.c
AR=xiar AR=xiar
...@@ -24,6 +24,9 @@ LAPACKLIBS=-llapack -lblas -lf2c # comment this line if you are not using LAPACK ...@@ -24,6 +24,9 @@ LAPACKLIBS=-llapack -lblas -lf2c # comment this line if you are not using LAPACK
# The following works with the ATLAS updated lapack and Linux_P4SSE2 from http://www.netlib.org/atlas/archives/linux/ # The following works with the ATLAS updated lapack and Linux_P4SSE2 from http://www.netlib.org/atlas/archives/linux/
#LAPACKLIBS=-L/usr/local/atlas/lib -llapack -lcblas -lf77blas -latlas -lf2c #LAPACKLIBS=-L/usr/local/atlas/lib -llapack -lcblas -lf77blas -latlas -lf2c
#LAPACKLIBS=-llapack -lgoto2 -lpthread -lf2c # This works with GotoBLAS
# from http://www.tacc.utexas.edu/research-development/tacc-projects/
LIBS=$(LAPACKLIBS) LIBS=$(LAPACKLIBS)
all: liblevmar.a lmdemo all: liblevmar.a lmdemo
...@@ -35,14 +38,15 @@ liblevmar.a: $(LIBOBJS) ...@@ -35,14 +38,15 @@ liblevmar.a: $(LIBOBJS)
lmdemo: $(DEMOBJS) liblevmar.a lmdemo: $(DEMOBJS) liblevmar.a
$(CC) $(ARCHFLAGS) $(LDFLAGS) $(DEMOBJS) -o lmdemo -llevmar $(LIBS) -lm $(CC) $(ARCHFLAGS) $(LDFLAGS) $(DEMOBJS) -o lmdemo -llevmar $(LIBS) -lm
lm.o: lm.c lm_core.c lm.h misc.h compiler.h lm.o: lm.c lm_core.c levmar.h misc.h compiler.h
Axb.o: Axb.c Axb_core.c lm.h misc.h Axb.o: Axb.c Axb_core.c levmar.h misc.h
misc.o: misc.c misc_core.c lm.h misc.h misc.o: misc.c misc_core.c levmar.h misc.h
lmlec.o: lmlec.c lmlec_core.c lm.h misc.h lmlec.o: lmlec.c lmlec_core.c levmar.h misc.h
lmbc.o: lmbc.c lmbc_core.c lm.h misc.h compiler.h lmbc.o: lmbc.c lmbc_core.c levmar.h misc.h compiler.h
lmblec.o: lmblec.c lmblec_core.c lm.h misc.h lmblec.o: lmblec.c lmblec_core.c levmar.h misc.h
lmbleic.o: lmbleic.c lmbleic_core.c levmar.h misc.h
lmdemo.o: lm.h lmdemo.o: levmar.h
clean: clean:
@rm -f $(LIBOBJS) $(DEMOBJS) @rm -f $(LIBOBJS) $(DEMOBJS)
......
...@@ -50,7 +50,8 @@ ARFLAGS = cru ...@@ -50,7 +50,8 @@ ARFLAGS = cru
liblevmar_a_AR = $(AR) $(ARFLAGS) liblevmar_a_AR = $(AR) $(ARFLAGS)
liblevmar_a_LIBADD = liblevmar_a_LIBADD =
am_liblevmar_a_OBJECTS = Axb.$(OBJEXT) lmbc.$(OBJEXT) lm.$(OBJEXT) \ am_liblevmar_a_OBJECTS = Axb.$(OBJEXT) lmbc.$(OBJEXT) lm.$(OBJEXT) \
lmblec.$(OBJEXT) lmlec.$(OBJEXT) misc.$(OBJEXT) lmblec.$(OBJEXT) lmbleic.$(OBJEXT) lmlec.$(OBJEXT) \
misc.$(OBJEXT)
liblevmar_a_OBJECTS = $(am_liblevmar_a_OBJECTS) liblevmar_a_OBJECTS = $(am_liblevmar_a_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp
...@@ -195,16 +196,19 @@ top_builddir = @top_builddir@ ...@@ -195,16 +196,19 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
# Makefile.am for the levmar Levenberg-Marquardt fitting library # Makefile.am for the levmar Levenberg-Marquardt fitting library
# Copyright (C) 2008 Emmanuel Bertin. # Copyright (C) 2007-2010 Emmanuel Bertin.
# levmar code by Manolis Lourakis <lourakis@ics.forth.gr> # levmar code by Manolis Lourakis <lourakis@ics.forth.gr>
# http://www.ics.forth.gr/~lourakis/levmar/ # http://www.ics.forth.gr/~lourakis/levmar/
noinst_LIBRARIES = liblevmar.a noinst_LIBRARIES = liblevmar.a
liblevmar_a_SOURCES = Axb.c lmbc.c lm.c lmblec.c lmlec.c misc.c \ liblevmar_a_SOURCES = Axb.c lmbc.c lm.c lmblec.c lmbleic.c lmlec.c misc.c \
compiler.h lm.h misc.h compiler.h levmar.h misc.h
EXTRA_liblevmar_a_SOURCES = Axb_core.c lmbc_core.c lm_core.c \ EXTRA_liblevmar_a_SOURCES = Axb_core.c lmbc_core.c lm_core.c \
lmblec_core.c lmlec_core.c misc_core.c \ lmblec_core.c lmbleic_core.c lmlec_core.c \
LICENSE README README.txt lmdemo.c misc_core.c \
LICENSE README README.txt \
Makefile.icc Makefile.vc levmar.vcproj lmdemo.vcproj \
expfit.c lmdemo.c lm.h matlab
all: all-am all: all-am
...@@ -255,12 +259,15 @@ distclean-compile: ...@@ -255,12 +259,15 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Axb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Axb.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Axb_core.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Axb_core.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/expfit.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lm.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lm_core.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lm_core.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmbc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmbc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmbc_core.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmbc_core.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmblec.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmblec.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmblec_core.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmblec_core.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmbleic.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmbleic_core.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmdemo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmdemo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmlec.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmlec.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmlec_core.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lmlec_core.Po@am__quote@
......
...@@ -21,8 +21,8 @@ CONFIGFLAGS=#/ULINSOLVERS_RETAIN_MEMORY ...@@ -21,8 +21,8 @@ CONFIGFLAGS=#/ULINSOLVERS_RETAIN_MEMORY
CFLAGS=$(CONFIGFLAGS) /I. /MD /W3 /EHsc /O2 $(SPOPTFLAGS) # /Wall CFLAGS=$(CONFIGFLAGS) /I. /MD /W3 /EHsc /O2 $(SPOPTFLAGS) # /Wall
LAPACKLIBS_PATH=C:\src\lib # WHEN USING LAPACK, CHANGE THIS TO WHERE YOUR COMPILED LIBS ARE! LAPACKLIBS_PATH=C:\src\lib # WHEN USING LAPACK, CHANGE THIS TO WHERE YOUR COMPILED LIBS ARE!
LDFLAGS=/link /subsystem:console /opt:ref /libpath:$(LAPACKLIBS_PATH) /libpath:. LDFLAGS=/link /subsystem:console /opt:ref /libpath:$(LAPACKLIBS_PATH) /libpath:.
LIBOBJS=lm.obj Axb.obj misc.obj lmlec.obj lmbc.obj lmblec.obj LIBOBJS=lm.obj Axb.obj misc.obj lmlec.obj lmbc.obj lmblec.obj lmbleic.obj
LIBSRCS=lm.c Axb.c misc.c lmlec.c lmbc.c lmblec.c LIBSRCS=lm.c Axb.c misc.c lmlec.c lmbc.c lmblec.c lmbleic.c
DEMOBJS=lmdemo.obj DEMOBJS=lmdemo.obj
DEMOSRCS=lmdemo.c DEMOSRCS=lmdemo.c
AR=lib /nologo AR=lib /nologo
...@@ -40,14 +40,15 @@ levmar.lib: $(LIBOBJS) ...@@ -40,14 +40,15 @@ levmar.lib: $(LIBOBJS)
lmdemo.exe: $(DEMOBJS) levmar.lib lmdemo.exe: $(DEMOBJS) levmar.lib
$(CC) $(DEMOBJS) $(LDFLAGS) /out:lmdemo.exe $(LIBS) $(CC) $(DEMOBJS) $(LDFLAGS) /out:lmdemo.exe $(LIBS)
lm.obj: lm.c lm_core.c lm.h misc.h compiler.h lm.obj: lm.c lm_core.c levmar.h misc.h compiler.h
Axb.obj: Axb.c Axb_core.c lm.h misc.h Axb.obj: Axb.c Axb_core.c levmar.h misc.h
misc.obj: misc.c misc_core.c lm.h misc.h misc.obj: misc.c misc_core.c levmar.h misc.h
lmlec.obj: lmlec.c lmlec_core.c lm.h misc.h lmlec.obj: lmlec.c lmlec_core.c levmar.h misc.h
lmbc.obj: lmbc.c lmbc_core.c lm.h misc.h compiler.h lmbc.obj: lmbc.c lmbc_core.c levmar.h misc.h compiler.h
lmblec.obj: lmblec.c lmblec_core.c lm.h misc.h lmblec.obj: lmblec.c lmblec_core.c levmar.h misc.h
lmbleic.obj: lmbleic.c lmbleic_core.c levmar.h misc.h
lmdemo.obj: lm.h lmdemo.obj: levmar.h
clean: clean:
-del $(LIBOBJS) $(DEMOBJS) -del $(LIBOBJS) $(DEMOBJS)
......
The levmar v2.4 library has been included in this package untouched, except for The levmar v2.5 library has been included in this package untouched, except for
three warnings removed, LU decomposition replaced with calls to ATLAS-Lapack three warnings removed, LU decomposition replaced with calls to ATLAS-Lapack
routines, Hessian matrix inversion done with SVD, and an AutoMakefile added. routines, Hessian matrix inversion done with SVD, and an AutoMakefile added.
Emmanuel Bertin <bertin@iap.fr> Emmanuel Bertin <bertin@iap.fr>
************************************************************** **************************************************************
LEVMAR LEVMAR
version 2.4 version 2.5
By Manolis Lourakis By Manolis Lourakis
Institute of Computer Science Institute of Computer Science
...@@ -12,15 +12,15 @@ ...@@ -12,15 +12,15 @@
GENERAL GENERAL
This is levmar, a copylefted C/C++ implementation of the Levenberg-Marquardt non-linear This is levmar, a copylefted C/C++ implementation of the Levenberg-Marquardt non-linear
least squares algorithm. levmar includes double and single precision LM versions, both least squares algorithm. levmar includes double and single precision LM versions, both
with analytic and finite difference approximated jacobians. levmar also has some support with analytic and finite difference approximated Jacobians. levmar also has some support
for constrained non-linear least squares, allowing linear equation and box constraints. for constrained non-linear least squares, allowing linear equation, box and linear
You have the following options regarding the solution of the underlying augmented normal inequality constraints. The following options regarding the solution of the underlying
equations: augmented normal equations are offered:
1) Assuming that you have LAPACK (or an equivalent vendor library such as ESSL, MKL, 1) Assuming that you have LAPACK (or an equivalent vendor library such as ESSL, MKL,
NAG, ...) installed, you can use the included LAPACK-based solvers (default). NAG, ...) installed, you can use the included LAPACK-based solvers (default).
2) If you don't have LAPACK or decide not to use it, undefine HAVE_LAPACK in lm.h 2) If you don't have LAPACK or decide not to use it, undefine HAVE_LAPACK in levmar.h
and a LAPACK-free, LU-based linear systems solver will by used. Also, the line and a LAPACK-free, LU-based linear systems solver will by used. Also, the line
setting the variable LAPACKLIBS in the Makefile should be commented out. setting the variable LAPACKLIBS in the Makefile should be commented out.
...@@ -38,12 +38,12 @@ LICENSE ...@@ -38,12 +38,12 @@ LICENSE
levmar is released under the GNU Public License (GPL), which can be found in the included levmar is released under the GNU Public License (GPL), which can be found in the included
LICENSE file. Note that under the terms of GPL, commercial use is allowed only if a software LICENSE file. Note that under the terms of GPL, commercial use is allowed only if a software
employing levmar is also published in source under the GPL. However, if you are interested employing levmar is also published in source under the GPL. However, if you are interested
in using levmar in a proprietary commercial apprlication, a commercial license for levmar in using levmar in a proprietary commercial application, a commercial license for levmar
can be obtained by contacting the author using the email address at the end of this file. can be obtained by contacting the author using the email address at the end of this file.
COMPILATION COMPILATION
- You might first consider setting a few configuration options at the top of - You might first consider setting a few configuration options at the top of
lm.h. See the accompanying comments for more details. levmar.h. See the accompanying comments for more details.
- On a Linux/Unix system, typing "make" will build both levmar and the demo - On a Linux/Unix system, typing "make" will build both levmar and the demo
program using gcc. Alternatively, if Intel's C++ compiler is installed, it program using gcc. Alternatively, if Intel's C++ compiler is installed, it
...@@ -63,7 +63,7 @@ COMPILATION ...@@ -63,7 +63,7 @@ COMPILATION
for details. for details.
MATLAB INTERFACE MATLAB INTERFACE
Since version 2.2, the levmar distrubution includes a matlab interface. Since version 2.2, the levmar distribution includes a matlab interface.
See the 'matlab' subdirectory for more information and examples of use. See the 'matlab' subdirectory for more information and examples of use.
Notice that *_core.c files are not to be compiled directly; For example, Notice that *_core.c files are not to be compiled directly; For example,
......
...@@ -38,4 +38,8 @@ ...@@ -38,4 +38,8 @@
#define LM_FINITE finite // other than MSVC, ICC, GCC, let's hope this will work #define LM_FINITE finite // other than MSVC, ICC, GCC, let's hope this will work
#endif #endif
#ifdef _MSC_VER // avoid deprecation warnings in VS2005
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif /* _COMPILER_H_ */ #endif /* _COMPILER_H_ */
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <lm.h> #include <levmar.h>
#ifndef LM_DBL_PREC #ifndef LM_DBL_PREC
#error Example program assumes that levmar has been compiled with double precision, see LM_DBL_PREC! #error Example program assumes that levmar has been compiled with double precision, see LM_DBL_PREC!
......
/*
////////////////////////////////////////////////////////////////////////////////////
//
// Prototypes and definitions for the Levenberg - Marquardt minimization algorithm
// Copyright (C) 2004 Manolis Lourakis (lourakis at ics forth gr)
// Institute of Computer Science, Foundation for Research & Technology - Hellas
// Heraklion, Crete, Greece.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
////////////////////////////////////////////////////////////////////////////////////
*/
#ifndef _LEVMAR_H_
#define _LEVMAR_H_
/************************************* Start of configuration options *************************************/
/* specify whether to use LAPACK or not. The first option is strongly recommended */
/*#define HAVE_LAPACK*/ /* use LAPACK */
#undef HAVE_LAPACK /* uncomment this to force not using LAPACK */
/* to avoid the overhead of repeated mallocs(), routines in Axb.c can be instructed to
* retain working memory between calls. Such a choice, however, renders these routines
* non-reentrant and is not safe in a shared memory multiprocessing environment.
* Bellow, this option is turned on only when not compiling with OpenMP.
*/
#if !defined(_OPENMP)
#define LINSOLVERS_RETAIN_MEMORY /* comment this if you don't want routines in Axb.c retain working memory between calls */
#endif
/* determine the precision variants to be build. Default settings build
* both the single and double precision routines
*/
#define LM_DBL_PREC /* comment this if you don't want the double precision routines to be compiled */
#define LM_SNGL_PREC /* comment this if you don't want the single precision routines to be compiled */
/****************** End of configuration options, no changes necessary beyond this point ******************/
#ifdef __cplusplus
extern "C" {
#endif
#define FABS(x) (((x)>=0.0)? (x) : -(x))
/* work arrays size for ?levmar_der and ?levmar_dif functions.
* should be multiplied by sizeof(double) or sizeof(float) to be converted to bytes
*/
#define LM_DER_WORKSZ(npar, nmeas) (2*(nmeas) + 4*(npar) + (nmeas)*(npar) + (npar)*(npar))
#define LM_DIF_WORKSZ(npar, nmeas) (4*(nmeas) + 4*(npar) + (nmeas)*(npar) + (npar)*(npar))
/* work arrays size for ?levmar_bc_der and ?levmar_bc_dif functions.
* should be multiplied by sizeof(double) or sizeof(float) to be converted to bytes
*/
#define LM_BC_DER_WORKSZ(npar, nmeas) (2*(nmeas) + 4*(npar) + (nmeas)*(npar) + (npar)*(npar))
#define LM_BC_DIF_WORKSZ(npar, nmeas) LM_BC_DER_WORKSZ((npar), (nmeas)) /* LEVMAR_BC_DIF currently implemented using LEVMAR_BC_DER()! */
/* work arrays size for ?levmar_lec_der and ?levmar_lec_dif functions.
* should be multiplied by sizeof(double) or sizeof(float) to be converted to bytes
*/
#define LM_LEC_DER_WORKSZ(npar, nmeas, nconstr) LM_DER_WORKSZ((npar)-(nconstr), (nmeas))
#define LM_LEC_DIF_WORKSZ(npar, nmeas, nconstr) LM_DIF_WORKSZ((npar)-(nconstr), (nmeas))
/* work arrays size for ?levmar_blec_der and ?levmar_blec_dif functions.
* should be multiplied by sizeof(double) or sizeof(float) to be converted to bytes
*/
#define LM_BLEC_DER_WORKSZ(npar, nmeas, nconstr) LM_LEC_DER_WORKSZ((npar), (nmeas)+(npar), (nconstr))
#define LM_BLEC_DIF_WORKSZ(npar, nmeas, nconstr) LM_LEC_DIF_WORKSZ((npar), (nmeas)+(npar), (nconstr))
/* work arrays size for ?levmar_bleic_der and ?levmar_bleic_dif functions.
* should be multiplied by sizeof(double) or sizeof(float) to be converted to bytes
*/
#define LM_BLEIC_DER_WORKSZ(npar, nmeas, nconstr1, nconstr2) LM_BLEC_DER_WORKSZ((npar)+(nconstr2), (nmeas)+(nconstr2), (nconstr1)+(nconstr2))
#define LM_BLEIC_DIF_WORKSZ(npar, nmeas, nconstr1, nconstr2) LM_BLEC_DIF_WORKSZ((npar)+(nconstr2), (nmeas)+(nconstr2), (nconstr1)+(nconstr2))
#define LM_OPTS_SZ 5 /* max(4, 5) */
#define LM_INFO_SZ 10
#define LM_ERROR -1
#define LM_INIT_MU 1E-03
#define LM_STOP_THRESH 1E-17
#define LM_DIFF_DELTA 1E-06
#define LM_VERSION "2.5 (December 2009)"
#ifdef LM_DBL_PREC
/* double precision LM, with & without Jacobian */
/* unconstrained minimization */
extern int dlevmar_der(
void (*func)(double *p, double *hx, int m, int n, void *adata),
void (*jacf)(double *p, double *j, int m, int n, void *adata),
double *p, double *x, int m, int n, int itmax, double *opts,
double *info, double *work, double *covar, void *adata);
extern int dlevmar_dif(
void (*func)(double *p, double *hx, int m, int n, void *adata),
double *p, double *x, int m, int n, int itmax, double *opts,
double *info, double *work, double *covar, void *adata);
/* box-constrained minimization */
extern int dlevmar_bc_der(
void (*func)(double *p, double *hx, int m, int n, void *adata),
void (*jacf)(double *p, double *j, int m, int n, void *adata),
double *p, double *x, int m, int n, double *lb, double *ub,
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
extern int dlevmar_bc_dif(
void (*func)(double *p, double *hx, int m, int n, void *adata),
double *p, double *x, int m, int n, double *lb, double *ub,
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
#ifdef HAVE_LAPACK
/* linear equation constrained minimization */
extern int dlevmar_lec_der(
void (*func)(double *p, double *hx, int m, int n, void *adata),
void (*jacf)(double *p, double *j, int m, int n, void *adata),
double *p, double *x, int m, int n, double *A, double *b, int k,
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
extern int dlevmar_lec_dif(
void (*func)(double *p, double *hx, int m, int n, void *adata),
double *p, double *x, int m, int n, double *A, double *b, int k,
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
/* box & linear equation constrained minimization */
extern int dlevmar_blec_der(
void (*func)(double *p, double *hx, int m, int n, void *adata),
void (*jacf)(double *p, double *j, int m, int n, void *adata),
double *p, double *x, int m, int n, double *lb, double *ub, double *A, double *b, int k, double *wghts,
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
extern int dlevmar_blec_dif(
void (*func)(double *p, double *hx, int m, int n, void *adata),
double *p, double *x, int m, int n, double *lb, double *ub, double *A, double *b, int k, double *wghts,
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
/* box, linear equations & inequalities constrained minimization */
extern int dlevmar_bleic_der(
void (*func)(double *p, double *hx, int m, int n, void *adata),
void (*jacf)(double *p, double *j, int m, int n, void *adata),
double *p, double *x, int m, int n, double *lb, double *ub,
double *A, double *b, int k1, double *C, double *d, int k2,
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
extern int dlevmar_bleic_dif(
void (*func)(double *p, double *hx, int m, int n, void *adata),
double *p, double *x, int m, int n, double *lb, double *ub,
double *A, double *b, int k1, double *C, double *d, int k2,
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
/* box & linear inequality constraints */
extern int dlevmar_blic_der(
void (*func)(double *p, double *hx, int m, int n, void *adata),
void (*jacf)(double *p, double *j, int m, int n, void *adata),
double *p, double *x, int m, int n, double *lb, double *ub, double *C, double *d, int k2,
int itmax, double opts[4], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
extern int dlevmar_blic_dif(
void (*func)(double *p, double *hx, int m, int n, void *adata),
double *p, double *x, int m, int n, double *lb, double *ub, double *C, double *d, int k2,
int itmax, double opts[5], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
/* linear equation & inequality constraints */
extern int dlevmar_leic_der(
void (*func)(double *p, double *hx, int m, int n, void *adata),
void (*jacf)(double *p, double *j, int m, int n, void *adata),
double *p, double *x, int m, int n, double *A, double *b, int k1, double *C, double *d, int k2,
int itmax, double opts[4], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
extern int dlevmar_leic_dif(
void (*func)(double *p, double *hx, int m, int n, void *adata),
double *p, double *x, int m, int n, double *A, double *b, int k1, double *C, double *d, int k2,
int itmax, double opts[5], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
/* linear inequality constraints */
extern int dlevmar_lic_der(
void (*func)(double *p, double *hx, int m, int n, void *adata),
void (*jacf)(double *p, double *j, int m, int n, void *adata),
double *p, double *x, int m, int n, double *C, double *d, int k2,
int itmax, double opts[4], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
extern int dlevmar_lic_dif(
void (*func)(double *p, double *hx, int m, int n, void *adata),
double *p, double *x, int m, int n, double *C, double *d, int k2,
int itmax, double opts[5], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
#endif /* HAVE_LAPACK */
#endif /* LM_DBL_PREC */
#ifdef LM_SNGL_PREC
/* single precision LM, with & without Jacobian */
/* unconstrained minimization */
extern int slevmar_der(
void (*func)(float *p, float *hx, int m, int n, void *adata),
void (*jacf)(float *p, float *j, int m, int n, void *adata),
float *p, float *x, int m, int n, int itmax, float *opts,
float *info, float *work, float *covar, void *adata);
extern int slevmar_dif(
void (*func)(float *p, float *hx, int m, int n, void *adata),
float *p, float *x, int m, int n, int itmax, float *opts,
float *info, float *work, float *covar, void *adata);
/* box-constrained minimization */
extern int slevmar_bc_der(
void (*func)(float *p, float *hx, int m, int n, void *adata),
void (*jacf)(float *p, float *j, int m, int n, void *adata),
float *p, float *x, int m, int n, float *lb, float *ub,
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
extern int slevmar_bc_dif(
void (*func)(float *p, float *hx, int m, int n, void *adata),
float *p, float *x, int m, int n, float *lb, float *ub,
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
#ifdef HAVE_LAPACK
/* linear equation constrained minimization */
extern int slevmar_lec_der(
void (*func)(float *p, float *hx, int m, int n, void *adata),
void (*jacf)(float *p, float *j, int m, int n, void *adata),
float *p, float *x, int m, int n, float *A, float *b, int k,
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
extern int slevmar_lec_dif(
void (*func)(float *p, float *hx, int m, int n, void *adata),
float *p, float *x, int m, int n, float *A, float *b, int k,
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
/* box & linear equation constrained minimization */
extern int slevmar_blec_der(
void (*func)(float *p, float *hx, int m, int n, void *adata),
void (*jacf)(float *p, float *j, int m, int n, void *adata),
float *p, float *x, int m, int n, float *lb, float *ub, float *A, float *b, int k, float *wghts,
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
extern int slevmar_blec_dif(
void (*func)(float *p, float *hx, int m, int n, void *adata),
float *p, float *x, int m, int n, float *lb, float *ub, float *A, float *b, int k, float *wghts,
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
/* box, linear equations & inequalities constrained minimization */
extern int slevmar_bleic_der(
void (*func)(float *p, float *hx, int m, int n, void *adata),
void (*jacf)(float *p, float *j, int m, int n, void *adata),
float *p, float *x, int m, int n, float *lb, float *ub,
float *A, float *b, int k1, float *C, float *d, int k2,
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
extern int slevmar_bleic_dif(
void (*func)(float *p, float *hx, int m, int n, void *adata),
float *p, float *x, int m, int n, float *lb, float *ub,
float *A, float *b, int k1, float *C, float *d, int k2,
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
/* box & linear inequality constraints */
extern int slevmar_blic_der(
void (*func)(float *p, float *hx, int m, int n, void *adata),
void (*jacf)(float *p, float *j, int m, int n, void *adata),
float *p, float *x, int m, int n, float *lb, float *ub, float *C, float *d, int k2,
int itmax, float opts[4], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
extern int slevmar_blic_dif(
void (*func)(float *p, float *hx, int m, int n, void *adata),
float *p, float *x, int m, int n, float *lb, float *ub, float *C, float *d, int k2,
int itmax, float opts[5], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
/* linear equality & inequality constraints */
extern int slevmar_leic_der(
void (*func)(float *p, float *hx, int m, int n, void *adata),
void (*jacf)(float *p, float *j, int m, int n, void *adata),
float *p, float *x, int m, int n, float *A, float *b, int k1, float *C, float *d, int k2,
int itmax, float opts[4], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
extern int slevmar_leic_dif(
void (*func)(float *p, float *hx, int m, int n, void *adata),
float *p, float *x, int m, int n, float *A, float *b, int k1, float *C, float *d, int k2,
int itmax, float opts[5], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
/* linear inequality constraints */
extern int slevmar_lic_der(
void (*func)(float *p, float *hx, int m, int n, void *adata),
void (*jacf)(float *p, float *j, int m, int n, void *adata),
float *p, float *x, int m, int n, float *C, float *d, int k2,
int itmax, float opts[4], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
extern int slevmar_lic_dif(
void (*func)(float *p, float *hx, int m, int n, void *adata),
float *p, float *x, int m, int n, float *C, float *d, int k2,
int itmax, float opts[5], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
#endif /* HAVE_LAPACK */
#endif /* LM_SNGL_PREC */
/* linear system solvers */
#ifdef HAVE_LAPACK
#ifdef LM_DBL_PREC
extern int dAx_eq_b_QR(double *A, double *B, double *x, int m);
extern int dAx_eq_b_QRLS(double *A, double *B, double *x, int m, int n);
extern int dAx_eq_b_Chol(double *A, double *B, double *x, int m);
extern int dAx_eq_b_LU(double *A, double *B, double *x, int m);
extern int dAx_eq_b_SVD(double *A, double *B, double *x, int m);
extern int dAx_eq_b_BK(double *A, double *B, double *x, int m);
#endif /* LM_DBL_PREC */
#ifdef LM_SNGL_PREC
extern int sAx_eq_b_QR(float *A, float *B, float *x, int m);
extern int sAx_eq_b_QRLS(float *A, float *B, float *x, int m, int n);
extern int sAx_eq_b_Chol(float *A, float *B, float *x, int m);
extern int sAx_eq_b_LU(float *A, float *B, float *x, int m);
extern int sAx_eq_b_SVD(float *A, float *B, float *x, int m);
extern int sAx_eq_b_BK(float *A, float *B, float *x, int m);
#endif /* LM_SNGL_PREC */
#else /* no LAPACK */
#ifdef LM_DBL_PREC
extern int dAx_eq_b_LU_noLapack(double *A, double *B, double *x, int n);
#endif /* LM_DBL_PREC */
#ifdef LM_SNGL_PREC
extern int sAx_eq_b_LU_noLapack(float *A, float *B, float *x, int n);
#endif /* LM_SNGL_PREC */
#endif /* HAVE_LAPACK */
/* Jacobian verification, double & single precision */
#ifdef LM_DBL_PREC
extern void dlevmar_chkjac(
void (*func)(double *p, double *hx, int m, int n, void *adata),
void (*jacf)(double *p, double *j, int m, int n, void *adata),
double *p, int m, int n, void *adata, double *err);
#endif /* LM_DBL_PREC */
#ifdef LM_SNGL_PREC
extern void slevmar_chkjac(
void (*func)(float *p, float *hx, int m, int n, void *adata),
void (*jacf)(float *p, float *j, int m, int n, void *adata),
float *p, int m, int n, void *adata, float *err);
#endif /* LM_SNGL_PREC */
/* standard deviation, coefficient of determination (R2) & Pearson's correlation coefficient for best-fit parameters */
#ifdef LM_DBL_PREC
extern double dlevmar_stddev( double *covar, int m, int i);
extern double dlevmar_corcoef(double *covar, int m, int i, int j);
extern double dlevmar_R2(void (*func)(double *p, double *hx, int m, int n, void *adata), double *p, double *x, int m, int n, void *adata);
#endif /* LM_DBL_PREC */
#ifdef LM_SNGL_PREC
extern float slevmar_stddev( float *covar, int m, int i);
extern float slevmar_corcoef(float *covar, int m, int i, int j);
extern float slevmar_R2(void (*func)(float *p, float *hx, int m, int n, void *adata), float *p, float *x, int m, int n, void *adata);
#endif /* LM_SNGL_PREC */
#ifdef __cplusplus
}
#endif
#endif /* _LEVMAR_H_ */
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <math.h> #include <math.h>
#include <float.h> #include <float.h>
#include "lm.h" #include "levmar.h"
#include "compiler.h" #include "compiler.h"
#include "misc.h" #include "misc.h"
......
...@@ -19,14 +19,14 @@ ...@@ -19,14 +19,14 @@
//////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////
*/ */
#ifndef _LM_H_ #ifndef _LEVMAR_H_
#define _LM_H_ #define _LEVMAR_H_
/************************************* Start of configuration options *************************************/ /************************************* Start of configuration options *************************************/
/* specify whether to use LAPACK or not. The first option is strongly recommended */ /* specify whether to use LAPACK or not. The first option is strongly recommended */
#define HAVE_LAPACK /* use LAPACK */ /*#define HAVE_LAPACK*/ /* use LAPACK */
#undef HAVE_LAPACK /* uncomment this to force not using LAPACK */ #undef HAVE_LAPACK /* uncomment this to force not using LAPACK */
/* to avoid the overhead of repeated mallocs(), routines in Axb.c can be instructed to /* to avoid the overhead of repeated mallocs(), routines in Axb.c can be instructed to
...@@ -78,13 +78,19 @@ extern "C" { ...@@ -78,13 +78,19 @@ extern "C" {
#define LM_BLEC_DER_WORKSZ(npar, nmeas, nconstr) LM_LEC_DER_WORKSZ((npar), (nmeas)+(npar), (nconstr)) #define LM_BLEC_DER_WORKSZ(npar, nmeas, nconstr) LM_LEC_DER_WORKSZ((npar), (nmeas)+(npar), (nconstr))
#define LM_BLEC_DIF_WORKSZ(npar, nmeas, nconstr) LM_LEC_DIF_WORKSZ((npar), (nmeas)+(npar), (nconstr)) #define LM_BLEC_DIF_WORKSZ(npar, nmeas, nconstr) LM_LEC_DIF_WORKSZ((npar), (nmeas)+(npar), (nconstr))
/* work arrays size for ?levmar_bleic_der and ?levmar_bleic_dif functions.
* should be multiplied by sizeof(double) or sizeof(float) to be converted to bytes
*/
#define LM_BLEIC_DER_WORKSZ(npar, nmeas, nconstr1, nconstr2) LM_BLEC_DER_WORKSZ((npar)+(nconstr2), (nmeas)+(nconstr2), (nconstr1)+(nconstr2))
#define LM_BLEIC_DIF_WORKSZ(npar, nmeas, nconstr1, nconstr2) LM_BLEC_DIF_WORKSZ((npar)+(nconstr2), (nmeas)+(nconstr2), (nconstr1)+(nconstr2))
#define LM_OPTS_SZ 5 /* max(4, 5) */ #define LM_OPTS_SZ 5 /* max(4, 5) */
#define LM_INFO_SZ 10 #define LM_INFO_SZ 10
#define LM_ERROR -1 #define LM_ERROR -1
#define LM_INIT_MU 1E-03 #define LM_INIT_MU 1E-03
#define LM_STOP_THRESH 1E-17 #define LM_STOP_THRESH 1E-17
#define LM_DIFF_DELTA 1E-06 #define LM_DIFF_DELTA 1E-06
#define LM_VERSION "2.4 (April 2009)" #define LM_VERSION "2.5 (December 2009)"
#ifdef LM_DBL_PREC #ifdef LM_DBL_PREC
/* double precision LM, with & without Jacobian */ /* double precision LM, with & without Jacobian */
...@@ -136,6 +142,56 @@ extern int dlevmar_blec_dif( ...@@ -136,6 +142,56 @@ extern int dlevmar_blec_dif(
void (*func)(double *p, double *hx, int m, int n, void *adata), void (*func)(double *p, double *hx, int m, int n, void *adata),
double *p, double *x, int m, int n, double *lb, double *ub, double *A, double *b, int k, double *wghts, double *p, double *x, int m, int n, double *lb, double *ub, double *A, double *b, int k, double *wghts,
int itmax, double *opts, double *info, double *work, double *covar, void *adata); int itmax, double *opts, double *info, double *work, double *covar, void *adata);
/* box, linear equations & inequalities constrained minimization */
extern int dlevmar_bleic_der(
void (*func)(double *p, double *hx, int m, int n, void *adata),
void (*jacf)(double *p, double *j, int m, int n, void *adata),
double *p, double *x, int m, int n, double *lb, double *ub,
double *A, double *b, int k1, double *C, double *d, int k2,
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
extern int dlevmar_bleic_dif(
void (*func)(double *p, double *hx, int m, int n, void *adata),
double *p, double *x, int m, int n, double *lb, double *ub,
double *A, double *b, int k1, double *C, double *d, int k2,
int itmax, double *opts, double *info, double *work, double *covar, void *adata);
/* box & linear inequality constraints */
extern int dlevmar_blic_der(
void (*func)(double *p, double *hx, int m, int n, void *adata),
void (*jacf)(double *p, double *j, int m, int n, void *adata),
double *p, double *x, int m, int n, double *lb, double *ub, double *C, double *d, int k2,
int itmax, double opts[4], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
extern int dlevmar_blic_dif(
void (*func)(double *p, double *hx, int m, int n, void *adata),
double *p, double *x, int m, int n, double *lb, double *ub, double *C, double *d, int k2,
int itmax, double opts[5], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
/* linear equation & inequality constraints */
extern int dlevmar_leic_der(
void (*func)(double *p, double *hx, int m, int n, void *adata),
void (*jacf)(double *p, double *j, int m, int n, void *adata),
double *p, double *x, int m, int n, double *A, double *b, int k1, double *C, double *d, int k2,
int itmax, double opts[4], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
extern int dlevmar_leic_dif(
void (*func)(double *p, double *hx, int m, int n, void *adata),
double *p, double *x, int m, int n, double *A, double *b, int k1, double *C, double *d, int k2,
int itmax, double opts[5], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
/* linear inequality constraints */
extern int dlevmar_lic_der(
void (*func)(double *p, double *hx, int m, int n, void *adata),
void (*jacf)(double *p, double *j, int m, int n, void *adata),
double *p, double *x, int m, int n, double *C, double *d, int k2,
int itmax, double opts[4], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
extern int dlevmar_lic_dif(
void (*func)(double *p, double *hx, int m, int n, void *adata),
double *p, double *x, int m, int n, double *C, double *d, int k2,
int itmax, double opts[5], double info[LM_INFO_SZ], double *work, double *covar, void *adata);
#endif /* HAVE_LAPACK */ #endif /* HAVE_LAPACK */
#endif /* LM_DBL_PREC */ #endif /* LM_DBL_PREC */
...@@ -191,6 +247,56 @@ extern int slevmar_blec_dif( ...@@ -191,6 +247,56 @@ extern int slevmar_blec_dif(
void (*func)(float *p, float *hx, int m, int n, void *adata), void (*func)(float *p, float *hx, int m, int n, void *adata),
float *p, float *x, int m, int n, float *lb, float *ub, float *A, float *b, int k, float *wghts, float *p, float *x, int m, int n, float *lb, float *ub, float *A, float *b, int k, float *wghts,
int itmax, float *opts, float *info, float *work, float *covar, void *adata); int itmax, float *opts, float *info, float *work, float *covar, void *adata);
/* box, linear equations & inequalities constrained minimization */
extern int slevmar_bleic_der(
void (*func)(float *p, float *hx, int m, int n, void *adata),
void (*jacf)(float *p, float *j, int m, int n, void *adata),
float *p, float *x, int m, int n, float *lb, float *ub,
float *A, float *b, int k1, float *C, float *d, int k2,
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
extern int slevmar_bleic_dif(
void (*func)(float *p, float *hx, int m, int n, void *adata),
float *p, float *x, int m, int n, float *lb, float *ub,
float *A, float *b, int k1, float *C, float *d, int k2,
int itmax, float *opts, float *info, float *work, float *covar, void *adata);
/* box & linear inequality constraints */
extern int slevmar_blic_der(
void (*func)(float *p, float *hx, int m, int n, void *adata),
void (*jacf)(float *p, float *j, int m, int n, void *adata),
float *p, float *x, int m, int n, float *lb, float *ub, float *C, float *d, int k2,
int itmax, float opts[4], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
extern int slevmar_blic_dif(
void (*func)(float *p, float *hx, int m, int n, void *adata),
float *p, float *x, int m, int n, float *lb, float *ub, float *C, float *d, int k2,
int itmax, float opts[5], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
/* linear equality & inequality constraints */
extern int slevmar_leic_der(
void (*func)(float *p, float *hx, int m, int n, void *adata),
void (*jacf)(float *p, float *j, int m, int n, void *adata),
float *p, float *x, int m, int n, float *A, float *b, int k1, float *C, float *d, int k2,
int itmax, float opts[4], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
extern int slevmar_leic_dif(
void (*func)(float *p, float *hx, int m, int n, void *adata),
float *p, float *x, int m, int n, float *A, float *b, int k1, float *C, float *d, int k2,
int itmax, float opts[5], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
/* linear inequality constraints */
extern int slevmar_lic_der(
void (*func)(float *p, float *hx, int m, int n, void *adata),
void (*jacf)(float *p, float *j, int m, int n, void *adata),
float *p, float *x, int m, int n, float *C, float *d, int k2,
int itmax, float opts[4], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
extern int slevmar_lic_dif(
void (*func)(float *p, float *hx, int m, int n, void *adata),
float *p, float *x, int m, int n, float *C, float *d, int k2,
int itmax, float opts[5], float info[LM_INFO_SZ], float *work, float *covar, void *adata);
#endif /* HAVE_LAPACK */ #endif /* HAVE_LAPACK */
#endif /* LM_SNGL_PREC */ #endif /* LM_SNGL_PREC */
...@@ -204,6 +310,7 @@ extern int dAx_eq_b_QRLS(double *A, double *B, double *x, int m, int n); ...@@ -204,6 +310,7 @@ extern int dAx_eq_b_QRLS(double *A, double *B, double *x, int m, int n);
extern int dAx_eq_b_Chol(double *A, double *B, double *x, int m); extern int dAx_eq_b_Chol(double *A, double *B, double *x, int m);
extern int dAx_eq_b_LU(double *A, double *B, double *x, int m); extern int dAx_eq_b_LU(double *A, double *B, double *x, int m);
extern int dAx_eq_b_SVD(double *A, double *B, double *x, int m); extern int dAx_eq_b_SVD(double *A, double *B, double *x, int m);
extern int dAx_eq_b_BK(double *A, double *B, double *x, int m);
#endif /* LM_DBL_PREC */ #endif /* LM_DBL_PREC */
#ifdef LM_SNGL_PREC #ifdef LM_SNGL_PREC
...@@ -212,6 +319,7 @@ extern int sAx_eq_b_QRLS(float *A, float *B, float *x, int m, int n); ...@@ -212,6 +319,7 @@ extern int sAx_eq_b_QRLS(float *A, float *B, float *x, int m, int n);
extern int sAx_eq_b_Chol(float *A, float *B, float *x, int m); extern int sAx_eq_b_Chol(float *A, float *B, float *x, int m);
extern int sAx_eq_b_LU(float *A, float *B, float *x, int m); extern int sAx_eq_b_LU(float *A, float *B, float *x, int m);
extern int sAx_eq_b_SVD(float *A, float *B, float *x, int m); extern int sAx_eq_b_SVD(float *A, float *B, float *x, int m);
extern int sAx_eq_b_BK(float *A, float *B, float *x, int m);
#endif /* LM_SNGL_PREC */ #endif /* LM_SNGL_PREC */
#else /* no LAPACK */ #else /* no LAPACK */
...@@ -259,4 +367,4 @@ extern float slevmar_R2(void (*func)(float *p, float *hx, int m, int n, void *ad ...@@ -259,4 +367,4 @@ extern float slevmar_R2(void (*func)(float *p, float *hx, int m, int n, void *ad
} }
#endif #endif
#endif /* _LM_H_ */ #endif /* _LEVMAR_H_ */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment