Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
further improvement EM algorithm implementation
- Loading branch information
1 parent
c704d4b
commit 1def2e3
Showing
20 changed files
with
2,794 additions
and
308 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# src/cmake/Findsasfit_fixed_point_acc.cmake | ||
# | ||
# Copyright (c) 2008-2019, Paul Scherrer Institute (PSI) | ||
# | ||
# All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# * Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# * Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# * Neither the name of the <organization> nor the | ||
# names of its contributors may be used to endorse or promote products | ||
# derived from this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
# DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY | ||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
# | ||
# Author(s) of this file: | ||
# Joachim Kohlbrecher (joachim.kohlbrecher@psi.ch) | ||
|
||
# Find the sasfit_fixed_point_acc includes and library | ||
# | ||
# sasfit_fixed_point_acc_INCLUDE_DIRS - where to find the touch lib header files | ||
# sasfit_fixed_point_acc_LIBRARIES - List of fully qualified libraries to link | ||
# against. | ||
# sasfit_fixed_point_acc_FOUND - Do not attempt to use if "no" or undefined. | ||
|
||
GET_FILENAME_COMPONENT(CURRENT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) | ||
GET_FILENAME_COMPONENT(CURRENT_DIR "${CURRENT_DIR}/.." ABSOLUTE) | ||
|
||
FIND_PATH(sasfit_fixed_point_acc_INCLUDE_DIR sasfit_fixed_point_acc.h | ||
${CURRENT_DIR}/sasfit_fixed_point_acc/include/ | ||
) | ||
|
||
FIND_LIBRARY(sasfit_fixed_point_LIBRARY sasfit_fixed_point_acc | ||
${CURRENT_DIR}/sasfit_fixed_point_acc/lib/ | ||
${CURRENT_DIR}/sasfit_fixed_point_acc/lib/debug/ | ||
${CURRENT_DIR}/sasfit_fixed_point_acc/lib/release/ | ||
) | ||
|
||
IF(sasfit_ff_INCLUDE_DIR) | ||
SET(sasfit_fixed_point_acc_FOUND "YES") | ||
SET(sasfit_fixed_point_acc_INCLUDE_DIRS ${sasfit_fixed_point_acc_INCLUDE_DIR}) | ||
IF(sasfit_fixed_point_acc_LIBRARY) | ||
SET(sasfit_fixed_point_acc_LIBRARIES ${sasfit_fixed_point_acc_LIBRARY}) | ||
ELSE(sasfit_fixed_point_acc_LIBRARY) | ||
MESSAGE(STATUS "sasfit_fixed_point_acc library not found!") | ||
ENDIF(sasfit_fixed_point_acc_LIBRARY) | ||
ELSE(sasfit_fixed_point_acc_INCLUDE_DIR) | ||
MESSAGE(STATUS "sasfit_fixed_point_acc include dir not found!") | ||
ENDIF(sasfit_fixed_point_acc_INCLUDE_DIR) | ||
|
||
MESSAGE(STATUS "found sasfit_fixed_point_acc inc: ${sasfit_fixed_point_acc_INCLUDE_DIR}") | ||
MESSAGE(STATUS "found sasfit_fixed_point_acc lib: ${sasfit_fixed_point_acc_LIBRARY}") | ||
|
||
IF(NOT sasfit_fixed_point_acc_FOUND) | ||
MESSAGE(SEND_ERROR "The sasfit_fixed_point_acc library was not found. For adjustments use ${CMAKE_CURRENT_LIST_FILE}.") | ||
ENDIF(NOT sasfit_fixed_point_acc_FOUND) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
cmake_minimum_required(VERSION 2.6.2) | ||
|
||
# the project name | ||
set(PRJ_NAME sasfit_fixed_point_acc) | ||
|
||
# required external libs which are installed on the system | ||
set(LIBS_EXT | ||
GSL | ||
FFTW | ||
) | ||
|
||
# required internal (sasfit_) libs | ||
set(LIBS_INT | ||
f2c | ||
sasfit_common | ||
sasfit_sd | ||
sasfit_sq | ||
sasfit_ff | ||
) | ||
|
||
# for source file listings, see SasfitSourceFiles.cmake | ||
|
||
# path to 'Find*.cmake' files in sasfit package, | ||
# relative to the location of this file | ||
set(REL_CMAKE_MODULE_PATH ../cmake) | ||
|
||
set(LIB_IS_PLUGIN false) | ||
|
||
# # | ||
### not adjustments required below this line (usually) ### | ||
# # | ||
|
||
project(${PRJ_NAME}) | ||
|
||
set(SRC_DIR ${${PRJ_NAME}_SOURCE_DIR}) | ||
set(CMAKE_MODULE_PATH ${SRC_DIR}/${REL_CMAKE_MODULE_PATH}) | ||
|
||
include(SasfitCmakeUtils) | ||
sasfit_cmake_library() | ||
|
74 changes: 74 additions & 0 deletions
74
src/sasfit_fixed_point_acc/include/sasfit_fixed_point_acc.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Author(s) of this file: | ||
* Joachim Kohlbrecher (joachim.kohlbrecher@psi.ch) | ||
*/ | ||
|
||
#ifndef SASFIT_FP | ||
#define SASFIT_FP | ||
|
||
#include <tcl.h> | ||
#include <sasfit_common.h> | ||
|
||
#include <stdio.h> | ||
#include <gsl/gsl_errno.h> | ||
#include <gsl/gsl_math.h> | ||
#include <gsl/gsl_vector.h> | ||
#include <gsl/gsl_roots.h> | ||
#include <gsl/gsl_sf.h> | ||
#include <gsl/gsl_const_mksa.h> | ||
#include <gsl/gsl_spline.h> | ||
|
||
#include <nvector/nvector_serial.h> | ||
#include "sasfit_oz.h" | ||
|
||
typedef double FP_Operator (void *); | ||
|
||
typedef struct { | ||
Tcl_Interp *interp; | ||
double *Ih, *DIh, *Ith, *h; | ||
int indx_min_appearent_sigma, indx_max_appearent_sigma; | ||
gsl_vector *DR; | ||
double dr, dq; | ||
int it; | ||
int Npoints; | ||
double mixcoeff; | ||
int maxsteps; | ||
double relerror; | ||
double alpha; | ||
double gNorm; | ||
double KLD, JSD; | ||
double Chi2Norm; | ||
sasfit_oz_root_algorithms root_algorithm; | ||
sasfit_oz_mixstrategy mixstrategy; | ||
double *in, *out; | ||
int interrupt; | ||
int failed; | ||
int PrintProgress; | ||
Tcl_Obj *fp_obj; | ||
int KINSetMAA; | ||
void *kin_mem; | ||
double KINSetFuncNormTol; | ||
double KINSetScaledSteptol; | ||
int KINSetNumMaxIters; | ||
int KINSetPrintLevel; | ||
int KINSetEtaForm; | ||
double KINSetEtaConstValue; | ||
int KINSpilsSetMaxRestarts; | ||
int KINSolStrategy; | ||
double KINSetMaxNewtonStep; | ||
void *FPstructure; | ||
N_Vector KINConstraints; | ||
FP_Operator * FP_Op; | ||
|
||
} sasfit_fp_data; | ||
|
||
int FP_init (sasfit_fp_data *); | ||
int FP_solver (sasfit_fp_data *); | ||
int FP_free (sasfit_fp_data *); | ||
static int FP_step_kinsol(N_Vector, N_Vector, void *); | ||
static int FP_step_kinsolFP(N_Vector, N_Vector, void *); | ||
double FP_step(sasfit_fp_data *); | ||
int FP_solver_by_iteration(sasfit_fp_data *, sasfit_oz_root_algorithms ); | ||
//Modified 29.4.2019 | ||
|
||
#endif // SASFIT_FP |
Oops, something went wrong.