ref: 0d2cb7ffece662eab2ff1988fca2e755e3f08552
parent: d87e1ccc519acd2d70f277982f9f03fa5b96048d
author: thebard <thebard>
date: Wed Feb 23 14:05:49 EST 2000
Alterations so that we can thread functions for multiple CPU's
--- a/psych.c
+++ b/psych.c
@@ -52,9 +52,9 @@
Source file:
-$Id: psych.c,v 1.47 2000/02/23 14:56:08 menno Exp $
-$Id: psych.c,v 1.47 2000/02/23 14:56:08 menno Exp $
-$Id: psych.c,v 1.47 2000/02/23 14:56:08 menno Exp $
+$Id: psych.c,v 1.48 2000/02/23 19:05:49 thebard Exp $
+$Id: psych.c,v 1.48 2000/02/23 19:05:49 thebard Exp $
+$Id: psych.c,v 1.48 2000/02/23 19:05:49 thebard Exp $
**********************************************************************/
@@ -859,21 +859,106 @@
/* added by T. Araki (1997.10.16) end */
}
+#ifndef WIN32
+void psy_step6_part1(void *inData)
+{
+ int b,bb,i;
+ double ecb,ct;
+ double sprd;
+
+ PARTITION_TABLE_LONG *part_tbl_long;
+ PSY_STATVARIABLE_LONG *psy_stvar_long;
+ PSY_VARIABLE_LONG *psy_var_long;
+ PSY_STEP6_PART1_CONTAINER *container;
+
+ container = (PSY_STEP6_PART1_CONTAINER *)inData;
+ part_tbl_long = container->part_tbl_long;
+ psy_stvar_long = container->psy_stvar_long;
+ psy_var_long = container->psy_var_long;
+
+ //part_tbl_long = *
+
+ for(b = 0; b < part_tbl_long->len; b++){
+ ecb = 0.0;
+ ct = 0.0;
+
+ for(bb = 0; bb < part_tbl_long->len; bb++){
+ //sprd = sprdngf(part_tbl_long, part_tbl_short, bb, b, 0);
+ sprd = part_tbl_long->dyn->spreading[bb][b];
+ ecb += psy_var_long->e[bb] * sprd;
+ ct += psy_var_long->c[bb] * sprd;
+ }
+
+ if (ecb!=0.0) {
+ psy_var_long->cb[b] = ct / ecb;
+ psy_stvar_long->en[b] = psy_var_long->en[b] = ecb
+ * part_tbl_long->dyn->rnorm[b];
+ } else {
+ psy_var_long->cb[b] = 0.0;
+ psy_stvar_long->en[b] = psy_var_long->en[b] = 0;
+ }
+ }
+}
+
+void psy_step6_part2(void *inData)
+{
+ int b,bb,i;
+ double ecb,ct;
+ double sprd;
+
+ PARTITION_TABLE_SHORT *part_tbl_short;
+ PSY_STATVARIABLE_SHORT *psy_stvar_short;
+ PSY_VARIABLE_SHORT *psy_var_short;
+ PSY_STEP6_PART2_CONTAINER *container;
+
+ container = (PSY_STEP6_PART2_CONTAINER *)inData;
+ part_tbl_short = container->part_tbl_short;
+ psy_stvar_short = container->psy_stvar_short;
+ psy_var_short = container->psy_var_short;
+
+ /* added by T. Araki (1997.10.16) */
+ for(i = 0; i < MAX_SHORT_WINDOWS; i++){
+ for(b = 0; b < part_tbl_short->len; b++){
+ ecb = 0.0;
+ ct = 0.0;
+
+ for(bb = 0; bb < part_tbl_short->len; bb++){
+ //sprd = sprdngf(part_tbl_long, part_tbl_short, bb, b, 1);
+ sprd = part_tbl_short->dyn->spreading[bb][b];
+ ecb += psy_var_short->e[i][bb] * sprd;
+ ct += psy_var_short->c[i][bb] * sprd;
+ }
+
+ if (ecb!=0.0) {
+ psy_var_short->cb[i][b] = ct / ecb;
+ psy_stvar_short->en[i][b] = psy_var_short->en[i][b] = ecb
+ * part_tbl_short->dyn->rnorm[b];
+ } else {
+ psy_var_short->cb[i][b] = 0.0;
+ psy_stvar_short->en[i][b] = psy_var_short->en[i][b] = 0;
+ }
+ }
+ }
+ /* added by T. Araki (1997.10.16) end */
+}
+#endif
+
void psy_step6(PARTITION_TABLE_LONG *part_tbl_long,
PARTITION_TABLE_SHORT *part_tbl_short,
PSY_STATVARIABLE_LONG *psy_stvar_long,
- PSY_STATVARIABLE_SHORT *psy_stvar_short,
+ PSY_STATVARIABLE_SHORT *psy_stvar_short,
PSY_VARIABLE_LONG *psy_var_long,
PSY_VARIABLE_SHORT *psy_var_short
)
{
- int b,bb,i;
- double ecb,ct;
- double sprd;
+ int b,bb,i;
+ double ecb,ct;
+ double sprd;
- for(b = 0; b < part_tbl_long->len; b++){
+ for(b = 0; b < part_tbl_long->len; b++){
ecb = 0.0;
ct = 0.0;
+
for(bb = 0; bb < part_tbl_long->len; bb++){
//sprd = sprdngf(part_tbl_long, part_tbl_short, bb, b, 0);
sprd = part_tbl_long->dyn->spreading[bb][b];
@@ -880,20 +965,23 @@
ecb += psy_var_long->e[bb] * sprd;
ct += psy_var_long->c[bb] * sprd;
}
+
if (ecb!=0.0) {
psy_var_long->cb[b] = ct / ecb;
- psy_stvar_long->en[b] = psy_var_long->en[b] = ecb * part_tbl_long->dyn->rnorm[b];
+ psy_stvar_long->en[b] = psy_var_long->en[b] = ecb
+ * part_tbl_long->dyn->rnorm[b];
} else {
psy_var_long->cb[b] = 0.0;
psy_stvar_long->en[b] = psy_var_long->en[b] = 0;
}
- }
+ }
/* added by T. Araki (1997.10.16) */
- for(i = 0; i < MAX_SHORT_WINDOWS; i++){
- for(b = 0; b < part_tbl_short->len; b++){
+ for(i = 0; i < MAX_SHORT_WINDOWS; i++){
+ for(b = 0; b < part_tbl_short->len; b++){
ecb = 0.0;
ct = 0.0;
+
for(bb = 0; bb < part_tbl_short->len; bb++){
//sprd = sprdngf(part_tbl_long, part_tbl_short, bb, b, 1);
sprd = part_tbl_short->dyn->spreading[bb][b];
@@ -900,15 +988,17 @@
ecb += psy_var_short->e[i][bb] * sprd;
ct += psy_var_short->c[i][bb] * sprd;
}
+
if (ecb!=0.0) {
psy_var_short->cb[i][b] = ct / ecb;
- psy_stvar_short->en[i][b] = psy_var_short->en[i][b] = ecb * part_tbl_short->dyn->rnorm[b];
+ psy_stvar_short->en[i][b] = psy_var_short->en[i][b] = ecb
+ * part_tbl_short->dyn->rnorm[b];
} else {
psy_var_short->cb[i][b] = 0.0;
psy_stvar_short->en[i][b] = psy_var_short->en[i][b] = 0;
}
}
- }
+ }
/* added by T. Araki (1997.10.16) end */
}
--- a/psych.h
+++ b/psych.h
@@ -200,6 +200,20 @@
CH_PSYCH_OUTPUT_SHORT p_chpo_short[][MAX_SHORT_WINDOWS]
);
+#ifndef WIN32
+/* structs for the psy_step6 part1 and part2 threads */
+typedef struct {
+ PARTITION_TABLE_LONG *part_tbl_long;
+ PSY_STATVARIABLE_LONG *psy_stvar_long;
+ PSY_VARIABLE_LONG *psy_var_long;
+} PSY_STEP6_PART1_CONTAINER;
+
+typedef struct {
+ PARTITION_TABLE_SHORT *part_tbl_short;
+ PSY_STATVARIABLE_SHORT *psy_stvar_short;
+ PSY_VARIABLE_SHORT *psy_var_short;
+} PSY_STEP6_PART2_CONTAINER;
+#endif
/* added by T. Okada( 1997.07.10 ) */
/* Jul 10 */
#define psy_max(x,y) ((x) > (y) ? (x) : (y))
@@ -258,6 +272,10 @@
PSY_VARIABLE_SHORT *psy_var_short,
int ch
);
+
+void psy_step6_step1(void *inData);
+
+void psy_step6_step1(void *inData);
void psy_step6(PARTITION_TABLE_LONG *part_tbl_long,
PARTITION_TABLE_SHORT *part_tbl_short,