Commit 49cfafce authored by Houtan Bastani's avatar Houtan Bastani
Browse files

prepare modifications for mex

parent 24e5ef84
......@@ -203,6 +203,11 @@ INCLUDE_DIR := -I$(MATRIX_DIR) -I$(ERROR_DIR) -I$(ARRAY_DIR) -I$(ASCII_DIR) -I$(
VPATH := $(VPATH) $(MATRIX_DIR) $(ERROR_DIR) $(ARRAY_DIR) $(ASCII_DIR) $(STAT_DIR) $(SPHERICAL_DIR) $(SORT_DIR) $(SWITCH_DIR) $(VAR_DIR)
OBJS := $(OBJS) bmatrix.o swzmatrix.o dw_error.o dw_rand.o dw_matrix_rand.o dw_array.o dw_matrix_array.o dw_matrix_sort.o dw_ascii.o dw_parse_cmd.o
# MEX
INCLUDE_DIR := -I$(WORK_DIR)/mex $(INCLUDE_DIR)
VPATH := $(VPATH) $(WORK_DIR)/mex
OBJS := $(OBJS) modify_for_mex.o
# TAO FILES
OBJS := $(OBJS)
......@@ -250,6 +255,6 @@ $(OUT_DIR)/sbvar_probabilities: $(OBJS_PROBA)
#
#################################################################################
clean:
rm -f $(OUT_DIR)/*.o *.o
rm -f $(OUT_DIR)/*.o *.o ; rm -f ../bin/*
#
#################################################################################
#include <stdlib.h>
#include "mex.h"
void
swz_exit(int status)
{
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
mexErrMsgTxt("Error in mexfile.\n");
#else
exit(status);
#endif
}
#ifndef _MEXMOD
#define _MEXMOD
void swz_exit(int status);
#endif
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
#define printf mexPrintf
#define exit swz_exit
#endif
......@@ -9,6 +9,8 @@
#include <string.h>
#include <stdlib.h>
#include "modify_for_mex.h"
/*******************************************************************************/
/**************************** TMarkovStateVariable *****************************/
/*******************************************************************************/
......
......@@ -5,6 +5,8 @@
#include <string.h>
#include <math.h>
#include "modify_for_mex.h"
//====== Static Global Variables ======
static TStateModel *Model=(TStateModel*)NULL;
static PRECISION *buffer=(PRECISION*)NULL;
......
......@@ -9,6 +9,8 @@
#include <stdlib.h>
#include <math.h>
#include "modify_for_mex.h"
static void ReadError(char *idformat, char *trailer, int error);
static int SetFilePosition(FILE *f_in, char *format, char *str);
static int ReadInteger(FILE *f_in, char *idformat, char *trailer, int *i);
......
......@@ -14,6 +14,8 @@
#include <math.h>
#include <time.h>
#include "modify_for_mex.h"
int main(int nargs, char **args)
{
TStateModel *model;
......
......@@ -17,6 +17,8 @@
#include <stdlib.h>
#include <string.h>
#include "modify_for_mex.h"
//=== Private counter for improper normal distribution ===
static int _VAR_IMPROPER_DISTRIBUTION_COUNTER = 0;
int Reset_VAR_Improper_Distribution_Counter(void)
......
......@@ -8,6 +8,8 @@
#include <string.h>
#include <math.h>
#include "modify_for_mex.h"
static int strlen_int(int n)
{
int i, j;
......
......@@ -8,6 +8,8 @@
#include <stdlib.h>
#include <string.h>
#include "modify_for_mex.h"
static int ReadError_VARio_matlab(char *id)
{
char *errmsg, *fmt="Error after line identifier ""%s""";
......
......@@ -9,6 +9,8 @@
#include <string.h>
#include <ctype.h>
#include "modify_for_mex.h"
/*
Allocates memory for filename. Assumes that fmt is of the form
......
......@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <string.h>
#include "modify_for_mex.h"
/*
Creates a standard initialization file from the matlab and specification file.
......
......@@ -19,6 +19,8 @@
#include <stdlib.h>
#include <math.h>
#include "modify_for_mex.h"
#define FIND_POSTERIOR_MODE 1
#define FIND_LIKELIHOOD_MODE 2
......
......@@ -12,6 +12,8 @@
#include <time.h>
#include <string.h>
#include "modify_for_mex.h"
// Compute psudo-inverse of mhm->variance
static void PsudoInverse(TMatrix X, TMatrix Y)
{
......
......@@ -14,6 +14,8 @@
#include <ctype.h>
#include <stdlib.h>
#include "modify_for_mex.h"
static void ReadError_MHMio(char *id)
{
char *errmsg, *fmt="Error after line identifier ""%s""";
......
......@@ -21,6 +21,8 @@
#include <string.h>
#include <time.h>
#include "modify_for_mex.h"
/*
Returns ln(exp(a) + exp(b)) computed to avoid overflow. If
a = ln(c) and b = ln(d), as is usually the case, then the
......
......@@ -7,6 +7,8 @@
#include <stdlib.h>
#include "modify_for_mex.h"
/*
Attempt to set up model from command line. Command line options are the
following
......
......@@ -12,6 +12,8 @@
#endif
#include <stdarg.h>
#include "modify_for_mex.h"
//================================== Macros ===================================//
#define dw_ElementSizeA(a) (dw_SpecsA(a)->size)
#define dw_GetOffsetA(a) (dw_SpecsA(a)->offset)
......
......@@ -5,6 +5,8 @@
#include <stdlib.h>
#include "modify_for_mex.h"
TElementSpecification dw_VectorSpecs =
{
dw_ARRAY_POINTER,
......
......@@ -7,6 +7,8 @@
#include <ctype.h>
#include <stdarg.h>
#include "modify_for_mex.h"
/*
Attempts to open filename for reading. Returns pointer to file upon success
and prints error message and exits upon failure. The file must exist.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment