Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*CMakeFiles
*CMakeCache.txt
.cproject
.project
*.cmake
Makefile
source/main
source/libfepc.so
test/*test
*Testing

18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

PROJECT(FEPC)

option(HAS_FFTW3 "Use fftw3" 0)

if (HAS_FFTW3)
set(CMAKE_C_FLAGS "${CCMAKE_C_FLAGS} -DHAS_FFTW3")
endif(HAS_FFTW3)

include_directories(include)

ADD_SUBDIRECTORY(source)

enable_testing()
ADD_SUBDIRECTORY(test)


55 changes: 0 additions & 55 deletions Makefile

This file was deleted.

10 changes: 7 additions & 3 deletions README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FEPC library

Copyright (C) 2009 Peter Gerds (gerds@mis.mpg.de)
Copyright (C) 2009 Peter Gerds (gerds@mis.mpg.de), 2010 Stefan Handschuh (handschu@mis.mpg.de)


This program is free software: you can redistribute it and/or modify
Expand All @@ -17,5 +17,9 @@ To read the text of the GNU Lesser General Public License,
see <http://www.gnu.org/licenses/>


This library provides several classes representing tensors in different formats
and algorithms to deal with them.

Create the makefiles with "cmake .". If the parameter "HAS_FFTW3" is set,
the fftw3 library will be used (if present). This however forces the
resulting binary to be GPL licensed if published as the fftw3 is released
under the GPL.

50 changes: 49 additions & 1 deletion basic.h → include/basic.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* FEPC
* Copyright (C) 2009 Peter Gerds (gerds@mis.mpg.de)
* Copyright (C) 2009 Peter Gerds (gerds@mis.mpg.de), 2011 Stefan Handschuh (handschu@mis.mpg.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand All @@ -21,6 +21,10 @@

#include "config.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
int dim; /* Dimension des Vektors */
int *array; /* Array mit Werten */
Expand Down Expand Up @@ -68,6 +72,10 @@ entry_d2one(vec_p s,vec_p n);
vec_p
entry_one2d(int pos,vec_p n);

/* Berechnet den zugehoerigen Vektor der Position pos eines multidimensionalen Array, dessen Dimension durch den Vektor n bestimmt ist, ohne dabei streng zu sein */
vec_p
entry_one2d_sloppy(int pos,vec_p n);

/* Berechnet den Vektor a*s + b*n */
vec_p
vec_op(int a, vec_p s, int b, vec_p n);
Expand All @@ -76,6 +84,14 @@ vec_op(int a, vec_p s, int b, vec_p n);
vec_p
vec_multi(int a, vec_p n);

/* Multipliziert einen reelwertigen Vektor mit einer Konstante */
vec_real_p
vec_real_multi(fepc_real_t factor, vec_real_p vector);

/* Multipliziert einen reelwertigen Vektor mit einer Konstante und speichert das Ergebnis im Eingabevektor */
void
vec_real_multi2(fepc_real_t factor, vec_real_p vector);

/* Dividiert den Vektor n mit der ganzen Zahl a */
vec_p
vec_div(int a, vec_p n);
Expand All @@ -84,14 +100,25 @@ vec_div(int a, vec_p n);
vec_p
vec_add(vec_p s, vec_p n);

/* Addiert Vektor s und Vektor n und speichert das Ergebnis in s */
void
vec_add2(vec_p s, vec_p n);

/* Erzeugt eine inhaltliche Kopie des Vektors n */
vec_p
vec_copy(vec_p n);

/* Subtrahiert Vektor s und Vektor n */
vec_real_p
vec_real_substract(vec_real_p s, vec_real_p n);

/* Berechnet das Skalarprodukt der Vektoren r und s */
int
vec_skalar_prod(vec_p r, vec_p s);

fepc_real_t
vec_real_skalar_prod(vec_real_p r, vec_real_p s);

/* Berechnet den groessten Vektor n sodass gilt: n<=r und n<=s */
vec_p
vec_min(vec_p r, vec_p s);
Expand Down Expand Up @@ -121,7 +148,28 @@ besitzt die Groesse 2. Es gilt Array[0] = s , Array[1] = r. */
vec_p*
vec_zerlegung(vec_p n);

/**
* Prints out a vector.
*/
void
print_vec(vec_p vector);

/**
* Prints out a real-valued vector
*/
void
print_vec_real(vec_real_p vector);

/*
* Returns the euklidian norm of the vector.
*/
fepc_real_t
vec_real_norm(vec_real_p vector);

