Skip to content

Commit

Permalink
fixes for c++11 and boost.python
Browse files Browse the repository at this point in the history
  • Loading branch information
dsteinberg committed Jan 25, 2018
1 parent 9b72090 commit 5a421e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions python/libclusterpy.cpp
Expand Up @@ -57,7 +57,7 @@ MatrixXd numpy2MatrixXd (const object& X)


// Convert (memory share) a list of numpy arrays to a vector of Eigen MatrixXd
vMatrixXd lnumpy2vMatrixXd (const list& X)
vMatrixXd lnumpy2vMatrixXd (const boost::python::list& X)
{

vMatrixXd X_;
Expand All @@ -71,7 +71,7 @@ vMatrixXd lnumpy2vMatrixXd (const list& X)

// Convert (memory share) a list of lists of arrays to a vector of vectors of
// matrices
vvMatrixXd llnumpy2vvMatrixXd (const list& X)
vvMatrixXd llnumpy2vvMatrixXd (const boost::python::list& X)
{

vvMatrixXd X_;
Expand Down Expand Up @@ -187,7 +187,7 @@ tuple wrapperBGMM (

// GMC
tuple wrapperGMC (
const list &X,
const boost::python::list &X,
const float clusterprior,
const int maxclusters,
const bool sparse,
Expand Down Expand Up @@ -215,7 +215,7 @@ tuple wrapperGMC (

// SGMC
tuple wrapperSGMC (
const list &X,
const boost::python::list &X,
const float clusterprior,
const int maxclusters,
const bool sparse,
Expand Down Expand Up @@ -243,7 +243,7 @@ tuple wrapperSGMC (

// SCM
tuple wrapperSCM (
const list &X,
const boost::python::list &X,
const float dirprior,
const float gausprior,
const int trunc,
Expand Down Expand Up @@ -274,8 +274,8 @@ tuple wrapperSCM (

// MCM
tuple wrapperMCM (
const list &W,
const list &X,
const boost::python::list &W,
const boost::python::list &X,
const float gausprior_t,
const float gausprior_k,
const int trunc,
Expand Down
12 changes: 6 additions & 6 deletions python/testapi.py
Expand Up @@ -64,7 +64,7 @@ def testgroupmix():

# Create points from clusters
J = 4 # Groups
W = [gengmm(2000) for j in range(0, J)]
W = [gengmm(2000) for j in range(J)]

# Test GMC
print("------------ Test GMC -------------")
Expand All @@ -90,7 +90,7 @@ def testmultmix():
# Create points from clusters
W = np.zeros((I, means.shape[1]))
X = []
for i in range(0, I):
for i in range(I):
W[i, :] = np.random.multivariate_normal(means[Y[i]], sigma[Y[i]], 1)
X.append(gengmm(Ni, betas[i, :]))

Expand Down Expand Up @@ -120,7 +120,7 @@ def gengmm(N, weights=None):
Nk[-1] = N - Nk[0:-1].sum()

X = [np.random.multivariate_normal(means[k, :], sigma[k], int(Nk[k]))
for k in range(0, K)]
for k in range(K)]

return np.concatenate(X)

Expand All @@ -136,9 +136,9 @@ def gensetweights(I):

betas = []
Y = []
for t in range(0, T):
Y += Nt[t] * [t]
betas.append(Nt[t] * [beta[t, :]])
for t in range(T):
Y += int(Nt[t]) * [t]
betas.append(int(Nt[t]) * [beta[t, :]])

return np.concatenate(betas), Y

Expand Down

0 comments on commit 5a421e7

Please sign in to comment.