Changes from tags/0.6.3 at r4116 to tags/0.7 at r4116


Ignore:
Location:
tags
Files:
83 added
60 deleted
104 edited

Legend:

Unmodified
Added
Removed
  • tags/0.7/AUTHORS

    r4116 r4116  
    11$Id$
     2
     3Authors of the yat library
     4
     5The following people (in order of appearance) have contributed
     6significantly to the current version of yat:
     7
     8Jari Häkkinen     2003-02-19
     9Daniel Dalevi     2003-02-19
     10Peter Johansson   2003-06-03
     11Markus Ringnér    2005-12-13
    212
    313======================================================================
     
    616Copyright (C) 2006 Jari Häkkinen
    717Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    8 Copyright (C) 2009 Peter Johansson
     18Copyright (C) 2009, 2010 Peter Johansson
    919
    1020Files are copyright by their respective authors. The contributions to
     
    2737along with yat. If not, see <http://www.gnu.org/licenses/>.
    2838======================================================================
    29 
    30 
    31 This package is developed and maintained by people formerly at the
    32 Department of Theoretical Physics, Lund University, Sweden.
    33 
    34 Jari Häkkinen
    35 Peter Johansson
    36 Markus Ringnér
    37 
    38 
    39 
    40 Developers that have left the project
    41 
    42 Daniel Dalevi
  • tags/0.7/Makefile.am

    r4116 r4116  
    88# Copyright (C) 2006 Jari Häkkinen
    99# Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    10 # Copyright (C) 2009 Peter Johansson
     10# Copyright (C) 2009, 2010 Peter Johansson
    1111#
    1212# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3636doxygen_mk:; @(cd yat; $(MAKE) $(AM_MAKEFLAGS) $@)
    3737
     38lazycheck recheck: all
     39  @(cd test && $(MAKE) $(AM_MAKEFLAGS) $@)
     40
     41
    3842# like the normal install target, but does not update header files
    3943# (and its time stamps) if the content did not change.
    4044install-modified:
    4145  $(MAKE) install $(AM_MAKEFLAGS) INSTALL_HEADER="$(install_sh_DATA) -C"
    42 
    43 # This is a workaround to avoid a broken make when .m4 files are
    44 # renamed or deleted. Something similar will be provided by Automake 1.11
    45 $(am__aclocal_m4_deps):
    4646
    4747###############################################################
     
    7070  && cd test && $(MAKE) $(AM_MAKEFLAGS) prefix=$$mcl_install yat_check_yat_test
    7171
    72 include $(srcdir)/maintainer.am
     72include $(srcdir)/am/maintainer.am
  • tags/0.7/NEWS

    r4116 r4116  
    22
    33See the end of this file for copyrights and conditions.
     4
     5yat 0.7.x series from http://dev.thep.lu.se/yat/svn/branches/0.7-stable
     6
     7version 0.7 (released 8 January 2011)
     8  - new namespace theplu::yat::omic
     9  - Constructors *Lookup(Matrix, Index, bool) are deprecated (#543)
     10  - dvi, ps and pdf docs are no longer generated
     11  - utility::load functions now work with std::string as well.
     12
     13  A complete list of closed tickets can be found here [[br]]
     14  http://dev.thep.lu.se/yat/query?status=closed&milestone=yat+0.7
     15
    416
    517yat 0.6.x series from http://dev.thep.lu.se/yat/svn/branches/0.6-stable
     
    179191Copyright (C) 2003, 2006 Jari Häkkinen
    180192Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson
    181 Copyright (C) 2010 Peter Johansson
     193Copyright (C) 2010, 2011 Peter Johansson
    182194
    183195This file is part of yat library, http://dev.thep.lu.se/yat
  • tags/0.7/README

    r4116 r4116  
    1717    options.
    1818 3. Compile with '`make`'.
    19  4. Optionally do '`make check`' to run test programs.
    20  5. '`make doc`' will generate documentation.
     19 4. '`make doc`' will generate documentation.
     20 5. Optionally do '`make check`' to run test programs.
    2121 6. Issue '`make install`' to install the package on your system,
    2222    documentation will not be installed if documentation was not
  • tags/0.7/README.developer

    r4116 r4116  
    102102To build from a subversion checkout, you will need Autotools. More
    103103specifically
    104  * Automake 1.10 (or later)
     104 * Automake 1.11 (or later)
    105105 * Autoconf 2.63 (or later)
    106106 * Libtool.
     
    128128
    129129http://www.gnu.org/software/libtool/manual/libtool.html#Debugging-executables
    130 
    131 == Enable svn-support ==
    132 
    133 If you are building from an svn wc, you may run '`configure`' with
    134 option '`--enable-svn-support`' to turn on some extra make
    135 targets. Most of the targets are useful at release time, i.e.,
    136 probably not very useful for other developers than the release
    137 manager. See [source:trunk/build_support/svn_support.am build_support/svn_support.am] for more details.
    138130
    139131= Versioning =
     
    210202Copyright (C) 2004 Jari Häkkinen
    211203Copyright (C) 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson
     204Copyright (C) 2010 Peter Johansson
    212205
    213206This file is part of yat library, http://dev.thep.lu.se/yat
  • tags/0.7/build_support/Makefile.am

    r4116 r4116  
    2222bin_SCRIPTS=yat-config
    2323
    24 pkgconfigdir = $(libdir)/pkgconfig
    25 pkgconfig_DATA= yat.pc
     24pkgconfigexecdir = $(libdir)/pkgconfig
     25pkgconfigexec_DATA= yat.pc
    2626
    2727CLEANFILES = yat.pc yat-config
     
    5858  -e 's|@YAT_PATCH_VERSION[@]|$(YAT_PATCH_VERSION)|g' \
    5959  -e 's|@YAT_DEV_BUILD[@]|$(YAT_DEV_BUILD)|g' \
    60   -e 's|@YAT_LIBNAME[@]|$(YAT_LIBNAME)|g' \
    6160  -e 's|@gsl_version[@]|$(gsl_version)|g' \
    6261  -e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \
  • tags/0.7/build_support/yat-config.in

    r4116 r4116  
    4646fi
    4747
    48 LA_FILE="$libdir/lib@YAT_LIBNAME@.la"
     48LA_FILE="$libdir/libyat.la"
    4949if test x$installed = xno; then
    50   LA_FILE="@abs_top_builddir@/yat/lib@YAT_LIBNAME@.la"
     50  LA_FILE="@abs_top_builddir@/yat/libyat.la"
    5151fi
    5252
     
    142142    ;;
    143143    --libs)
    144     flags="$flags -l@YAT_LIBNAME@ $YAT_PRIMARY_LIBS $YAT_CBLAS_LIB $LIBM $LIBS"
     144    flags="$flags -lyat $YAT_PRIMARY_LIBS $YAT_CBLAS_LIB $LIBM $LIBS"
    145145    ;;
    146146    --libs-without-cblas)
    147     flags="$flags -l@YAT_LIBNAME@ $YAT_PRIMARY_LIBS $LIBM $LIBS"
     147    flags="$flags -lyat $YAT_PRIMARY_LIBS $LIBM $LIBS"
    148148    ;;
    149149    --ldflags)
  • tags/0.7/build_support/yat.pc.in

    r4116 r4116  
    2929Version: @VERSION@
    3030Requires: gsl >= @gsl_version@
    31 Libs: -L${libdir} -l@YAT_LIBNAME@ @YAT_LDFLAGS@ @LDFLAGS@
     31Libs: -L${libdir} -lyat @YAT_LDFLAGS@ @LDFLAGS@
    3232Cflags: @YAT_CPPFLAGS@ @YAT_CXXFLAGS@ @CPPFLAGS@ @CXXFLAGS@ -I${includedir}
  • tags/0.7/configure.ac

    r4116 r4116  
    3232#     autoreconf
    3333
     34
    3435m4_include([m4/version.m4])
    35 AC_INIT([yat],[YAT_VERSION],[jari@thep.lu.se],,[http://dev.thep.lu.se/yat])
     36AC_INIT([yat],[YAT_VERSION],[libyat-users@lists.sourceforge.net],,
     37        [http://dev.thep.lu.se/yat])
    3638AC_PREREQ(2.63)
    3739AC_CONFIG_SRCDIR([yat/utility/Matrix.h])
     
    4850
    4951AC_CONFIG_HEADERS([config.h])
    50 AM_INIT_AUTOMAKE([1.10 std-options])
     52AM_INIT_AUTOMAKE([1.11 std-options color-tests parallel-tests])
    5153
    5254dnl The empty help-string for --with-gsl-prefix and
     
    7880# Checks for programs.
    7981AC_PROG_CXX
    80 AC_PROG_INSTALL
    8182AC_PROG_SED
    8283AC_PROG_LIBTOOL
     
    8687
    8788have_doxygen=no
    88 dx_enable_latex=no
    89 dx_enable_dvi=no
    90 dx_enable_ps=no
    91 dx_enable_pdf=no
    9289AC_PATH_PROG([DOXYGEN], [doxygen], [no])
    9390if test "$DOXYGEN" = "no"; then
     
    10097                      [have_doxygen=yes])
    10198   AC_MSG_RESULT([$doxygen_version])
    102    dx_enable_latex=yes
    103    # doxygen 1.5.8 has a bug for latex output and enums
    104    AS_IF([test $have_doxygen = yes],
    105          [AX_COMPARE_VERSION([$doxygen_version], [eq], [1.5.8],
    106                  [AC_MSG_WARN([doxygen 1.5.8 detected - latex output turned off])
    107                   dx_enable_latex=no])])
    108 fi
    109 
    110 # we need latex output to generate dvi, ps, and pdf
    111 AS_IF([test $dx_enable_latex = yes],
    112   [dx_enable_pdf=yes
    113    ACLTX_PROG_PDFLATEX([dx_enable_pdf=no])
    114    ACLTX_PROG_MAKEINDEX([dx_enable_pdf=no])
    115    dx_enable_dvi=yes
    116    ACLTX_PROG_LATEX([dx_enable_dvi=no])
    117    # ps needs dvi
    118    dx_enable_ps=$dx_enable_dvi
    119    ACLTX_PROG_DVIPS([dx_enable_ps=no])
    120    AS_IF([test "x$dx_enable_ps" != xno], [
    121      YAT_PROG_DVIPS_PSPICTURE([], [dx_enable_ps=no
    122                                    AC_MSG_NOTICE([ps generation turned off])])
    123    ])
    124   ]
    125 )
     99fi
    126100
    127101AC_SUBST(have_doxygen)
    128102AM_CONDITIONAL([DX_ENABLE_HTML], [test x$have_doxygen = xyes])
    129 AM_CONDITIONAL([DX_ENABLE_LATEX], [test x$dx_enable_latex = xyes])
    130 AM_CONDITIONAL([DX_ENABLE_DVI], [test x$dx_enable_dvi = xyes])
    131 AM_CONDITIONAL([DX_ENABLE_PS], [test x$dx_enable_ps = xyes])
    132 AM_CONDITIONAL([DX_ENABLE_PDF], [test x$dx_enable_pdf = xyes])
    133103AC_CONFIG_FILES([test/documentation_test.sh],
    134104                [chmod +x test/documentation_test.sh])
     
    226196boost_version=1.35
    227197AC_SUBST(boost_version)
    228 AX_BOOST_BASE(["$boost_version"])
    229 boost_version_check=$succeeded;
     198AX_BOOST_BASE(["$boost_version"], [boost_ok=yes], [boost_ok=no])
    230199YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS])
    231200
     
    278247CXXFLAGS=$yat_save_CXXFLAGS
    279248
    280 # yat specific settings
    281 YAT_LIBNAME="yat"
    282 YAT_LIB_LOCATION="yat"
    283 AC_SUBST(YAT_LIBNAME)
    284 AC_SUBST(YAT_LIB_LOCATION)
    285 
    286249#doxygen stuff
    287250DX_HTML_OUTPUT=html
    288 DX_LATEX_OUTPUT=latex
    289251AC_SUBST(DX_HTML_OUTPUT)
    290 AC_SUBST(DX_LATEX_OUTPUT)
     252# create dummie version of doxygen.mk
     253AC_CONFIG_COMMANDS([doxygen.mk],
     254[for f in $CONFIG_FILES; do
     255# for each directory in yat that has a Makefile, create a doxygen.mk
     256case $f in #(
     257  yat/*/Makefile) :
     258   outfile=`echo $f | sed 's,Makefile,doxygen.mk,'`;
     259   test -e $outfile || echo '# dummie' > $outfile;
     260esac
     261done
     262])
    291263
    292264
     
    305277     yat/classifier/Makefile
    306278     yat/normalizer/Makefile
     279     yat/omic/Makefile
    307280     yat/random/Makefile
    308281     yat/regression/Makefile
     
    326299  AC_MSG_WARN([
    327300  Support for quiet NAN required.
    328   Yat will not work on this system!])
     301  yat will not work on this system!])
    329302fi
    330303
     
    335308  AC_MSG_WARN([
    336309  Support for infinity required.
    337   Yat will not work on this system!])
     310  yat will not work on this system!])
    338311fi
    339312
     
    350323if test "x$want_boost" = "xyes"; then
    351324# Too old Boost is fatal -- sub-sequent compilation will fail.
    352 if test "${boost_version_check}" != "yes" ; then
     325if test "${boost_ok}" != "yes" ; then
    353326  all_reqs_ok="false"
    354327  AC_MSG_WARN([
    355   Boost found but not the required version. Please install
    356   Boost version ${boost_version} or later])
     328  Boost ${boost_version} (or newer) not found. Please make sure Boost
     329  is installed.])
    357330fi
    358331fi
     
    386359AC_SUBST(AM_CXXFLAGS)
    387360AC_SUBST(AM_LDFLAGS)
    388 
    389 YAT_SVN_RELEASE
     361AC_SUBST(enable_static)
     362
     363YAT_SVN_RELEASE([am/maintainer.am])
    390364
    391365# Create output.
     
    395369AC_MSG_NOTICE([])
    396370AC_MSG_NOTICE([ Ready to compile the yat library])
     371AC_MSG_NOTICE
    397372AS_IF([test x$have_doxygen = xyes],
    398   [AC_MSG_NOTICE([ Documentation will be generated in the following formats:])
    399    dox_formats="   html";
    400    AS_IF([test x$dx_enable_pdf = xyes], [dox_formats="$dox_formats pdf"])
    401    AS_IF([test x$dx_enable_ps = xyes],  [dox_formats="$dox_formats ps"])
    402    AS_IF([test x$dx_enable_dvi = xyes], [dox_formats="$dox_formats dvi"])
    403    AC_MSG_NOTICE([$dox_formats])
    404   ],
     373  [AC_MSG_NOTICE([ Documentation will be generated in html.])],
    405374  [AC_MSG_NOTICE([Generation of documentation is disabled])
    406375   AC_MSG_NOTICE([doxygen could not be found])
  • tags/0.7/doc/Makefile.am

    r4116 r4116  
    3535@am__include@ @am__quote@./$(top_builddir)/yat/classifier/doxygen.mk@am__quote@
    3636@am__include@ @am__quote@./$(top_builddir)/yat/normalizer/doxygen.mk@am__quote@
     37@am__include@ @am__quote@./$(top_builddir)/yat/omic/doxygen.mk@am__quote@
    3738@am__include@ @am__quote@./$(top_builddir)/yat/random/doxygen.mk@am__quote@
    3839@am__include@ @am__quote@./$(top_builddir)/yat/regression/doxygen.mk@am__quote@
     
    4142
    4243DOXYGEN_INPUT=$(classifier_doxygen_input) \
    43 $(normalizer_doxygen_input) \
    44 $(random_doxygen_input) \
    45 $(regression_doxygen_input) \
    46 $(statistics_doxygen_input) \
    47 $(utility_doxygen_input) \
     44$(yat_normalizer_doxygen_input) \
     45$(yat_omic_doxygen_input) \
     46$(yat_random_doxygen_input) \
     47$(yat_regression_doxygen_input) \
     48$(yat_statistics_doxygen_input) \
     49$(yat_utility_doxygen_input) \
    4850$(DOXYGEN_FILES)
    4951
     
    5658$(top_builddir)/yat/utility/doxygen.mk
    5759
    58 doc: html dvi ps pdf
     60doc: html
    5961
    6062
    6163# these are supported by automake and *-local will add target to *
    62 if DX_ENABLE_DVI
    63 dvi-local: $(PACKAGE).dvi
    64 endif
    65 if DX_ENABLE_PS
    66 ps-local: $(PACKAGE).ps
    67 endif
    68 if DX_ENABLE_PDF
    69 pdf-local: $(PACKAGE).pdf
    70 endif
    7164if DX_ENABLE_HTML
    7265html-local: $(DX_HTML_OUTPUT)/index.html
    73 endif
    74 
    75 # this is not supported by automake - there is no target latex
    76 if DX_ENABLE_LATEX
    77 latex-local: $(DX_LATEX_OUTPUT)/refman.tex
    7866endif
    7967
     
    8270  echo GENERATE_HTML = YES) | $(DOXYGEN) -;
    8371
    84 $(DX_LATEX_OUTPUT)/refman.tex: $(DOXYGEN_DEPS)
    85   @(cat doxygen.config && echo "INPUT = $(DOXYGEN_INPUT)" && \
    86   echo GENERATE_LATEX = YES) | $(DOXYGEN) -;
    87 
    88 $(PACKAGE).dvi: $(DX_LATEX_OUTPUT)/refman.tex
    89   cd $(DX_LATEX_OUTPUT) && $(latex) refman.tex && $(latex) refman.tex
    90   cp $(DX_LATEX_OUTPUT)/refman.dvi $(PACKAGE).dvi
    91 
    92 $(PACKAGE).ps: $(PACKAGE).dvi
    93   cd $(DX_LATEX_OUTPUT) && $(dvips) -q -o refman.ps refman.dvi;
    94   cp $(DX_LATEX_OUTPUT)/refman.ps $(PACKAGE).ps
    95 
    96 $(PACKAGE).pdf: $(DX_LATEX_OUTPUT)/refman.tex
    97   cd $(DX_LATEX_OUTPUT) && $(MAKE) pdf;
    98   cp $(DX_LATEX_OUTPUT)/refman.pdf $(PACKAGE).pdf
    99 
    100 
    10172install-data-hook:
    10273  @$(NORMAL_INSTALL)
    103   @$(MAKE) $(AM_MAKEFLAGS) install-dvi install-ps install-pdf install-html
     74  @$(MAKE) $(AM_MAKEFLAGS) install-html
    10475
    10576uninstall-hook:
    10677  @$(NORMAL_UNINSTALL)
    107   rm -rf $(DESTDIR)$(htmldir)/html $(DESTDIR)$(dvidir)/$(PACKAGE).dvi \
    108   $(DESTDIR)$(psdir)/$(PACKAGE).ps $(DESTDIR)$(pdfdir)/$(PACKAGE).pdf
     78  rm -rf $(DESTDIR)$(htmldir)/html
    10979
    11080installdirs-local:
    111   for dir in $(htmldir)/html $(dvidir) $(psdir) $(pdfdir); do \
     81  for dir in $(htmldir)/html; do \
    11282    test -z "$(DESTDIR)$$dir" || $(MKDIR_P) "$(DESTDIR)$$dir"; \
    11383  done
     
    12898  fi
    12999
    130 install-dvi-local:
    131   @if test -f "$(PACKAGE).dvi"; then \
    132     test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)";\
    133     $(INSTALL_DATA) $(PACKAGE).dvi "$(DESTDIR)$(dvidir)/$(PACKAGE).dvi"; \
    134     echo "$(INSTALL_DATA) $(PACKAGE).dvi $(DESTDIR)$(dvidir)/$(PACKAGE).dvi";\
    135   fi
    136 
    137 install-ps-local:
    138   @if test -f "$(PACKAGE).ps"; then \
    139     test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)";\
    140     $(INSTALL_DATA) $(PACKAGE).ps "$(DESTDIR)$(psdir)/$(PACKAGE).ps"; \
    141     echo "$(INSTALL_DATA) $(PACKAGE).ps $(DESTDIR)$(psdir)/$(PACKAGE).ps";\
    142   fi
    143 
    144 install-pdf-local:
    145   @if test -f "$(PACKAGE).pdf"; then \
    146     test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)";\
    147     $(INSTALL_DATA) $(PACKAGE).pdf "$(DESTDIR)$(pdfdir)/$(PACKAGE).pdf"; \
    148     echo "$(INSTALL_DATA) $(PACKAGE).pdf $(DESTDIR)$(pdfdir)/$(PACKAGE).pdf";\
    149   fi
    150 
    151 
    152100mostlyclean-local:
    153101  rm -f doxygen.error *~
    154102
    155103clean-local:
    156   rm -rf $(PACKAGE).dvi $(PACKAGE).ps $(PACKAGE).pdf $(DX_HTML_OUTPUT) \
    157   $(DX_LATEX_OUTPUT) stamp-doxygen
     104  rm -rf $(DX_HTML_OUTPUT)
    158105
    159106FORCE:
  • tags/0.7/doc/build_tool.doxygen

    r4116 r4116  
    22//
    33// Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    4 // Copyright (C) 2009 Peter Johansson
     4// Copyright (C) 2009, 2010 Peter Johansson
    55//
    66// This file is part of the yat library, http://dev.thep.lu.se/yat
     
    7171
    7272\verbatim
    73    YAT_CHECK_YAT([minimum-version], [action-if-found],[action-if-not-found])
     73   YAT_CHECK_YAT([minimum-version], [action-if-found], [action-if-not-found])
    7474\endverbatim
    7575
  • tags/0.7/doc/concepts.doxygen

    r4116 r4116  
    5252\subsection Types
    5353
    54 <table cellspacing=0>
     54<table cellspacing=0 border=1>
    5555<tr><td>Value type</td><td><tt>X::value_type</tt></td>
    5656<td>Type of element stored in Container.</td>
     
    9090\subsection public_functions Public Functions
    9191
    92 <table cellspacing=0>
     92<table cellspacing=0 border=1>
    9393<tr>
    9494<th>Name</th><th>Expression</th><th>Precondition</th><th>Return type</th>
     
    154154<td>Element Access</td>
    155155<td><tt>a(size_t row, size_t column)</tt></td>
    156 <td><tt>0 &lt;= row&lt;a.rows()</tt> and
     156<td><tt>0 &lt;= row &lt; a.rows()</tt> and
    157157<tt>0 &lt;= column &lt; a.columns()</tt></td>
    158158<td><tt>const_reference</tt></td>
     
    185185\subsection Types
    186186
    187 <table cellspacing=0>
     187<table cellspacing=0 border=1>
    188188<tr><td>Reference type</td><td><tt>X::reference</tt></td>
    189189<td>A type that behaves as reference to the \ref
     
    222222\subsection public_functions Public Functions
    223223
    224 <table cellspacing=0>
     224<table cellspacing=0 border=1>
    225225<tr>
    226226<th>Name</th><th>Expression</th><th>Precondition</th><th>Return type</th>
     
    297297\section Requirements
    298298
    299 Classes modelling the concept \ref concept_distance should implement
    300 the following public function:
     299Classes modelling the concept \ref concept_distance should have a copy
     300constructor
     301
     302\verbatim
     303Distance(const Distance& d);
     304\endverbatim
     305
     306and also implement the following public function:
    301307
    302308\verbatim
     
    342348
    343349Classes modelling the concept \ref concept_neighbor_weighting should
     350be DefaultConstructible and Assignable as well as
    344351implement the following public function:
    345352 
     
    410417they were weighted. For instance,
    411418theplu::yat::statistics::EuclideanDistance calculates the distance
    412 between two ranges. If both ranges are are unweighted the unweighted
     419between two ranges. If both ranges are unweighted the unweighted
    413420version is used, and when any of the two ranges is weighted the
    414421weighted version kicks in. In order to make this work also when
     
    424431default implementation will work for you (see class
    425432documentation). Otherwise, you will need to implement a
    426 specialization.
     433specialization. Note that the default implementation requires that, if
     434\c iterator is a weighted iterator, its \c reference must have
     435member functions data() and weight(). This should not be a problem as
     436long as \c reference is theplu::yat::utility::DataWeight or
     437theplu::yat::utility::DataWeightProxy, but could potentially be a
     438problem when creating weighted iterators with other \c reference.
    427439
    428440*/
     
    444456Examples of concept \ref concept_data_iterator include:
    445457  - theplu::yat::utility::Matrix::iterator,
     458  - theplu::yat::utility::MatrixWeighted::iterator,
    446459  - theplu::yat::classifier::MatrixLookup::const_iterator,
    447460  - theplu::yat::classifier::MatrixLookupWeighted::const_iterator
  • tags/0.7/doc/first_page.doxygen.in

    r4116 r4116  
    55  Copyright (C) 2003, 2004 Jari Häkkinen
    66  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2010 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    6768   <p> The yat project uses trac as issue tracking system. You can
    6869   report bugs and suggest enhancements through the <a
    69    href="http://dev.thep.lu.se/yat/">yat web site</a> . Forthcoming
     70   href="@PACKAGE_URL@/">yat web site</a> . Forthcoming
    7071   releases are scheduled in the <a
    71    href="http://dev.thep.lu.se/yat/roadmap">yat road map</a>. Future
     72   href="@PACKAGE_URL@/roadmap">yat road map</a>. Future
    7273   development can be monitored through the list of <a
    73    href="http://dev.thep.lu.se/yat/query">known issues</a>. </p>
     74   href="@PACKAGE_URL@/query">known issues</a>. </p>
    7475
    7576
     
    7778
    7879   <p> You can <a
    79    href="http://dev.thep.lu.se/yat/wiki/DownloadPage">download yat</a> at
    80    the project web site. </p>
     80   href="http://sourceforge.net/projects/libyat/files/">download
     81   yat</a> at the project web site. </p>
    8182
    8283
  • tags/0.7/doc/namespaces.doxygen

    r4116 r4116  
    44  Copyright (C) 2005 Jari Häkkinen, Peter Johansson, Markus Ringnér
    55  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2010 Peter Johansson
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    6667
    6768///
     69/// @namespace theplu::yat::omic
     70///
     71/// @brief Classes and functions related to genomics and proteomics
     72///
     73
     74///
    6875/// @namespace theplu::yat::regression
    6976///
  • tags/0.7/m4/Makefile.am

    r4116 r4116  
    33## $Id$
    44
    5 # Copyright (C) 2008, 2009 Peter Johansson
     5# Copyright (C) 2008, 2009, 2010 Peter Johansson
    66#
    77# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2424
    2525EXTRA_DIST = yat.m4
     26
     27## if we don't use the macro, we need to tell automake to include it in dist
     28EXTRA_DIST += yat_common.m4 yat_lt_link_ifelse.m4
  • tags/0.7/m4/ax_ac_print_to_file.m4

    r4116 r4116  
    11# ===========================================================================
    2 #          http://autoconf-archive.cryp.to/ax_ac_print_to_file.html
     2#    http://www.gnu.org/software/autoconf-archive/ax_ac_print_to_file.html
    33# ===========================================================================
    44#
     
    1919#   Copying and distribution of this file, with or without modification, are
    2020#   permitted in any medium without royalty provided the copyright notice
    21 #   and this notice are preserved.
     21#   and this notice are preserved. This file is offered as-is, without any
     22#   warranty.
     23
     24#serial 7
    2225
    2326AC_DEFUN([AX_AC_PRINT_TO_FILE],[
     27m4_esyscmd(
    2428AC_REQUIRE([AX_FILE_ESCAPES])
    25 m4_esyscmd(
    26 AX_FILE_ESCAPES
    2729[
    2830printf "$2" > "$1"
  • tags/0.7/m4/ax_boost_base.m4

    r4116 r4116  
    11# ===========================================================================
    2 #             http://autoconf-archive.cryp.to/ax_boost_base.html
     2#       http://www.gnu.org/software/autoconf-archive/ax_boost_base.html
    33# ===========================================================================
    44#
    55# SYNOPSIS
    66#
    7 #   AX_BOOST_BASE([MINIMUM-VERSION])
     7#   AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
    88#
    99# DESCRIPTION
     
    2424#     HAVE_BOOST
    2525#
    26 # LAST MODIFICATION
    27 #
    28 #   2008-04-12
    29 #
    30 # COPYLEFT
     26# LICENSE
    3127#
    3228#   Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
     29#   Copyright (c) 2009 Peter Adolphs
    3330#
    3431#   Copying and distribution of this file, with or without modification, are
    3532#   permitted in any medium without royalty provided the copyright notice
    36 #   and this notice are preserved.
     33#   and this notice are preserved. This file is offered as-is, without any
     34#   warranty.
     35
     36#serial 18
    3737
    3838AC_DEFUN([AX_BOOST_BASE],
    3939[
    4040AC_ARG_WITH([boost],
    41   AS_HELP_STRING([--with-boost@<:@=DIR@:>@], [use boost (default is yes) - it is possible to specify the root directory for boost (optional)]),
    42   [
     41  [AS_HELP_STRING([--with-boost@<:@=ARG@:>@],
     42    [use Boost library from a standard location (ARG=yes),
     43     from the specified location (ARG=<path>),
     44     or disable it (ARG=no)
     45     @<:@ARG=yes@:>@ ])],
     46    [
    4347    if test "$withval" = "no"; then
    44     want_boost="no"
     48        want_boost="no"
    4549    elif test "$withval" = "yes"; then
    4650        want_boost="yes"
    4751        ac_boost_path=""
    4852    else
    49       want_boost="yes"
     53        want_boost="yes"
    5054        ac_boost_path="$withval"
    51   fi
     55    fi
    5256    ],
    5357    [want_boost="yes"])
     
    5862        [Force given directory for boost libraries. Note that this will overwrite library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
    5963        [
    60         if test -d $withval
     64        if test -d "$withval"
    6165        then
    6266                ac_boost_lib_path="$withval"
     
    6973
    7074if test "x$want_boost" = "xyes"; then
    71   boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
    72   boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
    73   boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
    74   boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
    75   boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
    76   if test "x$boost_lib_version_req_sub_minor" = "x" ; then
    77     boost_lib_version_req_sub_minor="0"
    78       fi
    79   WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+  $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
    80   AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
    81   succeeded=no
    82 
    83   dnl first we check the system location for boost libraries
    84   dnl this location ist chosen if boost libraries are installed with the --layout=system option
    85   dnl or if you install boost with RPM
    86   if test "$ac_boost_path" != ""; then
    87     BOOST_LDFLAGS="-L$ac_boost_path/lib"
    88     BOOST_CPPFLAGS="-I$ac_boost_path/include"
    89   else
    90     for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
    91       if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
    92         BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
    93         BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
    94         break;
    95       fi
    96     done
    97   fi
     75    boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
     76    boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
     77    boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
     78    boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
     79    boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
     80    if test "x$boost_lib_version_req_sub_minor" = "x" ; then
     81        boost_lib_version_req_sub_minor="0"
     82        fi
     83    WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+  $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
     84    AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
     85    succeeded=no
     86
     87    dnl On x86_64 systems check for system libraries in both lib64 and lib.
     88    dnl The former is specified by FHS, but e.g. Debian does not adhere to
     89    dnl this (as it rises problems for generic multi-arch support).
     90    dnl The last entry in the list is chosen by default when no libraries
     91    dnl are found, e.g. when only header-only libraries are installed!
     92    libsubdirs="lib"
     93    if test `uname -m` = x86_64; then
     94        libsubdirs="lib64 lib lib64"
     95    fi
     96
     97    dnl first we check the system location for boost libraries
     98    dnl this location ist chosen if boost libraries are installed with the --layout=system option
     99    dnl or if you install boost with RPM
     100    if test "$ac_boost_path" != ""; then
     101        BOOST_CPPFLAGS="-I$ac_boost_path/include"
     102        for ac_boost_path_tmp in $libsubdirs; do
     103                if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
     104                        BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
     105                        break
     106                fi
     107        done
     108    elif test "$cross_compiling" != yes; then
     109        for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
     110            if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
     111                for libsubdir in $libsubdirs ; do
     112                    if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
     113                done
     114                BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
     115                BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
     116                break;
     117            fi
     118        done
     119    fi
    98120
    99121    dnl overwrite ld flags if we have required special directory with
     
    103125    fi
    104126
    105   CPPFLAGS_SAVED="$CPPFLAGS"
    106   CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
    107   export CPPFLAGS
    108 
    109   LDFLAGS_SAVED="$LDFLAGS"
    110   LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
    111   export LDFLAGS
    112 
    113   AC_LANG_PUSH(C++)
    114       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
    115   @%:@include <boost/version.hpp>
    116   ]], [[
    117   #if BOOST_VERSION >= $WANT_BOOST_VERSION
    118   // Everything is okay
    119   #else
    120   #  error Boost version is too old
    121   #endif
    122   ]])],[
     127    CPPFLAGS_SAVED="$CPPFLAGS"
     128    CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
     129    export CPPFLAGS
     130
     131    LDFLAGS_SAVED="$LDFLAGS"
     132    LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
     133    export LDFLAGS
     134
     135    AC_REQUIRE([AC_PROG_CXX])
     136    AC_LANG_PUSH(C++)
     137        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
     138    @%:@include <boost/version.hpp>
     139    ]], [[
     140    #if BOOST_VERSION >= $WANT_BOOST_VERSION
     141    // Everything is okay
     142    #else
     143    #  error Boost version is too old
     144    #endif
     145    ]])],[
    123146        AC_MSG_RESULT(yes)
    124   succeeded=yes
    125   found_system=yes
    126         ],[
    127         ])
    128   AC_LANG_POP([C++])
    129 
    130 
    131 
    132   dnl if we found no boost with system layout we search for boost libraries
    133   dnl built and installed without the --layout=system option or for a staged(not installed) version
    134   if test "x$succeeded" != "xyes"; then
    135     _version=0
    136     if test "$ac_boost_path" != ""; then
    137       if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
    138         for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
    139           _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
    140           V_CHECK=`expr $_version_tmp \> $_version`
    141           if test "$V_CHECK" = "1" ; then
    142             _version=$_version_tmp
    143           fi
    144           VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
    145           BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
    146         done
    147       fi
    148     else
    149       for ac_boost_path in /usr /usr/local /opt /opt/local ; do
    150         if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
    151           for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
    152             _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
    153             V_CHECK=`expr $_version_tmp \> $_version`
    154             if test "$V_CHECK" = "1" ; then
    155               _version=$_version_tmp
    156                           best_path=$ac_boost_path
    157             fi
    158           done
    159         fi
    160       done
    161 
    162       VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
    163       BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
    164             if test "$ac_boost_lib_path" = ""
    165             then
    166                BOOST_LDFLAGS="-L$best_path/lib"
    167             fi
    168 
    169           if test "x$BOOST_ROOT" != "x"; then
    170         if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
    171           version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
    172           stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
    173                 stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
    174           V_CHECK=`expr $stage_version_shorten \>\= $_version`
     147    succeeded=yes
     148    found_system=yes
     149        ],[
     150        ])
     151    AC_LANG_POP([C++])
     152
     153
     154
     155    dnl if we found no boost with system layout we search for boost libraries
     156    dnl built and installed without the --layout=system option or for a staged(not installed) version
     157    if test "x$succeeded" != "xyes"; then
     158        _version=0
     159        if test "$ac_boost_path" != ""; then
     160            if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
     161                for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
     162                    _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
     163                    V_CHECK=`expr $_version_tmp \> $_version`
     164                    if test "$V_CHECK" = "1" ; then
     165                        _version=$_version_tmp
     166                    fi
     167                    VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
     168                    BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
     169                done
     170            fi
     171        else
     172            if test "$cross_compiling" != yes; then
     173                for ac_boost_path in /usr /usr/local /opt /opt/local ; do
     174                    if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
     175                        for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
     176                            _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
     177                            V_CHECK=`expr $_version_tmp \> $_version`
     178                            if test "$V_CHECK" = "1" ; then
     179                                _version=$_version_tmp
     180                                best_path=$ac_boost_path
     181                            fi
     182                        done
     183                    fi
     184                done
     185
     186                VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
     187                BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
     188                if test "$ac_boost_lib_path" = ""; then
     189                    for libsubdir in $libsubdirs ; do
     190                        if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
     191                    done
     192                    BOOST_LDFLAGS="-L$best_path/$libsubdir"
     193                fi
     194            fi
     195
     196            if test "x$BOOST_ROOT" != "x"; then
     197                for libsubdir in $libsubdirs ; do
     198                    if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
     199                done
     200                if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then
     201                    version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
     202                    stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
     203                        stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
     204                    V_CHECK=`expr $stage_version_shorten \>\= $_version`
    175205                    if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
    176             AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
    177             BOOST_CPPFLAGS="-I$BOOST_ROOT"
    178             BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
    179           fi
    180         fi
    181           fi
    182     fi
    183 
    184     CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
    185     export CPPFLAGS
    186     LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
    187     export LDFLAGS
    188 
    189     AC_LANG_PUSH(C++)
    190         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
    191     @%:@include <boost/version.hpp>
    192     ]], [[
    193     #if BOOST_VERSION >= $WANT_BOOST_VERSION
    194     // Everything is okay
    195     #else
    196     #  error Boost version is too old
    197     #endif
    198     ]])],[
    199           AC_MSG_RESULT(yes)
    200     succeeded=yes
    201     found_system=yes
    202           ],[
    203           ])
    204     AC_LANG_POP([C++])
    205   fi
    206 
    207   if test "$succeeded" != "yes" ; then
    208     if test "$_version" = "0" ; then
    209       AC_MSG_ERROR([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
    210     else
    211       AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
    212     fi
    213   else
    214     AC_SUBST(BOOST_CPPFLAGS)
    215     AC_SUBST(BOOST_LDFLAGS)
    216     AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
    217   fi
    218 
    219         CPPFLAGS="$CPPFLAGS_SAVED"
    220         LDFLAGS="$LDFLAGS_SAVED"
     206                        AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
     207                        BOOST_CPPFLAGS="-I$BOOST_ROOT"
     208                        BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
     209                    fi
     210                fi
     211            fi
     212        fi
     213
     214        CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
     215        export CPPFLAGS
     216        LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
     217        export LDFLAGS
     218
     219        AC_LANG_PUSH(C++)
     220            AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
     221        @%:@include <boost/version.hpp>
     222        ]], [[
     223        #if BOOST_VERSION >= $WANT_BOOST_VERSION
     224        // Everything is okay
     225        #else
     226        #  error Boost version is too old
     227        #endif
     228        ]])],[
     229            AC_MSG_RESULT(yes)
     230        succeeded=yes
     231        found_system=yes
     232            ],[
     233            ])
     234        AC_LANG_POP([C++])
     235    fi
     236
     237    if test "$succeeded" != "yes" ; then
     238        if test "$_version" = "0" ; then
     239            AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
     240        else
     241            AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
     242        fi
     243        # execute ACTION-IF-NOT-FOUND (if present):
     244        ifelse([$3], , :, [$3])
     245    else
     246        AC_SUBST(BOOST_CPPFLAGS)
     247        AC_SUBST(BOOST_LDFLAGS)
     248        AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
     249        # execute ACTION-IF-FOUND (if present):
     250        ifelse([$2], , :, [$2])
     251    fi
     252
     253    CPPFLAGS="$CPPFLAGS_SAVED"
     254    LDFLAGS="$LDFLAGS_SAVED"
    221255fi
    222256
  • tags/0.7/m4/ax_compare_version.m4

    r4116 r4116  
    11# ===========================================================================
    2 #           http://autoconf-archive.cryp.to/ax_compare_version.html
     2#    http://www.gnu.org/software/autoconf-archive/ax_compare_version.html
    33# ===========================================================================
    44#
     
    7777#   Copying and distribution of this file, with or without modification, are
    7878#   permitted in any medium without royalty provided the copyright notice
    79 #   and this notice are preserved.
     79#   and this notice are preserved. This file is offered as-is, without any
     80#   warranty.
     81
     82#serial 11
    8083
    8184dnl #########################################################################
  • tags/0.7/m4/ax_cxx_check_flag.m4

    r4116 r4116  
    11# ===========================================================================
    2 #           http://autoconf-archive.cryp.to/ax_cxx_check_flag.html
     2#     http://www.gnu.org/software/autoconf-archive/ax_cxx_check_flag.html
    33# ===========================================================================
    44#
     
    1717#   Bogdan Drozdowski <bogdandr@op.pl> for testing and bug fixes.
    1818#
    19 # LAST MODIFICATION
    20 #
    21 #   2008-04-12
    22 #
    23 # COPYLEFT
     19# LICENSE
    2420#
    2521#   Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
     
    4743#
    4844#   This special exception to the GPL applies to versions of the Autoconf
    49 #   Macro released by the Autoconf Macro Archive. When you make and
    50 #   distribute a modified version of the Autoconf Macro, you may extend this
    51 #   special exception to the GPL to apply to your modified version as well.
     45#   Macro released by the Autoconf Archive. When you make and distribute a
     46#   modified version of the Autoconf Macro, you may extend this special
     47#   exception to the GPL to apply to your modified version as well.
     48
     49#serial 6
    5250
    5351AC_DEFUN([AX_CXX_CHECK_FLAG],[
  • tags/0.7/m4/ax_cxxcpp_check_flag.m4

    r4116 r4116  
    11# ===========================================================================
    2 #          http://autoconf-archive.cryp.to/ax_cxxcpp_check_flag.html
     2#   http://www.gnu.org/software/autoconf-archive/ax_cxxcpp_check_flag.html
    33# ===========================================================================
    44#
     
    1717#   Bogdan Drozdowski <bogdandr@op.pl> for testing and bug fixes.
    1818#
    19 # LAST MODIFICATION
    20 #
    21 #   2008-04-12
    22 #
    23 # COPYLEFT
     19# LICENSE
    2420#
    2521#   Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
     
    4743#
    4844#   This special exception to the GPL applies to versions of the Autoconf
    49 #   Macro released by the Autoconf Macro Archive. When you make and
    50 #   distribute a modified version of the Autoconf Macro, you may extend this
    51 #   special exception to the GPL to apply to your modified version as well.
     45#   Macro released by the Autoconf Archive. When you make and distribute a
     46#   modified version of the Autoconf Macro, you may extend this special
     47#   exception to the GPL to apply to your modified version as well.
     48
     49#serial 6
    5250
    5351AC_DEFUN([AX_CXXCPP_CHECK_FLAG],[
  • tags/0.7/m4/ax_file_escapes.m4

    r4116 r4116  
    11# ===========================================================================
    2 #            http://autoconf-archive.cryp.to/ax_file_escapes.html
     2#      http://www.gnu.org/software/autoconf-archive/ax_file_escapes.html
    33# ===========================================================================
    44#
     
    1717#   Copying and distribution of this file, with or without modification, are
    1818#   permitted in any medium without royalty provided the copyright notice
    19 #   and this notice are preserved.
     19#   and this notice are preserved. This file is offered as-is, without any
     20#   warranty.
     21
     22#serial 7
    2023
    2124AC_DEFUN([AX_FILE_ESCAPES],[
  • tags/0.7/m4/ax_ld_check_flag.m4

    r4116 r4116  
    11# ===========================================================================
    2 #            http://autoconf-archive.cryp.to/ax_ld_check_flag.html
     2#     http://www.gnu.org/software/autoconf-archive/ax_ld_check_flag.html
    33# ===========================================================================
    44#
     
    2525#   Bogdan Drozdowski <bogdandr@op.pl> for testing and bug fixes.
    2626#
    27 # LAST MODIFICATION
    28 #
    29 #   2008-04-12
    30 #
    31 # COPYLEFT
     27# LICENSE
    3228#
    3329#   Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
     
    5551#
    5652#   This special exception to the GPL applies to versions of the Autoconf
    57 #   Macro released by the Autoconf Macro Archive. When you make and
    58 #   distribute a modified version of the Autoconf Macro, you may extend this
    59 #   special exception to the GPL to apply to your modified version as well.
     53#   Macro released by the Autoconf Archive. When you make and distribute a
     54#   modified version of the Autoconf Macro, you may extend this special
     55#   exception to the GPL to apply to your modified version as well.
     56
     57#serial 6
    6058
    6159AC_DEFUN([AX_LD_CHECK_FLAG],[
  • tags/0.7/m4/version.m4

    r4116 r4116  
    22#
    33# Copyright (C) 2008, 2009 Jari Häkkinen, Peter Johansson
    4 # Copyright (C) 2010 Peter Johansson
     4# Copyright (C) 2010, 2011 Peter Johansson
    55#
    66# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2626m4_define([MAJOR_VERSION], [0])
    2727# MINOR - Modify when new functionality is added
    28 m4_define([MINOR_VERSION], [6])
     28m4_define([MINOR_VERSION], [7])
    2929# PATCH - Modify for every released patch
    30 m4_define([PATCH_VERSION], [3])
     30m4_define([PATCH_VERSION], [0])
    3131
    3232# DEV_BUILD - When rolling a tarball we set this to `false'. In
     
    6565# yat-0.6.2  3:2:0
    6666# yat-0.6.3  3:3:0
     67# yat-0.7.0  4:0:0
    6768#
    6869# *Accidently, the libtool number was not updated for yat 0.5
    6970#
    70 m4_define([YAT_LT_VERSION_INFO], [3:3:0])
     71m4_define([YAT_LT_VERSION_INFO], [4:0:0])
    7172
    7273###
  • tags/0.7/m4/yat.m4

    r4116 r4116  
    105105
    106106#
    107 # serial 4  # version number of yat.m4
     107# serial 5  # version number of yat.m4
    108108#
    109109# see http://www.gnu.org/software/automake/manual/automake.html#Serials
     
    232232       AC_SUBST(YAT_CPPFLAGS)
    233233       AC_SUBST(YAT_CXXFLAGS)
    234        AC_DEFINE(HAVE_YAT,,[define if yat library is available])],
     234       AC_DEFINE(HAVE_YAT,[1],[define if yat library is available])],
    235235      [AC_MSG_RESULT([incorrect]);
    236236       AC_MSG_WARN([
  • tags/0.7/m4/yat_common.m4

    r4116 r4116  
    11## $Id$
    22#
    3 # Copyright (C) 2009 Peter Johansson
     3# Copyright (C) 2009, 2010 Peter Johansson
    44#
    55# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2222# This file contains some small useful macros.
    2323#
    24 # serial 0
     24# serial 1
    2525#
    2626
     
    3535
    3636
    37 # YAT_RUN_LOG(COOMAND, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
     37# YAT_RUN_LOG(COMMAND, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
    3838# run COMMAND and log the output, set status in $yat_status and log
    3939# it. If status is zero execute ACTION-IF-TRUE, else execute
     
    4242[
    4343  AC_PREREQ([2.58])
    44   AS_VAR_PUSHDEF([COMMAND], [$1])
    45   COMMAND >&AS_MESSAGE_LOG_FD 2>conftest.err
     44  yat_command="$1";
     45  YAT_ECHO_LOG([$yat_command])
     46  $yat_command >&AS_MESSAGE_LOG_FD 2>conftest.err
    4647  yat_status=$?
    47   YAT_ECHO_LOG([COMMAND])
    4848  YAT_ECHO_LOG([status: $yat_status])
    4949  AS_IF([test $yat_status == 0], [$2],
  • tags/0.7/m4/yat_svn_release.m4

    r4116 r4116  
    11## $Id$
    22
    3 # serial
     3# serial 4 (yat 0.7)
    44
    55# SYNOPSIS
     
    4242  AC_REQUIRE([AC_PROG_EGREP])       
    4343  AC_CHECK_PROGS([MD5], [md5sum gmd5sum md5 md5deep], [no])
    44   m4_pushdef([YAT_OUTPUTFILE], [maintainer.am])
     44  m4_pushdef([YAT_OUTPUTFILE], [m4_default([$1], [maintainer.am])])
    4545
    46   AX_AC_PRINT_TO_FILE([maintainer.am],
     46  AX_AC_PRINT_TO_FILE(YAT_OUTPUTFILE,
    4747[#  ]YAT_OUTPUTFILE[ generated by autoconf from $0
    4848]yat_svn_release_copyright[
     
    101101  && rm -rf \$(mc_exportdir)
    102102
    103 release:
     103release: all
    104104  \$(MAKE) \$(AM_MAKEFLAGS) check-release-tools
    105105  @test -z \"\$(RELEASE_LOCAL)\" || \$(MAKE) \$(AM_MAKEFLAGS) \$(RELEASE_LOCAL)
     
    113113    \$(MD5) \$\$a > \$\$a.MD5; \\
    114114  done;
     115  @test -z \"\$(RELEASE_HOOK)\" || \$(MAKE) \$(AM_MAKEFLAGS) \$(RELEASE_HOOK)
    115116])
    116   m4_popdef([YAT_OUTPUTFILE])
     117  m4_popdef([YAT_OUTPUTFILE])
    117118
    118119]) # YAT_SVN_RELEASE
  • tags/0.7/test/Makefile.am

    r4116 r4116  
    2626SUBDIRS = data
    2727
     28## we use suffix .cc for all source
     29AM_DEFAULT_SOURCE_EXT = .cc
     30
    2831noinst_HEADERS = Suite.h
    2932
     
    4750  ./configure --with-yat=$(bindir) && $(MAKE) check
    4851
    49 check_PROGRAMS = alignment_test averager_test \
    50   commandline_test \
    51   consensus_inputranker_test data_lookup_1d_test  \
    52   data_weight_test data_weight_proxy_test distance_test \
    53   ensemble_test feature_selection_test fileutil_test \
    54   fisher_test getline_iterator_test histogram_test \
    55   igp_test index_test inputranker_test interpolation_test \
    56   iterator_test kernel_lookup_test kernel_test \
    57   knn_test kolmogorov_smirnov_test large_file_test matrix_lookup_test \
    58   matrix_lookup_weighted_test matrix_test \
    59   matrix_weighted_test merge_test nbc_test \
    60   ncc_test nni_test normalization_test pca_test \
    61   range_test regression_test rnd_test roc_test \
    62   score_test  smart_ptr_test    \
    63   smoother_test statistics_test stream_redirect_test \
    64   subset_generator_test svd_test svm_test \
    65   svm_multi_class_test target_test  \
    66   ttest_test \
    67   utility_test vector_test version_test view_test
     52EXTRA_PROGRAMS = alignment.test averager.test \
     53  codon.test commandline.test \
     54  concept.test \
     55  consensus_inputranker.test data_lookup_1d.test  \
     56  data_weight.test data_weight_proxy.test distance.test \
     57  dna.test ensemble.test feature_selection.test fileutil.test \
     58  fisher.test genomic_position.test getline_iterator.test histogram.test \
     59  igp.test index.test inputranker.test interpolation.test \
     60  iterator.test kernel_lookup.test kernel_pca.test kernel.test \
     61  knn.test kolmogorov_smirnov.test large_file.test matrix_lookup.test \
     62  matrix_lookup_weighted.test matrix.test \
     63  matrix_weighted.test merge.test nbc.test \
     64  ncc.test nni.test normalization.test pca.test \
     65  range.test regression.test rnd.test roc.test \
     66  score.test  segment.test smart_ptr.test   \
     67  smoother.test split.test statistics.test stream_redirect.test \
     68  subset_generator.test svd.test svm.test \
     69  svm_multi_class.test target.test  \
     70  ttest.test \
     71  utility.test vector.test version.test view.test
    6872
    69 TESTS = $(check_PROGRAMS)
     73TESTS = $(EXTRA_PROGRAMS)
     74CLEANFILES = $(EXTRA_PROGRAMS)
    7075
    7176# tests not passing through yet
     
    8085yat_cxx_add_flag_test.sh \
    8186yat_ld_add_flag_test.sh \
     87yat_lt_link_ifelse_test.sh \
    8288yat_m4_test.sh \
    8389yat_m4_test2.sh
     
    8692EXTRA_DIST = $(DISTRIBUTED_TESTS)
    8793
    88 LDADD = $(top_builddir)/$(YAT_LIB_LOCATION)/libyat.la libyattest.la $(YAT_LIBS)
     94TEST_EXTENSIONS = .sh .test
     95
     96LDADD = $(top_builddir)/yat/libyat.la libyattest.la $(YAT_LIBS)
    8997
    9098libyattest_la_SOURCES = Suite.cc
    9199
    92 alignment_test_SOURCES = alignment_test.cc
    93 averager_test_SOURCES = averager_test.cc
    94 commandline_test_SOURCES = commandline_test.cc
    95 consensus_inputranker_test_SOURCES = consensus_inputranker_test.cc
    96 data_lookup_1d_test_SOURCES = data_lookup_1d_test.cc
    97 data_weight_test_SOURCES = data_weight_test.cc
    98 data_weight_proxy_test_SOURCES = data_weight_proxy_test.cc
    99 distance_test_SOURCES = distance_test.cc
    100 ensemble_test_SOURCES = ensemble_test.cc
    101 feature_selection_test_SOURCES = feature_selection_test.cc
    102 fileutil_test_SOURCES = fileutil_test.cc
    103 fisher_test_SOURCES = fisher_test.cc
    104 getline_iterator_test_SOURCES = getline_iterator_test.cc
    105 histogram_test_SOURCES = histogram_test.cc
    106 igp_test_SOURCES = igp_test.cc
    107 index_test_SOURCES = index_test.cc
    108 inputranker_test_SOURCES = inputranker_test.cc
    109 interpolation_test_SOURCES = interpolation_test.cc
    110 iterator_test_SOURCES = iterator_test.cc
    111 kernel_test_SOURCES = kernel_test.cc
    112 kernel_lookup_test_SOURCES = kernel_lookup_test.cc
    113 knn_test_SOURCES = knn_test.cc 
    114 kolmogorov_smirnov_test_SOURCES = kolmogorov_smirnov_test.cc
    115 large_file_test_SOURCES = large_file_test.cc
    116 matrix_lookup_test_SOURCES = matrix_lookup_test.cc
    117 matrix_lookup_weighted_test_SOURCES = matrix_lookup_weighted_test.cc
    118 matrix_test_SOURCES = matrix_test.cc
    119 matrix_weighted_test_SOURCES = matrix_weighted_test.cc
    120 merge_test_SOURCES = merge_test.cc
    121 nbc_test_SOURCES = nbc_test.cc
    122 ncc_test_SOURCES = ncc_test.cc
    123 nni_test_SOURCES = nni_test.cc
    124 normalization_test_SOURCES = normalization_test.cc
    125 pca_test_SOURCES = pca_test.cc
    126 range_test_SOURCES = range_test.cc
    127 regression_test_SOURCES = regression_test.cc
    128 rnd_test_SOURCES = rnd_test.cc
    129 roc_test_SOURCES = roc_test.cc
    130 score_test_SOURCES = score_test.cc
    131 smart_ptr_test_SOURCES = smart_ptr_test.cc
    132 smoother_test_SOURCES = smoother_test.cc
    133 statistics_test_SOURCES = statistics_test.cc
    134 stream_redirect_test_SOURCES = stream_redirect_test.cc
    135 subset_generator_test_SOURCES = subset_generator_test.cc
    136 svd_test_SOURCES = svd_test.cc
    137 svm_test_SOURCES = svm_test.cc
    138 svm_multi_class_test_SOURCES = svm_multi_class_test.cc
    139 target_test_SOURCES = target_test.cc
    140 ttest_test_SOURCES = ttest_test.cc
    141 utility_test_SOURCES = utility_test.cc
    142 vector_test_SOURCES = vector_test.cc
    143 version_test_SOURCES = version_test.cc
    144 view_test_SOURCES = view_test.cc
     100lazycheck:; $(MAKE) $(AM_MAKEFLAGS) check RECHECK_LOGS=
     101
     102# dependencies for lazycheck
     103static_test.log: $(top_srcdir)/m4/yat.m4 common_defs.sh
     104yat_config_cblas_test.log: $(top_builddir)/build_support/yat-config \
     105  common_defs.sh
     106yat_cpp_add_flag_test.log: $(top_srcdir)/m4/yat_add_flag.m4 \
     107  $(top_srcdir)/m4/ax_cxxcpp_check_flag.m4 common_defs.sh
     108yat_cxx_add_flag_test.log: $(top_srcdir)/m4/yat_add_flag.m4 \
     109  $(top_srcdir)/m4/ax_cxx_check_flag.m4 common_defs.sh
     110yat_ld_add_flag_test.log: $(top_srcdir)/m4/yat_add_flag.m4 \
     111  $(top_srcdir)/m4/ax_ld_check_flag.m4 common_defs.sh
     112yat_lt_link_ifelse_test.log: $(top_srcdir)/m4/yat_lt_link_ifelse.m4 \
     113  common_defs.sh
     114yat_m4_test.log:$(top_srcdir)/m4/yat.m4 common_defs.sh \
     115  $(top_builddir)/build_support/yat-config
     116yat_m4_test2.log:$(top_srcdir)/m4/yat.m4 common_defs.sh
     117
     118## We always rerun documentation_test. When sources for doxygen have
     119## not changed and a rerun would not be needed, the test is very
     120## inexpensive because 'make doc' will not run anything, in other
     121## words, we always run the test but let the logic for 'make doc' take
     122## care of whether doxygen will run or not.
     123documentation_test.log: FORCE
  • tags/0.7/test/README

    r4116 r4116  
    77========
    88
    9 Running all tests
     9Running the tests
    1010-----------------
    1111
    12   make check
     12  To run all tests:
    1313
     14    make check
     15
     16  You can use `-j N' for faster completion on multiprocessor systems.
     17
     18  To rerun only failed tests:
     19
     20    make recheck
     21
     22  To rerun only those tests for there are newer sources
     23
     24    make lazycheck
     25
     26  To run only a subset of tests, use TESTS variable:
     27
     28    make check TESTS="first_test second_test"
     29
     30  To enable test output you can use the VERBOSE variable
     31
     32    make check VERBOSE=1
    1433
    1534Interpretation
     
    3150-----------------------------
    3251
    33   You can run a specific test directly. Add a '-v' flag to trigger verbosity
    34 
    35     ./program_test -v
    36 
    37   If you want to run the test suite in verbose mode, you can invoke
    38   make as follows:
    39 
    40     env VERBOSE=1 make -e check
    41 
    42   If you want to run only a subset of tests, you can invoke make as follows
    43 
    44     env TESTS="first_test second_test" make -e check
     52  You can run the test directly, `./foo_test'; it will be verbose. The
     53  verbose output is also available in `foo_test.log'. A summary log is
     54  created in the file `test-suite.log'.
    4555
    4656
     
    7080  reason it shall return 77.
    7181
    72   When a test is run without verbose flag, it should be silent also at
    73   failure. Achieve this behaviour by sending output through
    74   test::Suite class (see functions err() and out()).
    75 
    7682  When writing numerical tests, it is typically desired to allow for
    7783  some small errors in the comparisons. When comparing two doubles
     
    94100  files, split the test into several independent sub-functions.
    95101
     102C++ tests
     103---------
     104
     105  Use the test::Suite class liberally. See other tests for examples of
     106  typical usage. Add the test to EXTRA_PROGRAMS in Makefile.am. Tests
     107  should have the extension `.test' as in `foo.test' and corresponding
     108  source file should be named `foo.cc'.
     109
     110Shell tests
     111-----------
     112
     113  Use 'required=...' for setting a space delimited list of required
     114  tools (see other tests and common_defs.sh). Include common_defs.sh,
     115  with '. ./common_defs.sh'.
     116
     117  Add test to 'DISTRIBUTED_TESTS' in Makefile.am. In order to get the
     118  lazycheck to behave as expected, declare accurate dependencies. If
     119  test 'foo.sh', for example, depends on file 'bar.txt', create a make
     120  rule: 'foo.log: bar.txt'.
     121
     122  Make sure to set svn property 'svn:executable' on test.
    96123
    97124======================================================================
     
    99126Copyright (C) 2006 Jari Häkkinen
    100127Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    101 Copyright (C) 2009 Peter Johansson
     128Copyright (C) 2009, 2010 Peter Johansson
    102129
    103130This file is part of yat library, http://dev.thep.lu.se/yat
  • tags/0.7/test/Suite.cc

    r4116 r4116  
    33/*
    44  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2009 Peter Johansson
     5  Copyright (C) 2009, 2010 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3939
    4040  Suite::Suite(int argc, char* argv[])
    41     : dev_null_(NULL), known_issues_(0), ok_(true)
     41    : known_issues_(0), ok_(true)
    4242  {
    43     char* buffer=std::getenv("YAT_TEST_VERBOSE");
    44     if (buffer)
    45       std::cerr << "WARNING: environment variable `YAT_TEST_VERBOSE' "
    46                 << "is deprecated\n  use `VERBOSE' instead.\n";
    47     char* env_verbose=std::getenv("VERBOSE");
    48 
    49     if ( (argc>1 && argv[1]==std::string("-v")) ||
    50          (buffer && buffer == std::string("1")) ||
    51          env_verbose) {
    52       verbose_ = true;
    53       // synchronize cerr and cout, i.e., cout is flushed before
    54       // writing anything to cerr.
    55       std::cerr.tie(&std::cout);
    56     }
    57     else {
    58       verbose_ = false;
    59       dev_null_ = new std::ofstream("/dev/null");
    60       if (argc>1){
    61         std::stringstream ss(argv[0]);
    62         std::string prog;
    63         while(getline(ss, prog, '/'));
    64         if (prog.substr(0,3)=="lt-")
    65           prog = prog.substr(3);
    66         std::cout << prog << " -v : for printing extra information\n";
    67       }
    68     }
     43    // synchronize cerr and cout, i.e., cout is flushed before
     44    // writing anything to cerr.
     45    std::cerr.tie(&std::cout);
    6946  }
    7047
     
    7249  Suite::~Suite(void)
    7350  {
    74     if (dev_null_)
    75       delete dev_null_;
    7651  }
    7752
     
    9267  std::ostream& Suite::err(void) const
    9368  {
    94     if (verbose_)
    95       return std::cerr;
    96     return *dev_null_;
     69    return std::cerr;
    9770  }
    9871
     
    144117  std::ostream& Suite::out(void) const
    145118  {
    146     if (verbose_)
    147       return std::cout;
    148     return *dev_null_;
     119    return std::cout;
    149120  }
    150121
  • tags/0.7/test/Suite.h

    r4116 r4116  
    2424*/
    2525
     26#include <yat/utility/VectorMutable.h>
     27#include <yat/classifier/Target.h>
     28
     29#include <boost/concept_archetype.hpp>
     30
    2631#include <iosfwd>
    2732#include <sstream>
     33#include <vector>
    2834
    2935namespace theplu {
     
    155161
    156162  private:
    157     std::ofstream* dev_null_;
    158163    unsigned int known_issues_;
    159164    bool ok_;
    160     bool verbose_;
    161 
    162165  };
    163166
     
    220223    column_iterator end_column(size_t) { return NULL; }
    221224    iterator end_row(size_t) { return NULL; }
    222     reference operator()(size_t row, size_t column) const
     225    reference operator()(size_t row, size_t column)
    223226    { return this->element_; }
     227  };
     228
     229  /*
     230    class to test (at compile time) that a function (or class) works
     231    with a Distance. Do not run any test using this class because
     232    the class is not really functional at run time.
     233
     234    \see boost/concept_archetype.hpp
     235   */
     236  class distance_archetype
     237  {
     238  public:
     239    /// class must be constructible somehow, but we don't wanna assume
     240    /// void constructor or any other common constructor so we use the
     241    /// signature to allow construction without assuming too much.
     242    distance_archetype(const boost::detail::dummy_constructor&) {};
     243    distance_archetype(const distance_archetype&) {};
     244    template<typename T1, typename T2>
     245    double operator()(T1 first1, T1 last1, T2 first2) const { return 0.0; }
     246  private:
     247    distance_archetype(void);
     248    distance_archetype& operator=(const distance_archetype&);
     249  };
     250
     251  /*
     252    class to test (at compile time) that a function (or class) works
     253    with a NeighborWeighting. Do not run any test using this class because
     254    the class is not really functional at run time.
     255
     256    \see boost/concept_archetype.hpp
     257   */
     258  class neighbor_weighting_archetype
     259  {
     260  public:
     261    neighbor_weighting_archetype(void) {}
     262    void operator()(const utility::VectorBase& distance,
     263                    const std::vector<size_t>& k_sorted,
     264                    const classifier::Target& target,
     265                    utility::VectorMutable& prediction) const {}
     266    neighbor_weighting_archetype& operator=(const neighbor_weighting_archetype&)
     267    { return *this; }
     268  private:
     269    neighbor_weighting_archetype(const neighbor_weighting_archetype&) {};
    224270  };
    225271
  • tags/0.7/test/common_defs.sh.in

    r4116 r4116  
    22# $Id$
    33
    4 # Copyright (C) 2009 Peter Johansson
     4# Copyright (C) 2009, 2010 Peter Johansson
    55#
    66# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3131}
    3232
     33#
     34#
     35bootstrap ()
     36{
     37    @MKDIR_P@ m4
     38    autoreconf -siv && true
     39    res=$?
     40    case $res in
     41        0)
     42            :;;
     43        63)
     44            exit 77;;
     45        *)
     46            exit $res;;
     47    esac
     48}
     49
    3350
    3451me=$0
    3552
    36 while test $# -gt 0; do
    37     case "$1" in
    38     -v)
    39     VERBOSE=1
    40     ;;
    41     esac
    42     shift
    43 done
    44 
    45 if test -n "$YAT_TEST_VERBOSE"; then
    46   VERBOSE=YAT_TEST_VERBOSE;
    47   echo "WARNING: environment variable \`YAT_TEST_VERBOSE' is deprecated;";
    48   echo "  use \`VERBOSE' instead.";
    49 fi
    50 
    51 if test -z "$VERBOSE"; then
    52   exec > /dev/null 2>&1
    53 fi
    54 
    5553echo "=== Running $me ==="
    5654
    57 ac_prog_libtool=
    5855# if required tool is not available, exit 77 to skip test
    5956if test -n "$required"; then
     
    6461      (echo "$me: running libtool --version" && libtool --version) || \
    6562      (echo "$me: running glibtool --version" && glibtool --version) || exit 77
    66       ac_prog_libtool="AC_PROG_LIBTOOL"
    6763      ;;
    68       *.m4)
    69       : # do nothing see below
     64      static)
     65      if (test "x@enable_static@" = "xno"); then
     66        echo static libyat disabled;
     67        exit 77;
     68      fi
    7069      ;;
    7170      *)
     
    8382move_if_change=@abs_top_srcdir@/build_support/move-if-change
    8483
     84rm -rf $test_dir
    8585@MKDIR_P@ --verbose $test_dir
    86 
    87 if (echo "$required" | grep autoconf); then
    88 # if not a new acinclude.m4 exists, create a dummy one
    89 if (test -f acinclude.m4 && \
    90     is_newest acinclude.m4 common_defs.sh $me); then
    91   :
    92 else
    93   echo "creating a dummy acinclude.m4"
    94   echo "dnl a dummy include" > $test_dir/acinclude.m4 
    95 fi
    96 fi
    9786
    9887cd $test_dir
    9988
    100 if (echo "$required" | grep autoconf); then
     89if (echo "$required" | grep autoconf > /dev/null); then
    10190echo "creating configure.ac"
    102 cat > configure.ac.tmp <<EOF
     91cat > configure.ac <<EOF
    10392AC_INIT([hello],[1.0])
    10493AC_CONFIG_SRCDIR([hello.cc])
     
    10897AC_PROG_CXXCPP
    10998AC_PROG_CXX
    110 $ac_prog_libtool
    111 m4_include(acinclude.m4)
    112 AC_CONFIG_FILES([Makefile])
    113 AC_OUTPUT
    11499EOF
    115 $move_if_change -v configure.ac.tmp configure.ac
     100if (echo "$required" | grep libtool > /dev/null); then
     101echo AC_PROG_LIBTOOL >> configure.ac
     102fi
     103
    116104
    117105echo "creating Makefile.am"
    118 cat > Makefile.am.tmp <<EOF
    119 ACLOCAL_AMFLAGS = -I m4
    120 # dependency to rerun configure
    121 CONFIG_STATUS_DEPENDENCIES = $abs_top_builddir/build_support/yat-config
     106cat > Makefile.am <<EOF
     107ACLOCAL_AMFLAGS = -I m4 -I ${abs_top_srcdir}/m4 --install
    122108AM_CPPFLAGS = \$(YAT_CPPFLAGS)
    123109AM_CXXFLAGS = \$(YAT_CXXFLAGS)
     
    127113hello_SOURCES = hello.cc
    128114EOF
    129 $move_if_change -v Makefile.am.tmp Makefile.am
    130115
    131116echo "creating hello.cc"
    132 cat > hello.cc.tmp <<EOF
     117cat > hello.cc <<EOF
    133118#include <yat/utility/Vector.h>
    134119#include <yat/utility/version.h>
     
    151136}
    152137EOF
    153 $move_if_change -v hello.cc.tmp hello.cc
    154138fi #end of creation of autotool files
    155139
    156 if test -n "$required"; then
    157   for tool in $required; do
    158     case $tool in
    159       *.m4)
    160       @MKDIR_P@ --verbose m4
    161       echo "copying $tool"
    162       cp @abs_top_srcdir@/m4/$tool m4/$tool.tmp
    163       $move_if_change -v m4/$tool.tmp m4/$tool
    164       ;;
    165       *)
    166       :
    167     esac
    168   done
    169 fi
    170  
    171140# turn on shell traces when in verbose mode
    172 if test -n "$YAT_TEST_VERBOSE"; then
    173     set -x
    174 fi
     141set -x
  • tags/0.7/test/documentation_test.sh.in

    r4116 r4116  
    2525have_doxygen="@have_doxygen@"
    2626
    27 while test $# -gt 0; do
    28     case "$1" in
    29     -v)
    30     VERBOSE=1
    31     ;;
    32     esac
    33     shift
    34 done
    35 
    36 if test -n "$YAT_TEST_VERBOSE"; then
    37   VERBOSE=YAT_TEST_VERBOSE;
    38   echo "WARNING: environment variable \`YAT_TEST_VERBOSE' is deprecated;";
    39   echo "  use \`VERBOSE' instead.";
    40 fi
    41 
    42 if test -z "$VERBOSE"; then
    43   exec > /dev/null 2>&1
    44 fi
    45 
    4627if test $have_doxygen = "no"; then
    4728    echo Skipped;
  • tags/0.7/test/static_test.sh

    r4116 r4116  
    2222# test that it works to link statically against libyat
    2323
    24 required="autoconf automake libtool yat.m4"
     24required="autoconf automake libtool static"
    2525
    2626set -e
     
    2828. ./common_defs.sh || exit 1
    2929
    30 echo "Creating acinclude.m4"
    31 cat > acinclude.m4.tmp <<EOF
     30cat >> configure.ac <<EOF
    3231YAT_FIND_YAT
    3332CXX=\`\$yat_config --cxx\`
     
    3736YAT_LDADD=\`\$yat_config --link-libtool\`
    3837AC_SUBST(YAT_LDADD)
     38AC_CONFIG_FILES([Makefile])
     39AC_OUTPUT
    3940EOF
    40 $move_if_change -v acinclude.m4.tmp acinclude.m4
    4141
    4242echo "AM_LDFLAGS = -all-static" >> Makefile.am
    4343
    44 # bootstrapping
    45 if test -f Makefile; then
    46   :
    47 else
    48   autoreconf -siv
    49   ./configure --with-yat=$abs_top_builddir/build_support/yat-config
    50 fi
     44bootstrap
     45./configure --with-yat=$abs_top_builddir/build_support/yat-config
    5146
    52 # we always wanna relink
    53 rm -f hello
    54 echo "running make"
    5547make
    56 echo "running ./hello"
    5748./hello || exit 1
    5849
  • tags/0.7/test/yat_config_cblas_test.sh

    r4116 r4116  
    22# $Id$
    33#
    4 # Copyright (C) 2009 Peter Johansson
     4# Copyright (C) 2009, 2010 Peter Johansson
    55#
    66# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2929
    3030export YAT_CBLAS_LIB=BOGUSBOGUS
    31 cmd="$abs_top_builddir/build_support/yat-config --libs"
    32 echo "calling: $cmd"
    33 ret_str=`$cmd`
    34 echo "returns: $ret_str"
     31ret_str=`$abs_top_builddir/build_support/yat-config --libs`
    3532echo $ret_str | grep BOGUSBOGUS || exit 1
    36 
    37 echo "Test is OK"
     33exit 0
  • tags/0.7/test/yat_cpp_add_flag_test.sh

    r4116 r4116  
    22# $Id$
    33#
    4 # Copyright (C) 2009 Peter Johansson
     4# Copyright (C) 2009, 2010 Peter Johansson
    55#
    66# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2323# includes like `-I/usr/include' and `-I/usr/local/include'
    2424
    25 required="autoconf automake g++ yat_add_flag.m4 ax_cxxcpp_check_flag.m4"
     25required="autoconf automake g++"
    2626
    2727set -e
     
    2929. ./common_defs.sh || exit 1
    3030
    31 echo "Creating acinclude.m4"
    32 cat > acinclude.m4.tmp <<EOF
     31cat >> configure.ac <<EOF
    3332YAT_CPP_ADD_FLAG([YAT_CPPFLAGS__], [-I/usr/include])
    3433YAT_CPP_ADD_FLAG([YAT_CPPFLAGS__], [-I/usr/local/include])
     
    3635YAT_CPP_ADD_FLAG([YAT_CPPFLAGS__], [-DHAVE_SOMETHING])
    3736AC_SUBST(YAT_CPPFLAGS__)
     37AC_CONFIG_FILES([Makefile])
     38AC_OUTPUT
    3839EOF
    39 $move_if_change -v acinclude.m4.tmp acinclude.m4
    4040
    41 # bootstrapping
    42 if test -f Makefile; then
    43   :
    44 else
    45   autoreconf -siv
    46   ./configure CXX=g++
    47 fi
    48 
    49 echo "$me: running make Makefile"
    50 make Makefile
     41bootstrap
     42./configure CXX=g++
    5143
    5244grep 'YAT_CPPFLAGS__' Makefile
     
    5951fi
    6052
    61 if test `grep 'YAT_CPPFLAGS__.*SOMETHING.*SOMETHING' Makefile|wc -l`=0;
     53if test `grep 'YAT_CPPFLAGS__.*SOMETHING.*SOMETHING' Makefile|wc -l` = 0;
    6254then
    6355  :
  • tags/0.7/test/yat_cxx_add_flag_test.sh

    r4116 r4116  
    22# $Id$
    33#
    4 # Copyright (C) 2009 Peter Johansson
     4# Copyright (C) 2009, 2010 Peter Johansson
    55#
    66# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2323# is already present
    2424
    25 required="autoconf automake g++ yat_add_flag.m4 ax_cxx_check_flag.m4"
     25required="autoconf automake g++"
    2626
    2727set -e
     
    2929. ./common_defs.sh || exit 1
    3030
    31 echo "Creating acinclude.m4"
    32 cat > acinclude.m4.tmp <<EOF
     31cat >> configure.ac <<EOF
    3332YAT_CXX_ADD_FLAG([YAT_CXXFLAGS__], [-DSOMETHING])
    3433YAT_CXX_ADD_FLAG([YAT_CXXFLAGS__], [-DSOMETHING])
    3534AC_SUBST(YAT_CXXFLAGS__)
     35AC_CONFIG_FILES([Makefile])
     36AC_OUTPUT
    3637EOF
    37 $move_if_change -v acinclude.m4.tmp acinclude.m4
    3838
    39 # bootstrapping
    40 if test -f Makefile; then
    41   :
    42 else
    43   autoreconf -siv
    44   ./configure CXX=g++
    45 fi
    46 
    47 echo "$me: running make Makefile"
    48 make Makefile
     39bootstrap
     40./configure CXX=g++
    4941
    5042grep 'YAT_CXXFLAGS__' Makefile
  • tags/0.7/test/yat_ld_add_flag_test.sh

    r4116 r4116  
    22# $Id$
    33#
    4 # Copyright (C) 2009 Peter Johansson
     4# Copyright (C) 2009, 2010 Peter Johansson
    55#
    66# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2323# includes like `-L/usr/lib' and `-L/usr/local/lib'
    2424
    25 required="autoconf automake g++ yat_add_flag.m4 ax_ld_check_flag.m4"
     25required="autoconf automake g++"
    2626
    2727set -e
     
    2929. ./common_defs.sh || exit 1
    3030
    31 echo "Creating acinclude.m4"
    32 cat > acinclude.m4.tmp <<EOF
     31cat >> configure.ac <<EOF
    3332YAT_LD_ADD_FLAG([YAT_LDFLAGS__], [-L/usr/lib])
    3433YAT_LD_ADD_FLAG([YAT_LDFLAGS__], [-L/usr/local/lib])
     
    3635YAT_LD_ADD_FLAG([YAT_LDFLAGS__], [-L/opt/lib])
    3736AC_SUBST(YAT_LDFLAGS__)
     37AC_CONFIG_FILES([Makefile])
     38AC_OUTPUT
    3839EOF
    39 $move_if_change -v acinclude.m4.tmp acinclude.m4
    4040
    41 # bootstrapping
    42 if test -f Makefile; then
    43   :
    44 else
    45   autoreconf -siv
    46   ./configure CXX=g++
    47 fi
    48 
    49 echo "$me: running make Makefile"
    50 make Makefile
     41bootstrap
     42./configure CXX=g++
    5143
    5244grep 'YAT_LDFLAGS__' Makefile
     
    5951fi
    6052
    61 if test `grep 'YAT_LDFLAGS__.*opt.*opt' Makefile|wc -l`=0;
     53if test `grep 'YAT_LDFLAGS__.*opt.*opt' Makefile|wc -l` = 0;
    6254then
    6355  :
  • tags/0.7/test/yat_m4_test.sh

    r4116 r4116  
    2323# configure.ac. Test if the macro works against an uninstalled yat.
    2424
    25 required="autoconf automake libtool yat.m4"
     25required="autoconf automake libtool"
    2626
    2727set -e
     
    2929. ./common_defs.sh || exit 1
    3030
    31 echo "Creating acinclude.m4"
    32 cat > acinclude.m4.tmp <<EOF
     31cat >> configure.ac <<EOF
    3332YAT_FIND_YAT
    3433CXX=\`\$yat_config --cxx\`
     
    3837YAT_LDADD=\`\$yat_config --link-libtool\`
    3938AC_SUBST(YAT_LDADD)
     39AC_CONFIG_FILES([Makefile])
     40AC_OUTPUT
    4041EOF
    41 $move_if_change -v acinclude.m4.tmp acinclude.m4
    4242
    43 # bootstrapping
    44 if test -f Makefile; then
    45   :
    46 else
    47   autoreconf -siv
    48   ./configure --with-yat=$abs_top_builddir/build_support/yat-config
    49 fi
     43bootstrap
     44./configure --with-yat=$abs_top_builddir/build_support/yat-config
    5045
    5146# we always wanna relink
  • tags/0.7/test/yat_m4_test2.sh

    r4116 r4116  
    22# $Id$
    33#
    4 # Copyright (C) 2009 Peter Johansson
     4# Copyright (C) 2009, 2010 Peter Johansson
    55#
    66# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2222# test that option --with-yat=no works as expected.
    2323
    24 required="autoconf automake yat.m4"
     24required="autoconf automake"
    2525
    2626set -e
     
    2828. ./common_defs.sh || exit 1
    2929
    30 echo "creating acinclude.m4"
    31 cat > acinclude.m4.tmp <<EOF
     30cat >> configure.ac <<EOF
    3231YAT_FIND_YAT(,[AC_MSG_ERROR([yat_find_yat failed - see warning above])])
    3332YAT_CHECK_VERSION([1.60.2],
     
    3635YAT_CHECK_LIB(,[AC_MSG_ERROR([yat_check_lib failed - see warning above])])
    3736YAT_CHECK_YAT([2.7.8],,AC_MSG_ERROR([yat_check_yat failed - see warning above]))
     37AC_CONFIG_FILES([Makefile])
     38AC_OUTPUT
    3839EOF
    39 $move_if_change -v acinclude.m4.tmp acinclude.m4
    4040
    41 # bootstrapping
    42 if test -f Makefile; then
    43   :
    44 else
    45   autoreconf -fsiv
    46   ./configure --without-yat
    47 fi
     41bootstrap
     42./configure --without-yat
    4843make Makefile
    4944
  • tags/0.7/yat/Makefile.am

    r4116 r4116  
    66# Copyright (C) 2004 Jari Häkkinen, Peter Johansson, Cecilia Ritz
    77# Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    8 # Copyright (C) 2009 Peter Johansson
     8# Copyright (C) 2009, 2010 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 SUBDIRS = classifier normalizer random regression statistics utility
     25SUBDIRS = classifier normalizer omic random regression statistics utility
    2626
    2727lib_LTLIBRARIES = libyat.la
     
    3737  classifier/libclassifier.la \
    3838  normalizer/libnormalizer.la \
     39  omic/libomic.la \
    3940  random/librandom.la \
    4041  regression/libregression.la \
  • tags/0.7/yat/classifier/ConsensusInputRanker.cc

    r4116 r4116  
    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
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    7879    id_.resize(data.rows());
    7980    rank_.resize(data.rows());
    80     for (size_t i=0; i<sampler.size(); ++i){
    81       input_rankers_.push_back(InputRanker(MatrixLookupWeighted(data,sampler.training_index(i), false),
     81    for (size_t i=0; i<sampler.size(); ++i) {
     82      MatrixLookupWeighted mlw(data, utility::Index(data.rows()),
     83                               sampler.training_index(i));
     84      input_rankers_.push_back(InputRanker(mlw,
    8285                                           sampler.training_target(i),
    8386                                           score));       
  • tags/0.7/yat/classifier/EnsembleBuilder.h

    r4116 r4116  
    1010  Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
    1111  Copyright (C) 2009 Jari Häkkinen, Peter Johansson
     12  Copyright (C) 2010 Peter Johansson
    1213
    1314  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    221222                                               size_t k)
    222223  {
    223     return MatrixLookupWeighted(data, subset_->training_features(k), true);
     224    return MatrixLookupWeighted(data, subset_->training_features(k),
     225                                utility::Index(data.columns()));
    224226  }
    225227 
  • tags/0.7/yat/classifier/FeatureSelector.cc

    r4116 r4116  
    33/*
    44  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2010 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    5758  FeatureSelector::get(const MatrixLookupWeighted& matrix)
    5859  {
    59     return MatrixLookupWeighted(matrix, features_, true);
     60    return MatrixLookupWeighted(matrix, features_,
     61                                yat::utility::Index(matrix.columns()));
    6062  }
    6163
  • tags/0.7/yat/classifier/IGP.h

    r4116 r4116  
    77  Copyright (C) 2006 Jari Häkkinen, Markus Ringnér
    88  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
    9   Copyright (C) 2009 Peter Johansson
     9  Copyright (C) 2009, 2010 Peter Johansson
    1010
    1111  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2727#include "MatrixLookup.h"
    2828#include "Target.h"
     29#include "yat/utility/concept_check.h"
    2930#include "yat/utility/Vector.h"
    3031#include "yat/utility/yat_assert.h"
     32
     33#include <boost/concept_check.hpp>
    3134
    3235#include <cmath>
     
    9295    : matrix_(data), target_(target)
    9396  {   
     97    BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>));
    9498    calculate();
    9599  }
     
    99103    : matrix_(data), target_(target), distance_(dist)
    100104  {   
     105    BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>));
    101106    calculate();
    102107  }
  • tags/0.7/yat/classifier/KNN.h

    r4116 r4116  
    66/*
    77  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
    8   Copyright (C) 2009 Peter Johansson
     8  Copyright (C) 2009, 2010 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3131#include "SupervisedClassifier.h"
    3232#include "Target.h"
     33#include "yat/utility/concept_check.h"
     34#include "yat/utility/Exception.h"
    3335#include "yat/utility/Matrix.h"
     36#include "yat/utility/Vector.h"
     37#include "yat/utility/VectorConstView.h"
     38#include "yat/utility/VectorView.h"
    3439#include "yat/utility/yat_assert.h"
     40
     41#include <boost/concept_check.hpp>
    3542
    3643#include <cmath>
     
    3845#include <map>
    3946#include <stdexcept>
     47#include <vector>
    4048
    4149namespace theplu {
     
    132140        this case the distance between the two is set to infinity.
    133141    */
    134     void predict(const MatrixLookupWeighted& data, utility::Matrix& results) const;
     142    void predict(const MatrixLookupWeighted& data,
     143                 utility::Matrix& results) const;
    135144
    136145
     
    184193 
    185194 
    186   // templates
     195  /**
     196     \brief Concept check for a \ref concept_neighbor_weighting
     197
     198     This class is intended to be used in a <a
     199     href="\boost_url/concept_check/using_concept_check.htm">
     200     BOOST_CONCEPT_ASSERT </a>
     201
     202     \code
     203     template<class Distance>
     204     void some_function(double x)
     205     {
     206     BOOST_CONCEPT_ASSERT((DistanceConcept<Distance>));
     207     ...
     208     }
     209     \endcode
     210
     211     \since New in yat 0.7
     212  */
     213  template <class T>
     214  class NeighborWeightingConcept
     215    : public boost::DefaultConstructible<T>, public boost::Assignable<T>
     216  {
     217  public:
     218    /**
     219       \brief function doing the concept test
     220     */
     221    BOOST_CONCEPT_USAGE(NeighborWeightingConcept)
     222    {
     223      T neighbor_weighting;
     224      utility::Vector vec;
     225      const utility::VectorBase& distance(vec);
     226      utility::VectorMutable& prediction(vec);
     227      std::vector<size_t> k_sorted;
     228      Target target;
     229      neighbor_weighting(distance, k_sorted, target, prediction);
     230    }
     231  private:
     232  };
     233
     234  // template implementation
    187235 
    188236  template <typename Distance, typename NeighborWeighting>
     
    190238    : SupervisedClassifier(),data_ml_(0),data_mlw_(0),target_(0),k_(3)
    191239  {
     240    BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>));
     241    BOOST_CONCEPT_ASSERT((NeighborWeightingConcept<NeighborWeighting>));
    192242  }
    193243
    194244  template <typename Distance, typename NeighborWeighting>
    195245  KNN<Distance, NeighborWeighting>::KNN(const Distance& dist)
    196     : SupervisedClassifier(),data_ml_(0),data_mlw_(0),target_(0),k_(3), distance_(dist)
    197   {
     246    : SupervisedClassifier(), data_ml_(0), data_mlw_(0), target_(0), k_(3),
     247      distance_(dist)
     248  {
     249    BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>));
     250    //    BOOST_CONCEPT_ASSERT((NeighborWeightingConcept<NeighborWeighting>));
    198251  }
    199252
     
    212265    for(size_t i=0; i<training.columns(); i++) {
    213266      for(size_t j=0; j<test.columns(); j++) {
    214         (*distances)(i,j) = distance_(training.begin_column(i), training.end_column(i),
     267        (*distances)(i,j) = distance_(training.begin_column(i),
     268                                      training.end_column(i),
    215269                                      test.begin_column(j));
    216270        YAT_ASSERT(!std::isnan((*distances)(i,j)));
     
    228282    for(size_t i=0; i<training.columns(); i++) {
    229283      for(size_t j=0; j<test.columns(); j++) {
    230         (*distances)(i,j) = distance_(training.begin_column(i), training.end_column(i),
     284        (*distances)(i,j) = distance_(training.begin_column(i),
     285                                      training.end_column(i),
    231286                                      test.begin_column(j));
    232287        // If the distance is NaN (no common variables with non-zero weights),
     
    269324                                               const Target& target)
    270325  {   
    271     utility::yat_assert<std::runtime_error>
     326    utility::yat_assert<utility::runtime_error>
    272327      (data.columns()==target.size(),
    273328       "KNN::train called with different sizes of target and data");
     
    284339                                               const Target& target)
    285340  {   
    286     utility::yat_assert<std::runtime_error>
     341    utility::yat_assert<utility::runtime_error>
    287342      (data.columns()==target.size(),
    288343       "KNN::train called with different sizes of target and data");
     
    297352
    298353  template <typename Distance, typename NeighborWeighting>
    299   void KNN<Distance, NeighborWeighting>::predict(const MatrixLookup& test,
    300                                                  utility::Matrix& prediction) const
     354  void
     355  KNN<Distance, NeighborWeighting>::predict(const MatrixLookup& test,
     356                                            utility::Matrix& prediction) const
    301357  {   
    302358    // matrix with training samples as rows and test samples as columns
     
    304360    // unweighted training data
    305361    if(data_ml_ && !data_mlw_) {
    306       utility::yat_assert<std::runtime_error>
     362      utility::yat_assert<utility::runtime_error>
    307363        (data_ml_->rows()==test.rows(),
    308          "KNN::predict different number of rows in training and test data");     
     364         "KNN::predict different number of rows in training and test data");
    309365      distances=new utility::Matrix(data_ml_->columns(),test.columns());
    310366      calculate_unweighted(*data_ml_,test,distances);
     
    312368    else if (data_mlw_ && !data_ml_) {
    313369      // weighted training data
    314       utility::yat_assert<std::runtime_error>
     370      utility::yat_assert<utility::runtime_error>
    315371        (data_mlw_->rows()==test.rows(),
    316          "KNN::predict different number of rows in training and test data");           
     372         "KNN::predict different number of rows in training and test data");
    317373      distances=new utility::Matrix(data_mlw_->columns(),test.columns());
    318374      calculate_weighted(*data_mlw_,MatrixLookupWeighted(test),
     
    320376    }
    321377    else {
    322       std::runtime_error("KNN::predict no training data");
     378      throw utility::runtime_error("KNN::predict no training data");
    323379    }
    324380
     
    330386
    331387  template <typename Distance, typename NeighborWeighting>
    332   void KNN<Distance, NeighborWeighting>::predict(const MatrixLookupWeighted& test,
    333                                                  utility::Matrix& prediction) const
     388  void
     389  KNN<Distance, NeighborWeighting>::predict(const MatrixLookupWeighted& test,
     390                                            utility::Matrix& prediction) const
    334391  {   
    335392    // matrix with training samples as rows and test samples as columns
     
    337394    // unweighted training data
    338395    if(data_ml_ && !data_mlw_) {
    339       utility::yat_assert<std::runtime_error>
     396      utility::yat_assert<utility::runtime_error>
    340397        (data_ml_->rows()==test.rows(),
    341398         "KNN::predict different number of rows in training and test data");   
     
    345402    // weighted training data
    346403    else if (data_mlw_ && !data_ml_) {
    347       utility::yat_assert<std::runtime_error>
     404      utility::yat_assert<utility::runtime_error>
    348405        (data_mlw_->rows()==test.rows(),
    349406         "KNN::predict different number of rows in training and test data");   
     
    352409    }
    353410    else {
    354       std::runtime_error("KNN::predict no training data");
     411      throw utility::runtime_error("KNN::predict no training data");
    355412    }
    356413
     
    381438          prediction(c,j)=std::numeric_limits<double>::quiet_NaN();
    382439  }
    383 
    384 
    385440}}} // of namespace classifier, yat, and theplu
    386441
    387442#endif
    388 
  • tags/0.7/yat/classifier/Kernel.cc

    r4116 r4116  
    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
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2728#include "MatrixLookup.h"
    2829#include "MatrixLookupWeighted.h"
     30
     31#include "yat/utility/Exception.h"
    2932
    3033#include <cassert>
     
    6568   
    6669    if (other.weighted()){
    67       mlw_ = new MatrixLookupWeighted(*other.mlw_, utility::Index(index),true);
     70      mlw_ = new MatrixLookupWeighted(*other.mlw_, utility::Index(index),
     71                                      utility::Index(other.mlw_->columns()));
    6872      ref_count_w_ = new unsigned int(1);
    6973      ml_=NULL;
     
    96100  {
    97101    if (weighted())
    98       throw std::runtime_error("Kernel::data when Kernel is weighted");
     102      throw utility::runtime_error("Kernel::data when Kernel is weighted");
    99103    assert(ml_);
    100104    return *ml_;
     
    105109  {
    106110    if (!weighted())
    107       throw std::runtime_error("Kernel:data_weighted when Kernel is unweighted");
     111      throw utility::runtime_error("Kernel:data_weighted when Kernel is unweighted");
    108112    assert(mlw_);
    109113    return *mlw_;
  • tags/0.7/yat/classifier/KernelLookup.cc

    r4116 r4116  
    33/*
    44  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2010 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    140141  {
    141142    assert(weighted());
    142     return MatrixLookupWeighted(kernel_->data_weighted(),column_index_,false);
     143    using utility::Index; // just to avoid long line
     144    return MatrixLookupWeighted(kernel_->data_weighted(),
     145                                Index(kernel_->data_weighted().rows()),
     146                                column_index_);
    143147  }
    144148
     
    187191    if (kernel_->weighted()){
    188192      const MatrixLookupWeighted* ms =
    189         new MatrixLookupWeighted(data_weighted(),inputs,true);
     193        new MatrixLookupWeighted(data_weighted(),inputs,
     194                                 utility::Index(data_weighted().columns()));
    190195      kernel = kernel_->make_kernel(*ms, true);
    191196    }
  • tags/0.7/yat/classifier/KernelLookup.h

    r4116 r4116  
    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
    1011
    1112  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    8384    /// 'Read Only' iterator
    8485    typedef utility::StrideIterator<
    85     utility::Container2DIterator<const KernelLookup, value_type,
     86    utility::Container2DIterator<const KernelLookup, const double,
    8687                                 const_reference> >
    8788    const_iterator;
  • tags/0.7/yat/classifier/Makefile.am

    r4116 r4116  
    44
    55# Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
    6 # Copyright (C) 2009 Peter Johansson
     6# Copyright (C) 2009, 2010 Peter Johansson
    77#
    88# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    9696all-local: doxygen.mk
    9797
    98 doxygen.mk: Makefile.am
    99   echo "# generated by make" > $@ && \
    100   echo $(ECHO_N) "classifier_doxygen_input=$(ECHO_C)" >> $@ && \
    101   for f in $(include_classifier_HEADERS); do \
    102     echo $(ECHO_N) "\$$(top_srcdir)/$(subdir)/$$f $(ECHO_C)" >> $@; \
    103   done && \
    104   echo >> $@
     98DOXYGEN_INPUT=$(include_classifier_HEADERS)
    10599
     100include $(top_srcdir)/am/doxygen.am
  • tags/0.7/yat/classifier/MatrixLookup.h

    r4116 r4116  
    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 Peter Johansson
     10  Copyright (C) 2009, 2010 Peter Johansson
    1111
    1212  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2727
    2828#include "yat/utility/Container2DIterator.h"
     29#include "yat/utility/deprecate.h"
    2930#include "yat/utility/Index.h"
    3031#include "yat/utility/iterator_traits.h"
     
    8586
    8687    /// 'Read Only' iterator
    87     typedef utility::Container2DIterator<const MatrixLookup, value_type,
     88    typedef utility::Container2DIterator<const MatrixLookup, const double,
    8889                                         const_reference>
    8990    const_iterator;
     
    150151    /// undefined.
    151152    ///
     153    /// \deprecated Provided for backward compatibility with
     154    /// the 0.6 API. Use MatrixLookup(const utility::Matrix&, const
     155    /// utility::Index&, const utility::Index&)
     156    ///
    152157    MatrixLookup(const utility::Matrix& matrix,
    153158                 const utility::Index& index,
    154                  const bool row_vectors);
     159                 const bool row_vectors) YAT_DEPRECATE;
    155160
    156161    ///
     
    215220    /// undefined.
    216221    ///
     222    /// \deprecated Provided for backgroundColor compatibility with
     223    /// the 0.6 API. Use MatrixLookup(const MatrixLookup&, const
     224    /// utility::Index&, const utility::Index&)
     225    ///
    217226    MatrixLookup(const MatrixLookup& ml, const utility::Index&,
    218227                 const bool row_vectors);
     
    228237    /// @brief The istream constructor.
    229238    ///
    230     /// In construction the underlying matrix is created from
    231     /// stream. The MatrixLookup will be owner of the underlying
     239    /// In construction the underlying utility::Matrix is created from
     240    /// the stream using utility::Matrix(std::istream&). The
     241    /// constructed MatrixLookup will be owner of the underlying
    232242    /// matrix.
    233243    ///
    234     /// @see matrix(istream&) for details.
     244    /// @see Matrix(istream&) for details.
    235245    ///
    236246    MatrixLookup(std::istream&, char sep='\0');
  • tags/0.7/yat/classifier/MatrixLookupWeighted.h

    r4116 r4116  
    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 Peter Johansson
     9  Copyright (C) 2009, 2010 Peter Johansson
    1010
    1111  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2727#include "yat/utility/Container2DIterator.h"
    2828#include "yat/utility/DataWeight.h"
     29#include "yat/utility/deprecate.h"
    2930#include "yat/utility/Index.h"
    3031#include "yat/utility/MatrixWeighted.h"
     
    8081    typedef utility::StrideIterator<
    8182    utility::Container2DIterator<const MatrixLookupWeighted,
    82                                  value_type, const_reference> >
     83                                 const value_type, const_reference> >
    8384    const_iterator;
    8485
     
    182183    /// undefined.
    183184    ///
    184     MatrixLookupWeighted(const MatrixLookupWeighted& ml,
     185    /// \deprecated Provided for backward compatibility with the 0.6
     186    /// API. Use MatrixLookupWeighted(const MatrixLookupWeighted&,
     187    /// const utility::Index&, const utility::Index&)
     188    ///
     189    MatrixLookupWeighted(const MatrixLookupWeighted& ml,
    185190                         const utility::Index&,
    186                          const bool row_vectors);
     191                         const bool row_vectors) YAT_DEPRECATE;
    187192
    188193    ///
  • tags/0.7/yat/classifier/NCC.h

    r4116 r4116  
    77  Copyright (C) 2005 Peter Johansson, Markus Ringnér
    88  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
    9   Copyright (C) 2009 Peter Johansson
     9  Copyright (C) 2009, 2010 Peter Johansson
    1010
    1111  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3232#include "yat/statistics/Averager.h"
    3333#include "yat/statistics/AveragerWeighted.h"
     34#include "yat/utility/concept_check.h"
     35#include "yat/utility/Exception.h"
    3436#include "yat/utility/Matrix.h"
    3537#include "yat/utility/MatrixWeighted.h"
     
    3840#include "yat/utility/yat_assert.h"
    3941
     42#include <boost/concept_check.hpp>
     43
    4044#include <iterator>
    4145#include <map>
    4246#include <cmath>
    43 #include <stdexcept>
    4447
    4548namespace theplu {
     
    179182    : SupervisedClassifier(), centroids_nan_(false)
    180183  {
     184    BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>));
    181185  }
    182186
     
    185189    : SupervisedClassifier(), centroids_nan_(false), distance_(dist)
    186190  {
     191    BOOST_CONCEPT_ASSERT((utility::DistanceConcept<Distance>));
    187192  }
    188193
     
    250255                              utility::Matrix& prediction) const
    251256  {   
    252     utility::yat_assert<std::runtime_error>
     257    utility::yat_assert<utility::runtime_error>
    253258      (centroids_.rows()==test.rows(),
    254259       "NCC::predict test data with incorrect number of rows");
     
    270275                              utility::Matrix& prediction) const
    271276  {   
    272     utility::yat_assert<std::runtime_error>
     277    utility::yat_assert<utility::runtime_error>
    273278      (centroids_.rows()==test.rows(),
    274279       "NCC::predict test data with incorrect number of rows");
  • tags/0.7/yat/classifier/SVM.cc

    r4116 r4116  
    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 Peter Johansson
     8  Copyright (C) 2009, 2010 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2727#include "KernelLookup.h"
    2828#include "Target.h"
     29#include "yat/utility/Exception.h"
    2930#include "yat/utility/Matrix.h"
    3031#include "yat/utility/Vector.h"
     
    3637#include <limits>
    3738#include <sstream>
    38 #include <stdexcept>
    3939#include <string>
    4040#include <utility>
     
    262262      epochs++; 
    263263      if (epochs>max_epochs_){
    264         throw std::runtime_error("SVM: maximal number of epochs reached.");
     264        throw utility::runtime_error("SVM: maximal number of epochs reached.");
    265265      }
    266266    }
     
    384384      ss << "yat::classifier::SVM::train() error: "
    385385         << "Cannot calculate bias because there is no support vector";
    386       throw std::runtime_error(ss.str());
     386      throw utility::runtime_error(ss.str());
    387387    }
    388388
  • tags/0.7/yat/classifier/SVM.h

    r4116 r4116  
    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 Peter Johansson
     10  Copyright (C) 2009, 2010 Peter Johansson
    1111
    1212  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    191191       training.
    192192       
    193        \throw std::runtime_error if maximal number of epoch is reach.
     193       \throw utility::runtime_error if maximal number of epoch is reach.
    194194    */
    195195    void train(const KernelLookup& kernel, const Target& target);
  • tags/0.7/yat/classifier/SubsetGenerator.h

    r4116 r4116  
    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 Peter Johansson
     9  Copyright (C) 2009, 2010 Peter Johansson
    1010
    1111  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    302302        // training data with no feature selection
    303303        const MatrixLookupWeighted* train_data_all_feat =
    304           new MatrixLookupWeighted(ml, training_index(k), false);
     304          new MatrixLookupWeighted(ml, utility::Index(ml.rows()),
     305                                   training_index(k));
    305306        // use these data to create feature selection
    306307        f_selector_->update(*train_data_all_feat, training_target(k));
     
    329330        if (kernel.weighted()){
    330331          MatrixLookupWeighted ml = kernel.data_weighted();
    331           f_selector_->update(MatrixLookupWeighted(ml,training_index(k),false),
     332          f_selector_->update(MatrixLookupWeighted(ml,
     333                                                   utility::Index(ml.rows()),
     334                                                   training_index(k)),
    332335                              training_target(k));
    333336        }
     
    389392  SubsetGenerator<Data>::training_features(size_t i) const
    390393  {
    391     utility::yat_assert<std::runtime_error>(features_.size(),
    392                                            "SubsetGenerator::training_features");
     394    YAT_ASSERT(features_.size());
    393395    return f_selector_ ? features_[i] : features_[0];
    394396  }
     
    437439
    438440#endif
    439 
  • tags/0.7/yat/normalizer/Centralizer.h

    r4116 r4116  
    2424*/
    2525
     26#include "utility.h"
     27
    2628#include "yat/statistics/Average.h"
    2729#include "yat/utility/DataIterator.h"
     
    4547     mean, but this can be changed by providing a suitable
    4648     UnaryFunction.
     49
     50     Type Requirements:
     51     - InputIterator must be an \input_iterator
     52     - ForwardIterator must be a mutable \forward_iterator
    4753
    4854     \since New in yat 0.5
     
    7884       \see std::transform
    7985     */
    80     template<class InputIterator, class OutputIterator>
     86    template<class InputIterator, class ForwardIterator>
    8187    void operator()(InputIterator first, InputIterator last,
    82                     OutputIterator result) const
     88                    ForwardIterator result) const
    8389    {
    8490      BOOST_CONCEPT_ASSERT((boost::InputIterator<InputIterator>));
    85       typename utility::weighted_iterator_traits<InputIterator>::type tag;
    86       normalize(first, last, result, tag);
    87     }
    88 
    89   private:
    90     UnaryFunction func_;
    91 
    92     // unweighted version
    93     template<class InputIterator, class OutputIterator>
    94     void normalize(InputIterator first,InputIterator last,OutputIterator result,
    95                    utility::unweighted_iterator_tag tag) const
    96     {
    97       std::transform(first, last, result,
    98                      std::bind2nd(std::minus<double>(), func_(first, last)));
    99     }
    100 
    101 
    102     // weighted version
    103     template<class InputIterator, class OutputIterator>
    104     void normalize(InputIterator first,InputIterator last,OutputIterator result,
    105                    utility::weighted_iterator_tag tag) const
    106     {
    107       std::copy(utility::weight_iterator(first),
    108                 utility::weight_iterator(last),
    109                 utility::weight_iterator(result));
     91      BOOST_CONCEPT_ASSERT((boost::Mutable_ForwardIterator<ForwardIterator>));
     92      // copy weight if result is weighted
     93      detail::copy_weight_if_weighted(first, last, result);
    11094      std::transform(utility::data_iterator(first),
    11195                     utility::data_iterator(last),
     
    11498    }
    11599
     100  private:
     101    UnaryFunction func_;
    116102  };
    117103
  • tags/0.7/yat/normalizer/ColumnNormalizer.h

    r4116 r4116  
    66/*
    77  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2009 Peter Johansson
     8  Copyright (C) 2009, 2010 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2525
    2626#include "yat/utility/yat_assert.h"
     27#include "yat/utility/concept_check.h"
     28
     29#include <boost/concept_check.hpp>
    2730
    2831#include <cstddef>
     
    8487    void operator()(const Container2D1& matrix, Container2D2& result) const
    8588    {
    86       using utility::yat_assert;
    87       yat_assert<std::runtime_error>(matrix.rows()==result.rows(),
    88                                      "ColumnNormalizer: rows mismatch");
    89       yat_assert<std::runtime_error>(matrix.columns()==result.columns(),
    90                                      "ColumnNormalizer: columns mismatch");
     89      BOOST_CONCEPT_ASSERT((utility::Container2D<Container2D1>));
     90      BOOST_CONCEPT_ASSERT((utility::Mutable_Container2D<Container2D2>));
     91      YAT_ASSERT(matrix.rows()==result.rows());
     92      YAT_ASSERT(matrix.columns()==result.columns());
    9193      for (size_t i=0; i<matrix.columns(); ++i)
    9294        normalizer_(matrix.begin_column(i), matrix.end_column(i),
  • tags/0.7/yat/normalizer/Gauss.h

    r4116 r4116  
    2525
    2626#include "Spearman.h"
     27#include "yat/utility/concept_check.h"
    2728#include "yat/utility/iterator_traits.h"
    2829
     
    6970                    RandomAccessIter2 result) const
    7071    {
     72      BOOST_CONCEPT_ASSERT((utility::DataIteratorConcept<RandomAccessIter1>));
     73      BOOST_CONCEPT_ASSERT((utility::DataIteratorConcept<RandomAccessIter2>));
    7174      BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<RandomAccessIter1>));
    7275      BOOST_CONCEPT_ASSERT((boost::Mutable_RandomAccessIterator<RandomAccessIter2>));
  • tags/0.7/yat/normalizer/Makefile.am

    r4116 r4116  
    3434all-local: doxygen.mk
    3535
    36 doxygen.mk: Makefile.am
    37   echo "# generated by make" > $@ && \
    38   echo $(ECHO_N) "normalizer_doxygen_input=$(ECHO_C)" >> $@ && \
    39   for f in $(include_normalizer_HEADERS); do \
    40     echo $(ECHO_N) "\$$(top_srcdir)/$(subdir)/$$f $(ECHO_C)" >> $@; \
    41   done && \
    42   echo >> $@
     36DOXYGEN_INPUT=$(include_normalizer_HEADERS)
    4337
     38include $(top_srcdir)/am/doxygen.am
  • tags/0.7/yat/normalizer/RowNormalizer.h

    r4116 r4116  
    66/*
    77  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2009 Peter Johansson
     8  Copyright (C) 2009, 2010 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2525
    2626#include "yat/utility/yat_assert.h"
     27#include "yat/utility/concept_check.h"
     28
     29#include <boost/concept_check.hpp>
    2730
    2831#include <cstddef>
     
    8588                    Container2D2& result) const
    8689    {
     90      BOOST_CONCEPT_ASSERT((utility::Container2D<Container2D1>));
     91      BOOST_CONCEPT_ASSERT((utility::Mutable_Container2D<Container2D2>));
    8792      using utility::yat_assert;
    88       yat_assert<std::runtime_error>(matrix.rows()==result.rows(),
    89                                      "RowNormalizer: rows mismatch");
    90       yat_assert<std::runtime_error>(matrix.columns()==result.columns(),
    91                                      "RowNormalizer: columns mismatch");
     93      YAT_ASSERT(matrix.rows()==result.rows());
     94      YAT_ASSERT(matrix.columns()==result.columns());
    9295      for (size_t i=0; i<matrix.rows(); ++i)
    9396        normalizer_(matrix.begin_row(i), matrix.end_row(i),
  • tags/0.7/yat/normalizer/Zscore.h

    r4116 r4116  
    7474                   utility::unweighted_iterator_tag tag) const
    7575    {
    76       // we requre forward iterator since we iterate through the range
     76      // we require forward iterator since we iterate through the range
    7777      // multiple times.
    7878      BOOST_CONCEPT_ASSERT((boost::ForwardIterator<ForwardIterator>));
     
    9393                   utility::weighted_iterator_tag tag) const
    9494    {
    95       // we requre forward iterator since we iterate through the range
     95      // we require forward iterator since we iterate through the range
    9696      // multiple times.
    9797      BOOST_CONCEPT_ASSERT((boost::ForwardIterator<ForwardIter1>));
  • tags/0.7/yat/normalizer/qQuantileNormalizer.cc

    r4116 r4116  
    33/*
    44  Copyright (C) 2009 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2010 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2627#include "yat/statistics/AveragerWeighted.h"
    2728#include "yat/utility/DataWeight.h"
     29#include "yat/utility/Exception.h"
    2830#include "yat/utility/Vector.h"
    2931#include "yat/utility/VectorBase.h"
     
    98100           << "large. See qQuantileNormalizer constructor documentation "
    99101           << "for details on weights.\n";
    100         throw std::runtime_error(ss.str());
     102        throw utility::runtime_error(ss.str());
    101103      }
    102104      average_(i) = av.mean();
  • tags/0.7/yat/normalizer/qQuantileNormalizer.h

    r4116 r4116  
    2525
    2626#include "yat/regression/CSplineInterpolation.h"
     27#include "yat/utility/concept_check.h"
    2728#include "yat/utility/DataIterator.h"
    2829#include "yat/utility/DataWeight.h"
     30#include "yat/utility/Exception.h"
    2931#include "yat/utility/iterator_traits.h"
    3032#include "yat/utility/sort_index.h"
     
    232234    : target_(Partitioner(first, last, Q))
    233235  {
    234     utility::yat_assert<std::runtime_error>(Q>2,
    235                                             "qQuantileNormalizer: Q too small");
     236    YAT_ASSERT(Q>2);
    236237  }
    237238
     
    258259    BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<RandomAccessIterator1>));
    259260    BOOST_CONCEPT_ASSERT((boost::Mutable_RandomAccessIterator<RandomAccessIterator2>));
     261    BOOST_CONCEPT_ASSERT((utility::DataIteratorConcept<RandomAccessIterator1>));
     262    BOOST_CONCEPT_ASSERT((utility::DataIteratorConcept<RandomAccessIterator2>));
    260263    utility::check_iterator_is_unweighted(first);
    261264    utility::check_iterator_is_unweighted(result);
    262265    size_t N = last-first;
    263     utility::yat_assert<std::runtime_error>
    264       (N >= target_.size(), "qQuantileNormalizer: Input range too small");
     266    YAT_ASSERT(N >= target_.size());
    265267
    266268    std::vector<size_t> sorted_index(last-first);
     
    296298      size_t si = sorted_index[i];
    297299     
    298       yat_assert<std::runtime_error>((i+0.5)/N>idx(0),
    299                                "qQuantileNormalizer: invalid input to cspline");
     300      YAT_ASSERT((i+0.5)/N>idx(0));
    300301      result[si] = first[si] - cspline.evaluate((i+0.5)/N);
    301302    }
     
    319320    BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<RandomAccessIterator1>));
    320321    BOOST_CONCEPT_ASSERT((boost::Mutable_RandomAccessIterator<RandomAccessIterator2>));
     322    BOOST_CONCEPT_ASSERT((utility::DataIterator<RandomAccessIterator1>));
     323    BOOST_CONCEPT_ASSERT((utility::DataIterator<RandomAccessIterator2>));
    321324    // copy the weights
    322325    detail::copy_weight_if_weighted(first, last, result);
     
    383386  {
    384387    BOOST_CONCEPT_ASSERT((boost::ForwardIterator<ForwardIterator>));
     388    BOOST_CONCEPT_ASSERT((utility::DataIterator<ForwardIterator>));
    385389    build(first, last, N,
    386390          typename utility::weighted_iterator_traits<ForwardIterator>::type());
  • tags/0.7/yat/random/Makefile.am

    r4116 r4116  
    55# Copyright (C) 2005, 2006 Jari Häkkinen
    66# Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    7 # Copyright (C) 2009 Peter Johansson
     7# Copyright (C) 2009, 2010 Peter Johansson
    88#
    99# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3535all-local: doxygen.mk
    3636
    37 doxygen.mk: Makefile.am
    38   echo "# generated by make" > $@ && \
    39   echo $(ECHO_N) "random_doxygen_input=$(ECHO_C)" >> $@ && \
    40   for f in $(include_random_HEADERS); do \
    41     echo $(ECHO_N) "\$$(top_srcdir)/$(subdir)/$$f $(ECHO_C)" >> $@; \
    42   done && \
    43   echo >> $@
     37DOXYGEN_INPUT=$(include_random_HEADERS)
    4438
     39include $(top_srcdir)/am/doxygen.am
  • tags/0.7/yat/random/random.h

    r4116 r4116  
    327327     Variance: \f$ \frac{1}{12}(n-1)(n+1) \f$
    328328  */
    329   class DiscreteUniform : public Discrete
     329  class DiscreteUniform
     330    : public Discrete,
     331      public std::unary_function<unsigned long, unsigned long>
    330332  {
    331333  public:
  • tags/0.7/yat/regression/Local.cc

    r4116 r4116  
    44  Copyright (C) 2004 Peter Johansson
    55  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2010 Peter Johansson
    67
    78  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2425#include "Kernel.h"
    2526#include "OneDimensionalWeighted.h"
     27
     28#include "yat/utility/Exception.h"
    2629#include "yat/utility/Vector.h"
    2730#include "yat/utility/VectorView.h"
     
    5659      std::stringstream ss;
    5760      ss << "yat::regression::Local: step_size must be larger than zero.";
    58       throw std::runtime_error(ss.str());
     61      throw utility::runtime_error(ss.str());
    5962    }
    6063    if (nof_points<3){
     
    6265      ss << "yat::regression::Local: too few data points. "
    6366         << "At least 3 data points are needed to perform fitting.";
    64       throw std::runtime_error(ss.str());
     67      throw utility::runtime_error(ss.str());
    6568    }
    6669    if (data_.size()<step_size){
     
    6972         << "step_size, " << step_size
    7073         << ", is larger than number of added data points " << data_.size();
    71       throw std::runtime_error(ss.str());
     74      throw utility::runtime_error(ss.str());
    7275    }
    7376
  • tags/0.7/yat/regression/Local.h

    r4116 r4116  
    77  Copyright (C) 2004 Peter Johansson
    88  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    9   Copyright (C) 2009 Peter Johansson
     9  Copyright (C) 2009, 2010 Peter Johansson
    1010
    1111  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    7171    /// @param nof_points Number of points used in each fit
    7272    ///
    73     /// \throw std::runtime_error if step_size is 0, nof_points is
     73    /// \throw utility::runtime_error if step_size is 0, nof_points is
    7474    /// less than 3, or step_size is larger than number of added data
    7575    /// points.
  • tags/0.7/yat/regression/Makefile.am

    r4116 r4116  
    55# Copyright (C) 2006 Jari Häkkinen
    66# Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    7 # Copyright (C) 2009 Peter Johansson
     7# Copyright (C) 2009, 2010 Peter Johansson
    88#
    99# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    4646all-local: doxygen.mk
    4747
    48 doxygen.mk: Makefile.am
    49   echo "# generated by make" > $@ && \
    50   echo $(ECHO_N) "regression_doxygen_input=$(ECHO_C)" >> $@ && \
    51   for f in $(include_regression_HEADERS); do \
    52     echo $(ECHO_N) "\$$(top_srcdir)/$(subdir)/$$f $(ECHO_C)" >> $@; \
    53   done && \
    54   echo >> $@
     48DOXYGEN_INPUT=$(include_regression_HEADERS)
    5549
     50include $(top_srcdir)/am/doxygen.am
  • tags/0.7/yat/statistics/Fisher.cc

    r4116 r4116  
    2525#include "Fisher.h"
    2626#include "utility.h"
     27
     28#include "yat/utility/Exception.h"
    2729
    2830#include <gsl/gsl_cdf.h>
     
    9799    // If a column sum or a row sum is zero, the table is nonsense
    98100    if ((a==0 || d==0) && (c==0 || b==0)){
    99       throw std::runtime_error("runtime_error: Table in Fisher is not valid\n");
     101      throw utility::runtime_error("Table in Fisher is not valid\n");
    100102    }
    101103    a_ = a;
  • tags/0.7/yat/statistics/Fisher.h

    r4116 r4116  
    2525*/
    2626
    27 #include "Score.h"
    28 
    29 #include <cmath>
    30 
    3127namespace theplu {
    3228namespace yat {
    33 namespace utility {
    34   class vector;
    35 }
    3629namespace statistics { 
    3730  /**
  • tags/0.7/yat/statistics/Histogram.cc

    r4116 r4116  
    66  Copyright (C) 2006 Jari Häkkinen
    77  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2009 Peter Johansson
     8  Copyright (C) 2009, 2010 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2626#include "Histogram.h"
    2727
     28#include <yat/utility/utility.h>
     29
    2830#include <algorithm>
    2931#include <cassert>
    3032#include <cmath>
    3133#include <functional>
     34#include <istream>
    3235#include <ostream>
    3336
     
    4043    : xmax_(0), xmin_(0), sum_all_(), sum_histogram_()
    4144  {
     45  }
     46
     47
     48  Histogram::Histogram(std::istream& is)
     49  {
     50    std::string line;
     51    getline(is, line, ':');
     52    getline(is, line, '\n');
     53    xmin_ = utility::convert<double>(line);
     54    getline(is, line, ':');
     55    getline(is, line, '\n');
     56    xmax_ = utility::convert<double>(line);
     57    getline(is, line, ':');
     58    getline(is, line, '\n');
     59    size_t n = utility::convert<size_t>(line);
     60    histogram_.resize(n);
     61    getline(is, line, '\n');
     62    getline(is, line, ':');
     63    getline(is, line, '\n');
     64    double total = utility::convert<double>(line);
     65    getline(is, line, '\n');
     66    getline(is, line, '\n');
     67    std::vector<std::vector<double> > data;
     68    utility::load(is, data);
     69    for (size_t i=0; i<histogram_.size(); ++i) {
     70      assert(data[i].size()==2);
     71      add(data[i][0], data[i][1]);
     72    }
     73    add(xmax_, total - averager_all().sum_w());
    4274  }
    4375
  • tags/0.7/yat/statistics/Histogram.h

    r4116 r4116  
    2828
    2929#include "AveragerWeighted.h"
     30#include "yat/utility/concept_check.h"
    3031#include "yat/utility/iterator_traits.h"
    3132
    3233#include <boost/concept_check.hpp>
    3334
     35#include <iosfwd>
    3436#include <string>
    3537#include <vector>
     
    5658    ///
    5759    Histogram(void);
     60
     61    /**
     62       \brief The istream constructor.
     63
     64       This constructor creates a Histogram from output (possibly)
     65       created with operator<<. Note that the output from operator<<
     66       does not contain all information required to restore the
     67       Histogram. The values of all bins are restored, but the
     68       averagers, averager_all(void) and averager_histogram(void), and
     69       more specifically the second moment (sum_xx) in the averagers
     70       cannot be restored due to lack of information in the output.
     71
     72       \since New in yat 0.7
     73    */
     74    Histogram(std::istream&);
    5875
    5976    ///
     
    222239  {
    223240    BOOST_CONCEPT_ASSERT((boost::ForwardIterator<ForwardIterator>));
     241    BOOST_CONCEPT_ASSERT((utility::DataIteratorConcept<ForwardIterator>));
    224242    utility::iterator_traits<ForwardIterator> traits;
    225243    while (first!=last) {
  • tags/0.7/yat/statistics/Makefile.am

    r4116 r4116  
    55# Copyright (C) 2005 Jari Häkkinen, Peter Johansson
    66# Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
    7 # Copyright (C) 2009 Peter Johansson
     7# Copyright (C) 2009, 2010 Peter Johansson
    88#
    99# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    4646all-local: doxygen.mk
    4747
    48 doxygen.mk: Makefile.am
    49   echo "# generated by make" > $@ && \
    50   echo $(ECHO_N) "statistics_doxygen_input=$(ECHO_C)" >> $@ && \
    51   for f in $(include_statistics_HEADERS); do \
    52     echo $(ECHO_N) "\$$(top_srcdir)/$(subdir)/$$f $(ECHO_C)" >> $@; \
    53   done && \
    54   echo >> $@
     48DOXYGEN_INPUT=$(include_statistics_HEADERS)
    5549
     50include $(top_srcdir)/am/doxygen.am
  • tags/0.7/yat/statistics/Percentiler.h

    r4116 r4116  
    2424*/
    2525
     26#include "yat/utility/concept_check.h"
    2627#include "yat/utility/DataWeight.h"
    2728#include "yat/utility/iterator_traits.h"
     
    9798    {
    9899      BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<RandomAccessIterator>));
     100      BOOST_CONCEPT_ASSERT((utility::DataIteratorConcept<RandomAccessIterator>));
    99101      return calculate(first, last, sorted_,
    100102       typename utility::weighted_iterator_traits<RandomAccessIterator>::type());
  • tags/0.7/yat/statistics/utility.h

    r4116 r4116  
    3131#include "yat/classifier/DataLookupWeighted1D.h"
    3232#include "yat/classifier/Target.h"
     33#include "yat/utility/concept_check.h"
    3334#include "yat/utility/deprecate.h"
    3435#include "yat/utility/iterator_traits.h"
    3536#include "yat/utility/VectorBase.h"
    3637#include "yat/utility/yat_assert.h"
     38
     39#include <boost/concept_check.hpp>
    3740
    3841#include <algorithm>
     
    202205             bool sorted)
    203206  {
     207    BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<RandomAccessIterator>));
     208    BOOST_CONCEPT_ASSERT((utility::DataIteratorConcept<RandomAccessIterator>));
    204209    double m = median(first, last, sorted);
    205210    typedef typename std::iterator_traits<RandomAccessIterator>::value_type T;
     
    232237  {
    233238    BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<RandomAccessIterator>));
     239    BOOST_CONCEPT_ASSERT((utility::DataIteratorConcept<RandomAccessIterator>));
    234240    // range is one value only is a special case
    235241    if (first+1 == last)
  • tags/0.7/yat/utility/ColumnStream.cc

    r4116 r4116  
    33/*
    44  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2010 Peter Johansson
    56
    6   This file is part of svndigest, http://dev.thep.lu.se/svndigest
     7  This file is part of yat, http://dev.thep.lu.se/yat
    78
    8   svndigest is free software; you can redistribute it and/or modify it
     9  yat is free software; you can redistribute it and/or modify it
    910  under the terms of the GNU General Public License as published by
    1011  the Free Software Foundation; either version 3 of the License, or
    1112  (at your option) any later version.
    1213
    13   svndigest is distributed in the hope that it will be useful, but
     14  yat is distributed in the hope that it will be useful, but
    1415  WITHOUT ANY WARRANTY; without even the implied warranty of
    1516  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  • tags/0.7/yat/utility/ColumnStream.h

    r4116 r4116  
    66/*
    77  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2009 Peter Johansson
     8  Copyright (C) 2009, 2010 Peter Johansson
    99
    10   This file is part of svndigest, http://dev.thep.lu.se/svndigest
     10  This file is part of yat, http://dev.thep.lu.se/yat
    1111
    12   svndigest is free software; you can redistribute it and/or modify it
     12  yat is free software; you can redistribute it and/or modify it
    1313  under the terms of the GNU General Public License as published by
    1414  the Free Software Foundation; either version 3 of the License, or
    1515  (at your option) any later version.
    1616
    17   svndigest is distributed in the hope that it will be useful, but
     17  yat is distributed in the hope that it will be useful, but
    1818  WITHOUT ANY WARRANTY; without even the implied warranty of
    1919  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  • tags/0.7/yat/utility/CommandLine.cc

    r4116 r4116  
    44  Copyright (C) 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
    55  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    6   Copyright (C) 2009 Peter Johansson
    7   Copyright (C) 2010 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2009, 2010 Peter Johansson
    87
    98  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3231
    3332#include <algorithm>
     33#include <cassert>
    3434#include <functional>
    3535#include <fstream>
     
    6161        ss << "yat::utility::Commandline: two options with long_name: "
    6262           << option.long_name();
    63         throw std::runtime_error(ss.str());
     63        throw runtime_error(ss.str());
    6464      }
    6565      long_options_[option.long_name()] = &option;
     
    7070        ss << "yat::utility::Commandline: two options with short_name: "
    7171           << option.short_name();
    72         throw std::runtime_error(ss.str());
     72        throw runtime_error(ss.str());
    7373      }
    7474      short_options_[option.short_name()] = &option;
     
    144144          else if (iter==long_options_.end()) {
    145145            std::stringstream ss3;
    146             ss3 << ": unrecognized option `" << key << "'\n" << try_help();
     146            ss3 << "unrecognized option `" << key << "'\n" << try_help();
    147147            throw cmd_error(ss3.str());
    148148          }
     
    197197
    198198
    199   std::vector<std::string> CommandLine::split(std::string str, char del) const
    200   {
    201     std::vector<std::string> vec;
    202     std::stringstream ss(str);
    203     while (std::getline(ss, str, del)){
    204       vec.push_back(str);
    205     }
    206     return vec;
    207   }
     199  void CommandLine::sort(void)
     200  {
     201    sort(OptionCompare());
     202  }
     203
    208204
    209205  std::string CommandLine::try_help(void) const
     
    237233
    238234
     235  bool CommandLine::OptionCompare::operator()(const Option* lhs,
     236                                              const Option* rhs) const
     237  {
     238    assert(lhs);
     239    assert(rhs);
     240    std::string lhs_str = lhs->long_name();
     241    if (lhs_str.empty())
     242      lhs_str = lhs->short_name();
     243    std::string rhs_str = rhs->long_name();
     244    if (rhs_str.empty())
     245      rhs_str = rhs->short_name();
     246    return lhs_str < rhs_str;
     247  }
     248
     249
    239250}}} // of namespace utility, yat, and theplu
  • tags/0.7/yat/utility/CommandLine.h

    r4116 r4116  
    55
    66/*
    7   Copyright (C) 2007, 2008, 2009, 2010 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2010 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2324*/
    2425
     26#include <algorithm>
    2527#include <cctype>
    2628#include <map>
     
    157159
    158160    /**
     161       \brief Sort Options how they will appear in (help) output.
     162
     163       This function will sort the Options in alphabetical order. If
     164       the Option has a long_name, it is used for the sorting;
     165       otherwise, the short_name is used.
     166
     167       \since New in yat 0.7
     168     */
     169    void sort(void);
     170
     171    /**
     172       Like sort(void) but using \a compare to sort Options.
     173
     174       The functor Compare must be a <a
     175       href="http://www.sgi.com/tech/stl/BinaryPredicate.html">Binary
     176       Predicate</a> with both argument types \c const \c Option*.
     177
     178       \since New in yat 0.7
     179     */
     180    template<class Compare>
     181    void sort(Compare compare);
     182
     183    /**
    159184       \return something like "Try `<program_name()> --help` for
    160185       more information."
     
    164189  private:
    165190    friend std::ostream& operator<<(std::ostream& os, const CommandLine& cl);
    166     void add_private(std::string, Option&);
    167191    bool is_long_option(std::string str) const;
    168192    bool is_short_option(std::string str) const;
    169     std::vector<std::string> split(std::string str, char del) const;
    170193
    171194    std::string description_;
     
    177200    bool parsed_;
    178201    std::string program_name_;
     202
     203    // use cond to make doxygen ignore this privat class
     204    /// \cond
     205    struct OptionCompare
     206    {
     207      bool operator()(const Option*, const Option*) const;
     208    };
     209    /// \endcond
     210
    179211  };
    180212
     
    199231  std::ostream& operator<<(std::ostream&, const CommandLine&);
    200232
     233  template<class Compare>
     234  void CommandLine::sort(Compare compare)
     235  {
     236    std::sort(options_.begin(), options_.end(), compare);
     237  }
     238
    201239}}} // end of namespace utility, yat, and theplu
    202240
  • tags/0.7/yat/utility/Container2DIterator.h

    r4116 r4116  
    66/*
    77  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2009 Peter Johansson
     8  Copyright (C) 2009, 2010 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2424*/
    2525
     26#include "concept_check.h"
    2627#include "iterator_traits.h"
    2728#include "yat_assert.h"
    2829
     30#include <boost/concept_check.hpp>
    2931#include <boost/iterator/iterator_facade.hpp>
    3032
     
    4345     The iterator can be used to traverse through a \ref
    4446     concept_container_2d row by row.
     47
     48     Type Requirements:
     49     - \c Container must be a \ref concept_container_2d
     50     - \c value is typically \c Container::value_type if
     51       Container2DIterator is mutable or \c const \c
     52       Container::value_type otherwise.
     53     - \c reference, typically \c value&, must be convertible to \c
     54       value
     55     - \c Container must have an \c operator()(size_t, size_t) that
     56       returns a type that is convertible to \c reference.
    4557
    4658     \see StrideIterator
     
    6173       \brief Default Constructor
    6274    */
    63     Container2DIterator(void) {};
     75    Container2DIterator(void)
     76    {
     77      BOOST_CONCEPT_ASSERT((Container2D<Container>));
     78      BOOST_CONCEPT_ASSERT((boost::Convertible<reference,value>));
     79    };
    6480
    6581    /**
     
    7187    */
    7288    Container2DIterator(Container& container, size_t row, size_t column)
    73       : container_(&container), index_(row*container.columns()+column) {}
     89      : container_(&container), index_(row*container.columns()+column)
     90    {
     91      BOOST_CONCEPT_ASSERT((Container2D<Container>));
     92      BOOST_CONCEPT_ASSERT((boost::Convertible<reference,value>));
     93    }
    7494
    7595  private:
  • tags/0.7/yat/utility/DataIterator.h

    r4116 r4116  
    2626#include "iterator_traits.h"
    2727
     28#include <boost/concept_check.hpp>
    2829#include <boost/iterator/iterator_adaptor.hpp>
    2930#include <boost/type_traits/remove_reference.hpp>
     
    5455
    5556     \endcode
     57
     58    Type Requirement: \c BASE must be an \input_iterator
    5659  */
    5760  template<typename Base>
     
    7174     */
    7275    explicit DataIterator(Base b)
    73       : DataIterator::iterator_adaptor_(b) {}
     76      : DataIterator::iterator_adaptor_(b)
     77    {
     78      BOOST_CONCEPT_ASSERT((boost::InputIterator<Base>));
     79    }
    7480
    7581    /**
     
    7985     */
    8086    DataIterator(void)
    81       : DataIterator::iterator_adaptor_() {}
     87      : DataIterator::iterator_adaptor_()
     88    {
     89      BOOST_CONCEPT_ASSERT((boost::InputIterator<Base>));
     90    }
    8291
    8392    /**
  • tags/0.7/yat/utility/DataWeightProxy.h

    r4116 r4116  
    2626#include "DataWeight.h"
    2727
     28#include <boost/concept/assert.hpp>
     29
     30#include <iterator>
     31
    2832namespace theplu {
    2933namespace yat {
     
    3539     \brief Proxy class for DataWeight
    3640
    37      DataIterator and WeightIterator should be a mutable TrivialIterator
     41     Class is used in WeightedIterator
     42
     43     Type Requirements:
     44     - DataIterator must be a Trivial Iterator.
     45     - value_type must be convertible to \c const \c double.
     46     - reference must be convertible to \c const \c double&.
     47     - If the DataWeightProxy is going to be used in a non-const way
     48       iterators must be mutable and \c reference must be exactly \c
     49       double&. See data(void) and weight(void).
    3850  */
    3951  template<typename DataIterator, typename WeightIterator>
     
    4254  public:
    4355    /**
    44        \brief Default constructor
     56       \brief Constructor
    4557
    4658       \param data iterator pointing to data to hold
     
    4860     */
    4961    DataWeightProxy(DataIterator data, WeightIterator weight)
    50       : data_(data), weight_(weight) {}
     62      : data_(data), weight_(weight)
     63    {
     64      using boost::Convertible;
     65      // DataIterator::value must be convertible to double
     66      BOOST_CONCEPT_ASSERT((Convertible<data_type, double>));
     67      // this is for function data(void) const
     68      BOOST_CONCEPT_ASSERT((Convertible<data_reference, const double&>));
     69
     70      // same check for WeightIterator
     71      BOOST_CONCEPT_ASSERT((Convertible<weight_type, double>));
     72      BOOST_CONCEPT_ASSERT((Convertible<weight_reference, const double&>));
     73    }
    5174
    5275    /**
    5376       \return reference to data
    54      */
    55     //typename std::iterator_traits<DataWeight>::reference data(void) const
    56     double& data(void) { return *data_; }
     77
     78       This function requires that reference type of data_iterator
     79       is convertible to \c double. This function is typically used as
     80       left-hand side in an assignment and thus expected to being able
     81       to change the underlying data such as a double& can change the
     82       underlying double. But it is not required that return type is a
     83       double& as a Proxy class can do the job too.
     84    */
     85    typename std::iterator_traits<DataIterator>::reference data(void)
     86    {
     87      BOOST_CONCEPT_ASSERT((boost::Convertible<data_reference, double>));
     88      return *data_;
     89    }
    5790
    5891    /**
     
    6396    /**
    6497       \return reference to weight
     98
     99       This function requires that reference type of weight_iterator
     100       is convertible to \c double. This function is typically used as
     101       left-hand side in an assignment and thus expected to being able
     102       to change the underlying data such as a double& can change the
     103       underlying double. But it is not required that return type is a
     104       double& as a Proxy class can do the job too.
    65105     */
    66     double& weight(void) { return *weight_; }
     106    typename std::iterator_traits<WeightIterator>::reference weight(void)
     107    {
     108      BOOST_CONCEPT_ASSERT((boost::Convertible<weight_reference, double>));
     109      return *weight_;
     110    }
    67111
    68112    /**
     
    73117    /**
    74118       \brief assignment operator
     119
     120       This function uses non-const function data(void) and
     121       weight(void) and consequently requires that reference type of
     122       both data_iterator and weight_iterator are convertible to \c
     123       double.
    75124     */
    76125    DataWeightProxy& operator=(const DataWeightProxy& rhs)
     
    101150    WeightIterator weight_;
    102151
    103     // using compiler generated copy and assignment
    104     //DataWeightProxy& operator=(const DataWeightProxy&);
     152    typedef std::iterator_traits<DataIterator> data_traits;
     153    typedef typename data_traits::value_type data_type;
     154    typedef typename data_traits::reference data_reference;
     155
     156    typedef std::iterator_traits<WeightIterator> weight_traits;
     157    typedef typename weight_traits::value_type weight_type;
     158    typedef typename weight_traits::reference weight_reference;
     159
     160    // using compiler generated copy
    105161    //DataWeightProxy(const DataWeightProxy&);
    106162  };
  • tags/0.7/yat/utility/Exception.h

    r4116 r4116  
    66/*
    77  Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2010 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2627#include <string>
    2728
    28 #include <gsl/gsl_errno.h>
    29 
    3029namespace theplu {
    3130namespace yat {
    3231namespace utility {
     32
     33 
     34
     35  /**
     36     \brief Class used for all runtime error detected within yat library.
     37   */
     38  class runtime_error : public std::runtime_error
     39  {
     40  public:
     41    /**
     42       \brief Constructor
     43
     44       \param message message to be displayed using function what().
     45     */
     46    runtime_error(std::string message);
     47  };
     48
    3349
    3450  /**
     
    4359       \param message message to be displayed using function what().
    4460     */
    45     inline cmd_error(std::string message)
    46       : std::runtime_error(message) {}
     61    cmd_error(std::string message);
    4762  };
    4863
     64
     65  /**
     66     \brief Class that contains information reported via global
     67     variable errno.
     68
     69     \since New in yat 0.7
     70   */
     71  class errno_error : public std::runtime_error
     72  {
     73  public:
     74    /**
     75       The error message, return from what(), is set to
     76       \a message + strerror(errno)
     77     */
     78    errno_error(std::string message);
     79  };
    4980
    5081  /**
     
    6091       \brief Constructor to create an exception with a message.
    6192    */
    62     inline GSL_error(std::string message) throw()
    63       : std::runtime_error("GSL_error: " + message) {}
     93    GSL_error(std::string message);
    6494
    6595    /**
     
    6797       containg the GSL error description.
    6898    */
    69     inline GSL_error(std::string message, int gsl_status) throw()
    70       : std::runtime_error("GSL_error: " + message + " " +
    71                            gsl_strerror(gsl_status)) {}
     99    GSL_error(std::string message, int gsl_status);
    72100  };
    73101
     
    85113       \brief Constructor to create an exception with a message.
    86114    */
    87     inline IO_error(std::string message) throw()
    88       : std::runtime_error("IO_error: " + message) {}
     115    IO_error(std::string message);
    89116  };
    90117
  • tags/0.7/yat/utility/Makefile.am

    r4116 r4116  
    44
    55# Copyright (C) 2005, 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    6 # Copyright (C) 2009 Peter Johansson
     6# Copyright (C) 2009, 2010 Peter Johansson
    77#
    88# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2424libutility_la_SOURCES = \
    2525  Alignment.cc ColumnStream.cc CommandLine.cc DataWeight.cc \
    26   FileUtil.cc GetlineIterator.cc Index.cc kNNI.cc \
     26  Exception.cc FileUtil.cc GetlineIterator.cc Index.cc KernelPCA.cc kNNI.cc \
    2727  Matrix.cc MatrixWeighted.cc NNI.cc Option.cc \
    2828  OptionFile.cc OptionInFile.cc OptionOutFile.cc \
    2929  OptionHelp.cc OptionSwitch.cc \
    30   PCA.cc sort_index.cc stl_utility.cc SVD.cc TypeInfo.cc utility.cc Vector.cc \
     30  PCA.cc sort_index.cc split.cc \
     31  stl_utility.cc SVD.cc TypeInfo.cc utility.cc Vector.cc \
    3132  VectorBase.cc VectorConstView.cc VectorMutable.cc VectorView.cc \
    3233  version.cc WeNNI.cc
     
    3536
    3637include_utility_HEADERS = \
    37   Alignment.h ColumnStream.h CommandLine.h \
     38  Alignment.h ColumnStream.h CommandLine.h concept_check.h \
    3839  Container2DIterator.h DataIterator.h DataWeight.h DataWeightProxy.h \
    3940  deprecate.h Exception.h FileUtil.h GetlineIterator.h Index.h \
    4041  iterator_traits.h \
    41   kNNI.h Matrix.h MatrixWeighted.h merge.h NNI.h \
     42  KernelPCA.h kNNI.h Matrix.h MatrixWeighted.h merge.h NNI.h \
    4243  Option.h OptionArg.h OptionFile.h OptionInFile.h OptionOutFile.h \
    4344  OptionHelp.h OptionSwitch.h \
    4445  PCA.h \
    45   SmartPtr.h sort_index.h StreamRedirect.h \
     46  Segment.h SegmentMap.h SegmentSet.h SegmentTree.h \
     47  SmartPtr.h sort_index.h split.h StreamRedirect.h \
    4648  Range.h stl_utility.h StrideIterator.h \
    4749  SVD.h TypeInfo.h utility.h Vector.h \
     
    5658all-local: doxygen.mk
    5759
    58 doxygen.mk: Makefile.am
    59   echo "# generated by make" > $@ && \
    60   echo $(ECHO_N) "utility_doxygen_input=$(ECHO_C)" >> $@ && \
    61   for f in $(include_utility_HEADERS); do \
    62     echo $(ECHO_N) "\$$(top_srcdir)/$(subdir)/$$f $(ECHO_C)" >> $@; \
    63   done && \
    64   for f in $(extra_headers_DATA); do \
    65     echo $(ECHO_N) "\$$(top_builddir)/$(subdir)/$$f $(ECHO_C)" >> $@; \
    66   done && \
    67   echo >> $@
     60DOXYGEN_INPUT=$(include_utility_HEADERS) $(extra_headers_DATA)
    6861
     62include $(top_srcdir)/am/doxygen.am
  • tags/0.7/yat/utility/Matrix.cc

    r4116 r4116  
    66  Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    77  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2009 Peter Johansson
     8  Copyright (C) 2009, 2010 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2525
    2626#include "Matrix.h"
     27
     28#include "Exception.h"
    2729#include "Vector.h"
    2830#include "VectorBase.h"
     
    3335#include <gsl/gsl_blas.h>
    3436
     37#include <algorithm>
    3538#include <cassert>
    3639#include <climits>
     
    3841#include <iostream>
    3942#include <limits>
    40 #include <stdexcept>
    4143#include <sstream>
    4244#include <vector>
     
    8587      throw IO_error(ss.str());
    8688    }
    87     catch (std::runtime_error& e) {
     89    catch (runtime_error& e) {
    8890      std::stringstream ss(e.what());
    8991      ss << "\nMatrix(std::istream&): invalid matrix element\n";
     
    295297      std::stringstream msg;
    296298      msg << "Matrix::resize(" << r << ", " << c << "): incorrect dimensions\n";
    297       throw std::runtime_error(msg.str());
     299      throw runtime_error(msg.str());
    298300    }
    299301    // This should be triggered in else if above, right?
     
    476478        throw utility::GSL_error("Matrix::operator*= failed to allocate memory");
    477479    }
    478     gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, m_, other.m_, 0.0, blas_result_);
    479     gsl_matrix* tmp=m_;
    480     m_ = blas_result_;
    481     blas_result_=tmp;
     480    gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, m_, other.m_, 0.0,
     481                   blas_result_);
     482    std::swap(m_, blas_result_);
    482483    return *this;
    483484  }
  • tags/0.7/yat/utility/MatrixWeighted.cc

    r4116 r4116  
    66  Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
    77  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2009 Peter Johansson
     8  Copyright (C) 2009, 2010 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2727
    2828#include "DataIterator.h"
     29#include "Exception.h"
    2930#include "Matrix.h"
    3031#include "utility.h"
     
    3233
    3334#include <cassert>
    34 #include <stdexcept>
    3535#include <sstream>
    3636#include <vector>
     
    7979      throw IO_error(ss.str());
    8080    }
    81     catch (std::runtime_error& e) {
     81    catch (runtime_error& e) {
    8282      std::stringstream ss(e.what());
    8383      ss << "\nMatrixWeighted(std::istream&): invalid matrix element\n";
     
    205205      msg << "MatrixWeighted::resize(" << rows << ", " << columns
    206206          << "): incorrect dimensions\n";
    207       throw std::runtime_error(msg.str());
     207      throw runtime_error(msg.str());
    208208    }
    209209    columns_ = columns;
  • tags/0.7/yat/utility/Option.cc

    r4116 r4116  
    33/*
    44  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2009 Peter Johansson
     5  Copyright (C) 2009, 2010 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2323#include "Option.h"
    2424#include "CommandLine.h"
     25#include "Exception.h"
    2526
    2627#include <iostream>
    2728#include <sstream>
    28 #include <stdexcept>
    2929#include <string>
    3030
     
    3838  {
    3939    if (flag.empty())
    40       throw std::runtime_error("yat: Option: given flag is empty");
     40      throw runtime_error("yat: Option: given flag is empty");
    4141    if (flag.size()==1 || (flag.size()==2 && flag[1]==','))
    4242      short_name_ = flag[0];
     
    7272
    7373
     74  void Option::description(const std::string& description)
     75  {
     76    description_ = description;
     77  }
     78
     79
    7480  std::string Option::long_name(void) const
    7581  {
     
    8995  {
    9096    if (!cmd().parsed()) {
    91       std::string s("Option::present called before Commandline was parsed");
     97      std::string s("theplu::yat::utility::Option::present");
     98      s += " called before Commandline was parsed";
    9299      throw std::logic_error(s);
    93100    }
  • tags/0.7/yat/utility/Option.h

    r4116 r4116  
    66/*
    77  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2009 Peter Johansson
     8  Copyright (C) 2009, 2010 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    5757    */
    5858    std::string description(void) const;
     59
     60    /**
     61       \brief set description
     62
     63       \since New in yat 0.7
     64    */
     65    void description(const std::string& description);
    5966
    6067    /**
  • tags/0.7/yat/utility/OptionArg.h

    r4116 r4116  
    66/*
    77  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2009 Peter Johansson
     8  Copyright (C) 2009, 2010 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    134134    }
    135135
    136     void assign(std::string& lhs, std::string rhs )
     136    void assign(std::string& lhs, const std::string& rhs )
    137137    {
    138138      lhs = rhs;
     
    140140   
    141141    template<class T1>
    142     void assign(T1& lhs, std::string rhs )
     142    void assign(T1& lhs, const std::string& rhs )
    143143    {
    144144      try {
    145145        lhs = convert<T1>(rhs);
    146146      }
    147       catch (std::runtime_error& e) {
     147      catch (runtime_error& e) {
    148148        std::stringstream sstr(rhs);
    149         sstr << ": invalid argument";
     149        sstr << "invalid argument";
     150        sstr << "`" << rhs << "' for `";
     151        if (!long_name().empty())
     152          sstr << "--" << long_name();
     153        else
     154          sstr << "-" << short_name();
     155        sstr << "'";
    150156        throw cmd_error(sstr.str());
    151157      }
  • tags/0.7/yat/utility/OptionFile.cc

    r4116 r4116  
    33/*
    44  Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2010 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2425#include "FileUtil.h"
    2526
     27#include <cerrno>
    2628#include <cstring>
    2729#include <string>
  • tags/0.7/yat/utility/OptionHelp.cc

    r4116 r4116  
    33/*
    44  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2009 Peter Johansson
     5  Copyright (C) 2009, 2010 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    5050    std::cout << cmd() << "\n";
    5151    std::cout << post_cmd_;
    52     exit(0);
     52    exit(EXIT_SUCCESS);
    5353  }
    5454
  • tags/0.7/yat/utility/PCA.cc

    r4116 r4116  
    77  Copyright (C) 2006 Jari Häkkinen
    88  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     9  Copyright (C) 2010 Peter Johansson
    910
    1011  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2728#include "SVD.h"
    2829#include "utility.h"
    29 #include "VectorView.h"
     30#include "Vector.h"
    3031
    3132#include <iostream>
     
    4546
    4647
    47   const utility::Vector& PCA::eigenvalues(void) const
     48  const Vector& PCA::eigenvalues(void) const
    4849  {
    4950    return eigenvalues_;
     
    5152
    5253
    53   const utility::Matrix& PCA::eigenvectors(void) const
     54  const Matrix& PCA::eigenvectors(void) const
    5455  {
    5556    return eigenvectors_;
     
    7980      eigenvalues_(i) = eigenvalues_(i)*eigenvalues_(i);
    8081    eigenvalues_ *= 1.0/A_center.rows();
    81 
    82     // Sort the eigenvectors in order of eigenvalues
    83     // Simple (not efficient) algorithm that always
    84     // make sure that the i:th element is in its correct
    85     // position (N element --> Ordo( N*N ))
    86     /*
    87       // should not be needed since SVD gives single values ordered
    88     for ( size_t i = 0; i < eigenvalues_.size(); ++i )
    89       for ( size_t j = i + 1; j < eigenvalues_.size(); ++j )
    90         if ( eigenvalues_(j) > eigenvalues_(i) ) {
    91           std::swap( eigenvalues_(i), eigenvalues_(j) );
    92           eigenvectors_.swap_rows(i,j);
    93         }
    94     */
    9582  }
    9683
    9784
    98   /*
    99   void PCA::process_transposed_problem(void)
    100   {
    101     // Row-center the data matrix
    102     utility::matrix A_center( A_.rows(), A_.columns() );
    103     this->row_center( A_center );
    104 
    105     // Transform into SVD friendly dimension
    106     A_.transpose();
    107     A_center.transpose();
    108 
    109     // Single value decompose the data matrix
    110     std::auto_ptr<SVD> pSVD( new SVD( A_center ) );
    111     pSVD->decompose();
    112     utility::matrix U(pSVD->U());
    113     utility::matrix V(pSVD->V());
    114 
    115     // Read the eigenvectors and eigenvalues
    116     eigenvectors_.clone(V);
    117     eigenvectors_.transpose();
    118     eigenvalues_.clone(pSVD->s());
    119 
    120     // Transform back when done with SVD!
    121     // (used V insted of U now for eigenvectors)
    122     A_.transpose();
    123     A_center.transpose();
    124 
    125     // T
    126     for( size_t i = 0; i < eigenvalues_.size(); ++i )
    127       eigenvalues_[ i ] = eigenvalues_[ i ]*eigenvalues_[ i ];
    128     eigenvalues_ *= 1.0/A_center.rows();
    129 
    130     // Sort the eigenvectors in order of eigenvalues
    131     // Simple (not efficient) algorithm that always
    132     // make sure that the i:th element is in its correct
    133     // position (N element --> Ordo( N*N ))
    134     for ( size_t i = 0; i < eigenvalues_.size(); ++i )
    135       for ( size_t j = i + 1; j < eigenvalues_.size(); ++j )
    136         if ( eigenvalues_[ j ] > eigenvalues_[ i ] ) {
    137           std::swap( eigenvalues_[ i ], eigenvalues_[ j ] );
    138           eigenvectors_.swap_rows(i,j);
    139         }
    140   }
    141   */
    142 
    143 
    144   utility::Matrix PCA::projection(const utility::Matrix& samples ) const
     85  Matrix PCA::projection(const utility::Matrix& samples ) const
    14586  {
    14687    const size_t Ncol = samples.columns();
     
    163104
    164105
    165   /*
    166   utility::matrix
    167   PCA::projection_transposed(const utility::matrix& samples) const
    168   {
    169     const size_t Ncol = samples.columns();
    170     const size_t Nrow = samples.rows();
    171     utility::matrix projs( Nrow, Ncol );
    172 
    173     utility::vector temp(samples.rows());
    174     for( size_t j = 0; j < Ncol; ++j ) {
    175       for (size_t i=0; i<Ncol; ++i )
    176         temp(i) = samples(i,j);
    177       utility::vector centered( Nrow );
    178       for( size_t i = 0; i < Nrow; ++i )
    179         centered(i)=temp(i)-meanvalues_(i);
    180       utility::vector proj( eigenvectors_ * centered );
    181       for( size_t i = 0; i < Nrow; ++i )
    182         projs(i,j)=proj(i);
    183     }
    184     return projs;
    185   }
    186   */
    187 
    188 
    189106  // This function will row-center the matrix A_,
    190107  // that is, A_ = A_ - M, where M is a matrix
    191108  // with the meanvalues of each row
    192   void PCA::row_center(utility::Matrix& A_center)
     109  void PCA::row_center(Matrix& A_center)
    193110  {
    194111    meanvalues_ = Vector(A_.rows());
  • tags/0.7/yat/utility/PCA.h

    r4116 r4116  
    5656       should have been performed and no products.
    5757     */
    58     explicit PCA(const utility::Matrix&);
     58    explicit PCA(const Matrix&);
    5959 
    6060    /**
    61        If M<N use this method instead. Using the same format as before
    62        where rows in the matrix corresponds to the dimensional coordinate.
    63        The only difference is in the SVD step where the matrix V is used
    64        after running the transposed matrix. For projections, see
    65        projection_transposed() method.
    66      */
    67     //    void process_transposed_problem(void);
    68 
    69     /**
    70        \brief Returns eigenvalues in a utility::vector.
     61       \brief Returns eigenvalues.
    7162
    7263       \return A const reference to the internal vector containing all
    7364       eigenvalues.
    7465    */
    75     const utility::Vector& eigenvalues(void) const;
     66    const Vector& eigenvalues(void) const;
    7667
    7768    /**
    78        \brief Get all eigenvectors in a utility::matrix.
     69       \brief Get all eigenvectors in a Matrix.
    7970
    8071       \return A const reference to the internal matrix containing all
    8172       eigenvectors.
    8273    */
    83     const utility::Matrix& eigenvectors(void) const;
     74    const Matrix& eigenvectors(void) const;
    8475
    8576    /**
     
    9081       spanned by the eigenvectors.
    9182    */
    92     utility::Matrix projection( const utility::Matrix& ) const;
    93 
    94     /**
    95        Same as projection() but works when used
    96        process_transposed_problem().
    97     */
    98     //    utility::matrix projection_transposed( const utility::matrix& ) const;
    99 
     83    Matrix projection(const Matrix&) const;
    10084
    10185  private:
     
    11599       with the meanvalues of each row
    116100    */
    117     void row_center( utility::Matrix& A_center );
     101    void row_center(Matrix& A_center);
    118102
    119103    utility::Matrix A_;
  • tags/0.7/yat/utility/StrideIterator.h

    r4116 r4116  
    2424*/
    2525
    26 #include "iterator_traits.h"
    27 
    2826#include <boost/concept_check.hpp>
    2927#include <boost/iterator/iterator_adaptor.hpp>
     
    4038     _iterator+stride
    4139
     40     The stride must be positive. Negative stride can be accomplished
     41     by combining StrideIterator with a reverse_iterator (from
     42     e.g. std or boost).
    4243  */
    4344  template<typename RandomAccessIterator>
    4445  class StrideIterator
    4546    : public boost::iterator_adaptor<StrideIterator<RandomAccessIterator>
    46                                      , RandomAccessIterator>
     47                                     , RandomAccessIterator
     48                                     , boost::use_default
     49      , typename std::iterator_traits<RandomAccessIterator>::iterator_category>
    4750  {
    4851    typedef boost::iterator_adaptor<StrideIterator<RandomAccessIterator>,
    49                                     RandomAccessIterator> super_t;
     52                                    RandomAccessIterator,
     53                                    boost::use_default,
     54      typename std::iterator_traits<RandomAccessIterator>::iterator_category>
     55    super_t;
    5056
    5157  public:
  • tags/0.7/yat/utility/Vector.cc

    r4116 r4116  
    66  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
    77  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2009 Peter Johansson
     8  Copyright (C) 2009, 2010 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    8787      throw IO_error(ss.str());
    8888    }
    89     catch (std::runtime_error& e) {
     89    catch (runtime_error& e) {
    9090      std::stringstream ss(e.what());
    9191      ss << "\nVector(std::istream&): invalid vector element\n";
  • tags/0.7/yat/utility/VectorMutable.cc

    r4116 r4116  
    66  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
    77  Copyright (C) 2008, 2009 Jari Häkkinen, Peter Johansson
     8  Copyright (C) 2010 Peter Johansson
    89
    910  This file is part of the yat library, http://dev.thep.lu.se/trac/yat
     
    123124  {
    124125    if (size()!=other.size())
    125       throw std::runtime_error("VectorMutable::operator+= size must be same.");
     126      throw runtime_error("VectorMutable::operator+= size must be same.");
    126127    assert(vec_);
    127128    int status=gsl_vector_add(vec_, other.gsl_vector_p());
    128129    if (status)
    129       throw utility::GSL_error(std::string("VectorMutable::sub", status));
     130      throw utility::GSL_error(std::string("VectorMutable::add", status));
    130131    return *this;
    131132  }
     
    143144  {
    144145    if (size()!=other.size())
    145       throw std::runtime_error("VectorMutable::operator-= size must be same.");
     146      throw runtime_error("VectorMutable::operator-= size must be same.");
    146147    assert(vec_);
    147148    int status=gsl_vector_sub(vec_, other.gsl_vector_p());
  • tags/0.7/yat/utility/WeightIterator.h

    r4116 r4116  
    2424*/
    2525
     26#include "iterator_traits.h"
     27
     28#include <boost/concept_check.hpp>
    2629#include <boost/iterator/iterator_adaptor.hpp>
    2730#include <boost/type_traits/remove_reference.hpp>
     
    5255
    5356     \endcode
     57
     58    Type Requirement: \c BASE must be an \input_iterator
    5459  */
    5560  template<typename Base>
     
    7176     */
    7277    WeightIterator(void)
    73       : WeightIterator::iterator_adaptor_() {}
     78      : WeightIterator::iterator_adaptor_()
     79    {
     80      BOOST_CONCEPT_ASSERT((boost::InputIterator<Base>));
     81    }
    7482
    7583    /**
     
    7785     */
    7886    explicit WeightIterator(Base b)
    79       : WeightIterator::iterator_adaptor_(b) {}
     87      : WeightIterator::iterator_adaptor_(b)
     88    {
     89      BOOST_CONCEPT_ASSERT((boost::InputIterator<Base>));
     90    }
    8091
    8192    /**
  • tags/0.7/yat/utility/WeightedIterator.h

    r4116 r4116  
    3838
    3939     Adaptor enabling to make two unweighted iterators to behave like
    40      a weighted iterator. The data part corresponds to the
    41      DataIterator and the weight corresponds to the WeightIterator.
     40     a \ref concept_weighted_iterator. The data part corresponds to
     41     the data_iterator and the weight corresponds to the
     42     weight_iterator.
     43
     44     \c WeightedIterator is a weighted iterator and its \c value_type
     45     is \c DataWeight. However due to the nature of this adaptor there
     46     are no physical \c DataWeight in memory that \c WeightedIterator
     47     points to, so its \c reference_type is not \c DataWeight& but a
     48     \c DataWeightProxy. Therefore \c DataWeightProxy<DataIterator,
     49     WeightIterator> must be a valid expression.
     50
     51     WeightedIterator inherits most its features from \c data_iterator
     52     and \c weight_iterator. \c WeightedIterator is mutable, for
     53     example, if both underlying iterators are mutable and likewise it
     54     is a random access iterator if both underlying iterators are
     55     random access iterators.
    4256  */
    4357  template<typename DataIterator, typename WeightIterator>
     
    4559    : public boost::iterator_facade<
    4660    WeightedIterator<DataIterator, WeightIterator>,
    47     DataWeightProxy<DataIterator, WeightIterator>,
     61    DataWeight,
    4862    typename std::iterator_traits<DataIterator>::iterator_category,
    4963    DataWeightProxy<DataIterator, WeightIterator> >
  • tags/0.7/yat/utility/merge.h

    r4116 r4116  
    2323*/
    2424
     25#include "concept_check.h"
    2526#include "Matrix.h"
    2627#include "MatrixWeighted.h"
     
    2930#include "yat/statistics/Average.h"
    3031
     32#include <boost/concept_check.hpp>
    3133#include <boost/iterator/permutation_iterator.hpp>
    3234
     
    152154  void merge(const Container2D& x, std::vector<std::string>& labels, Matrix& y)
    153155  {
     156    BOOST_CONCEPT_ASSERT((utility::Container2D<Container2D>));
    154157    merge(x, labels, y, statistics::Average());
    155158  }
     
    159162             Matrix& result, Functor func)
    160163  {
     164    BOOST_CONCEPT_ASSERT((utility::Container2D<Container2D>));
    161165    std::map<std::string, std::vector<size_t> > label2index;
    162166    detail::merge_labels(labels, label2index);
     
    169173             MatrixWeighted& result, Functor1 func1, Functor2 func2)
    170174  {
     175    BOOST_CONCEPT_ASSERT((utility::Container2D<Container2D>));
    171176    std::map<std::string, std::vector<size_t> > label2index;
    172177    detail::merge_labels(labels, label2index);
     
    211216               MutableContainer2D& result, Functor1 func1, Functor2 func2)
    212217    {
     218      BOOST_CONCEPT_ASSERT((utility::Mutable_Container2D<MutableContainer2D>));
     219      BOOST_CONCEPT_ASSERT((utility::Container2D<Container2D>));
    213220      result.resize(label2index.size(), x.columns());
    214221      typedef std::map<std::string, std::vector<size_t> > Map;
  • tags/0.7/yat/utility/stl_utility.cc

    r4116 r4116  
    55  Copyright (C) 2006 Jari Häkkinen
    66  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     7  Copyright (C) 2010 Peter Johansson
    78
    89  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2425#include "stl_utility.h"
    2526
    26 #include <algorithm>
     27#include <boost/algorithm/string/case_conv.hpp>
     28
    2729#include <string>
    2830
     
    3335  std::string& to_lower(std::string& s)
    3436  {
    35     transform(s.begin(),s.end(), s.begin(), tolower);
     37    boost::to_lower(s);
    3638    return s;
    3739  }
     
    4042  std::string& to_upper(std::string& s)
    4143  {
    42     transform(s.begin(),s.end(), s.begin(), toupper);
     44    boost::to_upper(s);
    4345    return s;
    4446  }
  • tags/0.7/yat/utility/stl_utility.h

    r4116 r4116  
    3535///
    3636
     37#include "concept_check.h"
    3738#include "DataWeight.h"
     39#include "Exception.h"
    3840
    3941#include <boost/concept_check.hpp>
     
    4648#include <algorithm>
    4749#include <cmath>
     50#include <exception>
    4851#include <functional>
     52#include <iterator>
    4953#include <map>
    5054#include <ostream>
     55#include <sstream>
    5156#include <string>
    5257#include <utility>
     
    9095
    9196  /**
     97     \brief Adaptor between pointer and pointee interface
     98
     99     Pointer must have an \c operator*, i.e., \c Pointer can be a
     100     traditional pointer or an \input_iterator. Return type is decided
     101     by <a href=http://www.sgi.com/tech/stl/iterator_traits.html>
     102     std::iterator_traits </a>.
     103
     104     \since New in yat 0.7
     105   */
     106  template<typename Pointer>
     107  struct Dereferencer :
     108    public std::unary_function<Pointer,
     109                               typename std::iterator_traits<Pointer>::reference>
     110  {
     111    /**
     112       \brief constructor
     113     */
     114    Dereferencer(void)
     115    { BOOST_CONCEPT_ASSERT((TrivialIterator<Pointer>)); }
     116
     117    /**
     118       \return * \a ti
     119     */
     120    typename std::iterator_traits<Pointer>::reference
     121    operator()(Pointer ti) const { return *ti; }
     122  };
     123
     124
     125  /**
    92126     See The C++ Standard Library - A Tutorial and Reference by
    93127     Nicolai M. Josuttis
     
    98132     to \f$ f(g(x), h(y)) \f$
    99133
    100      F must be an adaptable binary functor
    101      G must be an adaptable unary functor
    102      H must be an adaptable unary functor
     134     - F must be an <a
     135     href="http://www.sgi.com/tech/stl/AdaptableBinaryFunction.html">
     136     AdaptableBinaryFunction</a>
     137     - G must be an <a
     138     href="http://www.sgi.com/tech/stl/AdaptableUnaryFunction.html">
     139     AdaptableUnaryFunction</a>
     140     - H must be an <a
     141     href="http://www.sgi.com/tech/stl/AdaptableUnaryFunction.html">
     142     AdaptableUnaryFunction</a>
     143     - \c G::result_type is convertible to \c F::first_argument_type
     144     - \c H::result_type is convertible to \c F::second_argument_type
     145
     146     \see compose_f_gxy and compose_f_gx
    103147   */
    104148  template<class F, class G, class H>
    105   class compose_f_gx_hy : std::binary_function<typename G::argument_type,
    106                                                typename H::argument_type,
    107                                                typename F::result_type>
     149  class compose_f_gx_hy :
     150    public std::binary_function<typename G::argument_type,
     151                                typename H::argument_type,
     152                                typename F::result_type>
    108153  {
    109154  public:
     
    112157     */
    113158    compose_f_gx_hy(F f, G g, H h)
    114       : f_(f), g_(g), h_(h) {}
     159      : f_(f), g_(g), h_(h)
     160    {
     161      BOOST_CONCEPT_ASSERT((boost::Convertible<typename G::result_type
     162                            , typename F::first_argument_type>));
     163      BOOST_CONCEPT_ASSERT((boost::Convertible<typename H::result_type
     164                            , typename F::second_argument_type>));
     165
     166    }
    115167
    116168    /**
     
    133185     Convenient function to create a compose_f_gx_hy.
    134186
     187     \relates compose_f_gx_hy
     188
    135189     \see std::make_pair
    136190  */
     
    141195  } 
    142196
     197
     198  /**
     199     See The C++ Standard Library - A Tutorial and Reference by
     200     Nicolai M. Josuttis
     201
     202     If f is a unary functor, g is a binary functor, and return type
     203     of g is convertible to F's argument type, then
     204     compose_f_gxy can be used to create a functor equivalent to
     205     \f$ f(g(x,y)) \f$
     206
     207     - F must be an <a
     208     href="http://www.sgi.com/tech/stl/AdaptableUnaryFunction.html">
     209     AdaptableUnaryFunction</a>
     210     - G must be an <a
     211     href="http://www.sgi.com/tech/stl/AdaptableBinaryFunction.html">
     212     AdaptableBinaryFunction</a>
     213     - \c G::result_type is convertible to \c F::argument_type
     214
     215     \see compose_f_gx_hy and compose_f_gx
     216
     217     \since New in yat 0.7
     218   */
     219  template<class F, class G>
     220  class compose_f_gxy :
     221    public std::binary_function<typename G::first_argument_type,
     222                                typename G::second_argument_type,
     223                                typename F::result_type>
     224  {
     225  public:
     226    /**
     227       \brief Constructor
     228     */
     229    compose_f_gxy(F f, G g)
     230      : f_(f), g_(g)
     231    {
     232      BOOST_CONCEPT_ASSERT((boost::Convertible<typename G::result_type
     233                            , typename F::argument_type>));
     234    }
     235
     236    /**
     237       \brief Does the work
     238     */
     239    typename F::result_type
     240    operator()(typename G::first_argument_type x,
     241               typename G::second_argument_type y) const
     242    {
     243      return f_(g_(x,y));
     244    }
     245
     246  private:
     247    F f_;
     248    G g_;
     249  };
     250
     251  /**
     252     Convenient function to create a compose_f_gxy.
     253
     254     \relates compose_f_gxy
     255
     256     \see std::make_pair
     257
     258     \since New in yat 0.7
     259  */
     260  template<class F, class G>
     261  compose_f_gxy<F, G> make_compose_f_gxy(F f, G g)
     262  {
     263    return compose_f_gxy<F,G>(f,g);
     264  } 
     265
     266
     267  /**
     268     See The C++ Standard Library - A Tutorial and Reference by
     269     Nicolai M. Josuttis
     270
     271     If f is a unary functor, g is a unary functor, and return type of
     272     g is convertible to F's argument type, then compose_f_gx can be
     273     used to create a functor equivalent to \f$ f(g(x)) \f$
     274
     275     - F must be an <a
     276     href="http://www.sgi.com/tech/stl/AdaptableBinaryFunction.html">
     277     AdaptableBinaryFunction</a>
     278     - G must be an <a
     279     href="http://www.sgi.com/tech/stl/AdaptableUnaryFunction.html">
     280     AdaptableUnaryFunction</a>
     281     - \c G::result_type is convertible to \c F::argument_type
     282
     283     \see compose_f_gx_hy and compose_f_gxy
     284
     285     \since New in yat 0.7
     286   */
     287  template<class F, class G>
     288  class compose_f_gx : public std::unary_function<typename G::argument_type,
     289                                                  typename F::result_type>
     290  {
     291  public:
     292    /**
     293       \brief Constructor
     294     */
     295    compose_f_gx(F f, G g)
     296      : f_(f), g_(g)
     297    {
     298      BOOST_CONCEPT_ASSERT((boost::Convertible<typename G::result_type
     299                            , typename F::argument_type>));
     300    }
     301
     302    /**
     303       \brief Does the work
     304     */
     305    typename F::result_type
     306    operator()(typename G::argument_type x) const
     307    {
     308      return f_(g_(x));
     309    }
     310
     311  private:
     312    F f_;
     313    G g_;
     314  };
     315
     316  /**
     317     Convenient function to create a compose_f_gx.
     318
     319     \relates compose_f_gx
     320
     321     \see std::make_pair
     322
     323     \since New in yat 0.7
     324  */
     325  template<class F, class G>
     326  compose_f_gx<F, G> make_compose_f_gx(F f, G g)
     327  {
     328    return compose_f_gx<F,G>(f,g);
     329  } 
     330
     331
    143332  /**
    144333     Functor class to exponentiate values using std::exp
     
    157346    { return std::exp(x); }
    158347  };
     348
     349  /**
     350     \brief Identity functor that returns its argument
     351
     352     \since New in yat 0.7
     353   */
     354  template<typename T>
     355  struct Identity : public std::unary_function<T, T>
     356  {
     357    /// \return \a arg
     358    T operator()(T arg) const { return arg; }
     359  };
     360
     361
     362  /**
     363     Same functionality as map::operator[] but the function does not
     364     modify the map and the function throws if key does not exist in
     365     the map.
     366
     367     \return const reference to m[k]
     368
     369     \since New in yat 0.7
     370   */
     371  template <typename Key, typename Tp, typename Compare, typename Alloc>
     372  const Tp& get(const std::map<Key, Tp, Compare, Alloc>& m, const Key& k);
     373
    159374
    160375  /**
     
    483698
    484699
     700  /**
     701     Convenient function that creates a binary predicate that can be
     702     used to compare pointers when you want to compare them with
     703     respect to the objects they point to.
     704
     705     Example:
     706     \code
     707     std::vector<MyClass*> vec(18);
     708     ...
     709     std::sort(vec.begin(), vec.end(),
     710               make_ptr_compare(vec[0], std::greater<MyClass>());
     711     \endcode
     712
     713
     714     Type Requirement:
     715     - \a compare must be a <a
     716     href="http://www.sgi.com/tech/stl/AdaptableBinaryPredicate.html">Adaptable
     717     Binary Predicate</a>.
     718     - value_type of Pointer must be convertible to argument_type of
     719       compare
     720
     721     \return a compose_f_gx_hy in which \c F is defined by \a compare
     722     and both \c G and \c H are \c Dereferencer functors.
     723
     724     \see compose_f_gx_hy
     725
     726     \since New in yat 0.7
     727   */
     728  template<typename Pointer, class Compare>
     729  compose_f_gx_hy<Compare, Dereferencer<Pointer>, Dereferencer<Pointer> >
     730  make_ptr_compare(Pointer p, Compare compare)
     731  {
     732    return make_compose_f_gx_hy(compare, Dereferencer<Pointer>(),
     733                                Dereferencer<Pointer>());
     734  }
     735
     736  /**
     737     Same as make_ptr_compare(2) except that std::less is used to
     738     compare pointers.
     739
     740     \since New in yat 0.7
     741   */
     742  template<typename Pointer>
     743  compose_f_gx_hy<std::less<typename std::iterator_traits<Pointer>::value_type>,
     744                  Dereferencer<Pointer>, Dereferencer<Pointer> >
     745  make_ptr_compare(Pointer p)
     746  {