#ifdef __cplusplus
}
#endif

#endif


18 changes: 16 additions & 2 deletions config.h → include/config.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* FEPC
* Copyright (C) 2009 Peter Gerds (gerds@mis.mpg.de)
* Copyright (C) 2009 Peter Gerds (gerds@mis.mpg.de), 2011 Stefan Handschuh (handschu@mis.mpg.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand Down Expand Up @@ -34,11 +34,22 @@
#include <math.h>
#include "seconds.h"

#ifdef __cplusplus
extern "C" {
#endif

/*
* basic types
*/

typedef enum { false, true } bool_t;
/*
* Adds c++ compatibility
*/
#if !defined(__cplusplus)
typedef enum { false, true } bool_t;
#else
typedef bool bool_t;
#endif

typedef double fepc_real_t;

Expand Down Expand Up @@ -69,4 +80,7 @@ typedef double fepc_real_t;
#define _INLINE_ static
#endif

#ifdef __cplusplus
}
#endif
#endif /* __CONFIG_H */
108 changes: 108 additions & 0 deletions include/discont.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* FEPC
* Copyright (C) 2010, 2011 Stefan Handschuh (handschu@mis.mpg.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _DISCONT
#define _DISCONT

#define ONE_THIRD 0.333333333333333333333333333333333333333333333333333333333333333333333
#define TWO_THIRD 0.666666666666666666666666666666666666666666666666666666666666666666666
#define SQRT_12 3.464101615137754587054892683011744733885610507620761256111613958903866

#include "fepc_easy.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
fepc_real_t y_0;

fepc_real_t slope;

} linear_function_t;

typedef linear_function_t * linear_function_p;


typedef struct {
int count;

linear_function_p * functions;
} linear_function_set_t;

typedef linear_function_set_t * linear_function_set_p;

typedef struct {
int stepcount;

interval_p * intervals;

linear_function_set_p * function_sets;

} discont_function_t;

typedef discont_function_t * discont_function_p;


linear_function_p
linear_function_new(fepc_real_t x_0, fepc_real_t slope);

linear_function_p
linear_function_new_points(fepc_real_t y_0, fepc_real_t y_1, fepc_real_t x_0, fepc_real_t x_1);

void
discont_function_del(discont_function_p function);

void
linear_function_set_del(linear_function_set_p function_set);

linear_function_set_p
linear_function_set_new(int count);

discont_function_p
discont_function_new(int stepcount);

func_p
convert_discont_function(discont_function_p function, fepc_real_t stepping);

discont_function_p
convert_func(func_p function, interval_p * intervals, fepc_real_t stepping);

void
discont_function_print(discont_function_p function);

void
linear_function_set_print(linear_function_set_p function_set);

fepc_real_t
integrate_coeff_discont(discont_function_p function, int v, int position, int p, int step, fepc_real_t stepping);

void
add_folgenentries_discont(func_p function, discont_function_p discont_function, fepc_real_t stepping);

void
discont_function_setup(discont_function_p function, int step, fepc_real_t start, fepc_real_t end, linear_function_set_p function_set);

void
discont_function_setup_points(discont_function_p function, int step, fepc_real_t start, fepc_real_t end, fepc_real_t * y1, fepc_real_t * y2, fepc_real_t stepping);

#ifdef __cplusplus
}
#endif

#endif
13 changes: 12 additions & 1 deletion faltung.h → include/faltung.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* FEPC
* Copyright (C) 2009 Peter Gerds (gerds@mis.mpg.de)
* Copyright (C) 2009 Peter Gerds (gerds@mis.mpg.de), 2011 Stefan Handschuh (handschu@mis.mpg.de)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand All @@ -21,6 +21,10 @@

#include "kuerzen.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Berechnet die Projektion der Faltung der Funktionen f und g auf die Gitterstruktur von w.
Von f und g sind die Gitterstrukturen sowie die dazugehoerigen Eintraege gegeben. Von w ist
nur die Gitterstruktur gegeben.
Expand All @@ -37,4 +41,11 @@ faltung_ref(func_p f, func_p g, func_p w, fepc_real_t h);
func_p
faltung_fepc(func_p f, func_p g, func_p w, fepc_real_t h);

void
faltung_fepc_overwrite(func_t * result, func_p f, func_p g, func_p w, fepc_real_t h);

#ifdef __cplusplus
}
#endif

#endif
Loading