From fca1e9b3e07a8aa28f782b780852ef6d80b689c4 Mon Sep 17 00:00:00 2001
From: Tiago Freitas Pereira <tiagofrepereira@gmail.com>
Date: Thu, 4 Dec 2014 14:10:27 +0800
Subject: [PATCH] Bind GMMStats class

---
 bob/learn/misc/main.cpp    |  1 +
 bob/learn/misc/main.h      | 13 +++++++++++++
 bob/learn/misc/test_gmm.py |  4 ++--
 setup.py                   |  3 ++-
 4 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/bob/learn/misc/main.cpp b/bob/learn/misc/main.cpp
index 388a218..f79e852 100644
--- a/bob/learn/misc/main.cpp
+++ b/bob/learn/misc/main.cpp
@@ -41,6 +41,7 @@ static PyObject* create_module (void) {
 
   if (PyModule_AddStringConstant(module, "__version__", BOB_EXT_MODULE_VERSION) < 0) return 0;
   if (!init_BobLearnMiscGaussian(module)) return 0;
+  if (!init_BobLearnMiscGMMStats(module)) return 0;
 
   static void* PyBobLearnMisc_API[PyBobLearnMisc_API_pointers];
 
diff --git a/bob/learn/misc/main.h b/bob/learn/misc/main.h
index bb40bec..1759cbd 100644
--- a/bob/learn/misc/main.h
+++ b/bob/learn/misc/main.h
@@ -18,6 +18,7 @@
 #include <bob.learn.misc/api.h>
 
 #include <bob.learn.misc/Gaussian.h>
+#include <bob.learn.misc/GMMStats.h>
 
 
 #if PY_VERSION_HEX >= 0x03000000
@@ -69,4 +70,16 @@ bool init_BobLearnMiscGaussian(PyObject* module);
 int PyBobLearnMiscGaussian_Check(PyObject* o);
 
 
+// GMMStats
+typedef struct {
+  PyObject_HEAD
+  boost::shared_ptr<bob::learn::misc::GMMStats> cxx;
+} PyBobLearnMiscGMMStatsObject;
+
+extern PyTypeObject PyBobLearnMiscGMMStats_Type;
+bool init_BobLearnMiscGMMStats(PyObject* module);
+int PyBobLearnMiscGMMStats_Check(PyObject* o);
+
+
+
 #endif // BOB_LEARN_EM_MAIN_H
diff --git a/bob/learn/misc/test_gmm.py b/bob/learn/misc/test_gmm.py
index cd98174..bb3855d 100644
--- a/bob/learn/misc/test_gmm.py
+++ b/bob/learn/misc/test_gmm.py
@@ -15,11 +15,11 @@ import tempfile
 import bob.io.base
 from bob.io.base.test_utils import datafile
 
-from . import GMMStats, GMMMachine
+from . import GMMStats
+#, GMMMachine
 
 def test_GMMStats():
   # Test a GMMStats
-
   # Initializes a GMMStats
   gs = GMMStats(2,3)
   log_likelihood = -3.
diff --git a/setup.py b/setup.py
index feabf72..c59f475 100644
--- a/setup.py
+++ b/setup.py
@@ -56,7 +56,7 @@ setup(
         [
           "bob/learn/misc/cpp/Gaussian.cpp",
           #"bob/learn/misc/cpp/GMMMachine.cpp",
-          #"bob/learn/misc/cpp/GMMStats.cpp",
+          "bob/learn/misc/cpp/GMMStats.cpp",
           #"bob/learn/misc/cpp/IVectorMachine.cpp",
           #"bob/learn/misc/cpp/JFAMachine.cpp",
           #"bob/learn/misc/cpp/KMeansMachine.cpp",
@@ -101,6 +101,7 @@ setup(
       Extension("bob.learn.misc._library",
         [
           "bob/learn/misc/gaussian.cpp",
+          "bob/learn/misc/gmm_stats.cpp",
 
           "bob/learn/misc/main.cpp",
         ],
-- 
GitLab