Renamed the main driver file name
This commit is contained in:
@@ -3,14 +3,15 @@ librule(
|
||||
name = "multibody", # this line can be safely omitted
|
||||
sources = [], # files that must be compiled
|
||||
headers = ["multibody.h",
|
||||
"multibody_kernel.h"], # include files part of the 'lib'
|
||||
"multibody_kernel.h",
|
||||
"naive_multibody.h"], # include files part of the 'lib'
|
||||
deplibs = ["mlpack/series_expansion:series_expansion",
|
||||
"fastlib:fastlib_int"] # dependency
|
||||
)
|
||||
|
||||
binrule(
|
||||
name = "multibody_bin", # the executable name
|
||||
sources = ["main.cc"], # compile multibody.cc
|
||||
sources = ["multibody_main.cc"], # compile multibody.cc
|
||||
headers = [], # no extra headers
|
||||
deplibs = [":multibody",
|
||||
"mlpack/series_expansion:series_expansion",
|
||||
|
||||
@@ -9,80 +9,6 @@
|
||||
#include "mlpack/series_expansion/series_expansion_aux.h"
|
||||
#include "multibody_kernel.h"
|
||||
|
||||
template<typename TMultibodyKernel>
|
||||
class NaiveMultibody {
|
||||
|
||||
FORBID_ACCIDENTAL_COPIES(NaiveMultibody);
|
||||
|
||||
private:
|
||||
|
||||
/** Temporary space for storing indices selected for exhaustive computation
|
||||
*/
|
||||
ArrayList<int> exhaustive_indices_;
|
||||
|
||||
/** dataset for the tree */
|
||||
Matrix data_;
|
||||
|
||||
/** multibody kernel function */
|
||||
TMultibodyKernel mkernel_;
|
||||
|
||||
/** potential estimate */
|
||||
double neg_potential_e_;
|
||||
double pos_potential_e_;
|
||||
|
||||
/** exhaustive computer */
|
||||
void NMultibody(int level) {
|
||||
|
||||
int num_nodes = mkernel_.order();
|
||||
int start_index = 0;
|
||||
double neg, pos;
|
||||
|
||||
if(level < num_nodes) {
|
||||
|
||||
if(level == 0) {
|
||||
start_index = 0;
|
||||
}
|
||||
else {
|
||||
start_index = exhaustive_indices_[level - 1] + 1;
|
||||
}
|
||||
|
||||
for(index_t i = start_index; i < data_.n_cols() -
|
||||
(num_nodes - level - 1); i++) {
|
||||
exhaustive_indices_[level] = i;
|
||||
NMultibody(level + 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
mkernel_.Eval(data_, exhaustive_indices_, &neg, &pos);
|
||||
neg_potential_e_ += neg;
|
||||
pos_potential_e_ += pos;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
NaiveMultibody() {}
|
||||
|
||||
~NaiveMultibody() {}
|
||||
|
||||
void Init(const Matrix &data, double bandwidth) {
|
||||
data_.Alias(data);
|
||||
exhaustive_indices_.Init(3);
|
||||
mkernel_.Init(bandwidth);
|
||||
neg_potential_e_ = pos_potential_e_ = 0;
|
||||
}
|
||||
|
||||
void Compute() {
|
||||
|
||||
NMultibody(0);
|
||||
|
||||
printf("Negative potential sum %g\n", neg_potential_e_);
|
||||
printf("Positive potential sum %g\n", pos_potential_e_);
|
||||
printf("Got potential sum %g\n", neg_potential_e_ + pos_potential_e_);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template<typename TKernelAux>
|
||||
class MultibodyStat {
|
||||
|
||||
|
||||
+6
@@ -1,5 +1,11 @@
|
||||
/** @file multibody_main.cc
|
||||
*
|
||||
* @author Dongryeol Lee (dongryel)
|
||||
*/
|
||||
|
||||
#include "multibody.h"
|
||||
#include "multibody_kernel.h"
|
||||
#include "naive_multibody.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Reference in New Issue
Block a user