-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdatafile.h
More file actions
105 lines (84 loc) · 4.28 KB
/
datafile.h
File metadata and controls
105 lines (84 loc) · 4.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef SOMPAK_DATAFILE_H
#define SOMPAK_DATAFILE_H
/************************************************************************
* *
* Program packages 'lvq_pak' and 'som_pak' : *
* *
* datafile.h *
* - header file for datafile.c: prototypes for functions *
* *
* Version 3.2 *
* Date: 21 Aug 1995 *
* *
* NOTE: This program package is copyrighted in the sense that it *
* may be used for scientific purposes. The package as a whole, or *
* parts thereof, cannot be included or used in any commercial *
* application without written permission granted by its producents. *
* No programs contained in this package may be copied for commercial *
* distribution. *
* *
* All comments concerning this program package may be sent to the *
* e-mail address 'lvq@cochlea.hut.fi'. *
* *
************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "lvq_pak.h"
#include "errors.h"
#include "fileio.h"
/* in files giving an x instead of a value marks that component to be
ignored in calculations */
#ifndef MASKED_VALUE
#define MASKED_VALUE "x"
#endif /* MASKED_VALUE */
/* characters that separate vector components on a line, typically
whitespace characters */
#ifndef SEPARATOR_CHARS
/* space and tab */
#define SEPARATOR_CHARS " \r\t"
#endif /* SEPARATOR_CHARS */
extern char *masked_string;
struct entries *open_data_file(char *name);
int read_headers(struct entries *entries);
struct entries *read_entries(struct entries *entries);
int save_entries_wcomments(struct entries *codes, char *out_code_file, char *comments);
#define save_entries(codes,name) save_entries_wcomments((codes),(name),NULL)
int write_entry(struct file_info *, struct entries *, struct data_entry *);
int write_header(struct file_info *fi, struct entries *codes);
struct data_entry *init_entry(struct entries *entr, struct data_entry *entry);
#define alloc_entry(entr) init_entry((entr), NULL)
void free_entry(struct data_entry *entry);
struct data_entry *load_entry(struct entries *entr, struct data_entry *entry);
struct data_entry *next_entry(eptr *ptr);
struct data_entry *rewind_entries(struct entries *, eptr *);
void close_entries(struct entries *entries);
struct entries *open_entries(char *name);
int rewind_datafile(struct file_info *fi);
int skip_headers(struct file_info *fi);
struct entries *alloc_entries(void);
struct entries *copy_entries(struct entries *entr);
#define free_entries(e) close_entries(e)
struct data_entry *copy_entry(struct entries *entries, struct data_entry *data);
void free_entrys(struct data_entry *data);
int get_topol(char *);
int get_neigh(char *);
int get_xdim(char *);
int get_ydim(char *);
#define topol_type(s) get_id_by_str(topol_list, s)
#define neigh_type(s) get_id_by_str(neigh_list, s)
#define topol_str(i) get_str_by_id(topol_list, i)
#define neigh_str(i) get_str_by_id(neigh_list, i)
int get_weight(char *str);
int label_not_needed(int level);
int use_weights(int level);
int use_fixed(int level);
int alpha_read(float *alphas, long noc, char *infile);
int alpha_write(float *alphas, long noc, char *outfile);
void invalidate_alphafile(char *outfile);
/* struct entries *new_entry_order(struct entries *data); */
struct data_entry *randomize_entry_order(struct data_entry *entry);
void set_buffer(struct entries *ent, long buffer);
int set_vector_functions(struct teach_params *params, char *name);
int set_teach_params(struct teach_params *params, struct entries *codes, struct entries *data, long dbuffer, char *name);
extern struct typelist topol_list[], neigh_list[], snapshot_list[];
#endif /* SOMPAK_FILEIO_H */