Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
cpp_sisso
Commits
2f3a44b8
Commit
2f3a44b8
authored
Sep 16, 2021
by
Thomas Purcell
Browse files
Code compiles, and runs but does not work
Something is wrong with the comparision functions
parent
a731c202
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/feature_creation/node/value_storage/nodes_value_containers.cpp
View file @
2f3a44b8
...
...
@@ -65,7 +65,8 @@ void node_value_arrs::initialize_values_arr(
VALUES_ARR
=
std
::
vector
<
double
>
(
N_STORE_FEATURES
*
N_SAMPLES
);
TEST_VALUES_ARR
=
std
::
vector
<
double
>
(
N_STORE_FEATURES
*
N_SAMPLES_TEST
);
STANDARDIZED_TEST_STORAGE_ARR
=
std
::
vector
<
double
>
(
2
*
(
N_PRIMARY_FEATURES
+
1
)
*
MAX_N_THREADS
*
N_SAMPLES_TEST
);
STANDARDIZED_STORAGE_ARR
=
std
::
vector
<
double
>
(
2
*
(
N_PRIMARY_FEATURES
+
1
)
*
N_SAMPLES
*
MAX_N_THREADS
);
STANDARDIZED_TEST_STORAGE_ARR
=
std
::
vector
<
double
>
(
2
*
(
N_PRIMARY_FEATURES
+
1
)
*
N_SAMPLES_TEST
*
MAX_N_THREADS
);
}
void
node_value_arrs
::
initialize_values_arr
(
...
...
src/feature_creation/node/value_storage/nodes_value_containers.hpp
View file @
2f3a44b8
...
...
@@ -304,7 +304,10 @@ namespace node_value_arrs
*/
inline
double
*
access_temp_stand_storage
(
const
unsigned
long
int
arr_ind
,
const
bool
for_comp
)
{
return
&
STANDARDIZED_STORAGE_ARR
[((
arr_ind
%
N_PRIMARY_FEATURES
)
+
for_comp
*
N_PRIMARY_FEATURES
)
*
N_PRIMARY_FEATURES
];
return
&
STANDARDIZED_STORAGE_ARR
[
((
arr_ind
%
N_PRIMARY_FEATURES
)
+
for_comp
*
N_PRIMARY_FEATURES
)
*
N_SAMPLES
+
omp_get_thread_num
()
*
2
*
(
N_PRIMARY_FEATURES
+
1
)
*
N_SAMPLES
];
}
/**
...
...
@@ -317,7 +320,10 @@ namespace node_value_arrs
*/
inline
double
*
access_temp_stand_storage_test
(
const
unsigned
long
int
arr_ind
,
const
bool
for_comp
)
{
return
&
STANDARDIZED_TEST_STORAGE_ARR
[((
arr_ind
%
N_PRIMARY_FEATURES
)
+
for_comp
*
N_PRIMARY_FEATURES
)
*
N_SAMPLES_TEST
];
return
&
STANDARDIZED_TEST_STORAGE_ARR
[
((
arr_ind
%
N_PRIMARY_FEATURES
)
+
for_comp
*
N_PRIMARY_FEATURES
)
*
N_SAMPLES_TEST
+
omp_get_thread_num
()
*
2
*
(
N_PRIMARY_FEATURES
+
1
)
*
N_SAMPLES_TEST
];
}
/**
...
...
src/utils/compare_features.cpp
View file @
2f3a44b8
...
...
@@ -90,12 +90,13 @@ bool comp_feats::valid_feature_against_selected_pearson_max_corr_1(
continue
;
}
double
comp_value
=
std
::
inner_product
(
double
comp_value
=
1.0
/
static_cast
<
double
>
(
n_samp
)
*
std
::
inner_product
(
val_ptr
,
val_ptr
+
n_samp
,
node_value_arrs
::
get_stand_d_matrix_ptr
(
dd
),
-
1.0
*
base_val
);
if
(
std
::
abs
(
comp_value
)
<
5.0e-9
)
{
return
false
;
...
...
@@ -122,7 +123,7 @@ bool comp_feats::valid_feature_against_selected_pearson_max_corr_1_feat_list(
continue
;
}
double
comp_value
=
std
::
inner_product
(
double
comp_value
=
1.0
/
static_cast
<
double
>
(
n_samp
)
*
std
::
inner_product
(
val_ptr
,
val_ptr
+
n_samp
,
selected
[
ff
]
->
stand_value_ptr
(
true
),
...
...
@@ -154,7 +155,7 @@ bool comp_feats::valid_feature_against_selected_pearson_max_corr_1_mpi_op(
continue
;
}
double
comp_value
=
std
::
inner_product
(
double
comp_value
=
1.0
/
static_cast
<
double
>
(
n_samp
)
*
std
::
inner_product
(
val_ptr
,
val_ptr
+
n_samp
,
feat_sc
.
_feat
->
stand_value_ptr
(
true
),
...
...
@@ -180,16 +181,20 @@ bool comp_feats::valid_feature_against_selected_pearson(
const
int
start_sel
)
{
if
(
end_sel
<=
start_sel
)
{
return
true
;
}
DGEMV_OUT
.
resize
(
end_sel
-
start_sel
);
double
base_val
=
std
::
inner_product
(
val_ptr
,
val_ptr
+
n_samp
,
val_ptr
,
0.0
);
double
base_val
=
std
::
inner_product
(
val_ptr
,
val_ptr
+
n_samp
,
val_ptr
,
0.0
)
/
static_cast
<
double
>
(
n_samp
)
;
volatile
bool
is_valid
=
true
;
dgemv_
(
'N'
,
DGEMV_OUT
.
size
(),
DGEMV_OUT
.
size
(),
n_samp
,
1.0
,
1.0
/
static_cast
<
double
>
(
n_samp
)
,
node_value_arrs
::
get_stand_d_matrix_ptr
(
start_sel
),
DGEMV_OUT
.
size
(),
val_ptr
,
...
...
@@ -200,9 +205,10 @@ bool comp_feats::valid_feature_against_selected_pearson(
);
double
comp_value
=
(
base_val
-
std
::
abs
(
DGEMV_OUT
[
idamax_
(
DGEMV_OUT
.
size
(),
DGEMV_OUT
.
data
(),
1
)])
base_val
-
std
::
abs
(
DGEMV_OUT
[
idamax_
(
DGEMV_OUT
.
size
(),
DGEMV_OUT
.
data
(),
1
)
-
1
])
);
// std::cout << *val_ptr << '\t' << util_funcs::mean(val_ptr, n_samp) << '\t' << util_funcs::stand_dev(val_ptr, n_samp) << std::endl;
std
::
cout
<<
comp_value
<<
'\t'
<<
base_val
<<
'\t'
<<
DGEMV_OUT
[
0
]
<<
std
::
endl
;
return
comp_value
<
(
1.0
-
cross_cor_max
+
5.0e-9
);
}
...
...
@@ -219,7 +225,7 @@ bool comp_feats::valid_feature_against_selected_pearson_feat_list(
for
(
auto
&
feat
:
selected
)
{
double
comp_value
=
std
::
abs
(
double
comp_value
=
1.0
/
static_cast
<
double
>
(
n_samp
)
*
std
::
abs
(
std
::
inner_product
(
val_ptr
,
val_ptr
+
n_samp
,
feat
->
stand_value_ptr
(
true
),
-
base_val
)
);
...
...
@@ -243,7 +249,7 @@ bool comp_feats::valid_feature_against_selected_pearson_mpi_op(
for
(
auto
&
feat_sc
:
out_vec
)
{
double
comp_value
=
std
::
abs
(
double
comp_value
=
1.0
/
static_cast
<
double
>
(
n_samp
)
*
std
::
abs
(
std
::
inner_product
(
val_ptr
,
val_ptr
+
n_samp
,
feat_sc
.
_feat
->
stand_value_ptr
(
true
),
-
base_val
)
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment