diff options
author | Calvin <calvin@EESI> | 2013-03-25 10:19:42 -0400 |
---|---|---|
committer | Calvin <calvin@EESI> | 2013-03-25 10:19:42 -0400 |
commit | 2760fc4511b08d84dfc6d94611a743db7179ab2d (patch) | |
tree | bd2dd0c6ea2f468e51b882a0425b678ddbe1fc6c | |
parent | 311200427caeaee2075c9bbf4ddcc4858ca85dec (diff) |
it no longer segfaults, all we need now is to get the return value
-rw-r--r-- | python/feast.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/python/feast.py b/python/feast.py index 4b4ad05..9955650 100644 --- a/python/feast.py +++ b/python/feast.py @@ -12,20 +12,18 @@ def select(data, labels, n_observations, n_features, n_select, method): exit() # JMI(n_features_to_ret, int n_samples, int n_feats, double *featureMatrix, double *classcol, outputFeatures); - c_output = (c_double * n_select) + output = np.zeros(n_select) c_n_observations = c_int(n_observations) c_n_select = c_int(n_select) c_n_features = c_int(n_features) - c_labels = (c_double * len(labels))(*labels) - - combined_list = [] - map(combined_list.extend, data.tolist()) - c_data = (c_double * len(combined_list))(*combined_list) - - - # right now just call only JMI, work out the rest later - libFSToolbox.JMI(c_n_select, c_n_observations, c_n_features, repr(c_data), repr(c_labels), repr(c_output)) + libFSToolbox.JMI(c_n_select, + c_n_observations, + c_n_features, + data.ctypes.data_as(POINTER(c_double)), + labels.ctypes.data_as(POINTER(c_double)), + output.ctypes.data_as(POINTER(c_double)) + ) return selected_features |