Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions Linux/LargeVismodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static PyObject *LoadFromList(PyObject *self, PyObject *args)
}
for (long long j = 0; j < n_dim; ++j)
{
real x = atof(PyString_AsString(PyObject_Str(PyList_GetItem(vec, j))));
real x = atof(PyBytes_AsString(PyUnicode_AsUTF8String(PyObject_Str(PyList_GetItem(vec, j)) )));
data[ll + j] = x;
}
}
Expand Down Expand Up @@ -123,9 +123,16 @@ static PyMethodDef PyExtMethods[] =
{ "save", SaveToFile, METH_VARARGS, "save(str filename)\nSave data to file." },
{ NULL, NULL, 0, NULL }
};
static struct PyModuleDef LargeVismodule =
{
PyModuleDef_HEAD_INIT,
"LargeVis",
NULL,
-1,
PyExtMethods
};

PyMODINIT_FUNC initLargeVis()
PyMODINIT_FUNC PyInit_LargeVis(void)
{
printf("LargeVis successfully imported!\n");
Py_InitModule("LargeVis", PyExtMethods);
}
return PyModule_Create(&LargeVismodule);
};
2 changes: 1 addition & 1 deletion Linux/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
LargeVis = Extension('LargeVis',
sources = ['LargeVis.cpp', 'LargeVismodule.cpp'],
depends=['LargeVis.h'],
include_dirs = ['/usr/local/include'],
include_dirs = ['/usr/local/include/gsl'],
library_dirs = ['/usr/local/lib'],
libraries=['gsl', 'gslcblas'],
extra_compile_args=['-lm -pthread -lgsl -lgslcblas -Ofast -march=native -ffast-math'])
Expand Down
17 changes: 12 additions & 5 deletions Windows/LargeVismodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static PyObject *LoadFromList(PyObject *self, PyObject *args)
}
for (long long j = 0; j < n_dim; ++j)
{
real x = atof(PyString_AsString(PyObject_Str(PyList_GetItem(vec, j))));
real x = atof(PyBytes_AsString(PyUnicode_AsUTF8String(PyObject_Str(PyList_GetItem(vec, j)) )));
data[ll + j] = x;
}
}
Expand Down Expand Up @@ -123,9 +123,16 @@ static PyMethodDef PyExtMethods[] =
{ "save", SaveToFile, METH_VARARGS, "save(str filename)\nSave data to file." },
{ NULL, NULL, 0, NULL }
};
static struct PyModuleDef LargeVismodule =
{
PyModuleDef_HEAD_INIT,
"LargeVis",
NULL,
-1,
PyExtMethods
};

PyMODINIT_FUNC initLargeVis()
PyMODINIT_FUNC PyInit_LargeVis(void)
{
printf("LargeVis successfully imported!\n");
Py_InitModule("LargeVis", PyExtMethods);
}
return PyModule_Create(&LargeVismodule);
};