Skip to content

Instantly share code, notes, and snippets.

push!(LOAD_PATH, "/Users/czhang/Desktop/Projects/dw_/julia/")
import DimmWitted
DimmWitted.set_libpath("/Users/czhang/Desktop/Projects/dw_/libdw_julia")
######################################
# The following function creates a
# synthetic data set:
# - Data type is Cdouble
# - Modle type is Array{Cdouble}
push!(LOAD_PATH, "/Users/czhang/Desktop/Projects/dw_/julia/")
import DimmWitted
DimmWitted.set_libpath("/Users/czhang/Desktop/Projects/dw_/libdw_julia")
######################################
# The following function creates a
# synthetic data set:
# - Data type is Cdouble
# - Modle type is Array{Cdouble}
push!(LOAD_PATH, "/Users/czhang/Desktop/Projects/dw_/julia/")
import DimmWitted
DimmWitted.set_libpath("/Users/czhang/Desktop/Projects/dw_/libdw_julia")
gc_disable()
######################################
# The following function creates a
# synthetic data set:
# - Data type is Cdouble
push!(LOAD_PATH, "/Users/czhang/Desktop/Projects/dw_/julia/")
import DimmWitted
DimmWitted.set_libpath("/Users/czhang/Desktop/Projects/dw_/libdw_julia")
######################################
# The following function creates a
# synthetic data set:
# - Data type is Cdouble
# - Modle type is Array{Cdouble}
#
push!(LOAD_PATH, "/Users/czhang/Desktop/Projects/dw_/julia/")
import DimmWitted
DimmWitted.set_libpath("/Users/czhang/Desktop/Projects/dw_/libdw_julia")
######################################
# The following piece of code creates a
# synthetic data set:
# - Data type is Cdouble
# - Modle type is Array{Cdouble}
#
bool Serialize(int fd) const {
int flag = contains_value_;
int pt = 0;
memcpy((void*) &buf[pt], &flag, sizeof(flag));
pt += sizeof(flag);
int length = key_.length();
bool Deserialize(int fd) {
int flag;
int length;
ReadN(fd, (char*) &flag, sizeof(flag));
contains_value_ = flag;
ReadN(fd, (char*) &length, sizeof(length));
ReadN(fd, (char*) buf, length);
key_ = std::string(buf);
#ifndef MESSAGE_H
#define MESSAGE_H
#include <string>
#include <iostream>
#include "common.h"
class Message {
private:
inference.factors: {
# Smokes(x) => Cancer(x)
smokes_cancer {
input_query: """
SELECT person_has_cancer.id as "person_has_cancer.id",
person_smokes.id as "person_smokes.id",
person_smokes.smokes as "person_smokes.smokes",
person_has_cancer.has_cancer as "person_has_cancer.has_cancer"
FROM person_has_cancer, person_smokes
#include <iostream>
#include <chrono>
#include <ctime>
using namespace std;
// double n=4 << 21;
long n=1E3 * 1E3 * 1E3;
const long cnt=1e8;
double fast(const double* const a) {