Changes from tags/0.9.2 at r4254 to tags/0.10 at r4254


Ignore:
Location:
tags/0.10
Files:
20 added
237 edited

Legend:

Unmodified
Added
Removed
  • tags/0.10/Makefile.am

    r4254 r4254  
    9494  esac
    9595
    96 maintainer-check-local: mc_installcheck yat-pc-check
     96maintainer-check-local: mc_installcheck yat-pc-check mc_without_samtools
    9797
    9898mc_installcheck:
     
    167167
    168168include $(srcdir)/am/maintainer.am
     169
     170# run within maintainer-check
     171# try ./configure --without-samtools; make; make check
     172mc_without_samtools:
     173  @rm -rf _mc_without_samtools
     174  mkdir _mc_without_samtools
     175  cd _mc_without_samtools \
     176  && ../$(srcdir)/configure $(DISTCHECK_CONFIGURE_FLAGS) --without-samtools \
     177  && $(MAKE) $(AM_MAKEFLAGS) && $(MAKE) check $(AM_MAKEFLAGS)
  • tags/0.10/NEWS

    r4254 r4254  
    22
    33See the end of this file for copyrights and conditions.
     4
     5yat 0.10.x series from http://dev.thep.lu.se/yat/svn/branches/0.10-stable
     6
     7version 0.10 (released 4 January 2013)
     8  - samtools wrapper classes (ticket #729)
     9  - new utility functions (ticket #717)
     10
     11  A complete list of closed tickets can be found here [[br]]
     12  http://dev.thep.lu.se/yat/query?status=closed&milestone=yat+0.10
    413
    514yat 0.9.x series from http://dev.thep.lu.se/yat/svn/branches/0.9-stable
     
    278287Copyright (C) 2010, 2011 Peter Johansson
    279288Copyright (C) 2012 Jari Häkkinen, Peter Johansson
     289Copyright (C) 2013 Peter Johansson
    280290
    281291This file is part of yat library, http://dev.thep.lu.se/yat
  • tags/0.10/README

    r4254 r4254  
    102102== Optional packages ==
    103103
     104=== Samtools ===
     105
     106Samtools available from http://samtools.sourceforge.net/ is required
     107to enable classes related to bam files. You can build yat without
     108samtools if you run configure with `--without-samtools`, in which case
     109bam related classes are not included in built library. Header files
     110<sam.h> and <bam.h> are needed as well as library libbam. If you have
     111header files available outside compiler's search path, you can help
     112the compiler with `./configure CPPFLAGS=-I<include dir>` when header
     113files are found in directory `<include dir>`. Likewise, you can run
     114`./configure LDFLAGS=-L<lib dir>` when library is found in `<lib dir>`
     115outside linker's search path. In order to run tests related to bam
     116files, the samtools binary is also needed. If not found during
     117configuration, these tests will be skipped. If you have samtools
     118available outside PATH, you can help configure to find it with
     119`./configure SAMTOOLS=/path/to/samtools`.
     120
     121=== ZLIB ===
     122
     123Zlib available from http://www.zlib.net/ is required to build samtools
     124and consequently needed to build yat too, unless you turn off samtools
     125support (please refer to samtools section above). Header file `zlib.h`
     126and library libz are required. If installed in an unconventional
     127location you can help the compiler/linker with `CPPFLAGS=-I<include
     128dir>` and `LDFLAGS=-L<lib dir>`, respectively.
     129
    104130=== ATLAS ===
    105131
     
    131157can be found through http://dev.thep.lu.se/yat. If you wish to build a
    132158local copy, issue `make doc` and you will find the documents in
    133 directory `doc/`.
     159directory `doc/html/`.
    134160
    135161= Developers =
  • tags/0.10/README.developer

    r4254 r4254  
    5959way but there is still some work to do before we do exceptions in a neutral way.
    6060
     61=== Samtools ===
     62
     63Code that depends on samtools API should be excluded from the build
     64when configured --without-samtools, i.e., put files within
     65`HAVE_LIBBAM` conditionals (or alternatively put code inside `#ifdef
     66HAVE_SAMTOOL` preprocessor conditionals). In order to support multiple
     67inclusion styles we do not include <bam.h> directly, but `#include
     68<config_bam.h>` and `#include YAT_BAM_HEADER`. Similarly, for `<sam.h>`
     69include `YAT_SAM_HEADER`. For more details on this, refer to
     70`yat/omic/config_bam.h`.
     71
    6172=== Doxygen ===
    6273We generate our documentation using [http://www.doxygen.org Doxygen]
  • tags/0.10/build_support/yat-config.in

    r4254 r4254  
    22
    33# Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    4 # Copyright (C) 2009, 2010, 2011 Peter Johansson
     4# Copyright (C) 2009, 2010, 2011, 2012 Peter Johansson
    55#
    66# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    7373  --version                   print @PACKAGE@'s version
    7474  --version-major             print @PACKAGE@'s MAJOR version
    75   --version-minor             print @PACKAGE@'s MINOR version 
    76   --version-patch             print @PACKAGE@'s PATCH version 
     75  --version-minor             print @PACKAGE@'s MINOR version
     76  --version-patch             print @PACKAGE@'s PATCH version
    7777  --help                      print this help
    7878
     
    120120       if test "x$includedir" = "x/usr/include"; then
    121121         : # ignore standard include
    122        elif (test "$CXX" = "g++" && 
     122       elif (test "$CXX" = "g++" &&
    123123             test "x$includedir" = "x/usr/local/include"); then
    124124         : # ignore /usr/local/include if we use g++
     
    126126         flags="$flags -I$includedir"
    127127       fi
    128     else 
     128    else
    129129       # For VPATH build we need to add path to some generated files
    130130       # The second part is to allow header files in `yat/utility' to
     
    150150    if test "x$libdir" = "x/usr/lib"; then
    151151      : # ignore standard '/usr/lib'
    152     elif (test "$CXX" = "g++" && 
     152    elif (test "$CXX" = "g++" &&
    153153          test "x$libdir" = "x/usr/local/lib"); then
    154154      : # ignore '/usr/local/lib' if we use g++
     
    178178      fi
    179179      if test "$optarg" = "$min_patch"; then
    180         echo "yat-config: \`$optarg' is not a valid VERSION" 
     180        echo "yat-config: \`$optarg' is not a valid VERSION"
    181181        exit 255
    182182      fi
    183183      if !(test -n "$min_major" && test -n "$min_minor" \
    184            && test -n "$min_patch"); then 
    185         echo "yat-config: \`$optarg' is not a valid VERSION" 
     184           && test -n "$min_patch"); then
     185        echo "yat-config: \`$optarg' is not a valid VERSION"
    186186        exit 255
    187187      fi
     
    191191               ( test $min_minor -eq @YAT_MINOR_VERSION@ && \
    192192                 ( test $min_patch -gt @YAT_PATCH_VERSION@ ||
    193                    (test $min_patch -eq @YAT_PATCH_VERSION@ && 
     193                   (test $min_patch -eq @YAT_PATCH_VERSION@ &&
    194194                    test "@YAT_DEV_BUILD@" = "true" )))))) ; then
    195195      exit 1;
     
    230230if test -n "$flags"; then
    231231   reversed_flags=
    232    for opt in $flags; do
     232   for opt in $flags; do
    233233     reversed_flags="$opt $reversed_flags"
    234234   done
    235235   unique_flags=
    236    for opt in $reversed_flags; do
    237      unique=1;       
    238      for opt2 in $unique_flags; do 
    239        if test $opt = $opt2; then 
    240          unique=0 
     236   for opt in $reversed_flags; do
     237     unique=1;
     238     for opt2 in $unique_flags; do
     239       if test $opt = $opt2; then
     240         unique=0
    241241       fi
    242242     done
  • tags/0.10/configure.ac

    r4254 r4254  
    5858
    5959AC_CONFIG_HEADERS([config.h])
    60 AM_INIT_AUTOMAKE([1.11 std-options color-tests parallel-tests silent-rules -Werror subdir-objects])
     60AM_INIT_AUTOMAKE([1.11 std-options color-tests parallel-tests
     61                  silent-rules subdir-objects])
     62
     63dnl When fatal error are detected we use macro YAT_MSG_ERROR that
     64dnl collects all error messages and aborts configure [just] before
     65dnl creating output files with this message below plus collected
     66dnl messages from YAT_MSG_ERROR calls.
     67YAT_MSG_ERROR_PREPARE([
     68        Some pre-requisites were not fulfilled, aborting configure.
     69        Please consult the 'README' file for more information about what
     70        is needed to compile yat and refer to messages below.
     71])
     72
    6173
    6274# Set default programming language
     
    7385AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
    7486
    75 # Let user overide default CXXFLAGS
    76 if test "${CXXFLAGS+set}" != set; then
    77   CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
    78 fi
     87# record if CXXFLAGS was set by user for further use below
     88AS_IF([test "${CXXFLAGS+set}" = set], [
     89  CXXFLAGS_set_by_user=yes
     90],[
     91  CXXFLAGS_set_by_user=no
     92  # set CXXFLAGS to avoid expansion in AC_PROG_CXX
     93  CXXFLAGS=
     94])
     95
    7996# Checks for programs.
    8097AC_PROG_CXX
     
    124141     [quiet_nan=no])
    125142   AC_MSG_RESULT($quiet_nan)])
     143# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
     144# of created binary, will fail.
     145AS_IF([test x"$quiet_nan" = x"no"], [
     146  YAT_MSG_ERROR([dnl
     147Support for quiet NAN required. yat will not work on this system!])
     148])
     149
    126150# Check for infinity support for doubles in OS
    127151# Check at run-time, but if we are cross-compiling fall back on a
     
    147171     [has_infinity=no])
    148172   AC_MSG_RESULT($has_infinity)])
     173# No support for infinity is fatal -- sub-sequent compilation, or execution
     174# of created binary, will fail.
     175AS_IF([test x"${has_infinity}" = x"no"], [
     176YAT_MSG_ERROR([dnl
     177Support for infinity required. yat will not work on this system!])
     178])
     179
    149180
    150181AC_MSG_CHECKING([g++ deprecation attribute])
     
    179210AC_MSG_NOTICE([checking for libraries])
    180211AC_CHECK_LIBM
     212LIBS="$LIBM $LIBS"
    181213
    182214# find library implementing BLAS C API, or use gslcblas
    183215YAT_LIB_CBLAS([YAT_CBLAS_LIB=$CBLAS_LIB], [YAT_CBLAS_LIB=-lgslcblas])
     216LIBS="$YAT_CBLAS_LIB $LIBS"
    184217
    185218# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
     
    187220gsl_version="1.8"
    188221AC_SUBST(gsl_version)
    189 gsl_ok=yes
    190 YAT_CHECK_GSL([$gsl_version],[gsl_ok=yes],[gsl_ok=no])
     222YAT_CHECK_GSL([$gsl_version],[LIBS="-lgsl $LIBS"],[YAT_MSG_ERROR([dnl
     223GSL $gsl_version (or newer) not found. The GNU Scientific Library
     224(GSL) library cannot be found. Please make sure GSL is
     225installed. Please refer to warnings above for more details])
     226])
    191227
    192228# Boost http://www.boost.org
    193229boost_version=1.35
    194230AC_SUBST(boost_version)
    195 AX_BOOST_BASE(["$boost_version"], [boost_ok=yes], [boost_ok=no])
     231AX_BOOST_BASE(["$boost_version"], [], [YAT_MSG_ERROR([dnl
     232Boost ${boost_version} (or newer) not found. Please install boost, or provide
     233CPPFLAGS=-I/path/to/boost])
     234])
    196235# skip boost link tests if boost is not wanted (--without-boost)
    197236AS_IF([test x"$want_boost" = x"yes"],[
     
    201240  YAT_LD_ADD_FLAG([LDFLAGS], [$BOOST_LDFLAGS])
    202241  # boost tests above only test compilation, so let's try link in the libs
    203   save_LIBS=$LIBS
    204242  LIBS="$LIBS $BOOST_THREAD_LIB $BOOST_SYSTEM_LIB"
    205243  AC_MSG_CHECKING([for thread_specific_ptr])
     
    209247                 [AC_MSG_RESULT([yes])],
    210248                 [AC_MSG_RESULT([no])
    211                   boost_ok=no])
    212   LIBS=$save_LIBS
     249                  YAT_MSG_ERROR([Boost thread library not found. Please install library boost-thread.])
     250                 ])
    213251])
    214252
     
    239277
    240278
     279# samtools API from http://samtools.sourceforge.net
     280AC_ARG_WITH([samtools],
     281            [AS_HELP_STRING([--without-samtools],
     282                            [disable samtools support])],
     283            [],
     284            [with_samtools=yes])
     285
     286AS_IF([test x"$with_samtools" != x"no"], [
     287  AC_CHECK_HEADER([zlib.h], [],
     288    [YAT_MSG_ERROR([Header file 'zlib.h' was not found])])
     289  AC_CHECK_LIB([z], [inflateEnd], [],
     290    [YAT_MSG_ERROR([Library 'libz' was not found])])
     291  YAT_CHECK_HEADER_BAM([],[YAT_MSG_ERROR([Header file 'bam.h' was not found])])
     292  # try link against libbam
     293  YAT_CHECK_LIBBAM([LIBS="$BAM_LIBS $LIBS"
     294                    AC_DEFINE([HAVE_LIBBAM], [1],
     295                              [Define to 1 if libbam is available])],
     296    [YAT_MSG_ERROR([Library 'libbam' was not found])])
     297  AC_PATH_PROG([SAMTOOLS], [samtools], [false])
     298  AC_ARG_VAR([SAMTOOLS], [Tools for alignment in the SAM format])
     299], [
     300  SAMTOOLS=false
     301])
     302AM_CONDITIONAL([HAVE_LIBBAM], [test x"$with_samtools" = x"yes"])
     303AM_CONDITIONAL([HAVE_SAMTOOLS], [test x"$SAMTOOLS" != x"false"])
     304AC_SUBST([SAMTOOLS])
     305AS_IF([test x"$SAMTOOLS" = x"false"], [], [
     306  AC_DEFINE([HAVE_SAMTOOLS], [1], [Define if samtools executable is available])
     307])
     308
    241309#support for large files
    242310AC_SYS_LARGEFILE
     
    246314fi
    247315
     316AC_DEFINE([HAVE_INLINE], [1], [Define if inline is available on system])
     317AC_ARG_ENABLE([debug],
     318  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
     319
     320# If neither --enable-assert nor --disable-assert, set enable_assert
     321# to same as enable_debug
     322AC_ARG_ENABLE([assert],
     323              [AS_HELP_STRING([--enable-assert], [turn on assertions])],
     324              [], [enable_assert=$enable_debug])
     325
    248326# we use prefix INTERNAL_ for variables that are solely needed for
    249327# building yat, i.e., they are not needed for a user of yat and are
    250328# not propagated to yat-config or yat.m4.
    251 AS_IF([test x"$ax_cv_cxx_compiler_vendor" = x"gnu"], [
    252   YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wall -pedantic])
    253 ])
    254 YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DHAVE_INLINE=1])
    255 AC_ARG_ENABLE([debug],
    256   [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
    257 if test "${enable_debug}" = "yes" ; then
    258   YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DYAT_DEBUG=1])
    259   YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-g -O])
    260 else
     329AS_IF([test "${enable_debug}" = "yes"], [
     330  AC_DEFINE([YAT_DEBUG], [1], [Define to activate yat assertioons])
     331  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wall -pedantic -g -O])
     332], [
    261333  # avoid defining GSL_RANGE_CHECK_OFF if GSL_RANGE_CHECK is already defined
    262334  AC_CHECK_DECL([GSL_RANGE_CHECK],[],
    263                 [YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS],[-DGSL_RANGE_CHECK_OFF])])
    264   YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DNDEBUG])
    265   YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-O3])
    266 fi
     335                [AC_DEFINE([GSL_RANGE_CHECK_OFF], [1],
     336                           [Define to turn off GSL range checks])])
     337  # If CXXFLAGS not set by user, set it to default value
     338  AS_IF([test x$CXXFLAGS_set_by_user != xyes], [
     339    YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS],[-O3])
     340  ])
     341])
     342
     343AS_IF([test x"$enable_assert" = x"no"], [
     344  AC_DEFINE([NDEBUG], [1], [Define to turn off assertions])
     345])
    267346
    268347# turn off compiler warning #654 from intel compiler
     
    283362])
    284363
    285 # some versions of boost uses long long - turn off compiler warnings
    286 # with -Wno-long-long
    287 yat_save_CXXFLAGS=$CXXFLAGS
    288 AC_MSG_CHECKING([whether boost uses long long])
    289 CXXFLAGS="$INTERNAL_CXXFLAGS $CXXFLAGS"
    290 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
    291   [
    292     @%:@include <boost/iterator/transform_iterator.hpp>
    293     @%:@include <boost/thread.hpp>
    294     @%:@include <cmath>
    295     @%:@include <functional>
    296     @%:@include <vector>
    297   ],[
     364AS_IF([test x$enable_debug = xyes], [
     365  # some versions of boost uses long long - turn off compiler warnings
     366  # with -Wno-long-long
     367  yat_save_CXXFLAGS=$CXXFLAGS
     368  AC_MSG_CHECKING([whether boost uses long long])
     369  CXXFLAGS="$INTERNAL_CXXFLAGS $CXXFLAGS"
     370  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
     371    [
     372      @%:@include <boost/iterator/transform_iterator.hpp>
     373      @%:@include <boost/thread.hpp>
     374      @%:@include <cmath>
     375      @%:@include <functional>
     376      @%:@include <vector>
     377    ],[
    298378      using namespace boost;
    299379      typedef std::pointer_to_unary_function<double, double> F;
     
    303383      int x = boost::thread::hardware_concurrency();
    304384      ++x;
    305   ])],
    306 [AC_MSG_RESULT([no])],
    307 [AC_MSG_RESULT([yes])
    308  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wno-long-long])
    309 ])
    310 # restore CXXFLAGS
    311 CXXFLAGS=$yat_save_CXXFLAGS
     385    ])],
     386  [AC_MSG_RESULT([no])],
     387  [AC_MSG_RESULT([yes])
     388   YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wno-long-long])
     389  ])
     390  # restore CXXFLAGS
     391  CXXFLAGS=$yat_save_CXXFLAGS
     392])
    312393
    313394#doxygen stuff
     
    331412                   [Define to absolute path to top yat src dir])
    332413
    333 # Print failure status information about selected items, and exit if
    334 # fatal errors were encountered. No output will be created if
    335 # configure is halted prematurely.
    336 
    337 # used to trigger exit before creation of output
    338 all_reqs_ok="true"
    339 
    340 # No support for quiet NAN is fatal -- sub-sequent compilation, or execution
    341 # of created binary, will fail.
    342 if test "${quiet_nan}" = "no" ; then
    343   all_reqs_ok="false"
    344   AC_MSG_WARN([
    345   Support for quiet NAN required.
    346   yat will not work on this system!])
    347 fi
    348 
    349 # No support for infinity is fatal -- sub-sequent compilation, or execution
    350 # of created binary, will fail.
    351 if test "${has_infinity}" = "no" ; then
    352   all_reqs_ok="false"
    353   AC_MSG_WARN([
    354   Support for infinity required.
    355   yat will not work on this system!])
    356 fi
    357 
    358 
    359 # Non-existing GSL is fatal -- sub-sequent compilation will fail.
    360 if test "x$gsl_ok" != "xyes" ; then
    361   all_reqs_ok="false"
    362   AC_MSG_WARN([
    363   GSL $gsl_version (or newer) not found. The GNU Scientific Library
    364   (GSL) library cannot be found. Please make sure GSL is
    365   installed. Please refer to warnings above for more details])
    366 fi
    367 
    368 if test "x$want_boost" = "xyes"; then
    369 # Too old Boost is fatal -- sub-sequent compilation will fail.
    370 AS_IF([test "${boost_ok}" != "yes"],[
    371   all_reqs_ok="false"
    372   AC_MSG_WARN([
    373   Boost ${boost_version} (or newer) not found. Please make sure Boost
    374   is installed.])
    375 ], [
    376   AS_IF([test x$ax_cv_boost_thread = xno], [
    377     all_reqs_ok="false"
    378     AC_MSG_WARN([
    379   Boost thread library not found. Please make sure library boost-thread is
    380   is installed.])
    381   ])
    382 ])
    383 fi
    384 
    385 if (test "$all_reqs_ok" = "false") ; then
    386   AC_MSG_FAILURE([
    387   Some pre-requisites were not fulfilled, aborting configure.
    388   Please consult the 'README' file for more information about what
    389   is needed to compile yat and refer to above warning messages.
    390   Needed files were NOT created.])
    391 fi
    392 
    393414# Reset flags
    394415APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_)
     
    397418APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_)
    398419
    399 YAT_PRIMARY_LIBS="-lgsl $BOOST_THREAD_LIB $BOOST_SYSTEM_LIB"
    400 YAT_LIBS="$YAT_PRIMARY_LIBS $YAT_CBLAS_LIB $LIBM"
     420# YAT_LIBS minus cblas and math libraries
     421YAT_PRIMARY_LIBS=
     422for lib in $YAT_LIBS; do
     423  AS_CASE([$lib], [$YAT_CBLAS_LIB], [],
     424          [$LIBM], [],
     425          [YAT_PRIMARY_LIBS="$YAT_PRIMARY_LIBS $lib"])
     426done
    401427AC_SUBST(YAT_PRIMARY_LIBS)
    402428AC_SUBST(YAT_LIBS)
     
    404430
    405431# set and AC_SUBST variables that are interpreted by Automake
    406 AM_CPPFLAGS="-I\$(top_srcdir) $INTERNAL_CPPFLAGS $YAT_CPPFLAGS"
     432AM_CPPFLAGS="$INTERNAL_CPPFLAGS $YAT_CPPFLAGS"
    407433AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS"
    408434AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS"
     
    434460])
    435461
    436 AC_MSG_RESULT([----------------------------------------------------------------])
    437 AC_MSG_RESULT([Creating yat configuration])
    438462# Create output.
    439463AC_OUTPUT
     
    447471  Build Static Library: $enable_static
    448472  Build Documentation:  $doxygen_message
     473  With Bam Support:     $with_samtools
    449474
    450475Options used to compile and link:
  • tags/0.10/m4/Makefile.am

    r4254 r4254  
    2626aclocal_DATA += m4/yat_am_macros.m4
    2727aclocal_DATA += m4/yat_cblas.m4
     28aclocal_DATA += m4/yat_check_libbam.m4
    2829aclocal_DATA += m4/yat_common.m4
    2930aclocal_DATA += m4/yat_gsl.m4
  • tags/0.10/m4/ax_boost_system.m4

    r4254 r4254  
    3232#   warranty.
    3333
    34 #serial 14
     34#serial 17
    3535
    3636AC_DEFUN([AX_BOOST_SYSTEM],
     
    8484      LDFLAGS_SAVE=$LDFLAGS
    8585            if test "x$ax_boost_user_system_lib" = "x"; then
    86                 for libextension in `ls $BOOSTLIBDIR/libboost_system*.so* $BOOSTLIBDIR/libboost_system*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.so.*$;\1;' -e 's;^lib\(boost_system.*\)\.a*$;\1;'` ; do
     86                for libextension in `ls -r $BOOSTLIBDIR/libboost_system* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'` ; do
    8787                     ax_lib=${libextension}
    8888            AC_CHECK_LIB($ax_lib, exit,
     
    9191        done
    9292                if test "x$link_system" != "xyes"; then
    93                 for libextension in `ls $BOOSTLIBDIR/boost_system*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.dll.*$;\1;' -e 's;^\(boost_system.*\)\.a*$;\1;'` ; do
     93                for libextension in `ls -r $BOOSTLIBDIR/boost_system* 2>/dev/null | sed 's,.*/,,' | sed -e 's,\..*,,'` ; do
    9494                     ax_lib=${libextension}
    9595            AC_CHECK_LIB($ax_lib, exit,
  • tags/0.10/m4/ax_boost_thread.m4

    r4254 r4254  
    3131#   warranty.
    3232
    33 #serial 23
     33#serial 27
    3434
    3535AC_DEFUN([AX_BOOST_THREAD],
     
    105105                        esac
    106106            if test "x$ax_boost_user_thread_lib" = "x"; then
    107                 for libextension in `ls $BOOSTLIBDIR/libboost_thread*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_thread.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_thread*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_thread.*\)\.a*$;\1;'`; do
     107                for libextension in `ls -r $BOOSTLIBDIR/libboost_thread* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'`; do
    108108                     ax_lib=${libextension}
    109109            AC_CHECK_LIB($ax_lib, exit,
     
    112112        done
    113113                if test "x$link_thread" != "xyes"; then
    114                 for libextension in `ls $BOOSTLIBDIR/boost_thread*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/boost_thread*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.a*$;\1;'` ; do
     114                for libextension in `ls -r $BOOSTLIBDIR/boost_thread* 2>/dev/null | sed 's,.*/,,' | sed 's,\..*,,'`; do
    115115                     ax_lib=${libextension}
    116116            AC_CHECK_LIB($ax_lib, exit,
  • tags/0.10/m4/version.m4

    r4254 r4254  
    22#
    33# Copyright (C) 2008, 2009 Jari Häkkinen, Peter Johansson
    4 # Copyright (C) 2010, 2011, 2012 Peter Johansson
     4# Copyright (C) 2010, 2011, 2012, 2013 Peter Johansson
    55#
    66# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2626m4_include([m4/my_version.m4])
    2727
    28 MY_VERSION_early([0], [9], [2], [false])
     28MY_VERSION_early([0], [10], [0], [false])
    2929
    3030# Library versioning (current:revision:age)
     
    6969# yat-0.9.1  6:1:0
    7070# yat-0.9.2  6:2:0
     71# yat-0.10   7:0:0
    7172#
    7273# *Accidently, the libtool number was not updated for yat 0.5
    7374#
    74 m4_define([YAT_LT_VERSION_INFO], [6:2:0])
     75m4_define([YAT_LT_VERSION_INFO], [7:0:0])
  • tags/0.10/m4/yat.m4

    r4254 r4254  
    11## $Id$
    22#
    3 # serial 7  (yat 0.9)
     3# serial 8  (yat 0.10)
    44#
    55# see http://www.gnu.org/software/automake/manual/automake.html#Serials
     
    115115AC_REQUIRE([YAT_FIND_YAT])  dnl
    116116YAT_CHECK_VERSION([$1],,[ac_yat_check_yat_res="no"])
    117 YAT_CHECK_HEADER(,[ac_yat_check_yat_res="no"])
    118 YAT_CHECK_LIB(,[ac_yat_check_yat_res="no"])
     117
     118AS_IF([test x$ac_yat_check_yat_res = xyes], [
     119  YAT_CHECK_HEADER(,[ac_yat_check_yat_res="no"])
     120])
     121
     122AS_IF([test x$ac_yat_check_yat_res = xyes], [
     123  YAT_CHECK_LIB(,[ac_yat_check_yat_res="no"])
     124])
    119125
    120126_YAT_ACTION([test "$ac_yat_check_yat_res" != "no"],[$2],[$3])
  • tags/0.10/m4/yat_cblas.m4

    r4254 r4254  
    1616# COPYLEFT
    1717#
    18 #   Copyright (C) 2009 Peter Johansson
     18#   Copyright (C) 2009, 2012 Peter Johansson
    1919#
    2020#   This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3939
    4040#
    41 # serial 0 
     41# serial 0
    4242#
    4343
  • tags/0.10/m4/yat_msg_error.m4

    r4254 r4254  
    22
    33#
    4 # serial 2 (yat 0.9)
     4# serial 3 (yat 0.10)
    55#
    66
     
    3434[
    3535  AC_REQUIRE([YAT_MSG_ERROR_PREPARE])
    36   AS_ECHO(["$1"]) >> conftest.yat_msg_error
     36  AS_ECHO(["$1"]) >> yat_msg_error.txt
    3737  AS_ECHO(["$as_me:$LINENO: error: $1"]) >& AS_MESSAGE_LOG_FD
    3838]) # YAT_MSG_ERROR
     
    4646AC_DEFUN([YAT_MSG_ERROR_PREPARE],
    4747[
     48rm -f yat_msg_error.txt
    4849AC_CONFIG_COMMANDS_PRE([
    49    AS_IF([test -f conftest.yat_msg_error], [
     50   AS_IF([test -f yat_msg_error.txt], [
    5051     msg="m4_default([$1], [some requirements were not fulfilled, see below])"
    5152     AS_ECHO(["$as_me: error: $msg"]) >&2
    52      cat conftest.yat_msg_error >&2
     53     cat yat_msg_error.txt >&2
    5354     AS_EXIT([1])
    5455   ])
  • tags/0.10/test/Makefile.am

    r4254 r4254  
    3939  test/averager3.test \
    4040  test/averager4.test \
     41  test/bam_pair_analyse test/bam_iterator test/bam_region_iterator \
    4142  test/codon.test test/commandline.test \
    4243  test/concept.test \
    4344  test/consensus_inputranker.test test/data_lookup_1d.test  \
    44   test/data_weight.test test/data_weight_proxy.test test/distance.test \
     45  test/data_weight.test test/data_weight_proxy.test \
     46  test/deleter.test \
     47  test/distance.test \
    4548  test/dna.test test/ensemble.test test/feature_selection.test \
    4649  test/fileutil.test \
     
    100103LDADD = yat/libyat.la test/libyattest.la $(YAT_LIBS)
    101104
    102 test_large_file_test_LDADD = test/libyattest.la
    103 
     105#test_large_file_test_LDADD = test/libyattest.la
     106
     107test_libyattest_la_LIBADD = yat/libyat.la
    104108test_libyattest_la_SOURCES = test/Suite.cc
    105109
     
    214218## test data
    215219EXTRA_DIST += \
     220test/data/foo.sam \
    216221test/data/isoform.peaks \
    217222test/data/knni_matrix.data \
     
    243248test/data/wenni_result.data \
    244249test/data/wenni_weight.data
     250
     251CLEANFILES += test/data/.dirstamp
     252CLEANFILES += test/data/foo.bam
     253CLEANFILES += test/data/foo.sorted.bam
     254CLEANFILES += test/data/foo.sorted.bam.bai
     255
     256check_DATA  = test/data/foo.sorted.bam
     257check_DATA += test/data/foo.sorted.bam.bai
     258
     259test/data/.dirstamp:
     260  @$(MKDIR_P) test/data
     261  @: > $@
     262
     263if HAVE_SAMTOOLS
     264test/data/foo.bam: test/data/foo.sam test/data/.dirstamp Makefile
     265  $(SAMTOOLS) view -Sb $(srcdir)/test/data/foo.sam > $@-t && mv $@-t $@
     266
     267test/data/foo.sorted.bam: test/data/foo.bam
     268  $(SAMTOOLS) sort test/data/foo.bam test/data/foo.sorted
     269
     270test/data/foo.sorted.bam.bai: test/data/foo.sorted.bam
     271  $(SAMTOOLS) index test/data/foo.sorted.bam
     272else
     273test/data/foo.sorted.bam: test/data/.dirstamp
     274  : > $@
     275
     276test/data/foo.sorted.bam.bai: test/data/.dirstamp
     277  : > $@
     278endif
  • tags/0.10/test/Suite.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2009, 2010, 2011 Peter Johansson
     5  Copyright (C) 2009, 2010, 2011, 2012 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2424
    2525#include "Suite.h"
     26#include "yat/utility/utility.h"
    2627
    2728#include <algorithm>
     
    4344    : known_issues_(0), ok_(true)
    4445  {
     46    std::string test_dir = "test/testSubDir/" + utility::basename(argv[0]);
     47    utility::mkdir_p(test_dir);
     48    chdir(test_dir.c_str());
     49    out() << "running '" << argv[0] << "' in '" << test_dir << "'\n";
    4550    // synchronize cerr and cout, i.e., cout is flushed before
    4651    // writing anything to cerr.
  • tags/0.10/test/Suite.h

    r4254 r4254  
    66/*
    77  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2009, 2010, 2011 Peter Johansson
     8  Copyright (C) 2009, 2010, 2011, 2012 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2525
    2626#define YAT_TEST_PROLOGUE "\n=== " << __func__ << " ===\n"
     27
     28// used to tell automake that test should be skipped
     29#define EXIT_SKIP 77
    2730
    2831#include <yat/utility/VectorMutable.h>
  • tags/0.10/test/alignment.cc

    r4254 r4254  
    2222  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2323*/
     24
     25#include <config.h>
    2426
    2527#include "Suite.h"
  • tags/0.10/test/alignment2.cc

    r4254 r4254  
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/averager.cc

    r4254 r4254  
    2222  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2323*/
     24
     25#include <config.h>
    2426
    2527#include "Suite.h"
  • tags/0.10/test/averager1.cc

    r4254 r4254  
    1717  along with yat. If not, see <http://www.gnu.org/licenses/>.
    1818*/
     19
     20#include <config.h>
    1921
    2022#include "Suite.h"
  • tags/0.10/test/averager3.cc

    r4254 r4254  
    1717  along with yat. If not, see <http://www.gnu.org/licenses/>.
    1818*/
     19
     20#include <config.h>
    1921
    2022#include "Suite.h"
  • tags/0.10/test/averager4.cc

    r4254 r4254  
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/codon.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2010, 2011 Peter Johansson
     4  Copyright (C) 2010, 2011, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/commandline.cc

    r4254 r4254  
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "Suite.h"
     
    6264  suite.err() << "testing commandline" << std::endl;
    6365
    64   // Peter, creation of this directory should perhaps be in a more central place
    65   FileUtil dir("test/testSubDir");
    66   if (!dir.exists())
    67     if (mkdir(dir.path().c_str(), 0755)) {
    68       suite.err() << "mkdir " << dir.path() << " failed\n";
    69       return 1;
    70     }
    71   FileUtil subdir("test/testSubDir/commandline_test.dir");
    72   if (!subdir.exists()) {
    73     if (mkdir(subdir.path().c_str(), 0755)) {
    74       suite.err() << "mkdir " << subdir.path() << " failed\n";
    75       return 1;
    76     }
    77   }
    78   if (subdir.permissions("w")) {
    79     chmod(subdir.path().c_str(), S_IREAD | S_IWRITE | S_IEXEC);
    80   }
    81 
    8266  try {
    8367    suite.add(cmd_help(suite));
     
    626610  }
    627611
    628   FileUtil subdir("test/testSubDir/commandline_test.dir/write-protected");
     612  FileUtil subdir("write-protected");
    629613  if (!subdir.exists()) {
    630614    if (mkdir(subdir.path().c_str(), 0555)) {
  • tags/0.10/test/common_defs.sh.in

    r4254 r4254  
    22# $Id$
    33
    4 # Copyright (C) 2009, 2010, 2011, 2012 Peter Johansson
     4# Copyright (C) 2009, 2010, 2011, 2012, 2013 Peter Johansson
    55#
    66# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    115115@MKDIR_P@ --verbose $test_dir
    116116
     117# Taken from Automake 1.11 tests/defs.sh.in
     118
     119# Unset some MAKE... variables that may cause 'make' to act like a
     120# recursively invoked sub-make.  Any 'make' invocation in a test is
     121# conceptually an independent invocation, not part of the main
     122# 'yat' build.
     123unset MFLAGS
     124unset MAKEFLAGS
     125unset MAKELEVEL
     126unset DESTDIR
     127unset V
     128unset TESTS
     129unset TEST_LOGS
     130unset RECHECK_LOGS
     131unset VERBOSE
     132
    117133cd $test_dir
    118134
  • tags/0.10/test/concept.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2010 Peter Johansson
     4  Copyright (C) 2010, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/consensus_inputranker.cc

    r4254 r4254  
    44  Copyright (C) 2004, 2005 Peter Johansson
    55  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2012 Peter Johansson
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2021  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2122*/
     23
     24#include <config.h>
    2225
    2326#include "Suite.h"
  • tags/0.10/test/crossvalidation.cc

    r4254 r4254  
    55  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    66  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2012 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2122  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2223*/
     24
     25#include <config.h>
    2326
    2427#include "yat/classifier/CrossValidationSampler.h"
  • tags/0.10/test/data_lookup_1d.cc

    r4254 r4254  
    44  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    55  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    6   Copyright (C) 2009 Peter Johansson
     6  Copyright (C) 2009, 2012 Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2121  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2222*/
     23
     24#include <config.h>
    2325
    2426#include "Suite.h"
  • tags/0.10/test/data_weight.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "Suite.h"
  • tags/0.10/test/data_weight_proxy.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2008, 2009, 2010 Peter Johansson
     4  Copyright (C) 2008, 2009, 2010, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/distance.cc

    r4254 r4254  
    44  Copyright (C) 2007 Jari Häkkinen, Markus Ringnér
    55  Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
    6   Copyright (C) 2009, 2010 Peter Johansson
     6  Copyright (C) 2009, 2010, 2012 Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2121  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2222*/
     23
     24#include <config.h>
    2325
    2426#include "Suite.h"
  • tags/0.10/test/dna.cc

    r4254 r4254  
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/ensemble.cc

    r4254 r4254  
    55  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    66  Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
    7   Copyright (C) 2009 Peter Johansson
     7  Copyright (C) 2009, 2012 Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2222  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2323*/
     24
     25#include <config.h>
    2426
    2527#include "Suite.h"
  • tags/0.10/test/feature_selection.cc

    r4254 r4254  
    55  Copyright (C) 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
    66  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    7   Copyright (C) 2009 Peter Johansson
     7  Copyright (C) 2009, 2012 Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2222  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2323*/
     24
     25#include <config.h>
    2426
    2527#include "Suite.h"
  • tags/0.10/test/fileutil.cc

    r4254 r4254  
    44  Copyright (C) 2006 Jari Häkkinen
    55  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    6   Copyright (C) 2009, 2010 Peter Johansson
     6  Copyright (C) 2009, 2010, 2012 Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2121  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2222*/
     23
     24#include <config.h>
    2325
    2426#include "Suite.h"
  • tags/0.10/test/fisher.cc

    r4254 r4254  
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/genomic_position.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2010 Peter Johansson
     4  Copyright (C) 2010, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/getline_iterator.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2009 Peter Johansson
     4  Copyright (C) 2009, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/gff.cc

    r4254 r4254  
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/help.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2011 Peter Johansson
     4  Copyright (C) 2011, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "yat/utility/CommandLine.h"
  • tags/0.10/test/histogram.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2009, 2010 Peter Johansson
     4  Copyright (C) 2009, 2010, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/igp.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2009 Peter Johansson
     4  Copyright (C) 2009, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/index.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "Suite.h"
  • tags/0.10/test/inputranker.cc

    r4254 r4254  
    44  Copyright (C) 2004, 2005 Peter Johansson
    55  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2012 Peter Johansson
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2021  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2122*/
     23
     24#include <config.h>
    2225
    2326#include "Suite.h"
  • tags/0.10/test/interpolation.cc

    r4254 r4254  
    44  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    55  Copyright (C) 2009 Jari Häkkinen
     6  Copyright (C) 2012 Peter Johansson
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2021  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2122*/
     23
     24#include <config.h>
    2225
    2326#include "Suite.h"
  • tags/0.10/test/iterator.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
    5   Copyright (C) 2009, 2010 Peter Johansson
     5  Copyright (C) 2009, 2010, 2012 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "Suite.h"
  • tags/0.10/test/kendall.cc

    r4254 r4254  
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/kernel.cc

    r4254 r4254  
    55  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    66  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    7   Copyright (C) 2009 Peter Johansson
     7  Copyright (C) 2009, 2012 Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2222  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2323*/
     24
     25#include <config.h>
    2426
    2527#include "Suite.h"
  • tags/0.10/test/kernel_lookup.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2010 Peter Johansson
     5  Copyright (C) 2010, 2012 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "Suite.h"
  • tags/0.10/test/kernel_pca.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2010 Peter Johansson
     4  Copyright (C) 2010, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/knn.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
    5   Copyright (C) 2010 Peter Johansson
     5  Copyright (C) 2010, 2012 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "Suite.h"
  • tags/0.10/test/kolmogorov_smirnov.cc

    r4254 r4254  
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/large_file.cc

    r4254 r4254  
    2222*/
    2323
    24 #ifdef HAVE_CONFIG_H
    2524#include "config.h"
    26 #endif
    2725
    2826#include "Suite.h"
  • tags/0.10/test/matrix.cc

    r4254 r4254  
    2222  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2323*/
     24
     25#include <config.h>
    2426
    2527#include "Suite.h"
  • tags/0.10/test/matrix_lookup.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2010 Peter Johansson
     5  Copyright (C) 2010, 2012 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "Suite.h"
  • tags/0.10/test/matrix_lookup_weighted.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2008, 2010 Peter Johansson
     4  Copyright (C) 2008, 2010, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/matrix_weighted.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2009, 2010 Peter Johansson
     5  Copyright (C) 2009, 2010, 2012 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "Suite.h"
  • tags/0.10/test/merge.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2009, 2010 Peter Johansson
     4  Copyright (C) 2009, 2010, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/nbc.cc

    r4254 r4254  
    44  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    55  Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
     6  Copyright (C) 2012 Peter Johansson
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2021  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2122*/
     23
     24#include <config.h>
    2225
    2326#include "Suite.h"
  • tags/0.10/test/ncc.cc

    r4254 r4254  
    44  Copyright (C) 2006 Jari Häkkinen, Markus Ringnér
    55  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
    6   Copyright (C) 2010 Peter Johansson
     6  Copyright (C) 2010, 2012 Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2121  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2222*/
     23
     24#include <config.h>
    2325
    2426#include "Suite.h"
  • tags/0.10/test/nni.cc

    r4254 r4254  
    77  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    88  Copyright (C) 2009 Jari Häkkinen
     9  Copyright (C) 2012 Peter Johansson
    910
    1011  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2324  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2425*/
     26
     27#include <config.h>
    2528
    2629#include "Suite.h"
  • tags/0.10/test/normalization.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2008, 2009 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2010 Peter Johansson
     5  Copyright (C) 2010, 2012 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "Suite.h"
  • tags/0.10/test/pca.cc

    r4254 r4254  
    77  Copyright (C) 2006 Jari Häkkinen
    88  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     9  Copyright (C) 2012 Peter Johansson
    910
    1011  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2324  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2425*/
     26
     27#include <config.h>
    2528
    2629#include "Suite.h"
  • tags/0.10/test/range.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "Suite.h"
  • tags/0.10/test/regression.cc

    r4254 r4254  
    2121  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2222*/
     23
     24#include <config.h>
    2325
    2426#include "Suite.h"
  • tags/0.10/test/rnd.cc

    r4254 r4254  
    77  Copyright (C) 2006 Jari Häkkinen
    88  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     9  Copyright (C) 2012 Peter Johansson
    910
    1011  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2324  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2425*/
     26
     27#include <config.h>
    2528
    2629#include "Suite.h"
     
    5962  Gaussian g;
    6063
     64  Binomial bin(0.5, 10);
     65
    6166  return suite.return_value();
    6267}
  • tags/0.10/test/rng-mt.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2012 Peter Johansson
     4  Copyright (C) 2012, 2013 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020*/
    2121
     22#include <config.h>
     23
    2224#include "Suite.h"
    2325
     
    2729
    2830#include <algorithm>
     31#include <cstdlib>
    2932#include <iostream>
    3033#include <iterator>
     34#include <stdexcept>
    3135#include <vector>
    3236
     
    4246  void operator()(void)
    4347  {
    44     for (std::vector<int>::iterator i=begin_; i!=end_; ++i)
    45       *i = rnd_(100);
     48    try {
     49      for (std::vector<int>::iterator i=begin_; i!=end_; ++i)
     50        *i = rnd_(100);
     51    }
     52    catch (std::exception& e) {
     53      std::cerr << e.what() << "\n";
     54      exit(EXIT_FAILURE);
     55    }
    4656  }
    4757
     
    8595  suite.out() << "\ny: ";
    8696  std::copy(y.begin(), y.end(), std::ostream_iterator<int>(suite.out(), " "));
    87   suite.out() << "\n";
     97  suite.out() << std::endl;
    8898
    8999  if (x==y) {
     
    91101    suite.err() << "x and y are equal\n";
    92102  }
     103}
    93104
     105
     106std::vector<int> rnd_vec(void)
     107{
     108  std::vector<int> x(10);
     109  Visitor visitor1(x);
     110  boost::thread_group threads;
     111  threads.create_thread(visitor1);
     112  threads.join_all();
     113  return x;
    94114}
    95115
     
    100120  // test that we get same number with same seed
    101121  RNG::instance()->seed(0);
    102   std::vector<int> x(10);
    103   Visitor visitor1(x);
    104   boost::thread_group threads;
    105   threads.create_thread(visitor1);
    106   threads.join_all();
    107   std::vector<int> y(x);
     122  std::vector<int> y = rnd_vec();
     123  suite.out() << "y: ";
     124  std::copy(y.begin(), y.end(), std::ostream_iterator<int>(suite.out(), " "));
     125  suite.out() << std::endl;
     126
    108127  RNG::instance()->seed(0);
    109   threads.create_thread(visitor1);
    110   threads.join_all();
     128  std::vector<int> x = rnd_vec();
    111129  suite.out() << "x: ";
    112130  std::copy(x.begin(), x.end(), std::ostream_iterator<int>(suite.out(), " "));
    113   suite.out() << "\ny: ";
    114   std::copy(y.begin(), y.end(), std::ostream_iterator<int>(suite.out(), " "));
    115   suite.out() << "\n";
     131  suite.out() << std::endl;
    116132  if (x!=y) {
    117133    suite.add(false);
     
    133149  Visitor visitor(x);
    134150  visitor();
    135 
    136   std::vector<int> y(x);
    137   Visitor visitor1(y);
    138   boost::thread_group threads;
    139   threads.create_thread(visitor1);
    140   threads.join_all();
    141 
    142151  suite.out() << "x: ";
    143152  std::copy(x.begin(), x.end(), std::ostream_iterator<int>(suite.out(), " "));
    144   suite.out() << "\ny: ";
     153  suite.out() << std::endl;
     154
     155  std::vector<int> y = rnd_vec();
     156  suite.out() << "y: ";
    145157  std::copy(y.begin(), y.end(), std::ostream_iterator<int>(suite.out(), " "));
    146   suite.out() << "\n";
     158  suite.out() << std::endl;
    147159
    148160  if (x==y) {
  • tags/0.10/test/roc.cc

    r4254 r4254  
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "Suite.h"
  • tags/0.10/test/score.cc

    r4254 r4254  
    55  Copyright (C) 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
    66  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2012 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2122  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2223*/
     24
     25#include <config.h>
    2326
    2427#include "Suite.h"
  • tags/0.10/test/segment.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2010, 2011 Peter Johansson
     4  Copyright (C) 2010, 2011, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/smart_ptr.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "Suite.h"
  • tags/0.10/test/smoother.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2010 Peter Johansson
     4  Copyright (C) 2010, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/spearman.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2011 Peter Johansson
     4  Copyright (C) 2011, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/split.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2010 Peter Johansson
     4  Copyright (C) 2010, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020*/
    2121
     22#include <config.h>
     23
    2224#include "Suite.h"
    2325
     
    2931using namespace theplu::yat;
    3032
     33template<typename T>
    3134void test_split(const std::vector<std::string>& correct, const std::string& str,
    32                 char delim, test::Suite& suite);
     35                T delim, test::Suite& suite);
    3336
    3437int main(int argc, char* argv[])
     
    5356  test_split(correct, "banan", 'n', suite);
    5457
     58  correct[0]="split";
     59  correct[1]="me";
     60  correct[2]="please";
     61  test_split(correct, "split,me;please", ";,", suite);
     62
     63
    5564  return suite.return_value();
    5665}
    5766
     67  template<typename T>
    5868void test_split(const std::vector<std::string>& correct, const std::string& str,
    59                 char delim, test::Suite& suite)
     69                T delim, test::Suite& suite)
    6070{
    6171  suite.out() << "split(vec, \"" << str << "\", '" << delim << "')\n";
  • tags/0.10/test/statistics.cc

    r4254 r4254  
    66  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    77  Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2010, 2011 Peter Johansson
     8  Copyright (C) 2010, 2011, 2012 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2323  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2424*/
     25
     26#include <config.h>
    2527
    2628#include "Suite.h"
  • tags/0.10/test/stream_redirect.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2009 Peter Johansson
     4  Copyright (C) 2009, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/subset_generator.cc

    r4254 r4254  
    44  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    55  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2012 Peter Johansson
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2021  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2122*/
     23
     24#include <config.h>
    2225
    2326#include "Suite.h"
  • tags/0.10/test/svd.cc

    r4254 r4254  
    77  Copyright (C) 2006 Jari Häkkinen
    88  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     9  Copyright (C) 2012 Peter Johansson
    910
    1011  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2324  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2425*/
     26
     27#include <config.h>
    2528
    2629#include "Suite.h"
  • tags/0.10/test/svm.cc

    r4254 r4254  
    55  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    66  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2012 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2122  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2223*/
     24
     25#include <config.h>
    2326
    2427#include "Suite.h"
  • tags/0.10/test/svm_multi_class.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2009 Peter Johansson
     4  Copyright (C) 2009, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/target.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "Suite.h"
  • tags/0.10/test/ttest.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "Suite.h"
  • tags/0.10/test/tukey.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2011 Peter Johansson
     4  Copyright (C) 2011, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Suite.h"
  • tags/0.10/test/utility.cc

    r4254 r4254  
    55  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    66  Copyright (C) 2009, 2010, 2011 Peter Johansson
     7  Copyright (C) 2012 Jari Häkkinen, Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2122  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2223*/
     24
     25#include <config.h>
    2326
    2427#include "Suite.h"
     
    3437#include <boost/concept_archetype.hpp>
    3538
     39#include <cassert>
    3640#include <cerrno>
    3741#include <fstream>
     
    5054void test_load2(test::Suite&);
    5155void test_inverse(test::Suite&);
     56
     57void test_dirname(test::Suite& suite);
     58void test_basename(test::Suite& suite);
     59void test_fnmatch(test::Suite& suite);
     60bool test_fnmatch(bool, std::string, std::string);
    5261
    5362template<typename InputIterator, typename Key>
     
    196205
    197206  test_compose_functors(suite);
     207
     208  double x = 8.0;
     209  suite.add(suite.equal(utility::log2(x), 3.0));
     210  float xf = x;
     211  suite.add(suite.equal(utility::log2(xf), 3.0));
     212  long double xld = 8.0;
     213  suite.add(suite.equal(utility::log2(xld), 3.0));
     214
     215  test_basename(suite);
     216  test_dirname(suite);
     217  test_fnmatch(suite);
    198218
    199219  return suite.return_value();
     
    383403    std::multimap<std::string, size_t, std::greater<std::string> > m4;
    384404    utility::inverse(start, end, m4);
     405
     406    std::map<std::string, size_t> unique_map;
     407    utility::inverse(start, end, unique_map);
    385408  }
    386409}
     
    505528
    506529}
     530
     531
     532void test_fnmatch(test::Suite& suite)
     533{
     534  bool ok=true;
     535  ok &= test_fnmatch(true,"peter", "peter");
     536  ok &= test_fnmatch(false,"peter", "peterj");
     537
     538  ok &= test_fnmatch(true,"*", "peterj");
     539  ok &= test_fnmatch(true,"p*", "peterj");
     540  ok &= test_fnmatch(true, "p*", "peter");
     541  ok &= test_fnmatch(false, "p*j", "peter");
     542  ok &= test_fnmatch(true, "p*j", "peterj");
     543  ok &= test_fnmatch(true, "*peter", "peter");
     544
     545  ok &= test_fnmatch(true, "p?ter", "peter");
     546  ok &= test_fnmatch(false, "p?er", "peter");
     547  ok &= test_fnmatch(false, "p?eter", "peter");
     548
     549  ok &= test_fnmatch(true, "filename", "filename");
     550  ok &= test_fnmatch(true, "*name", "filename");
     551  ok &= test_fnmatch(true, "[fa]il?name", "filename");
     552  ok &= test_fnmatch(true, "[fa]*il?name", "ffilename");
     553
     554  ok &= test_fnmatch(true, "[fa]*il?name", "fafafailename");
     555  ok &= test_fnmatch(false, "[fa]?il?name", "ilename");
     556  ok &= test_fnmatch(false, "?[fa]il?name", "ilename");
     557  ok &= test_fnmatch(true, "[fa]il?name", "filename");
     558  ok &= test_fnmatch(false, "[fa]?il?name", "fafafailename");
     559
     560  ok &= test_fnmatch(true, "*name", "/path/to/filename");
     561  ok &= test_fnmatch(true, "*name", "file.name");
     562  ok &= test_fnmatch(true, "*.txt", ".file.txt");
     563  suite.add(ok);
     564}
     565
     566
     567void test_dirname(test::Suite& suite)
     568{
     569  std::vector<std::string> path;
     570  path.push_back("/usr/lib");
     571  path.push_back("/usr/");
     572  path.push_back("usr");
     573  path.push_back("/");
     574  path.push_back(".");
     575  path.push_back("..");
     576  std::vector<std::string> dir;
     577  dir.push_back("/usr");
     578  dir.push_back("/");
     579  dir.push_back(".");
     580  dir.push_back("/");
     581  dir.push_back(".");
     582  dir.push_back(".");
     583  assert(dir.size()==path.size());
     584  using utility::dirname;
     585  for (size_t i=0; i<dir.size(); ++i) {
     586    if (dir[i] != dirname(path[i])) {
     587      suite.add(false);
     588      suite.out() << "error:\n";
     589      suite.out() << "path:           " << path[i] << "\n";
     590      suite.out() << "directory_name: " << dirname(path[i]) << "\n";
     591      suite.out() << "expected:       " << dir[i] << "\n";
     592    }
     593  }
     594}
     595
     596
     597void test_basename(test::Suite& suite)
     598{
     599  std::vector<std::string> path;
     600  path.push_back("/usr/lib");
     601  path.push_back("/usr/");
     602  path.push_back("usr");
     603  path.push_back("/");
     604  path.push_back(".");
     605  path.push_back("..");
     606  std::vector<std::string> file;
     607  file.push_back("lib");
     608  file.push_back("usr");
     609  file.push_back("usr");
     610  file.push_back("/");
     611  file.push_back(".");
     612  file.push_back("..");
     613  assert(file.size()==path.size());
     614  using utility::basename;
     615  for (size_t i=0; i<file.size(); ++i) {
     616    if (file[i] != basename(path[i])) {
     617      suite.add(false);
     618      suite.out() << "error:\n";
     619      suite.out() << "path:           " << path[i] << "\n";
     620      suite.out() << "basename:       " << basename(path[i]) << "\n";
     621      suite.out() << "expected:       " << file[i] << "\n";
     622    }
     623  }
     624}
     625
     626
     627bool test_fnmatch(bool answ, std::string a, std::string b)
     628{
     629  using namespace utility;
     630  bool res = fnmatch(a, b);
     631  // check that fnmatch and regexp agree
     632  if (res == answ)
     633    return true;
     634  if (res!=answ)
     635    std::cerr << "fnmatch(" << a << ", " << b << ") results "
     636              << res
     637              << ". Expects " << answ << std::endl;
     638  return false;
     639}
  • tags/0.10/test/vector.cc

    r4254 r4254  
    77  Copyright (C) 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
    88  Copyright (C) 2008, 2009 Jari Häkkinen, Peter Johansson
     9  Copyright (C) 2012 Peter Johansson
    910
    1011  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2324  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2425*/
     26
     27#include <config.h>
    2528
    2629#include "Suite.h"
  • tags/0.10/test/version.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2009, 2011 Peter Johansson
     5  Copyright (C) 2009, 2011, 2012 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "Suite.h"
     
    4749  suite.out() << "    patch:   " << patch_version() << "\n";
    4850
     51  suite.add(YAT_VERSION == version());
     52
    4953  suite.out() << "Boost API version: " << BOOST_LIB_VERSION << "\n";
    5054  suite.out() << "GSL API version: " << GSL_VERSION << "\n";
  • tags/0.10/test/view.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2009 Peter Johansson
     5  Copyright (C) 2009, 2012 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "Suite.h"
  • tags/0.10/test/yat_msg_error_test.sh

    r4254 r4254  
    3636AC_MSG_RESULT([no])
    3737YAT_MSG_ERROR([could not find something more])
     38AC_COMPILE_IFELSE([AC_LANG_PROGRAM])
    3839AC_CONFIG_FILES([Makefile])
    3940AC_OUTPUT
  • tags/0.10/yat/Makefile.am

    r4254 r4254  
    2727yat_libyat_la_SOURCES =
    2828
    29 # Dummy C++ source to cause C++ linking.
    30 nodist_EXTRA_yat_libyat_la_SOURCES = dummy.cc
    31 
    3229yat_libyat_la_LDFLAGS = -version-info $(YAT_LT_VERSION) $(AM_LDFLAGS)
    3330
    3431yat_libyat_la_LIBADD = \
    35   yat/classifier/libclassifier.la \
    36   yat/normalizer/libnormalizer.la \
    37   yat/omic/libomic.la \
    38   yat/random/librandom.la \
    39   yat/regression/libregression.la \
    40   yat/statistics/libstatistics.la \
    41   yat/utility/libutility.la \
    4232  $(YAT_PRIMARY_LIBS) $(LIBM)
    4333
  • tags/0.10/yat/classifier/BootstrapSampler.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "BootstrapSampler.h"
  • tags/0.10/yat/classifier/ConsensusInputRanker.cc

    r4254 r4254  
    66  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    77  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2010 Peter Johansson
     8  Copyright (C) 2010, 2012 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2323  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2424*/
     25
     26#include <config.h>
    2527
    2628#include "ConsensusInputRanker.h"
  • tags/0.10/yat/classifier/CrossValidationSampler.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "CrossValidationSampler.h"
  • tags/0.10/yat/classifier/DataLookup1D.cc

    r4254 r4254  
    55  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    66  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    7   Copyright (C) 2009 Peter Johansson
     7  Copyright (C) 2009, 2012 Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2222  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2323*/
     24
     25#include <config.h>
    2426
    2527#include "DataLookup1D.h"
  • tags/0.10/yat/classifier/DataLookupWeighted1D.cc

    r4254 r4254  
    55  Copyright (C) 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
    66  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2012 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2122  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2223*/
     24
     25#include <config.h>
    2326
    2427#include "DataLookupWeighted1D.h"
  • tags/0.10/yat/classifier/FeatureSelector.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2010 Peter Johansson
     5  Copyright (C) 2010, 2012 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "FeatureSelector.h"
  • tags/0.10/yat/classifier/FeatureSelectorIR.cc

    r4254 r4254  
    55  Copyright (C) 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
    66  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2012 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2122  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2223*/
     24
     25#include <config.h>
    2326
    2427#include "FeatureSelectorIR.h"
  • tags/0.10/yat/classifier/FeatureSelectorRandom.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "FeatureSelectorRandom.h"
  • tags/0.10/yat/classifier/GaussianKernelFunction.cc

    r4254 r4254  
    55  Copyright (C) 2005 Peter Johansson
    66  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2012 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2122  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2223*/
     24
     25#include <config.h>
    2326
    2427#include "GaussianKernelFunction.h"
  • tags/0.10/yat/classifier/InputRanker.cc

    r4254 r4254  
    66  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
    77  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2012 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2223  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2324*/
     25
     26#include <config.h>
    2427
    2528#include "InputRanker.h"
  • tags/0.10/yat/classifier/KNN_ReciprocalDistance.cc

    r4254 r4254  
    55/*
    66  Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
     7  Copyright (C) 2012 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2122  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2223*/
     24
     25#include <config.h>
    2326
    2427#include "KNN_ReciprocalDistance.h"
  • tags/0.10/yat/classifier/KNN_ReciprocalRank.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "KNN_ReciprocalRank.h"
  • tags/0.10/yat/classifier/KNN_Uniform.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "KNN_Uniform.h"
  • tags/0.10/yat/classifier/Kernel.cc

    r4254 r4254  
    44  Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
    55  Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
    6   Copyright (C) 2010 Peter Johansson
     6  Copyright (C) 2010, 2012 Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2121  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2222*/
     23
     24#include <config.h>
    2325
    2426#include "Kernel.h"
  • tags/0.10/yat/classifier/KernelLookup.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2010 Peter Johansson
     5  Copyright (C) 2010, 2012 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2121*/
    2222
     23#include <config.h>
     24
    2325#include "KernelLookup.h"
    2426#include "MatrixLookup.h"
    2527#include "MatrixLookupWeighted.h"
     28#include "yat/utility/Deleter.h"
    2629#include "yat/utility/Matrix.h"
    2730#include "yat/utility/MatrixWeighted.h"
     
    3437
    3538  KernelLookup::KernelLookup(const Kernel& kernel, const bool own)
    36     : kernel_(utility::SmartPtr<const Kernel>(&kernel, own))
     39    : kernel_(&kernel, utility::Deleter(own))
    3740  {
    3841    column_index_ = utility::Index(kernel.size());
     
    4245
    4346  KernelLookup::KernelLookup(const Kernel& kernel,
    44                              const utility::Index& row, 
     47                             const utility::Index& row,
    4548                             const utility::Index& column,
    4649                             const bool owner)
    47     : column_index_(column), 
    48       kernel_(utility::SmartPtr<const Kernel>(&kernel, owner)),
     50    : column_index_(column),
     51      kernel_(&kernel, utility::Deleter(owner)),
    4952      row_index_(row)
    5053  {
     
    5659
    5760
    58   KernelLookup::KernelLookup(const KernelLookup& other, 
    59                              const utility::Index& row, 
     61  KernelLookup::KernelLookup(const KernelLookup& other,
     62                             const utility::Index& row,
    6063                             const utility::Index& column)
    6164    : kernel_(other.kernel_)
     
    6467    column_index_ = utility::Index(other.column_index_, column);
    6568  }
    66  
     69
    6770
    6871  KernelLookup::KernelLookup(const KernelLookup& other)
    69     : column_index_(other.column_index_), kernel_(other.kernel_), 
     72    : column_index_(other.column_index_), kernel_(other.kernel_),
    7073      row_index_(other.row_index_)
    7174  {
     
    7578    assert(validate(column_index_));
    7679  }
    77  
    78 
    79   KernelLookup::KernelLookup(const KernelLookup& other, 
    80                              const utility::Index& index, 
     80
     81
     82  KernelLookup::KernelLookup(const KernelLookup& other,
     83                             const utility::Index& index,
    8184                             const bool row)
    8285    : kernel_(other.kernel_)
     
    97100    assert(validate(column_index_));
    98101  }
    99  
     102
    100103
    101104  KernelLookup::~KernelLookup(void)
     
    110113
    111114
    112   KernelLookup::const_column_iterator 
     115  KernelLookup::const_column_iterator
    113116  KernelLookup::begin_column(size_t i) const
    114117  {
    115118    return const_column_iterator(const_column_iterator::iterator_type(*this,
    116                                                                       0,i), 
     119                                                                      0,i),
    117120                                 columns());
    118121  }
     
    142145    assert(weighted());
    143146    using utility::Index; // just to avoid long line
    144     return MatrixLookupWeighted(kernel_->data_weighted(), 
    145                                 Index(kernel_->data_weighted().rows()), 
     147    return MatrixLookupWeighted(kernel_->data_weighted(),
     148                                Index(kernel_->data_weighted().rows()),
    146149                                column_index_);
    147150  }
     
    168171  KernelLookup::const_column_iterator KernelLookup::end_column(size_t i) const
    169172  {
    170     return const_column_iterator(const_column_iterator::iterator_type(*this, 
     173    return const_column_iterator(const_column_iterator::iterator_type(*this,
    171174                                                                      rows(),i),
    172175                                 columns());
     
    190193    const Kernel* kernel;
    191194    if (kernel_->weighted()){
    192       const MatrixLookupWeighted* ms = 
    193         new MatrixLookupWeighted(data_weighted(),inputs, 
     195      const MatrixLookupWeighted* ms =
     196        new MatrixLookupWeighted(data_weighted(),inputs,
    194197                                 utility::Index(data_weighted().columns()));
    195198      kernel = kernel_->make_kernel(*ms, true);
     
    208211    if (!weighted()){
    209212      assert(data.rows()==kernel_->data().rows());
    210       utility::Matrix* data_all = 
     213      utility::Matrix* data_all =
    211214        new utility::Matrix(data.rows(), row_index_.size()+data.columns());
    212215
     
    215218        // first some columns from data in kernel_
    216219        for (size_t j=0; j<row_index_.size(); ++j){
    217           (*data_all)(i,j) = kernel_->data()(i,row_index_[j]); 
     220          (*data_all)(i,j) = kernel_->data()(i,row_index_[j]);
    218221        }
    219        
     222
    220223        // last columns are equal to new data
    221224        for (size_t j=0;j<data.columns(); ++j){
     
    235238      const MatrixLookup* tmp = new MatrixLookup(*data_all, true);
    236239
    237       const Kernel* kernel = 
     240      const Kernel* kernel =
    238241        kernel_->make_kernel(*tmp, true);
    239242
    240       return KernelLookup(*kernel, utility::Index(row_index), 
     243      return KernelLookup(*kernel, utility::Index(row_index),
    241244                          utility::Index(column_index), true);
    242245    }
     
    245248    // kernel_ holds MatrixLookupWeighted, hence new Kernel also
    246249    // should hold a MatrixLookupweighted.
    247     utility::MatrixWeighted* x_all = 
     250    utility::MatrixWeighted* x_all =
    248251      new utility::MatrixWeighted(data.rows(), rows()+data.columns());
    249252    const MatrixLookupWeighted& kernel_data = kernel_->data_weighted();
     
    253256      // first some columns from data in kernel_
    254257      for (size_t j=0; j<row_index_.size(); ++j){
    255         (*x_all)(i,j) = kernel_data(i,row_index_[j]); 
     258        (*x_all)(i,j) = kernel_data(i,row_index_[j]);
    256259      }
    257260
     
    275278
    276279
    277     return KernelLookup(*kernel, row_index_, 
     280    return KernelLookup(*kernel, row_index_,
    278281                        utility::Index(column_index), true);
    279282  }
     
    283286  KernelLookup KernelLookup::test_kernel(const MatrixLookupWeighted& data) const
    284287  {
    285     utility::MatrixWeighted* x_all = 
     288    utility::MatrixWeighted* x_all =
    286289      new utility::MatrixWeighted(data.rows(), rows()+data.columns());
    287290
    288291    if (weighted()){
    289292      const MatrixLookupWeighted& kernel_data = kernel_->data_weighted();
    290    
     293
    291294      for (size_t i=0; i<data.rows(); ++i){
    292295        // first columns are equal to data in kernel_
     
    311314      }
    312315    }
    313    
     316
    314317    std::vector<size_t> column_index;
    315318    column_index.reserve(data.columns());
    316319    for (size_t i=0;i<data.columns(); ++i)
    317320      column_index.push_back(i+row_index_.size());
    318     const Kernel* kernel = 
     321    const Kernel* kernel =
    319322      kernel_->make_kernel(MatrixLookupWeighted(*x_all, true));
    320     return KernelLookup(*kernel, row_index_, 
     323    return KernelLookup(*kernel, row_index_,
    321324                        utility::Index(column_index), true);
    322325  }
     
    347350
    348351
    349   KernelLookup::const_reference 
     352  KernelLookup::const_reference
    350353  KernelLookup::operator()(size_t row, size_t column) const
    351354  {
  • tags/0.10/yat/classifier/KernelLookup.h

    r4254 r4254  
    88  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    99  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    10   Copyright (C) 2010 Peter Johansson
     10  Copyright (C) 2010, 2012 Peter Johansson
    1111
    1212  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3030#include "yat/utility/Index.h"
    3131#include "yat/utility/iterator_traits.h"
    32 #include "yat/utility/SmartPtr.h"
    3332#include "yat/utility/StrideIterator.h"
     33
     34#include <boost/shared_ptr.hpp>
    3435
    3536namespace theplu {
     
    323324
    324325    utility::Index column_index_;
    325     utility::SmartPtr<const Kernel> kernel_;
     326    boost::shared_ptr<const Kernel> kernel_;
    326327    utility::Index row_index_;
    327    
    328328  }; // class KernelLookup
    329329
  • tags/0.10/yat/classifier/Kernel_MEV.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "Kernel_MEV.h"
  • tags/0.10/yat/classifier/Kernel_SEV.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "Kernel_SEV.h"
  • tags/0.10/yat/classifier/Makefile

    r4254 r4254  
    1818# along with yat. If not, see <http://www.gnu.org/licenses/>.
    1919
    20 all:; cd ../.. && $(MAKE) yat/classifier/libclassifier.la
     20all:; cd ../.. && $(MAKE) yat/libyat.la
  • tags/0.10/yat/classifier/Makefile.am

    r4254 r4254  
    2121# along with yat. If not, see <http://www.gnu.org/licenses/>.
    2222
    23 noinst_LTLIBRARIES += yat/classifier/libclassifier.la
    24 yat_classifier_libclassifier_la_SOURCES = \
     23yat_libyat_la_SOURCES += \
    2524  yat/classifier/BootstrapSampler.cc \
    2625  yat/classifier/ConsensusInputRanker.cc \
  • tags/0.10/yat/classifier/MatrixLookup.cc

    r4254 r4254  
    55  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    66  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    7   Copyright (C) 2009 Peter Johansson
     7  Copyright (C) 2009, 2012 Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2323*/
    2424
     25#include <config.h>
     26
    2527#include "MatrixLookup.h"
     28#include "yat/utility/Deleter.h"
    2629#include "yat/utility/Matrix.h"
    2730
     
    3740
    3841  MatrixLookup::MatrixLookup(const utility::Matrix& data, const bool own)
    39     : data_(MatrixP(&data, own))
     42    : data_(&data, utility::Deleter(own))
    4043  {
    4144    column_index_ = utility::Index(data.columns());
     
    4548    assert(validate());
    4649  }
    47  
    48 
    49 
    50   MatrixLookup::MatrixLookup(const utility::Matrix& data, 
    51                              const utility::Index& row, 
     50
     51
     52
     53  MatrixLookup::MatrixLookup(const utility::Matrix& data,
     54                             const utility::Index& row,
    5255                             const utility::Index& col)
    5356    : column_index_(col),
    54       data_(MatrixP(&data, false)),
     57      data_(&data, utility::Deleter(false)),
    5558      row_index_(row)
    5659
     
    6063    assert(validate());
    6164  }
    62  
    63 
    64 
    65   MatrixLookup::MatrixLookup(const utility::Matrix& data, 
    66                              const utility::Index& index, 
     65
     66
     67
     68  MatrixLookup::MatrixLookup(const utility::Matrix& data,
     69                             const utility::Index& index,
    6770                             const bool row)
    68     : data_(MatrixP(&data, false))
     71    : data_(&data, utility::Deleter(false))
    6972  {
    7073    if (row){
     
    8285    assert(validate());
    8386  }
    84  
     87
    8588
    8689
    8790  MatrixLookup::MatrixLookup(const MatrixLookup& other)
    88     : column_index_(other.column_index_), 
     91    : column_index_(other.column_index_),
    8992      data_(other.data_),
    9093      row_index_(other.row_index_)
     
    9598
    9699
    97   MatrixLookup::MatrixLookup(const MatrixLookup& other, 
    98                              const utility::Index& row, 
     100  MatrixLookup::MatrixLookup(const MatrixLookup& other,
     101                             const utility::Index& row,
    99102                             const utility::Index& col)
    100     : column_index_(utility::Index(other.column_index_, col)), 
    101       data_(other.data_), row_index_(utility::Index(other.row_index_, row)) 
     103    : column_index_(utility::Index(other.column_index_, col)),
     104      data_(other.data_), row_index_(utility::Index(other.row_index_, row))
    102105  {
    103106    assert(rows()==row.size());
     
    105108    assert(validate());
    106109  }
    107  
    108 
    109 
    110   MatrixLookup::MatrixLookup(const MatrixLookup& other, 
     110
     111
     112
     113  MatrixLookup::MatrixLookup(const MatrixLookup& other,
    111114                             const utility::Index& index, bool row)
    112115    : data_(other.data_)
     
    125128
    126129
    127   MatrixLookup::MatrixLookup(const size_t rows, const size_t columns, 
     130  MatrixLookup::MatrixLookup(const size_t rows, const size_t columns,
    128131                             const double value)
    129132    : data_(MatrixP(new utility::Matrix(1,1,value)))
    130   {   
     133  {
    131134    column_index_ = utility::Index(std::vector<size_t>(columns, 0));
    132135    row_index_ = utility::Index(std::vector<size_t>(rows,0));
     
    157160  MatrixLookup::const_column_iterator MatrixLookup::begin_column(size_t i) const
    158161  {
    159     return const_column_iterator(data_->begin_column(column_index_[i]), 
     162    return const_column_iterator(data_->begin_column(column_index_[i]),
    160163                                 row_index_.begin());
    161164  }
     
    164167  MatrixLookup::const_row_iterator MatrixLookup::begin_row(size_t i) const
    165168  {
    166     return const_row_iterator(data_->begin_row(row_index_[i]), 
     169    return const_row_iterator(data_->begin_row(row_index_[i]),
    167170                              column_index_.begin());
    168171  }
     
    183186  MatrixLookup::const_column_iterator MatrixLookup::end_column(size_t i) const
    184187  {
    185     return const_column_iterator(data_->end_column(column_index_[i]), 
     188    return const_column_iterator(data_->end_column(column_index_[i]),
    186189                                 row_index_.end());
    187190  }
     
    190193  MatrixLookup::const_row_iterator MatrixLookup::end_row(size_t i) const
    191194  {
    192     return const_row_iterator(data_->end_row(row_index_[i]), 
     195    return const_row_iterator(data_->end_row(row_index_[i]),
    193196                                 column_index_.end());
    194197  }
     
    213216
    214217
    215   bool MatrixLookup::weighted(void) const 
     218  bool MatrixLookup::weighted(void) const
    216219  {
    217220    return false;
     
    220223
    221224
    222   MatrixLookup::const_reference 
     225  MatrixLookup::const_reference
    223226  MatrixLookup::operator()(size_t row, size_t column) const
    224227  {
  • tags/0.10/yat/classifier/MatrixLookup.h

    r4254 r4254  
    1 #ifndef _theplu_yat_classifier_matrix_lookup_ 
    2 #define _theplu_yat_classifier_matrix_lookup_ 
     1#ifndef _theplu_yat_classifier_matrix_lookup_
     2#define _theplu_yat_classifier_matrix_lookup_
    33
    44// $Id$
     
    88  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    99  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    10   Copyright (C) 2009, 2010 Peter Johansson
     10  Copyright (C) 2009, 2010, 2012 Peter Johansson
    1111
    1212  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3131#include "yat/utility/iterator_traits.h"
    3232#include "yat/utility/Matrix.h"
    33 #include "yat/utility/SmartPtr.h"
    3433
    3534#include <boost/iterator/permutation_iterator.hpp>
     35#include <boost/shared_ptr.hpp>
    3636
    3737#include <iosfwd>
     
    4040namespace theplu {
    4141namespace yat {
    42 namespace classifier { 
     42namespace classifier {
    4343
    4444  ///
     
    5656  /// utility::Matrix.
    5757  ///
    58   /// A MatrixLookup can be created directly from a utility::Matrix or from 
     58  /// A MatrixLookup can be created directly from a utility::Matrix or from
    5959  /// another MatrixLookup. In the latter case, the resulting
    6060  /// MatrixLookup is looking directly into the underlying utility::Matrix to
     
    6464  /// underlying utility::Matrix. This implies that underlying data is deleted
    6565  /// in destructor of MatrixLookup, but only if there is no other
    66   /// owner of the underlying data. 
     66  /// owner of the underlying data.
    6767  ///
    6868  /// \see MatrixLookupWeighted
     
    8686
    8787    /// 'Read Only' iterator
    88     typedef utility::Container2DIterator<const MatrixLookup, const double, 
     88    typedef utility::Container2DIterator<const MatrixLookup, const double,
    8989                                         const_reference>
    9090    const_iterator;
     
    9494     */
    9595    typedef boost::permutation_iterator<utility::Matrix::const_column_iterator,
    96                                         utility::Index::const_iterator> 
     96                                        utility::Index::const_iterator>
    9797    const_column_iterator;
    9898
     
    103103
    104104    ///
    105     /// Constructor creating a lookup into the entire @a matrix. 
     105    /// Constructor creating a lookup into the entire @a matrix.
    106106    /// \param matrix underlying matrix
    107107    /// @param own if true MatrixLookup owns its underlying @a matrix
     
    110110    /// other object, this will lead to \a matrix having multiple
    111111    /// owners without the owners being aware of each
    112     /// other. Consequently multiple deletion will occur. 
     112    /// other. Consequently multiple deletion will occur.
    113113    ///
    114114    /// @note If @a matrix goes out of scope or is deleted, the
     
    131131    /// undefined.
    132132    ///
    133     MatrixLookup(const utility::Matrix& matrix, const utility::Index& row, 
     133    MatrixLookup(const utility::Matrix& matrix, const utility::Index& row,
    134134                 const utility::Index& column);
    135135
     
    155155    /// utility::Index&, const utility::Index&)
    156156    ///
    157     MatrixLookup(const utility::Matrix& matrix, 
    158                  const utility::Index& index, 
     157    MatrixLookup(const utility::Matrix& matrix,
     158                 const utility::Index& index,
    159159                 const bool row_vectors) YAT_DEPRECATE;
    160160
     
    172172
    173173    ///
    174     /// @brief Create a sub-MatrixLookup. 
     174    /// @brief Create a sub-MatrixLookup.
    175175    ///
    176176    /// The Lookup is independent of
     
    195195    /// undefined.
    196196    ///
    197     MatrixLookup(const MatrixLookup& ml, const utility::Index& row, 
     197    MatrixLookup(const MatrixLookup& ml, const utility::Index& row,
    198198                 const utility::Index& column);
    199199
     
    224224    /// utility::Index&, const utility::Index&)
    225225    ///
    226     MatrixLookup(const MatrixLookup& ml, const utility::Index&, 
     226    MatrixLookup(const MatrixLookup& ml, const utility::Index&,
    227227                 const bool row_vectors);
    228228
     
    247247
    248248    ///
    249     /// @brief Destructor. 
     249    /// @brief Destructor.
    250250    ///
    251251    /// If ownership is set true and there is no other owner of
     
    309309    /// Access operator
    310310    ///
    311     /// @return element 
     311    /// @return element
    312312    ///
    313313    const_reference operator()(size_t row, size_t column) const;
     
    322322    ///
    323323    const MatrixLookup& operator=(const MatrixLookup&);
    324    
     324
    325325  private:
    326326    friend class MatrixLookupWeighted;
    327327
    328328    utility::Index column_index_;
    329     typedef utility::SmartPtr<const utility::Matrix> MatrixP;
     329    typedef boost::shared_ptr<const utility::Matrix> MatrixP;
    330330    MatrixP data_;
    331331    utility::Index row_index_;
     
    333333    // for assertions
    334334    bool validate(void) const;
    335   }; 
    336  
     335  };
     336
    337337  ///
    338338  /// The output operator MatrixLookup
  • tags/0.10/yat/classifier/MatrixLookupWeighted.cc

    r4254 r4254  
    44  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    55  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    6   Copyright (C) 2009 Peter Johansson
     6  Copyright (C) 2009, 2012 Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2222*/
    2323
     24#include <config.h>
     25
    2426#include "MatrixLookupWeighted.h"
    2527#include "MatrixLookup.h"
    2628#include "yat/utility/DataIterator.h"
     29#include "yat/utility/Deleter.h"
    2730#include "yat/utility/Matrix.h"
    2831#include "yat/utility/MatrixWeighted.h"
     
    4245                                             const utility::Index& rows,
    4346                                             const utility::Index& columns)
    44     : column_index_(columns), data_(MatrixWP(&m,false)), row_index_(rows)
     47    : column_index_(columns), data_(&m, utility::Deleter(false)),
     48      row_index_(rows)
    4549  {
    4650    assert(validate());
     
    5054  MatrixLookupWeighted::MatrixLookupWeighted(const utility::MatrixWeighted& m,
    5155                                             bool owner)
    52     : column_index_(utility::Index(m.columns())), 
    53       data_(MatrixWP(&m,owner)),
     56    : column_index_(utility::Index(m.columns())),
     57      data_(&m,utility::Deleter(owner)),
    5458      row_index_(utility::Index(m.rows()))
    5559  {
     
    5963
    6064  MatrixLookupWeighted::MatrixLookupWeighted(const MatrixLookup& ml)
    61     : column_index_(ml.column_index_), 
     65    : column_index_(ml.column_index_),
    6266      row_index_(ml.row_index_)
    63   { 
     67  {
    6468    utility::MatrixWeighted* mw = new utility::MatrixWeighted(*ml.data_);
    6569    data_ = MatrixWP(mw);
    6670    assert(validate());
    6771  }
    68  
     72
    6973
    7074  MatrixLookupWeighted::MatrixLookupWeighted(const MatrixLookupWeighted& other)
    71     : column_index_(other.column_index_), data_(other.data_), 
     75    : column_index_(other.column_index_), data_(other.data_),
    7276      row_index_(other.row_index_)
    7377  {
     
    7882
    7983  MatrixLookupWeighted::MatrixLookupWeighted(const MatrixLookupWeighted& other,
    80                                              const utility::Index& row, 
     84                                             const utility::Index& row,
    8185                                             const utility::Index& col)
    82     : column_index_(utility::Index(other.column_index_, col)), 
     86    : column_index_(utility::Index(other.column_index_, col)),
    8387      data_(other.data_), row_index_(utility::Index(other.row_index_, row))
    8488  {
    8589    assert(validate());
    8690  }
    87  
    88 
    89 
    90   MatrixLookupWeighted::MatrixLookupWeighted(const MatrixLookupWeighted& other, 
    91                                              const utility::Index& index, 
     91
     92
     93
     94  MatrixLookupWeighted::MatrixLookupWeighted(const MatrixLookupWeighted& other,
     95                                             const utility::Index& index,
    9296                                             bool row)
    9397    : data_(other.data_)
     
    103107    assert(validate());
    104108  }
    105  
    106 
    107 
    108   MatrixLookupWeighted::MatrixLookupWeighted(const size_t rows, 
    109                                              const size_t columns, 
     109
     110
     111
     112  MatrixLookupWeighted::MatrixLookupWeighted(const size_t rows,
     113                                             const size_t columns,
    110114                                             const double value,
    111115                                             const double weight)
     
    117121  }
    118122
    119  
     123
    120124  MatrixLookupWeighted::MatrixLookupWeighted(std::istream& is, char sep)
    121125    : data_(MatrixWP(new utility::MatrixWeighted(is,sep)))
     
    125129    assert(validate());
    126130  }
    127  
     131
    128132
    129133  MatrixLookupWeighted::~MatrixLookupWeighted(void)
     
    139143
    140144
    141   MatrixLookupWeighted::const_column_iterator 
     145  MatrixLookupWeighted::const_column_iterator
    142146  MatrixLookupWeighted::begin_column(size_t i) const
    143147  {
     
    147151
    148152
    149   MatrixLookupWeighted::const_row_iterator 
     153  MatrixLookupWeighted::const_row_iterator
    150154  MatrixLookupWeighted::begin_row(size_t i) const
    151155  {
     
    178182
    179183
    180   MatrixLookupWeighted::const_column_iterator 
     184  MatrixLookupWeighted::const_column_iterator
    181185  MatrixLookupWeighted::end_column(size_t i) const
    182186  {
    183     return const_column_iterator(data_->end_column(column_index_[i]), 
     187    return const_column_iterator(data_->end_column(column_index_[i]),
    184188                                 row_index_.end());
    185189  }
    186190
    187191
    188   MatrixLookupWeighted::const_row_iterator 
     192  MatrixLookupWeighted::const_row_iterator
    189193  MatrixLookupWeighted::end_row(size_t i) const
    190194  {
    191     return const_row_iterator(data_->end_row(row_index_[i]), 
     195    return const_row_iterator(data_->end_row(row_index_[i]),
    192196                              column_index_.end());
    193197  }
     
    223227
    224228
    225   bool MatrixLookupWeighted::weighted(void) const 
     229  bool MatrixLookupWeighted::weighted(void) const
    226230  {
    227231    return true;
     
    232236  MatrixLookupWeighted::const_reference
    233237  MatrixLookupWeighted::operator()(const size_t row, const size_t column) const
    234   { 
     238  {
    235239    return (*data_)(row_index_[row], column_index_[column]);
    236240  }
  • tags/0.10/yat/classifier/MatrixLookupWeighted.h

    r4254 r4254  
    1 #ifndef _theplu_yat_classifier_matrix_lookup_weighted_ 
    2 #define _theplu_yat_classifier_matrix_lookup_weighted_ 
     1#ifndef _theplu_yat_classifier_matrix_lookup_weighted_
     2#define _theplu_yat_classifier_matrix_lookup_weighted_
    33
    44// $Id$
     
    77  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    88  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    9   Copyright (C) 2009, 2010 Peter Johansson
     9  Copyright (C) 2009, 2010, 2012 Peter Johansson
    1010
    1111  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3030#include "yat/utility/Index.h"
    3131#include "yat/utility/MatrixWeighted.h"
    32 #include "yat/utility/SmartPtr.h"
    3332#include "yat/utility/StrideIterator.h"
    3433
    3534#include <boost/iterator/permutation_iterator.hpp>
     35#include <boost/shared_ptr.hpp>
    3636
    3737#include <iosfwd>
     
    4141namespace theplu {
    4242namespace yat {
    43 namespace classifier { 
     43namespace classifier {
    4444
    4545  class MatrixLookup;
     
    8080    /// 'Read Only' iterator
    8181    typedef utility::StrideIterator<
    82     utility::Container2DIterator<const MatrixLookupWeighted, 
     82    utility::Container2DIterator<const MatrixLookupWeighted,
    8383                                 const value_type, const_reference> >
    8484    const_iterator;
     
    119119
    120120       \note no check for nan is performed.
    121        
     121
    122122       @note from yat 0.5 data is copied and further modifications in
    123123       \a matrix will not be reflected in MatrixLookupWeighted.
     
    157157    /// undefined.
    158158    ///
    159     MatrixLookupWeighted(const MatrixLookupWeighted& ml, 
    160                          const utility::Index& row, 
     159    MatrixLookupWeighted(const MatrixLookupWeighted& ml,
     160                         const utility::Index& row,
    161161                         const utility::Index& column);
    162162
     
    187187    /// const utility::Index&, const utility::Index&)
    188188    ///
    189     MatrixLookupWeighted(const MatrixLookupWeighted& ml, 
    190                          const utility::Index&, 
     189    MatrixLookupWeighted(const MatrixLookupWeighted& ml,
     190                         const utility::Index&,
    191191                         const bool row_vectors) YAT_DEPRECATE;
    192192
     
    196196    /// MatrixLookupWeighted owns its underlying matrix.
    197197    ///
    198     MatrixLookupWeighted(const size_t rows, const size_t columns, 
     198    MatrixLookupWeighted(const size_t rows, const size_t columns,
    199199                         const double value=0, const double weight=1);
    200200
     
    294294    ///
    295295    const MatrixLookupWeighted& operator=(const MatrixLookupWeighted&);
    296    
     296
    297297  private:
    298     typedef utility::SmartPtr<const utility::MatrixWeighted> MatrixWP;
     298    typedef boost::shared_ptr<const utility::MatrixWeighted> MatrixWP;
    299299    utility::Index column_index_;
    300300    MatrixWP data_;
     
    303303    // for assertions
    304304    bool validate(void) const;
    305   }; 
    306  
    307   ///
    308   /// The output operator MatrixLookupWeighted 
     305  };
     306
     307  ///
     308  /// The output operator MatrixLookupWeighted
    309309  ///
    310310  /// For eacd data element data(i,j) is printed except those being
  • tags/0.10/yat/classifier/NBC.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "NBC.h"
     
    2730#include "yat/statistics/AveragerWeighted.h"
    2831#include "yat/utility/Matrix.h"
     32#include "yat/utility/WeightedIterator.h"
    2933
    3034#include <cassert>
     
    165169    /// problems when calculating P = exp(- -lnP), we centralize matrix
    166170    /// by adding a constant.
    167     // lookup of prediction with zero weights for NaNs
    168     MatrixLookupWeighted mlw(prediction);
     171    utility::Matrix weights;
     172    // create zero/unity weight matrix (w=0 if NaN)
     173    nan(prediction, weights);
     174    using utility::weighted_iterator;
    169175    statistics::AveragerWeighted a;
    170     add(a, mlw.begin(), mlw.end());
     176    add(a, weighted_iterator(prediction.begin(), weights.begin()),
     177        weighted_iterator(prediction.end(), weights.end()));
    171178    prediction -= a.mean();
    172    
     179
    173180    // exponentiate
    174181    for (size_t i=0; i<prediction.rows(); ++i)
    175182      for (size_t j=0; j<prediction.columns(); ++j)
    176183        prediction(i,j) = std::exp(prediction(i,j));
    177    
     184
    178185    // normalize each row (label) to sum up to unity (probability)
    179186    for (size_t i=0; i<prediction.rows(); ++i){
    180187      // calculate sum of row ignoring NaNs
    181188      statistics::AveragerWeighted a;
    182       add(a, mlw.begin_row(i), mlw.end_row(i));
     189      add(a, weighted_iterator(prediction.begin_row(i), weights.begin_row(i)),
     190          weighted_iterator(prediction.end_row(i), weights.end_row(i)));
    183191      prediction.row_view(i) *= 1.0/a.sum_wx();
    184192    }
  • tags/0.10/yat/classifier/PolynomialKernelFunction.cc

    r4254 r4254  
    44  Copyright (C) 2003 Peter Johansson
    55  Copyright (C) 2004, 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2012 Peter Johansson
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2021  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2122*/
     23
     24#include <config.h>
    2225
    2326#include "PolynomialKernelFunction.h"
  • tags/0.10/yat/classifier/SVM.cc

    r4254 r4254  
    66  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    77  Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
    8   Copyright (C) 2009, 2010 Peter Johansson
     8  Copyright (C) 2009, 2010, 2012 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2323  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2424*/
     25
     26#include <config.h>
    2527
    2628#include "SVM.h"
  • tags/0.10/yat/classifier/SVindex.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "SVindex.h"
  • tags/0.10/yat/classifier/Sampler.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "Sampler.h"
  • tags/0.10/yat/classifier/SupervisedClassifier.cc

    r4254 r4254  
    66  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    77  Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
     8  Copyright (C) 2012 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2324*/
    2425
     26#include <config.h>
     27
    2528#include "SupervisedClassifier.h"
    2629#include "InputRanker.h"
  • tags/0.10/yat/classifier/SvmMultiClass.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2009 Peter Johansson
     4  Copyright (C) 2009, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "SvmMultiClass.h"
  • tags/0.10/yat/classifier/Target.cc

    r4254 r4254  
    55  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    66  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2012 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2122  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2223*/
     24
     25#include <config.h>
    2326
    2427#include "Target.h"
  • tags/0.10/yat/classifier/utility.cc

    r4254 r4254  
    44  Copyright (C) 2006 Jari Häkkinen, Markus Ringnér
    55  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2012 Peter Johansson
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2021  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2122*/
     23
     24#include <config.h>
    2225
    2326#include "utility.h"
  • tags/0.10/yat/normalizer/Makefile

    r4254 r4254  
    1818# along with yat. If not, see <http://www.gnu.org/licenses/>.
    1919
    20 all:; cd ../.. && $(MAKE) yat/normalizer/libnormalizer.la
     20all:; cd ../.. && $(MAKE) yat/libyat.la
  • tags/0.10/yat/normalizer/Makefile.am

    r4254 r4254  
    2121# along with yat. If not, see <http://www.gnu.org/licenses/>.
    2222
    23 noinst_LTLIBRARIES += yat/normalizer/libnormalizer.la
    24 yat_normalizer_libnormalizer_la_SOURCES = \
     23yat_libyat_la_SOURCES += \
    2524  yat/normalizer/qQuantileNormalizer.cc \
    2625  yat/normalizer/QuantileNormalizer.cc
  • tags/0.10/yat/normalizer/QuantileNormalizer.cc

    r4254 r4254  
    44  Copyright (C) 2005, 2006 Jari Häkkinen, Markus Ringnér
    55  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2012 Peter Johansson
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2021  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2122*/
     23
     24#include <config.h>
    2225
    2326#include "QuantileNormalizer.h"
  • tags/0.10/yat/normalizer/qQuantileNormalizer.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2009 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2010 Peter Johansson
     5  Copyright (C) 2010, 2012 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "qQuantileNormalizer.h"
  • tags/0.10/yat/omic/Codon.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2010, 2011 Peter Johansson
     4  Copyright (C) 2010, 2011, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020*/
    2121
     22#include <config.h>
     23
    2224#include "Codon.h"
    2325
     
    3436  Codon::Map_ Codon::map_;
    3537
    36   Codon::Codon(void) 
     38  Codon::Codon(void)
    3739  {
    3840    create_map();
     
    7375      std::stringstream ss;
    7476      ss << e.what() << "\n"
    75          << "invalid argument Codon::Codon" 
     77         << "invalid argument Codon::Codon"
    7678         << "(" << vec[0] << ", " << vec[1] << ", " << vec[2] << ")";
    7779      throw std::invalid_argument(ss.str());
     
    8082
    8183
    82   void Codon::add_to_map(char aa, const std::string& codons) 
     84  void Codon::add_to_map(char aa, const std::string& codons)
    8385  {
    8486    // FIXME: change this file to take one codon instead and remove
     
    9698  }
    9799
    98  
     100
    99101  char Codon::amino_acid(void) const
    100102  {
     
    124126    add_to_map('N', "AAT,AAC");
    125127    add_to_map('M', "ATG");
    126     add_to_map('D', "GAT,GAC");   
     128    add_to_map('D', "GAT,GAC");
    127129    add_to_map('F', "TTT,TTC");
    128130    add_to_map('C', "TGT,TGC");
     
    160162  }
    161163
    162   bool Codon::Compare_::operator()(const std::vector<DNA>& lhs, 
     164  bool Codon::Compare_::operator()(const std::vector<DNA>& lhs,
    163165                                   const std::vector<DNA>& rhs) const
    164166  {
  • tags/0.10/yat/omic/Codon.h

    r4254 r4254  
    55  $Id$
    66
    7   Copyright (C) 2010, 2011 Peter Johansson
     7  Copyright (C) 2010, 2011, 2012 Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    110110    struct Compare_
    111111    {
    112       bool operator()(const std::vector<DNA>& lhs, 
     112      bool operator()(const std::vector<DNA>& lhs,
    113113                      const std::vector<DNA>& rhs) const;
    114114    };
    115     typedef std::map<std::vector<DNA>, char, Compare_> Map_; 
     115    typedef std::map<std::vector<DNA>, char, Compare_> Map_;
    116116    static Map_ map_;
    117117
    118118    Map_::const_iterator iter_;
    119    
    120     void add_to_map(char aa, const std::string& codons); 
    121    
     119
     120    void add_to_map(char aa, const std::string& codons);
     121
    122122    void init(const std::vector<DNA>& vec);
    123123    void create_map(void);
     
    126126    // Codon(const Codon&)
    127127    // Codon& operator=(const Codon&)
    128   }; 
    129  
     128  };
     129
    130130  /**
    131131     \brief Functor comparing if two Codons translate to the same amino acid
  • tags/0.10/yat/omic/DNA.cc

    r4254 r4254  
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "DNA.h"
  • tags/0.10/yat/omic/GFF.cc

    r4254 r4254  
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "GFF.h"
  • tags/0.10/yat/omic/GFF2.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2011 Peter Johansson
     4  Copyright (C) 2011, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "GFF2.h"
  • tags/0.10/yat/omic/GFF2.h

    r4254 r4254  
    55  $Id$
    66
    7   Copyright (C) 2011 Peter Johansson
     7  Copyright (C) 2011, 2012 Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3232     Class for GFF2
    3333
    34      The difference is how the values 
     34     The difference is how the values
    3535
    3636     \since New in yat 0.8
  • tags/0.10/yat/omic/GFF3.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2011 Peter Johansson
     4  Copyright (C) 2011, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "GFF3.h"
  • tags/0.10/yat/omic/GenomicPosition.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2010, 2011 Peter Johansson
     4  Copyright (C) 2010, 2011, 2012 Peter Johansson
    55
    66  The yat library is free software; you can redistribute it and/or
     
    88  published by the Free Software Foundation; either version 3 of the
    99  License, or (at your option) any later version.
    10  
     10
    1111  The yat library is distributed in the hope that it will be useful,
    1212  but WITHOUT ANY WARRANTY; without even the implied warranty of
    1313  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    1414  General Public License for more details.
    15  
     15
    1616  You should have received a copy of the GNU General Public License
    1717  along with this program. If not, see <http://www.gnu.org/licenses/>.
    1818*/
     19
     20#include <config.h>
    1921
    2022#include "GenomicPosition.h"
     
    2830namespace omic {
    2931
    30   GenomicPosition::GenomicPosition(void) 
     32  GenomicPosition::GenomicPosition(void)
    3133  {}
    3234
    3335
    34   GenomicPosition::GenomicPosition(unsigned short int chr, 
     36  GenomicPosition::GenomicPosition(unsigned short int chr,
    3537                                   unsigned long int pos)
    3638    : chr_(chr), pos_(pos)
     
    3840
    3941
    40   GenomicPosition::GenomicPosition(const std::string& chr, 
     42  GenomicPosition::GenomicPosition(const std::string& chr,
    4143                                   const std::string& pos)
    42     : chr_(chr2int(chr)), 
     44    : chr_(chr2int(chr)),
    4345      pos_(yat::utility::convert<unsigned long int>(pos))
    4446  {}
  • tags/0.10/yat/omic/GenomicPosition.h

    r4254 r4254  
    55  $Id$
    66
    7   Copyright (C) 2010 Peter Johansson
     7  Copyright (C) 2010, 2012 Peter Johansson
    88
    99  The yat library is free software; you can redistribute it and/or
     
    1111  published by the Free Software Foundation; either version 3 of the
    1212  License, or (at your option) any later version.
    13  
     13
    1414  The yat library is distributed in the hope that it will be useful,
    1515  but WITHOUT ANY WARRANTY; without even the implied warranty of
     
    8686     */
    8787    const unsigned long int& position(void) const;
    88    
     88
    8989  private:
    9090    unsigned short chr_;
    9191    unsigned long pos_;
    92   }; 
     92  };
    9393
    9494  /**
  • tags/0.10/yat/omic/Makefile

    r4254 r4254  
    1818# along with yat. If not, see <http://www.gnu.org/licenses/>.
    1919
    20 all:; cd ../.. && $(MAKE) yat/omic/libomic.la
     20all:; cd ../.. && $(MAKE) yat/libyat.la
  • tags/0.10/yat/omic/Makefile.am

    r4254 r4254  
    2020# along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121
    22 noinst_LTLIBRARIES += yat/omic/libomic.la
    23 yat_omic_libomic_la_SOURCES =
    24 yat_omic_libomic_la_SOURCES += yat/omic/Codon.cc
    25 yat_omic_libomic_la_SOURCES += yat/omic/DNA.cc
    26 yat_omic_libomic_la_SOURCES += yat/omic/GenomicPosition.cc
    27 yat_omic_libomic_la_SOURCES += yat/omic/GFF.cc
    28 yat_omic_libomic_la_SOURCES += yat/omic/GFF2.cc
    29 yat_omic_libomic_la_SOURCES += yat/omic/GFF3.cc
     22if HAVE_LIBBAM
     23yat_libyat_la_SOURCES += yat/omic/BamFile.cc
     24yat_libyat_la_SOURCES += yat/omic/BamHeader.cc
     25yat_libyat_la_SOURCES += yat/omic/BamRead.cc
     26yat_libyat_la_SOURCES += yat/omic/BamReadIterator.cc
     27yat_libyat_la_SOURCES += yat/omic/BamWriteIterator.cc
     28endif
     29yat_libyat_la_SOURCES += yat/omic/Codon.cc
     30yat_libyat_la_SOURCES += yat/omic/DNA.cc
     31yat_libyat_la_SOURCES += yat/omic/GenomicPosition.cc
     32yat_libyat_la_SOURCES += yat/omic/GFF.cc
     33yat_libyat_la_SOURCES += yat/omic/GFF2.cc
     34yat_libyat_la_SOURCES += yat/omic/GFF3.cc
    3035
     36if HAVE_LIBBAM
     37nobase_include_HEADERS += $(srcdir)/yat/omic/algorithm.h
     38nobase_include_HEADERS += $(srcdir)/yat/omic/BamFile.h
     39nobase_include_HEADERS += $(srcdir)/yat/omic/BamHeader.h
     40nobase_include_HEADERS += $(srcdir)/yat/omic/BamRead.h
     41nobase_include_HEADERS += $(srcdir)/yat/omic/BamReadIterator.h
     42nobase_include_HEADERS += $(srcdir)/yat/omic/BamWriteIterator.h
     43nobase_include_HEADERS += $(srcdir)/yat/omic/config_bam.h
     44endif
    3145nobase_include_HEADERS += $(srcdir)/yat/omic/Codon.h
    3246nobase_include_HEADERS += $(srcdir)/yat/omic/DNA.h
  • tags/0.10/yat/random/Makefile

    r4254 r4254  
    1818# along with yat. If not, see <http://www.gnu.org/licenses/>.
    1919
    20 all:; cd ../.. && $(MAKE) yat/random/librandom.la
     20all:; cd ../.. && $(MAKE) yat/libyat.la
  • tags/0.10/yat/random/Makefile.am

    r4254 r4254  
    2222# along with yat. If not, see <http://www.gnu.org/licenses/>.
    2323
    24 noinst_LTLIBRARIES += yat/random/librandom.la
    25 yat_random_librandom_la_SOURCES = yat/random/random.cc
     24yat_libyat_la_SOURCES += yat/random/random.cc
    2625
    2726nobase_include_HEADERS += $(srcdir)/yat/random/random.h
  • tags/0.10/yat/random/random.cc

    r4254 r4254  
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "random.h"
     
    203205
    204206
     207  Binomial::Binomial(double p, unsigned int n)
     208    : Discrete(), p_(p), n_(n)
     209  {
     210  }
     211
     212
     213  unsigned long Binomial::operator()(void) const
     214  {
     215    return gsl_ran_binomial(rng_->rng(), p_, n_);
     216  }
     217
     218
    205219  DiscreteGeneral::DiscreteGeneral(const statistics::Histogram& hist)
    206220    : gen_(NULL)
  • tags/0.10/yat/random/random.h

    r4254 r4254  
    239239    void clone(const gsl_rng&);
    240240  };
    241    
     241
    242242
    243243  // --------------------- Discrete distribtuions ---------------------
     
    254254  {
    255255  public:
     256    /**
     257       type returned by operator()
     258
     259       \since New in yat 0.10
     260     */
     261    typedef unsigned long int result_type;
     262
    256263    ///
    257264    /// @brief Constructor
     
    289296    /// @return A random number.
    290297    ///
    291     virtual unsigned long operator()(void) const = 0;
    292    
     298    virtual result_type operator()(void) const = 0;
     299
    293300  protected:
    294301    /// GSL random gererator
     
    296303  };
    297304
     305  /**
     306     \brief Binomial distribution
     307
     308     \see gsl_ran_binomial
     309
     310     \since New in yat 0.10
     311   */
     312  class Binomial : Discrete
     313  {
     314  public:
     315    /**
     316       \brief Constructor
     317
     318       Create an object that generates random numbers from binomial
     319       distribution, the number of successes in \n trials each with
     320       success probability \a p.
     321     */
     322    Binomial(double p, unsigned int n);
     323
     324    /**
     325       \return number from binomial distrubtion as parametrized in constructor.
     326     */
     327    unsigned long operator()(void) const;
     328  private:
     329    double p_;
     330    unsigned int n_;
     331  };
     332
    298333  ///
    299334  /// @brief General
    300335  ///
    301   class DiscreteGeneral : public Discrete 
     336  class DiscreteGeneral : public Discrete
    302337  {
    303338  public:
     
    308343    ///
    309344    explicit DiscreteGeneral(const statistics::Histogram& hist);
    310    
     345
    311346    /**
    312347       \brief Copy constructor
     
    348383  /**
    349384     @brief Discrete uniform distribution
    350  
     385
    351386     Discrete uniform distribution also known as the "equally likely
    352387     outcomes" distribution. Each outcome, in this case an integer
    353388     from [0,n-1] , have equal probability to occur.
    354      
     389
    355390     Distribution function \f$ p(k) = \frac{1}{n+1} \f$ for \f$ 0 \le
    356      k < n \f$ \n 
    357      Expectation value: \f$ \frac{n-1}{2} \f$ \n 
     391     k < n \f$ \n
     392     Expectation value: \f$ \frac{n-1}{2} \f$ \n
    358393     Variance: \f$ \frac{1}{12}(n-1)(n+1) \f$
    359394  */
    360   class DiscreteUniform 
    361     : public Discrete, 
     395  class DiscreteUniform
     396    : public Discrete,
    362397      public std::unary_function<unsigned long, unsigned long>
    363398  {
     
    407442  /**
    408443     @brief Poisson Distribution
    409  
     444
    410445     Having a Poisson process (i.e. no memory), number of occurences
    411446     within a given time window is Poisson distributed. This
     
    414449     succesful is small (in such a way that the expected number of
    415450     succesful attempts is \f$ m \f$.
    416      
     451
    417452     Probability function \f$ p(k) = e^{-m}\frac{m^k}{k!} \f$ for \f$ 0 \le
    418      k  \f$ \n 
    419      Expectation value: \f$ m \f$ \n 
     453     k  \f$ \n
     454     Expectation value: \f$ m \f$ \n
    420455     Variance: \f$ m \f$
    421456  */
     
    457492  {
    458493  public:
     494    /**
     495       type returned by operator()
     496
     497       \since New in yat 0.10
     498     */
     499    typedef double result_type;
    459500
    460501    ///
     
    493534    /// @return A random number
    494535    ///
    495     virtual double operator()(void) const = 0;
     536    virtual result_type operator()(void) const = 0;
    496537
    497538  protected:
     
    550591     \brief Generator of random numbers from an exponential
    551592     distribution.
    552      
     593
    553594     The distribution function is \f$ f(x) = \frac{1}{m}\exp(-x/a)
    554595     \f$ for \f$ x \f$ with the expectation value \f$ m \f$ and
     
    584625  /**
    585626     @brief Gaussian distribution
    586      
     627
    587628     Class for generating a random number from a Gaussian distribution
    588629     between zero and unity. Utilizes the Box-Muller algorithm, which
    589630     needs two calls to random generator.
    590      
     631
    591632     Distribution function \f$ f(x) =
    592633     \frac{1}{\sqrt{2\pi\sigma^2}}\exp(-\frac{(x-\mu)^2}{2\sigma^2})
  • tags/0.10/yat/regression/AkimaInterpolation.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2004, 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "AkimaInterpolation.h"
  • tags/0.10/yat/regression/AkimaPeriodicInterpolation.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2004, 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "AkimaPeriodicInterpolation.h"
  • tags/0.10/yat/regression/CSplineInterpolation.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2004, 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "CSplineInterpolation.h"
  • tags/0.10/yat/regression/CSplinePeriodicInterpolation.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2004, 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "CSplinePeriodicInterpolation.h"
  • tags/0.10/yat/regression/GSLInterpolation.cc

    r4254 r4254  
    44  Copyright (C) 2004, 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    55  Copyright (C) 2009 Jari Häkkinen
     6  Copyright (C) 2012 Peter Johansson
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2021  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2122*/
     23
     24#include <config.h>
    2225
    2326#include "GSLInterpolation.h"
  • tags/0.10/yat/regression/KernelBox.cc

    r4254 r4254  
    55  Copyright (C) 2006 Jari Häkkinen
    66  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2012 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2122  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2223*/
     24
     25#include <config.h>
    2326
    2427#include "KernelBox.h"
  • tags/0.10/yat/regression/KernelTriCube.cc

    r4254 r4254  
    55  Copyright (C) 2006 Jari Häkkinen
    66  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2012 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2122  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2223*/
     24
     25#include <config.h>
    2326
    2427#include "KernelTriCube.h"
  • tags/0.10/yat/regression/Linear.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2004, 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "Linear.h"
  • tags/0.10/yat/regression/LinearInterpolation.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2004, 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "LinearInterpolation.h"
  • tags/0.10/yat/regression/LinearWeighted.cc

    r4254 r4254  
    55  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    66  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2012 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2122  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2223*/
     24
     25#include <config.h>
    2326
    2427#include "LinearWeighted.h"
  • tags/0.10/yat/regression/LinearWeighted.h

    r4254 r4254  
    88  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    99  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     10  Copyright (C) 2012 Peter Johansson
    1011
    1112  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3536
    3637  ///
    37   /// @brief linear regression.   
     38  /// @brief linear regression.
    3839  ///
    39   /// @todo document
    40   ///
    41   class LinearWeighted : public OneDimensionalWeighted
     40  class LinearWeighted : public OneDimensionalWeighted
    4241  {
    43  
     42
    4443  public:
    4544    ///
     
    5251    ///
    5352    virtual ~LinearWeighted(void);
    54          
     53
    5554    /**
    5655       \f$ alpha \f$ is estimated as \f$ \frac{\sum w_iy_i}{\sum w_i} \f$
    57    
     56
    5857       @return the parameter \f$ \alpha \f$
    5958    */
     
    7271       \f$ beta \f$ is estimated as \f$ \frac{\sum
    7372       w_i(y_i-m_y)(x_i-m_x)}{\sum w_i(x_i-m_x)^2} \f$
    74    
     73
    7574       @return the parameter \f$ \beta \f$
    7675    */
     
    8584    */
    8685    double beta_var(void) const;
    87    
     86
    8887    /**
    8988       This function computes the best-fit linear regression
     
    9796    void fit(const utility::VectorBase& x, const utility::VectorBase& y,
    9897             const utility::VectorBase& w);
    99    
     98
    10099    ///
    101     ///  Function predicting value using the linear model: 
     100    ///  Function predicting value using the linear model:
    102101    /// \f$ y =\alpha + \beta (x - m) \f$
    103102    ///
     
    126125    double syy(void) const;
    127126    double sxy(void) const;
    128    
     127
    129128    double alpha_;
    130129    double alpha_var_;
  • tags/0.10/yat/regression/Local.cc

    r4254 r4254  
    44  Copyright (C) 2004 Peter Johansson
    55  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    6   Copyright (C) 2010, 2011 Peter Johansson
     6  Copyright (C) 2010, 2011, 2012 Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2121  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2222*/
     23
     24#include <config.h>
    2325
    2426#include "Local.h"
  • tags/0.10/yat/regression/Makefile

    r4254 r4254  
    1818# along with yat. If not, see <http://www.gnu.org/licenses/>.
    1919
    20 all:; cd ../.. && $(MAKE) yat/regression/libregression.la
     20all:; cd ../.. && $(MAKE) yat/libyat.la
  • tags/0.10/yat/regression/Makefile.am

    r4254 r4254  
    2222# along with yat. If not, see <http://www.gnu.org/licenses/>.
    2323
    24 noinst_LTLIBRARIES += yat/regression/libregression.la
    25 yat_regression_libregression_la_SOURCES = \
     24yat_libyat_la_SOURCES += \
    2625  yat/regression/AkimaInterpolation.cc  \
    2726  yat/regression/AkimaPeriodicInterpolation.cc \
  • tags/0.10/yat/regression/MultiDimensional.cc

    r4254 r4254  
    44  Copyright (C) 2005 Jari Häkkinen
    55  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    6   Copyright (C) 2011 Peter Johansson
     6  Copyright (C) 2011, 2012 Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2121  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2222*/
     23
     24#include <config.h>
    2325
    2426#include "MultiDimensional.h"
  • tags/0.10/yat/regression/MultiDimensionalWeighted.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "MultiDimensionalWeighted.h"
  • tags/0.10/yat/regression/Naive.cc

    r4254 r4254  
    44  Copyright (C) 2004 Peter Johansson
    55  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2012 Peter Johansson
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2021  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2122*/
     23
     24#include <config.h>
    2225
    2326#include "Naive.h"
  • tags/0.10/yat/regression/NaiveWeighted.cc

    r4254 r4254  
    44  Copyright (C) 2005 Peter Johansson
    55  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2012 Peter Johansson
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2021  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2122*/
     23
     24#include <config.h>
    2225
    2326#include "NaiveWeighted.h"
  • tags/0.10/yat/regression/NaiveWeighted.h

    r4254 r4254  
    77  Copyright (C) 2005 Peter Johansson
    88  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     9  Copyright (C) 2012 Peter Johansson
    910
    1011  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3940  /// @brief naive fitting.
    4041  ///
    41   /// @todo document
    42   ///
    43   class NaiveWeighted : public OneDimensionalWeighted
     42  class NaiveWeighted : public OneDimensionalWeighted
    4443  {
    45  
     44
    4645  public:
    4746    ///
     
    5453    ///
    5554    virtual ~NaiveWeighted(void);
    56          
     55
    5756    /**
    5857       This function computes the best-fit for the naive model \f$ y
     
    6766    ///
    6867    /// Function predicting value using the naive model, i.e. a
    69     /// weighted average. 
     68    /// weighted average.
    7069    ///
    7170    double predict(const double x) const;
  • tags/0.10/yat/regression/OneDimensional.cc

    r4254 r4254  
    44  Copyright (C) 2005 Peter Johansson
    55  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    6   Copyright (C) 2011 Peter Johansson
     6  Copyright (C) 2011, 2012 Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2121  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2222*/
     23
     24#include <config.h>
    2325
    2426#include "OneDimensional.h"
  • tags/0.10/yat/regression/OneDimensionalWeighted.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "OneDimensionalWeighted.h"
  • tags/0.10/yat/regression/Polynomial.cc

    r4254 r4254  
    44  Copyright (C) 2005 Jari Häkkinen
    55  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    6   Copyright (C) 2011 Peter Johansson
     6  Copyright (C) 2011, 2012 Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2121  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2222*/
     23
     24#include <config.h>
    2325
    2426#include "Polynomial.h"
  • tags/0.10/yat/regression/PolynomialInterpolation.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2004, 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "PolynomialInterpolation.h"
  • tags/0.10/yat/regression/PolynomialWeighted.cc

    r4254 r4254  
    33/*
    44  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "PolynomialWeighted.h"
  • tags/0.10/yat/regression/TukeyBiweight.cc

    r4254 r4254  
    22
    33/*
    4   Copyright (C) 2011 Peter Johansson
     4  Copyright (C) 2011, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020*/
    2121
     22#include <config.h>
     23
    2224#include "TukeyBiweight.h"
    2325
  • tags/0.10/yat/statistics/AUC.cc

    r4254 r4254  
    44  Copyright (C) 2004, 2005 Peter Johansson
    55  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    6   Copyright (C) 2011 Peter Johansson
     6  Copyright (C) 2011, 2012 Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2121  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2222*/
     23
     24#include <config.h>
    2325
    2426#include <iostream>
  • tags/0.10/yat/statistics/Averager.cc

    r4254 r4254  
    2323  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2424*/
     25
     26#include <config.h>
    2527
    2628#include "Averager.h"
  • tags/0.10/yat/statistics/Averager1.cc

    r4254 r4254  
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Averager1.h"
  • tags/0.10/yat/statistics/Averager3.cc

    r4254 r4254  
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Averager3.h"
  • tags/0.10/yat/statistics/Averager4.cc

    r4254 r4254  
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Averager4.h"
  • tags/0.10/yat/statistics/AveragerPair.cc

    r4254 r4254  
    55  Copyright (C) 2005 Peter Johansson
    66  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    7   Copyright (C) 2011 Peter Johansson
     7  Copyright (C) 2011, 2012 Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2222  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2323*/
     24
     25#include <config.h>
    2426
    2527#include "AveragerPair.h"
  • tags/0.10/yat/statistics/AveragerPairWeighted.cc

    r4254 r4254  
    66  Copyright (C) 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
    77  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2011 Peter Johansson
     8  Copyright (C) 2011, 2012 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2323  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2424*/
     25
     26#include <config.h>
    2527
    2628#include "AveragerPairWeighted.h"
  • tags/0.10/yat/statistics/AveragerWeighted.cc

    r4254 r4254  
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "AveragerWeighted.h"
  • tags/0.10/yat/statistics/Fisher.cc

    r4254 r4254  
    55  Copyright (C) 2005 Peter Johansson
    66  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    7   Copyright (C) 2009, 2010, 2011 Peter Johansson
     7  Copyright (C) 2009, 2010, 2011, 2012 Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2222  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2323*/
     24
     25#include <config.h>
    2426
    2527#include "Fisher.h"
  • tags/0.10/yat/statistics/FoldChange.cc

    r4254 r4254  
    44  Copyright (C) 2005 Peter Johansson
    55  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2012 Peter Johansson
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2021  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2122*/
     23
     24#include <config.h>
    2225
    2326#include "FoldChange.h"
  • tags/0.10/yat/statistics/Histogram.cc

    r4254 r4254  
    66  Copyright (C) 2006 Jari Häkkinen
    77  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2009, 2010, 2011 Peter Johansson
     8  Copyright (C) 2009, 2010, 2011, 2012 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat