Skip to content

Commit f5a6816

Browse files
authored
Update cov-lib.h
1 parent 7fe9f43 commit f5a6816

1 file changed

Lines changed: 31 additions & 34 deletions

File tree

mcstas-comps/share/cov-lib.h

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,6 @@
2727
#define __TLIBS2_C_MATHLIB_H__
2828

2929

30-
/* ---------------------------------------------------------------------------- */
31-
/* linked list */
32-
/* ---------------------------------------------------------------------------- */
33-
struct tl2_list
34-
{
35-
struct tl2_list *next;
36-
void *elem;
37-
};
38-
39-
typedef struct tl2_list tl2_list_type;
40-
41-
extern tl2_list_type* tl2_lst_create(void *elem);
42-
#pragma acc routine
43-
extern tl2_list_type* tl2_lst_append(tl2_list_type *lst, void *elem);
44-
extern void tl2_lst_remove(tl2_list_type *lst, void *elem);
45-
extern void tl2_lst_free(tl2_list_type *lst);
46-
/* ---------------------------------------------------------------------------- */
47-
48-
4930
/* ---------------------------------------------------------------------------- */
5031
/* linalg functions */
5132
/* ---------------------------------------------------------------------------- */
@@ -102,12 +83,14 @@ extern int tl2_inverse(const double* M, double* I, int N);
10283
/**
10384
* matrix-matrix product
10485
*/
105-
extern void tl2_matmat_mul(const double* M1, const double* M2, double *RES, int I, int J, int K);
86+
extern void tl2_matmat_mul(const double* M1, const double* M2,
87+
double *RES, int I, int J, int K);
10688

10789
/**
10890
* matrix-vector product
10991
*/
110-
extern void tl2_matvec_mul(const double* M, const double* v, double *res, int I, int J);
92+
extern void tl2_matvec_mul(const double* M, const double* v,
93+
double *res, int I, int J);
11194

11295
/**
11396
* transposed matrix
@@ -162,12 +145,14 @@ extern void tl2_vec_div(const double* v, double s, double *res, int N);
162145
/**
163146
* matrix addition
164147
*/
165-
extern void tl2_mat_add(const double* M0, const double* M1, double *RES, int I, int J);
148+
extern void tl2_mat_add(const double* M0, const double* M1,
149+
double *RES, int I, int J);
166150

167151
/**
168152
* matrix subtraction
169153
*/
170-
extern void tl2_mat_sub(const double* M0, const double* M1, double *RES, int I, int J);
154+
extern void tl2_mat_sub(const double* M0, const double* M1,
155+
double *RES, int I, int J);
171156

172157
/**
173158
* negative matrix
@@ -177,35 +162,38 @@ extern void tl2_mat_neg(const double* M, double *RES, int I, int J);
177162
/**
178163
* matrix-scalar multiplication
179164
*/
180-
extern void tl2_mat_mul(const double* M, double s, double *RES, int I, int J);
165+
extern void tl2_mat_mul(const double* M, double s,
166+
double *RES, int I, int J);
181167

182168
/**
183169
* matrix-scalar division
184170
*/
185-
extern void tl2_mat_div(const double* M, double s, double *RES, int I, int J);
171+
extern void tl2_mat_div(const double* M, double s,
172+
double *RES, int I, int J);
186173

187174
/**
188175
* mean vector
189176
*/
190-
extern void tl2_vec_mean(const tl2_list_type* veclist, const tl2_list_type* problist,
191-
double* mean, int N);
177+
extern void tl2_vec_mean(const double* vecs, const double* probs,
178+
double* mean, int N, unsigned int EVTS);
192179

193180
/**
194-
* covariance matrix
181+
* matrix trafo
195182
*/
196-
extern int tl2_covariance(const tl2_list_type* veclist, const tl2_list_type* problist,
197-
double* COV, double* mean, int N);
183+
extern void tl2_mat_trafo(const double* M, const double* T,
184+
double* RES, int N, int ortho);
198185

199186
/**
200-
* matrix trafo
187+
* covariance matrix
201188
*/
202-
extern void tl2_mat_trafo(const double* M, const double* T, double* RES, int N, int ortho);
189+
extern int tl2_covariance(const double* vecs, const double* probs,
190+
double* COV, double* mean, int N, unsigned int EVTS);
203191

204192
/**
205193
* resolution matrix
206194
*/
207-
extern int tl2_reso(const tl2_list_type* veclist, const tl2_list_type* problist,
208-
double* COV, double* RESO);
195+
extern int tl2_reso(const double* vecs, const double* probs,
196+
double* COV, double* RESO, unsigned int EVTS);
209197
/* ---------------------------------------------------------------------------- */
210198

211199

@@ -214,6 +202,15 @@ extern int tl2_reso(const tl2_list_type* veclist, const tl2_list_type* problist,
214202
/* ----------------------------------------------------------------------------- */
215203
#pragma acc routine
216204
extern double tl2_k_to_E(double kix, double kiy, double kiz, double kfx, double kfy, double kfz);
205+
206+
extern void tl2_print_vec(const double* vec, const char* title, int I);
207+
extern void tl2_print_mat(const double* mat, const char* title, int I, int J);
208+
209+
/**
210+
* save neutron events
211+
*/
212+
extern int tl2_save_events(const double* vecs, const double* probs,
213+
const char* filename, unsigned int EVTS);
217214
/* ----------------------------------------------------------------------------- */
218215

219216

0 commit comments

Comments
 (0)