www.pudn.com > ica_v0.04.rar > ica.h


/*
  ica.h

  Time-stamp: 

  Contains constant and variable declarations used for the ICA
  program.

  Programmer: Peter Stepien
              pstepien@sedal.usyd.edu.au
              CEL, School of Electrical & Information Engineering
              The University of Sydney
              SYDNEY NSW 2006 Australia

              COPYRIGHT 1997-2001
*/

/* Version string. Will come from RCS later */

#define VERSION "V0.04"

/* Boolean constants */

#define TRUE  1
#define FALSE 0

/* Default values for program parameters you may want to change
   these values to make running the program more convenient */

#define DEFAULT_INPUT_FILENAME    "ica.in"
#define DEFAULT_OUTPUT_FILENAME   "ica.out"
#define DEFAULT_INPUT_TYPE        FLOAT64
#define DEFAULT_OUTPUT_TYPE       FLOAT64
#define DEFAULT_NUM_CHANNELS      0 /* Have to specify if not EDF input */
#define DEFAULT_LEARN_RATE        0.00001
#define DEFAULT_NUM_PASSES        1
#define DEFAULT_BLOCK_SIZE        1
#define DEFAULT_NONLINEAR_TYPE    EXP
#define DEFAULT_INPUT_W           FALSE
#define DEFAULT_OUTPUT_W          FALSE
#define DEFAULT_OUTPUT_COV        FALSE
#define DEFAULT_OUTPUT_UNMIX      TRUE
#define DEFAULT_W_INPUT_FILENAME  "ica_w.in"
#define DEFAULT_W_OUTPUT_FILENAME "ica_w.out"

/* If 16 bit data needs have it's bytes swapped. Comment out otherwise.
   Effects reading EDF files and INT16. Output is never swapped.
   Since EDF files are usually generated on x86 based machines,
   the following define will be required for Sun workstations. */

#define SWAPBYTES

/********** Should not have to change anything below here **********/

/* Definition of EDF file header */

#define EDF_MAX_SIGNALS 32

typedef struct
{
  char version[8];
  char patient_id[80];
  char record_id[80];
  char start_date[8];
  char start_time[8];
  char header_size[8];
  char reserved1[44];
  char num_records[8];
  char duration[8];
  char num_signals[4];
}
EDF_header_struct;

/* Input and output file definitions */

#define EDF     1
#define INT16   2
#define FLOAT64 3
#define FLOAT32 4

extern const char *FILE_TYPE_MAP[];

/* Non-linearity types */

#define EXP  1
#define TANH 2

extern const char *NONLINEAR_TYPE_MAP[];

/* Define what floating point numbers are going to be to make them 64 bits */

#define FLOAT_TYPE double

/* Function prototypes */

/* From ica.c */

int ica_do(int input_file, int output_file, int input_type, int output_type,
	   int num_channels, FLOAT_TYPE learn_rate,
	   int num_passes, int block_size,
	   int nonlinear_type,
	   int output_w, int w_output_file,
	   int output_unmix,
	   int w_input_file);

/* From io.c */

int io_reset_file_pointer(int file, int file_type);
int io_get_inputs(int file, int file_type,
		  FLOAT_TYPE *inputs, int num_channels);
void io_put_outputs(int output_file, int file_type,
		    FLOAT_TYPE *outputs, int num_channels);

/* From util.c */

void util_print_file_types();
int util_get_file_type(char *string);
void util_print_nonlinear_types();
int util_get_nonlinear_type(char *string);
FLOAT_TYPE util_rms_cov(FLOAT_TYPE cov[][], int num_channels);
void util_cov(int input_file, int file_type, int num_channels,
	      FLOAT_TYPE cov[][]);