Commit cb2a10d9 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

proceeding with mag102003

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.
proceeding with sigfit
proceeding with series operations
introduced interface to LAPACK


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 1474
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 628aa742
This is a legacy version of the repository. It may be incomplete as well as
inconsistent. See README.history for details. For the old stock of the
repository copyright and licence conditions apply as specified for versions
commited after 2015-03-01. Use recent versions as a base for new development.
The legacy version is only stored to keep a record of history.
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id: Makefile,v 1.1 2004-02-07 22:13:10 tforb Exp $
#
# Copyright (c) 2004 by Thomas Forbriger (BFO Schiltach)
#
# provide access to LAPACK for AFF modules
#
# REVISIONS and CHANGES
# 07/02/2004 V1.0 Thomas Forbriger
#
# ============================================================================
#
HEADERS=$(shell find . -name \*.h)
#SRC=misc/fortranio.cc misc/commandline.cc misc/ioswap.cc misc/error.cc \
# misc/blitzfortranio.cc hacks/hack_blitztogrepg.cc
LIBSRC=linearxx.cc
INCINSTALLPATH=$(LOCINCLUDEDIR)/linearxx
LIBINSTALLPATH=$(LOCLIBDIR)
# name of headers with comments stripped off
STRIPHEADER=$(addsuffix .strip,$(notdir $(HEADERS)))
# name of installed (exported) header files
INSTHEADER=$(addprefix $(INCINSTALLPATH)/,$(notdir $(HEADERS)))
# if defined, empty lines are kept in stripped comment headers
# to synchronize line numbers
EMPTYPRINT=1
#EMPTYPRINT=0
# define this to be cat in case you do not have remcmmnt available
REMCMMNT=remcmmnt
#REMCMMNT=cat
#
# general part
# ------------
#
FLAGS=
CXXFLAGS=-fhonor-std -Wall $(FLAGS)
CXXFLAGS=-Wall $(FLAGS)
LDFLAGS=-L$(LOCLIBDIR)
CPPFLAGS=-I$(LOCINCLUDEDIR) $(FLAGS)
all: liblinearxx.a doxybrief doxyfull
flist: Makefile $(wildcard *.h *.cc *.cfg)
echo $^ | tr ' ' '\n' | sort > $@
.PHONY: edit
edit: flist; vim $<
.PHONY: clean
clean: ;
-find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v
-/bin/rm -vf flist *.d *.o tsxx_tests
#======================================================================
# pattern rules
# -------------
%.d: %.cc
$(SHELL) -ec '$(CXX) -M $(CPPFLAGS) $< \
| sed '\''s,\($(notdir $*)\)\.o[ :]*,$(dir $@)\1.o $@ : ,g'\'' \
> $@; \
[ -s $@ ] || rm -f $@'
#======================================================================
# library part
# ------------
-include $(patsubst %.cc,%.d,$(LIBSRC))
libtsxx.a: $(patsubst %.cc,%.o,$(LIBSRC))
ar rcv $@ $^
ranlib $@
newlib $@
#----------------------------------------------------------------------
# comment stripping
%.hd: %.h; echo $(notdir $<.strip): $< > $@
-include $(patsubst %.h,%.hd,$(HEADERS))
# first awk rule assumes that the first non-comment line starts with '#'
# and that the first (copyright) comment end with pattern "^ */"
%.h.strip:
awk 'BEGIN {hot=1;} /^ \*\// { if (hot) { hot=2; print; next;} }\
/^#/ { hot=0; } \
{ if (hot==2) { print ""; } else if (hot) { print; } }' $< > $@
$(REMCMMNT) $< | awk 'BEGIN {hot=0;} \
/^ *$$/ { if ((hot) && ($(EMPTYPRINT))) { print; } next; } \
/^#/ { hot=1; } { if (hot) print; }' >> $@
#----------------------------------------------------------------------
$(INCINSTALLPATH)/%.h: %.h.strip
mkdir -p $(INCINSTALLPATH)
-rm -fv $@
ln -svf $$(pwd)/$< $@
install-include: $(INSTHEADER)
touch $@
#======================================================================
# documentation part
# ------------------
DOXYWWWPATH=$(HOME)/public_html/txt/cxx/liblinearxx
.PHONY: doxyclean doxyview doxybriefview doxyfullconf doxybriefconf
doxyclean: ;/bin/rm -rfv doc docbrief
DOXYSRC=$(LIBSRC) $(HEADERS)
doc/%: doxyfull.cfg $(DOXYSRC)
mkdir -vp $(DOXYWWWPATH)
ln -sfv $(DOXYWWWPATH) doc
doxygen $<
docbrief/%: doxybrief.cfg $(DOXYSRC); doxygen $<
doxybriefconf doxyfullconf: doxy%conf:
doxywizard $(patsubst doxy%conf,doxy%.cfg,$@)
doxybrief: docbrief/html/index.html
doxyfull: doc/html/index.html
doxydoc: doxybrief doxyfull
doxyfullview: doxyfull; mozilla file:$(DOXYWWWPATH)/html/index.html &
doxybriefview: doxybrief; mozilla file:/docbrief/html/index.html &
doxyview: doxyfullview doxybrief
#======================================================================
# test code
# ---------
tstest: tstest.cc
$(CXX) -o $@ $< -I$(LOCINCLUDEDIR) -ltsxx -laff -L$(LOCLIBDIR)
tests: tstest; $<; rm -fv $<
# ----- END OF Makefile -----
# Doxygen configuration generated by Doxywizard version 0.1
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "LINEAR++ library: AFF to LAPACK"
PROJECT_NUMBER =
OUTPUT_DIRECTORY = docbrief
OUTPUT_LANGUAGE = English
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = NO
HIDE_UNDOC_MEMBERS = YES
HIDE_UNDOC_CLASSES = YES
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ALWAYS_DETAILED_SEC = NO
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = NO
CLASS_DIAGRAMS = YES
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
VERBATIM_HEADERS = YES
SHOW_INCLUDE_FILES = YES
JAVADOC_AUTOBRIEF = YES
INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
DISTRIBUTE_GROUP_DOC = YES
TAB_SIZE = 8
ENABLED_SECTIONS =
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
ALIASES =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ./
FILE_PATTERNS = README \
gsexx.h \
gsexx_T*cc \
gsexxcc
RECURSIVE = NO
EXCLUDE =
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
IMAGE_PATH =
INPUT_FILTER =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = YES
LATEX_OUTPUT = latex
COMPACT_LATEX = YES
PAPER_TYPE = a4wide
EXTRA_PACKAGES = pslatex
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = YES
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = YES
MAN_OUTPUT = man
MAN_EXTENSION = .3
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DOT_PATH =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
GENERATE_LEGEND = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
CGI_NAME = search.cgi
CGI_URL =
DOC_URL =
DOC_ABSPATH =
BIN_ABSPATH = /usr/local/bin/
EXT_DOC_PATHS =
# Doxygen configuration generated by Doxywizard version 0.1
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "LINEAR++ library: AFF to LAPACK"
PROJECT_NUMBER =
OUTPUT_DIRECTORY = doc
OUTPUT_LANGUAGE = English
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
ALWAYS_DETAILED_SEC = YES
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = YES
CLASS_DIAGRAMS = YES
SOURCE_BROWSER = YES
INLINE_SOURCES = YES
STRIP_CODE_COMMENTS = YES
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
VERBATIM_HEADERS = YES
SHOW_INCLUDE_FILES = YES
JAVADOC_AUTOBRIEF = YES
INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
DISTRIBUTE_GROUP_DOC = YES
TAB_SIZE = 8
ENABLED_SECTIONS = internal
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
ALIASES =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ./
FILE_PATTERNS = README \
*.h \
*.cc
RECURSIVE = NO
EXCLUDE =
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
IMAGE_PATH =
INPUT_FILTER =
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_HEADER =
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
DISABLE_INDEX = NO
ENUM_VALUES_PER_LINE = 4
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = YES
LATEX_OUTPUT = latex
COMPACT_LATEX = YES
PAPER_TYPE = a4wide
EXTRA_PACKAGES = pslatex
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = YES
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = YES
MAN_OUTPUT = man
MAN_EXTENSION = .3
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
HAVE_DOT = NO
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DOT_PATH =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
GENERATE_LEGEND = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
CGI_NAME = search.cgi
CGI_URL =
DOC_URL =
DOC_ABSPATH =
BIN_ABSPATH = /usr/local/bin/
EXT_DOC_PATHS =
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: convolve.h,v 1.1 2004-02-07 17:38:18 tforb Exp $
* $Id: convolve.h,v 1.2 2004-02-07 22:13:12 tforb Exp $
* \author Thomas Forbriger
* \date 07/02/2004
*
......@@ -23,26 +23,54 @@
#define TF_CONVOLVE_H_VERSION \
"TF_CONVOLVE_H V1.0 "
#define TF_CONVOLVE_H_CVSID \
"$Id: convolve.h,v 1.1 2004-02-07 17:38:18 tforb Exp $"
"$Id: convolve.h,v 1.2 2004-02-07 22:13:12 tforb Exp $"
#include<aff/series.h>
namespace ts {
//! calculate convolution of two series
/*! Calculate convolution of two series.
*
* The function evaluates
* \f[
* c_k = \sum\limits_l a_l b_{k-l},
* \f]
* where the index ranges of the input series are
* \f$ a_l: l \in [F_a,L_a] \f$ and
* \f$ b_l: l \in [F_b,L_b]. \f$
* From the second factor we conclude
* \f$ F_b +l \leq k \leq L_b + l \f$ and thus the index range of
* \f$ c_l \f$ is
* \f[
* F_b + F_a \leq k \leq L_b + L_a.
* \f]
* For a given \f$ k \f$ the range of summation index \f$ l \f$ is
* defined by the two conditions
* \f[
* k- L_b \leq l \leq k- F_b
* \f]
* and
* \f[
* F_a \leq k \leq L_a.
* \f]
*
* \param a \f$ a_l \f$
* \param b \f$ b_l \f$
* \return c \f$ c_l \f$
*/
template<class T>
aff::Series<T> convolve(const aff::ConstSeries<T>& a,
const aff::ConstSeries<T>& b)
{
aff::Series<T> retval(a.last()-b.first(),b.last()-a.first());
for (long int i=retval.first(); i<=retval.last(); ++i)
aff::Series<T> retval(a.first()+b.first(),b.last()+a.last());
for (long int k=retval.first(); k<=retval.last(); ++k)
{
retval(i)=T(0);
long int lmin=a.first() > (b.first()+i) ? a.first() : (b.first()+i);
long int lmax=a.last() < (b.last()+i) ? a.last() : (b.last()+i);
retval(k)=T(0);
long int lmin=a.first() > (k-b.last()) ? a.first() : (k-b.last());
long int lmax=a.last() < (k-b.first()) ? a.last() : (k-b.first());
for(long int l=lmin; l<=lmax; ++l)
{
retval(i)+=a(l)*b(l+i);
retval(k)+=a(l)*b(k-l);
}
}
return(retval);
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: correlate.h,v 1.1 2004-02-07 17:38:18 tforb Exp $
* $Id: correlate.h,v 1.2 2004-02-07 22:13:12 tforb Exp $
* \author Thomas Forbriger
* \date 07/02/2004
*
......@@ -23,26 +23,54 @@
#define TF_CORRELATE_H_VERSION \
"TF_CORRELATE_H V1.0 "
#define TF_CORRELATE_H_CVSID \
"$Id: correlate.h,v 1.1 2004-02-07 17:38:18 tforb Exp $"
"$Id: correlate.h,v 1.2 2004-02-07 22:13:12 tforb Exp $"
#include<aff/series.h>
namespace ts {
//! calculate crosscorrelation of two series
/*! Calculate crosscorrelation of two series.
*
* The function evaluates
* \f[
* c_k = \sum\limits_l a_l b_{k+l},
* \f]
* where the index ranges of the input series are
* \f$ a_l: l \in [F_a,L_a] \f$ and
* \f$ b_l: l \in [F_b,L_b]. \f$
* From the second factor we conclude
* \f$ F_b -l \leq k \leq L_b - l \f$ and thus the index range of
* \f$ c_l \f$ is
* \f[
* F_b - L_a \leq k \leq L_b - F_a.
* \f]
* For a given \f$ k \f$ the range of summation index \f$ l \f$ is
* defined by the two conditions
* \f[
* F_b - k \leq l \leq L_b - k
* \f]
* and
* \f[
* F_a \leq k \leq L_a.
* \f]
*
* \param a \f$ a_l \f$
* \param b \f$ b_l \f$
* \return c \f$ c_l \f$
*/
template<class T>
aff::Series<T> correlate(const aff::ConstSeries<T>& a,
const aff::ConstSeries<T>& b)
{
aff::Series<T> retval(a.last()-b.first(),b.last()-a.first());
for (long int i=retval.first(); i<=retval.last(); ++i)
aff::Series<T> retval(b.first()-a.last(),b.last()-a.first());
for (long int k=retval.first(); k<=retval.last(); ++k)
{
retval(i)=T(0);
long int lmin=a.first() > (b.first()+i) ? a.first() : (b.first()+i);
long int lmax=a.last() < (b.last()+i) ? a.last() : (b.last()+i);
retval(k)=T(0);
long int lmin=a.first() > (b.first()-k) ? a.first() : (b.first()-k);
long int lmax=a.last() < (b.last()-k) ? a.last() : (b.last()-k);
for(long int l=lmin; l<=lmax; ++l)
{
retval(i)+=a(l)*b(l+i);
retval(k)+=a(l)*b(l+k);
}
}
return(retval);
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: innerproduct.h,v 1.1 2004-02-07 17:38:19 tforb Exp $
* $Id: innerproduct.h,v 1.2 2004-02-07 22:13:12 tforb Exp $
* \author Thomas Forbriger
* \date 07/02/2004
*
......@@ -23,7 +23,7 @@
#define TF_INNERPRODUCT_H_VERSION \
"TF_INNERPRODUCT_H V1.0 "
#define TF_INNERPRODUCT_H_CVSID \
"$Id: innerproduct.h,v 1.1 2004-02-07 17:38:19 tforb Exp $"
"$Id: innerproduct.h,v 1.2 2004-02-07 22:13:12 tforb Exp $"
#include<aff/series.h>
......@@ -31,16 +31,17 @@ namespace ts {
//! calculate inner product of two series
template<class T>
T innerproduct(const aff::ConstSeries<T>& a, const aff::ConstSeries<T>& b)
T innerproduct(const aff::ConstSeries<T>& a,
const aff::ConstSeries<T>& b)
{
T retval=0;
long int first=a.first() > b.first() ? a.first() : b.first();
long int last=a.last() < b.last() ? a.last() : b.last();
long int first=(a.first() > b.first() ? a.first() : b.first());
long int last=(a.last() < b.last() ? a.last() : b.last());