Commit df746752 authored by laura.gassner's avatar laura.gassner
Browse files

Merge branch 'thof/DENISE-import_Seitosh'

parents aca39e8a 628f7bb8
c this is <polesnzeroes.f>
c ----------------------------------------------------------------------------
c ($Id: Fpolesnzeroes.f 4966 2013-02-01 13:46:50Z lrehor $)
c
c Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
c
c pole and zero access subroutines
c
c ----
c This program is free software; you can redistribute it and/or modify
c it under the terms of the GNU General Public License as published by
c the Free Software Foundation; either version 2 of the License, or
c (at your option) any later version.
c
c This program is distributed in the hope that it will be useful,
c but WITHOUT ANY WARRANTY; without even the implied warranty of
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c GNU General Public License for more details.
c
c You should have received a copy of the GNU General Public License
c along with this program; if not, write to the Free Software
c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
c ----
c
c
c REVISIONS and CHANGES
c 11/11/2002 V1.0 Thomas Forbriger
c 13/11/2002 V1.1 introduce waterlevel to omega
c
cS
c ============================================================================
c
subroutine fou_revision
c
c print library code revision
c
cE
print *,
& '$Id: Fpolesnzeroes.f 4966 2013-02-01 13:46:50Z lrehor $'
return
end
c
cS
c----------------------------------------------------------------------
c
subroutine fou_clear
c
c initialize poles and zeros database
c
include 'polesnzeros.inc'
c
cE
call fou_normal
fourier_numer=(1.d0,0.d0)
fourier_denom=(1.d0,0.d0)
fourier_npoles=0
fourier_nzeros=0
c
return
end
c
cS
c----------------------------------------------------------------------
c
subroutine fou_inverse
c
c set inverse flag
c all following coefficients will be treated as inverse filters
c
include 'polesnzeros.inc'
c
cE
c
fourier_normal=.false.
c
return
end
c
cS
c----------------------------------------------------------------------
c
subroutine fou_normal
c
c reset inverse flag
c all following coefficients will be treated as normal filters
c
include 'polesnzeros.inc'
c
cE
c
fourier_normal=.true.
c
return
end
c
cS
c----------------------------------------------------------------------
c
subroutine fou_pole(pole)
c
c set one pole
c
double complex pole
c
include 'polesnzeros.inc'
c
cE
c
if (fourier_normal) then
if (fourier_npoles.lt.fourier_nmax) then
fourier_npoles=fourier_npoles+1
fourier_poles(fourier_npoles)=pole
else
stop 'ERROR (fourier_pole): too many poles'
endif
else
if (fourier_nzeros.lt.fourier_nmax) then
fourier_nzeros=fourier_nzeros+1
fourier_zeros(fourier_nzeros)=pole
else
stop 'ERROR (fourier_pole): too many zeros'
endif
endif
c
return
end
c
cS
c----------------------------------------------------------------------
c
subroutine fou_zero(zero)
c
c set one zero
c
double complex zero
c
include 'polesnzeros.inc'
c
cE
c
if (fourier_normal) then
if (fourier_nzeros.lt.fourier_nmax) then
fourier_nzeros=fourier_nzeros+1
fourier_zeros(fourier_nzeros)=zero
else
stop 'ERROR (fourier_zero): too many zeros'
endif
else
if (fourier_npoles.lt.fourier_nmax) then
fourier_npoles=fourier_npoles+1
fourier_poles(fourier_npoles)=zero
else
stop 'ERROR (fourier_zero): too many poles'
endif
endif
c
return
end
c
cS
c----------------------------------------------------------------------
c
subroutine fou_numer(factor)
c
c set one numerator factor
c
double precision factor
c
include 'polesnzeros.inc'
c
cE
c
if (fourier_normal) then
fourier_numer=factor*fourier_numer
else
fourier_denom=factor*fourier_denom
endif
c
return
end
c
cS
c----------------------------------------------------------------------
c
subroutine fou_denom(factor)
c
c set one denominator factor
c
double precision factor
c
include 'polesnzeros.inc'
c
cE
c
if (fourier_normal) then
fourier_denom=factor*fourier_denom
else
fourier_numer=factor*fourier_numer
endif
c
return
end
c
cS
c----------------------------------------------------------------------
c
subroutine fou_cnumer(factor)
c
c set one complex numerator factor
c
double complex factor
c
include 'polesnzeros.inc'
c
cE
c
if (fourier_normal) then
fourier_numer=factor*fourier_numer
else
fourier_denom=factor*fourier_denom
endif
c
return
end
c
cS
c----------------------------------------------------------------------
c
subroutine fou_cdenom(factor)
c
c set one complex denominator factor
c
double complex factor
c
include 'polesnzeros.inc'
c
cE
c
if (fourier_normal) then
fourier_denom=factor*fourier_denom
else
fourier_numer=factor*fourier_numer
endif
c
return
end
c
cS
c----------------------------------------------------------------------
c
double complex function fou_eval(om)
c
c evaluate filter response coefficient at real frequency om
c the function applies a waterlevel of 1.d-30 to om
c
double precision om
c
include 'polesnzeros.inc'
c
cE
double complex value, thenumer, thedenom, omega
integer i
c
omega=max(1.d-30,om)
c
thenumer=(1.d0,0.d0)
do i=1,fourier_nzeros
thenumer=thenumer*(omega-fourier_zeros(i))
enddo
c
thedenom=(1.d0,0.d0)
do i=1,fourier_npoles
thedenom=thedenom*(omega-fourier_poles(i))
enddo
c
value=thenumer*fourier_numer/(fourier_denom*thedenom)
c
fou_eval=value
c
return
end
c
c ----- END OF polesnzeroes.f -----
# this is <Makefile> # this is <Makefile>
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# $Id: Makefile 4966 2013-02-01 13:46:50Z lrehor $ # $Id$
# #
# Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) # Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
# #
# Fourier coefficients library # Fourier coefficients library
# #
# ---- # ----
# This program is free software; you can redistribute it and/or modify # libfourier is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
...@@ -22,13 +22,15 @@ ...@@ -22,13 +22,15 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# ---- # ----
# #
# provide Fourier coefficients of filter responses etc. # Fourier library: Operations in the Fourier domain
# =================================================
# #
# this library makes use of libaff # Please have a look at the README file coming along with the source code in
# libaff must be installed first # this directory for further notes regarding provided functionality,
# prerequisites and installation.
# #
# REVISIONS and CHANGES # REVISIONS and CHANGES
# 07/11/2002 V1.0 Thomas Forbriger # 07/11/2002 V1.0 Thomas Forbriger (thof)
# 05/01/2003 V1.1 uuuhhhhhh # 05/01/2003 V1.1 uuuhhhhhh
# had to resolve a specific problem: my library # had to resolve a specific problem: my library
# procuded object files for Fortran code with the same # procuded object files for Fortran code with the same
...@@ -49,19 +51,21 @@ ...@@ -49,19 +51,21 @@
# C++ object files # C++ object files
# 17/01/2011 V1.8 distinguish library creation and installation # 17/01/2011 V1.8 distinguish library creation and installation
# 29/01/2013 V1.9 added tarball rules # 29/01/2013 V1.9 added tarball rules
# 26/01/2014 (thof): no longer strip comments from header files
# #
# ============================================================================ # ============================================================================
# #
include ../Makefile_var CONTRIBDIR=..
include $(CONTRIBDIR)/Makefile_var
.PHONY: all .PHONY: all
all: install doc all: install doc
.PHONY: doc .PHONY: doc
doc: doxydoc libfourier.doc doc: doxydoc
LIBRARIES=libfourier.a libfourierxx.a LIBRARIES=libfourierxx.a
#shared: libfourierxx.so #shared: libfourierxx.so
.PHONY: install .PHONY: install
...@@ -72,7 +76,8 @@ $(LOCLIBDIR)/%: install-include % ...@@ -72,7 +76,8 @@ $(LOCLIBDIR)/%: install-include %
#---------------------------------------------------------------------- #----------------------------------------------------------------------
flist: Makefile $(wildcard *.f *.inc *.h *.cc *.c README *.cfg) COPYING flist: Makefile $(wildcard *.f *.inc *.h *.cc *.c README *.cfg) COPYING \
$(DOXYTXT)
echo $^ | tr ' ' '\n' | sort > $@ echo $^ | tr ' ' '\n' | sort > $@
.PHONY: edit .PHONY: edit
...@@ -80,11 +85,10 @@ edit: flist; vim $< ...@@ -80,11 +85,10 @@ edit: flist; vim $<
.PHONY: clean .PHONY: clean
clean: clean:
-/bin/rm -fv *.o *.bak *.doc *.o77 flist *.of2c -/bin/rm -fv *.o *.bak *.o77 flist *.of2c
-find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v -find . -name \*.bak | xargs --no-run-if-empty /bin/rm -v
-find . -name \*.o | xargs --no-run-if-empty /bin/rm -v -find . -name \*.o | xargs --no-run-if-empty /bin/rm -v
-find . -name \*.d | xargs --no-run-if-empty /bin/rm -v -find . -name \*.d | xargs --no-run-if-empty /bin/rm -v
-find . -name \*.h.strip | xargs --no-run-if-empty /bin/rm -v
-/bin/rm -vf flist *.o install-include *.xxx junk* *.a *.so -/bin/rm -vf flist *.o install-include *.xxx junk* *.a *.so
# ============================================================================ # ============================================================================
...@@ -141,36 +145,6 @@ libfourier.a: $(LIBOBS) ...@@ -141,36 +145,6 @@ libfourier.a: $(LIBOBS)
$(RANLIB) $@ $(RANLIB) $@
# ============================================================================ # ============================================================================
#
# A note on header files:
# We extensively comment class declarations within the header files. The
# reduce compilation time when using the library code, comments will be
# stripped from the header files that are exportet. These stripped versions
# are placed in the source code path with name *.h.strip and will be linked to
# INCINSTALLPATH with name *.h.
#
# Although comment stripping could be done by perl with an elaborate regular
# expression, we prefer the remcmmnt command by Jari Laaksonen. You can find
# the code at
# http://www.eti.pg.gda.pl/KATEDRY/kecs/lab-cpp/snippets/
# If it is not available to you, you should set TF_REMCMMNT=cat (see below)
#
# ============================================================================
#
# environment variables
# ---------------------
#
# You will like to set the following environment variables:
#
# LOCINCLUDEDIR Defines the path where header files will be copied for
# usage in your own projects. You will pass this path to
# the precompiler with the -I option.
# LOCLIBDIR Defines the path where the binary library will be
# placed.
# TF_WWWBASEDIR Defines the path to your personal homepage. That's the
# place where doxygen output will be written too (see
# below).
# files # files
# ----- # -----
...@@ -185,29 +159,18 @@ SRC=fcommand.cc filters.cc polesnzeroes.cc fftwaff.cc error.cc fftwaffar.cc ...@@ -185,29 +159,18 @@ SRC=fcommand.cc filters.cc polesnzeroes.cc fftwaff.cc error.cc fftwaffar.cc
TESTS=$(wildcard tests/*.cc) TESTS=$(wildcard tests/*.cc)
# whereever we find a README, we will use it # whereever we find a README, we will use it
README=$(shell find . -name README) README=$(shell find . -name README)
# the frame of doxygen documentation is palced in text files
DOXYTXT=$(shell find . -name doxygen\*.txt)
# place where we will copy header files # place where we will copy header files
INCINSTALLPATH=$(LOCINCLUDEDIR)/fourier INCINSTALLPATH=$(LOCINCLUDEDIR)/fourier
# place where we will copy the binary library # place where we will copy the binary library
LIBINSTALLPATH=$(LOCLIBDIR) LIBINSTALLPATH=$(LOCLIBDIR)
# name of headers with comments stripped off (these are linked to your include
# directory)
STRIPHEADER=$(addsuffix .strip,$(notdir $(HEADERS)))
# name of installed (exported) header files (these are the names in your # name of installed (exported) header files (these are the names in your
# include directory) # include directory)
INSTHEADER=$(addprefix $(INCINSTALLPATH)/,$(filter-out ./tests/%,$(HEADERS))) INSTHEADER=$(addprefix $(INCINSTALLPATH)/,$(filter-out ./tests/%,$(HEADERS)))
# if defined, empty lines are kept in comment-stripped headers
# to synchronize line numbers (necessary during library debugging)
EMPTYPRINT=1
#EMPTYPRINT=0
# define this to be cat in case you do not have remcmmnt available
ifndef TF_REMCMMNT
TF_REMCMMNT=cat
endif
# compiler and preprocessor flags # compiler and preprocessor flags
FLAGS= FLAGS=
#CXXFLAGS += -Wall -pedantic $(FLAGS) -O3 #CXXFLAGS += -Wall -pedantic $(FLAGS) -O3
...@@ -242,33 +205,11 @@ include $(patsubst %.cc,%.d,$(SRC)) ...@@ -242,33 +205,11 @@ include $(patsubst %.cc,%.d,$(SRC))
#====================================================================== #======================================================================
# header files # header files
# ------------ # ------------
#
# Since we extensively document the class structures within the header files,
# these should be stripped for the production version (otherwise the compiler
# has to scan all comments on each compile). Stripping is done by the rule
# below and is controlled by the variables TF_REMCMMNT and EMPTYPRINT (see
# above).
# comment stripping
# -----------------
# awk rule assumes that the first non-comment line starts with '#'
# and that the first (copyright) comment end with pattern "^ */"
%.h.strip: %.h
awk 'BEGIN {hot=1;} /^ \*\// { if (hot) { hot=2; print; next;} }\
/^#/ { hot=0; } \
{ if (hot==2) { print ""; } else if (hot) { print; } }' $< > $@
$(TF_REMCMMNT) $< | awk 'BEGIN {hot=0;} \
/^ *$$/ { if ((hot) && ($(EMPTYPRINT))) { print ""; } next; } \
/^#/ { hot=1; } { if (hot) print; }' >> $@
#----------------------------------------------------------------------
.PRECIOUS: %.h.strip
$(INCINSTALLPATH)/%.h: %.h.strip $(INCINSTALLPATH)/%.h: %.h
mkdir -vp $(dir $@) @mkdir -vp $(dir $@)
-rm -fv $@ -@rm -fv $@
/bin/cp -vpd $< $@ @/bin/cp -vpd $< $@
# install header files # install header files
.PHONY: install-include .PHONY: install-include
...@@ -330,7 +271,7 @@ DOXYWWWPATH=$(TF_WWWBASEDIR)/libfourier ...@@ -330,7 +271,7 @@ DOXYWWWPATH=$(TF_WWWBASEDIR)/libfourier
doxyclean: ;/bin/rm -rfv $(DOXYWWWPATH) doxydoc.xxx doxyclean: ;/bin/rm -rfv $(DOXYWWWPATH) doxydoc.xxx
DOXYSRC=$(README) $(HEADERS) $(SRC) DOXYSRC=$(DOXYTXT) $(HEADERS) $(SRC)
# create doxygen intermediate configuration # create doxygen intermediate configuration
PWD=$(shell env pwd) PWD=$(shell env pwd)
...@@ -368,14 +309,6 @@ fullpackage: $(TF_MAKEPKG) ...@@ -368,14 +309,6 @@ fullpackage: $(TF_MAKEPKG)
PACKAGEEXPORT="trunk/src/libs/libfourier:src" \ PACKAGEEXPORT="trunk/src/libs/libfourier:src" \
PACKAGETARGETS="src:install: src:doc:" \ PACKAGETARGETS="src:install: src:doc:" \
PACKAGELIBS="libaff" PACKAGELIBS="libaff"
.PHONY: srcpackage
srcpackage: $(TF_MAKEPKG)
$(MAKE) -f $< \
PACKAGE=libfourier \
PACKAGESRCONLY=yes \
PACKAGEEXPORT="trunk/src/libs/libfourier:src" \
PACKAGETARGETS="src:install: src:doc:" \
PACKAGELIBS="-"
endif endif
# ----- END OF Makefile ----- # ----- END OF Makefile -----
/*! \file libfourier/README this is <README>
* \brief C++ library to operate on Fourier transforms (libfourierxx) ============================================================================
* FOURIER --- Fourier coefficients library
* ---------------------------------------------------------------------------- -------------------------------
* $Id$
* $Id: README 3555 2010-12-11 16:46:58Z tforb $ ============================================================================
*
* Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt)
*
* C++ library to operate on Fourier transforms (libfourierxx)
*
* REVISIONS and CHANGES
* - 02/10/2007 V1.0 Thomas Forbriger (started README)
*
* ============================================================================
*/
/*! \mainpage For compilation instructions see README.1st in the root directory of the tar-ball or
http://gpitrsvn.gpi.uni-karlsruhe.de:8000/TFSoftware/wiki/docs/installation
\author Thomas Forbriger The library provides modules to perform Fourier transformations and to
\since 2002 operate on Fourier transforms.An interface to FFTW is available.Signal
\date $Date: 2007-10-02 18:49:08 $ filters can be defined by their Fourier domain response function and applied
\version $Id: README 3555 2010-12-11 16:46:58Z tforb $ to the Fourier transform of a signal. libaff is used to store Fourier
coefficients and time series samples.Further stuff will be collected in
this library in the future.
The library provides modules to perform Fourier transformations and to operate Binary libraries
on Fourier transforms. ----------------
An interface to FFTW is available. libfourier.a Fortran library
Signal filters can be defined by their response spectrum and applied to a libfourierxx.a C++ library
Fourier transform.
libaff is used to store Fourier coefficients and time series samples.
Further stuff will be collected in this library in the future.
*/
/*======================================================================*/ Dependencies
------------
libaff is required to compile the binary libraries
fftw3 is required for the C++ library
doxygen is required to process source code documentation
/*! \page page_fftw3 Scaling of Fourier transform in FFTW3 Installation
* ------------
* \section sec_fftw3_library Fourier transformation in the FFTW3 library environment variables:
* LOCINCLUDEDIR Defines the path where header files will be copied for
* The FFTW3 reference