diff --git a/test/Makefile.am b/test/Makefile.am index e1d0046..2287c30 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -15,7 +15,8 @@ check_PROGRAMS = test_GVector \ test_GFits \ test_GResponse \ test_GModel \ - test_GData + test_GData \ + test_GOptimizer TESTS = test_GVector \ test_GMatrix \ @@ -24,7 +25,8 @@ TESTS = test_GVector \ test_GFits \ test_GResponse \ test_GModel \ - test_GData + test_GData \ + test_GOptimizer test_GVector_SOURCES = test_GVector.cpp test_GVector_LDADD = ../src/libgamma.la @@ -42,3 +44,5 @@ test_GModel_SOURCES = test_GModel.cpp test_GModel_LDADD = ../src/libgamma.la test_GData_SOURCES = test_GData.cpp test_GData_LDADD = ../src/libgamma.la +test_GOptimizer_SOURCES = test_GOptimizer.cpp +test_GOptimizer_LDADD = ../src/libgamma.la diff --git a/test/Makefile.in b/test/Makefile.in index 22a7b67..714566e 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. +# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -17,15 +18,12 @@ # we use srcdir/src for "private" includes # we use srcdir/include for the static global include files # we use builddir/src for the generated include files to get found -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -42,16 +40,26 @@ host_triplet = @host@ check_PROGRAMS = test_GVector$(EXEEXT) test_GMatrix$(EXEEXT) \ test_GSymMatrix$(EXEEXT) test_GSparseMatrix$(EXEEXT) \ test_GFits$(EXEEXT) test_GResponse$(EXEEXT) \ - test_GModel$(EXEEXT) test_GData$(EXEEXT) + test_GModel$(EXEEXT) test_GData$(EXEEXT) \ + test_GOptimizer$(EXEEXT) +TESTS = test_GVector$(EXEEXT) test_GMatrix$(EXEEXT) \ + test_GSymMatrix$(EXEEXT) test_GSparseMatrix$(EXEEXT) \ + test_GFits$(EXEEXT) test_GResponse$(EXEEXT) \ + test_GModel$(EXEEXT) test_GData$(EXEEXT) \ + test_GOptimizer$(EXEEXT) subdir = test DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = am_test_GData_OBJECTS = test_GData.$(OBJEXT) test_GData_OBJECTS = $(am_test_GData_OBJECTS) test_GData_DEPENDENCIES = ../src/libgamma.la @@ -64,6 +72,9 @@ test_GMatrix_DEPENDENCIES = ../src/libgamma.la am_test_GModel_OBJECTS = test_GModel.$(OBJEXT) test_GModel_OBJECTS = $(am_test_GModel_OBJECTS) test_GModel_DEPENDENCIES = ../src/libgamma.la +am_test_GOptimizer_OBJECTS = test_GOptimizer.$(OBJEXT) +test_GOptimizer_OBJECTS = $(am_test_GOptimizer_OBJECTS) +test_GOptimizer_DEPENDENCIES = ../src/libgamma.la am_test_GResponse_OBJECTS = test_GResponse.$(OBJEXT) test_GResponse_OBJECTS = $(am_test_GResponse_OBJECTS) test_GResponse_DEPENDENCIES = ../src/libgamma.la @@ -76,27 +87,32 @@ test_GSymMatrix_DEPENDENCIES = ../src/libgamma.la am_test_GVector_OBJECTS = test_GVector.$(OBJEXT) test_GVector_OBJECTS = $(am_test_GVector_OBJECTS) test_GVector_DEPENDENCIES = ../src/libgamma.la -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = am__depfiles_maybe = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ SOURCES = $(test_GData_SOURCES) $(test_GFits_SOURCES) \ $(test_GMatrix_SOURCES) $(test_GModel_SOURCES) \ - $(test_GResponse_SOURCES) $(test_GSparseMatrix_SOURCES) \ - $(test_GSymMatrix_SOURCES) $(test_GVector_SOURCES) + $(test_GOptimizer_SOURCES) $(test_GResponse_SOURCES) \ + $(test_GSparseMatrix_SOURCES) $(test_GSymMatrix_SOURCES) \ + $(test_GVector_SOURCES) DIST_SOURCES = $(test_GData_SOURCES) $(test_GFits_SOURCES) \ $(test_GMatrix_SOURCES) $(test_GModel_SOURCES) \ - $(test_GResponse_SOURCES) $(test_GSparseMatrix_SOURCES) \ - $(test_GSymMatrix_SOURCES) $(test_GVector_SOURCES) + $(test_GOptimizer_SOURCES) $(test_GResponse_SOURCES) \ + $(test_GSparseMatrix_SOURCES) $(test_GSymMatrix_SOURCES) \ + $(test_GVector_SOURCES) ETAGS = etags CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -114,42 +130,44 @@ CXXCPP = @CXXCPP@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ -ENABLE_PYTHON_BINDING_FALSE = @ENABLE_PYTHON_BINDING_FALSE@ -ENABLE_PYTHON_BINDING_TRUE = @ENABLE_PYTHON_BINDING_TRUE@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ GAMMALIB_LT_VERSION = @GAMMALIB_LT_VERSION@ GREP = @GREP@ -HAVE_PYTHON_FALSE = @HAVE_PYTHON_FALSE@ -HAVE_PYTHON_TRUE = @HAVE_PYTHON_TRUE@ -HAVE_SWIG_FALSE = @HAVE_SWIG_FALSE@ -HAVE_SWIG_TRUE = @HAVE_SWIG_TRUE@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PYTHON = @PYTHON@ @@ -164,9 +182,13 @@ SHELL = @SHELL@ STRIP = @STRIP@ SWIG = @SWIG@ VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__leading_dot = @am__leading_dot@ am__tar = @am__tar@ am__untar = @am__untar@ @@ -176,6 +198,7 @@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ @@ -194,6 +217,7 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -207,21 +231,16 @@ pyexecdir = @pyexecdir@ pythondir = @pythondir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir)/include \ -I$(top_builddir)/src \ -I$(top_srcdir)/src -TESTS = test_GVector \ - test_GMatrix \ - test_GSymMatrix \ - test_GSparseMatrix \ - test_GFits \ - test_GResponse \ - test_GModel \ - test_GData - test_GVector_SOURCES = test_GVector.cpp test_GVector_LDADD = ../src/libgamma.la test_GMatrix_SOURCES = test_GMatrix.cpp @@ -238,6 +257,8 @@ test_GModel_SOURCES = test_GModel.cpp test_GModel_LDADD = ../src/libgamma.la test_GData_SOURCES = test_GData.cpp test_GData_LDADD = ../src/libgamma.la +test_GOptimizer_SOURCES = test_GOptimizer.cpp +test_GOptimizer_LDADD = ../src/libgamma.la all: all-am .SUFFIXES: @@ -246,14 +267,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps test/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps test/Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps test/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu --ignore-deps test/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -271,37 +292,43 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list test_GData$(EXEEXT): $(test_GData_OBJECTS) $(test_GData_DEPENDENCIES) @rm -f test_GData$(EXEEXT) - $(CXXLINK) $(test_GData_LDFLAGS) $(test_GData_OBJECTS) $(test_GData_LDADD) $(LIBS) + $(CXXLINK) $(test_GData_OBJECTS) $(test_GData_LDADD) $(LIBS) test_GFits$(EXEEXT): $(test_GFits_OBJECTS) $(test_GFits_DEPENDENCIES) @rm -f test_GFits$(EXEEXT) - $(CXXLINK) $(test_GFits_LDFLAGS) $(test_GFits_OBJECTS) $(test_GFits_LDADD) $(LIBS) + $(CXXLINK) $(test_GFits_OBJECTS) $(test_GFits_LDADD) $(LIBS) test_GMatrix$(EXEEXT): $(test_GMatrix_OBJECTS) $(test_GMatrix_DEPENDENCIES) @rm -f test_GMatrix$(EXEEXT) - $(CXXLINK) $(test_GMatrix_LDFLAGS) $(test_GMatrix_OBJECTS) $(test_GMatrix_LDADD) $(LIBS) + $(CXXLINK) $(test_GMatrix_OBJECTS) $(test_GMatrix_LDADD) $(LIBS) test_GModel$(EXEEXT): $(test_GModel_OBJECTS) $(test_GModel_DEPENDENCIES) @rm -f test_GModel$(EXEEXT) - $(CXXLINK) $(test_GModel_LDFLAGS) $(test_GModel_OBJECTS) $(test_GModel_LDADD) $(LIBS) + $(CXXLINK) $(test_GModel_OBJECTS) $(test_GModel_LDADD) $(LIBS) +test_GOptimizer$(EXEEXT): $(test_GOptimizer_OBJECTS) $(test_GOptimizer_DEPENDENCIES) + @rm -f test_GOptimizer$(EXEEXT) + $(CXXLINK) $(test_GOptimizer_OBJECTS) $(test_GOptimizer_LDADD) $(LIBS) test_GResponse$(EXEEXT): $(test_GResponse_OBJECTS) $(test_GResponse_DEPENDENCIES) @rm -f test_GResponse$(EXEEXT) - $(CXXLINK) $(test_GResponse_LDFLAGS) $(test_GResponse_OBJECTS) $(test_GResponse_LDADD) $(LIBS) + $(CXXLINK) $(test_GResponse_OBJECTS) $(test_GResponse_LDADD) $(LIBS) test_GSparseMatrix$(EXEEXT): $(test_GSparseMatrix_OBJECTS) $(test_GSparseMatrix_DEPENDENCIES) @rm -f test_GSparseMatrix$(EXEEXT) - $(CXXLINK) $(test_GSparseMatrix_LDFLAGS) $(test_GSparseMatrix_OBJECTS) $(test_GSparseMatrix_LDADD) $(LIBS) + $(CXXLINK) $(test_GSparseMatrix_OBJECTS) $(test_GSparseMatrix_LDADD) $(LIBS) test_GSymMatrix$(EXEEXT): $(test_GSymMatrix_OBJECTS) $(test_GSymMatrix_DEPENDENCIES) @rm -f test_GSymMatrix$(EXEEXT) - $(CXXLINK) $(test_GSymMatrix_LDFLAGS) $(test_GSymMatrix_OBJECTS) $(test_GSymMatrix_LDADD) $(LIBS) + $(CXXLINK) $(test_GSymMatrix_OBJECTS) $(test_GSymMatrix_LDADD) $(LIBS) test_GVector$(EXEEXT): $(test_GVector_OBJECTS) $(test_GVector_DEPENDENCIES) @rm -f test_GVector$(EXEEXT) - $(CXXLINK) $(test_GVector_LDFLAGS) $(test_GVector_OBJECTS) $(test_GVector_LDADD) $(LIBS) + $(CXXLINK) $(test_GVector_OBJECTS) $(test_GVector_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -324,54 +351,54 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ + set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -379,7 +406,8 @@ distclean-tags: check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ - list='$(TESTS)'; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ @@ -388,49 +416,63 @@ check-TESTS: $(TESTS) if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ - *" $$tst "*) \ + *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ - echo "XPASS: $$tst"; \ + col=$$red; res=XPASS; \ ;; \ *) \ - echo "PASS: $$tst"; \ + col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ - *" $$tst "*) \ + *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ - echo "XFAIL: $$tst"; \ + col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ - echo "FAIL: $$tst"; \ + col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ - echo "SKIP: $$tst"; \ + col=$$blu; res=SKIP; \ fi; \ + echo "$${col}$$res$${std}: $$tst"; \ done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ - banner="All $$all tests passed"; \ + banner="$$All$$all $$tests passed"; \ else \ - banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all tests failed"; \ + banner="$$failed of $$all $$tests failed"; \ else \ - banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ - skipped="($$skip tests were not run)"; \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ @@ -441,38 +483,45 @@ check-TESTS: $(TESTS) dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ - echo "$$dashes"; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ - echo "$$dashes"; \ + echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @@ -502,6 +551,7 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -514,7 +564,7 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am @@ -522,18 +572,38 @@ dvi-am: html: html-am +html-am: + info: info-am info-am: install-data-am: +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am @@ -553,19 +623,24 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am +uninstall-am: + +.MAKE: check-am install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am + tags uninstall uninstall-am + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/test/test_GOptimizer.cpp b/test/test_GOptimizer.cpp new file mode 100644 index 0000000..6eecc13 --- /dev/null +++ b/test/test_GOptimizer.cpp @@ -0,0 +1,190 @@ +/*************************************************************************** + * test_GOptimizer.cpp - test GOptimizer class * + * ----------------------------------------------------------------------- * + * copyright (C) 2009 by Jurgen Knodlseder * + * ----------------------------------------------------------------------- * + * * + * 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. * + * * + ***************************************************************************/ + +/* __ Includes ___________________________________________________________ */ +#include +#include "test_GOptimizer.hpp" + +/* __ Namespaces _________________________________________________________ */ + +/* __ Globals ____________________________________________________________ */ + + +/*************************************************************************** + * Test: Model parameter handling * + ***************************************************************************/ +void MyOptFct::init_members(void) +{ + m_event = GData::iterator(); + m_end = GData::iterator(); + return; +} +void MyOptFct::copy_members(const MyOptFct& fct) +{ + m_data = fct.m_data; + m_event = fct.m_event; + m_end = fct.m_end; + return; +} +MyOptFct& MyOptFct::operator= (const MyOptFct& fct) +{ + if (this != &fct) { + free_members(); + init_members(); + copy_members(fct); + } + return *this; +} +void MyOptFct::first_item(void) +{ + m_event = m_data.begin(); + m_end = m_data.end(); + return; +} +bool MyOptFct::next_item(void) +{ + m_event++; + return (m_event == m_end); +} +GVector MyOptFct::get_gradient(void) +{ + GVector gradient = GVector(10); + return (gradient); +} +void MyOptFct::set_data(const GData& data) +{ + m_data = data; + m_event = m_data.begin(); + m_end = m_data.end(); + return; +} + + +/*************************************************************************** + * Test: Optimizer * + ***************************************************************************/ +void test_optimizer(void) +{ + // Write header + std::cout << "Test GOptimizer: "; + + // Number of observations in data + int nobs = 50; + + // Setup GData for optimizing + GData data; + GLATObservation obs; + try { + obs.load_binned("data/lat/cntmap.fits.gz", "", ""); + for (int i = 0; i < nobs; ++i) + data.add(obs); + } + catch (std::exception &e) { + std::cout << std::endl << "TEST ERROR: Unable setup GData for optimizing." + << std::endl; + std::cout << e.what() << std::endl; + throw; + } + std::cout << "."; +//std::cout << data << std::endl; + + + // Setup optimizer + MyOptFct opt; + try { + opt.set_data(data); + } + catch (std::exception &e) { + std::cout << std::endl << "TEST ERROR: Unable setup optimizer." + << std::endl; + std::cout << e.what() << std::endl; + throw; + } + std::cout << "."; + + // Time simple GData iterator + double t_elapse; + try { + clock_t t_start = clock(); + int num = 0; + int sum = 0; + for (GData::iterator event = data.begin(); event != data.end(); ++event) { + num++; + sum += (int)event->counts(); + } + t_elapse = double(clock() - t_start)/double(CLOCKS_PER_SEC); + } + catch (std::exception &e) { + std::cout << std::endl << "TEST ERROR: Unable to iterate GData." << std::endl; + std::cout << e.what() << std::endl; + throw; + } + std::cout << "." << std::endl; + std::cout << " - Reference time for GData::iterator: " << t_elapse << std::endl; + + // Iterate over optimizer + try { + clock_t t_start = clock(); + int num = 0; + int sum = 0; + int sum_m = 0; + for (MyOptFct::iterator item = opt.begin(); item != opt.end(); ++item) { + num++; + sum += (int)item.data(); +// double model = item.model(); +// GVector gradient = item.gradient(); + } + t_elapse = double(clock() - t_start)/double(CLOCKS_PER_SEC); + if (sum != 1359*nobs || num != 200000*nobs) { + std::cout << std::endl << + "TEST ERROR: Wrong number of iterations in MyOptFct::iterator." + << std::endl; + throw; + } + } + catch (std::exception &e) { + std::cout << std::endl << "TEST ERROR: Unable to iterate." + << std::endl; + std::cout << e.what() << std::endl; + throw; + } + std::cout << " - Time for MyOptFct::iterator doing same operations: " << t_elapse + << std::endl; + std::cout << "."; + + // Plot final test success + std::cout << " ok." << std::endl; + + // Exit test + return; + +} + + +/*************************************************************************** + * Main test function * + ***************************************************************************/ +int main(void) +{ + // Dump header + std::cout << std::endl; + std::cout << "****************************" << std::endl; + std::cout << "* GOptimizer class testing *" << std::endl; + std::cout << "****************************" << std::endl; + + // Execute the tests + test_optimizer(); + + // Return + return 0; +} diff --git a/test/test_GOptimizer.hpp b/test/test_GOptimizer.hpp new file mode 100644 index 0000000..6abbac0 --- /dev/null +++ b/test/test_GOptimizer.hpp @@ -0,0 +1,61 @@ +/*************************************************************************** + * test_GOptimizer.hpp - test GOptimizer class * + * ----------------------------------------------------------------------- * + * copyright (C) 2009 by Jurgen Knodlseder * + * ----------------------------------------------------------------------- * + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef TEST_GOPTIMIZER_HPP +#define TEST_GOPTIMIZER_HPP + +/* __ Includes ___________________________________________________________ */ +#include "GammaLib.hpp" +#include // cout, cerr +#include // std::exception + + +/***********************************************************************//** + * @class MyOptFct + * + * @brief MyOptFct class interface defintion. + ***************************************************************************/ +class MyOptFct : public GOptimizerFunction { + +public: + + // Constructors and destructors + MyOptFct() { init_members(); return; } + MyOptFct(const MyOptFct& fct) { init_members(); copy_members(fct); return; } + virtual ~MyOptFct() { free_members(); return; } + + // Operators + MyOptFct& operator= (const MyOptFct& fct); + + // Methods + void first_item(void); //!< Move to first item + bool next_item(void); //!< Move to next element (true if end) + double get_data(void) { return m_event->counts(); } + double get_model(void) { return m_event->counts(); } + GVector get_gradient(void) ; //!< Get gradient reference + void set_data(const GData& data); + +protected: + // Protected methods + void init_members(void); + void copy_members(const MyOptFct& fct); + void free_members(void) { return; } + + // Protected data area + GData m_data; + GData::iterator m_event; //!< Iterator on actual event + GData::iterator m_end; //!< Iterator on end (speeds up iterating) + +}; + +#endif /* TEST_GOPTIMIZER_HPP */