Dip  0.92.4
DippyPythonUtils.h
Go to the documentation of this file.
1 #ifndef DIPPY_PYTHONUTILS_INCLUDED
2 #define DIPPY_PYTHONUTILS_INCLUDED
3 
4 #include "Python.h"
5 
6 #include "Decomp.h"
7 #include "DecompAlgo.h"
8 
9 #include <map>
10 #include <vector>
11 using namespace std;
12 
13 // Some convenience functions for converting between Python objects and
14 // C/C++ data structures
15 
23 PyObject* pyTupleList_FromDoubleArray(const double* values, PyObject* pList);
24 
33 PyObject* pyTupleList_FromNode(DecompAlgo* algo, DecompStatus decompStatus);
34 
42 void pyColDict_AsPairedVector(PyObject* pColDict, vector< pair<int, double> >& vector, map<PyObject*, int> indices);
43 
52 int pyColDict_AsPackedArrays(PyObject* pColDict, map<PyObject*, int> indices, int** inds, double** vals);
53 
54 int pyColDict_AsPackedArrays(PyObject* pColDict, map<PyObject*, int> indices, int** inds, double** vals, DecompVarType & varType);
55 
64  map<PyObject*, int> rowIndices, map<PyObject*, int> colIndices);
65 
69 void addTupleToPyList(PyObject* pList, PyObject* key, PyObject* value);
70 
74 void insertTupleToPyList(PyObject* pList, unsigned position, PyObject* key, PyObject* value);
75 
76 #endif
DecompVarType
Definition: Decomp.h:269
DecompStatus
Definition: Decomp.h:184
void addTupleToPyList(PyObject *pList, PyObject *key, PyObject *value)
Creates a (key,value) tuple and appends to a Python list of tuples *.
Sparse Matrix Base Class.
void pyColDict_AsPairedVector(PyObject *pColDict, vector< pair< int, double > > &vector, map< PyObject *, int > indices)
Convert a column dictionary to a (int, double) vector.
CoinPackedMatrix * pyConstraints_AsPackedMatrix(PyObject *pRowList, map< PyObject *, int > rowIndices, map< PyObject *, int > colIndices)
Convert a list of Python constraints to a CoinPackedMatrix.
PyObject * pyTupleList_FromDoubleArray(const double *values, PyObject *pList)
Convert a double array to a Python tuple list.
int pyColDict_AsPackedArrays(PyObject *pColDict, map< PyObject *, int > indices, int **inds, double **vals)
Convert a column dictionary to packed arrays.
void insertTupleToPyList(PyObject *pList, unsigned position, PyObject *key, PyObject *value)
Creates a (key,value) tuple and inserts in a Python list of tuples *.
PyObject * pyTupleList_FromNode(DecompAlgo *algo, DecompStatus decompStatus)
Package a AlpsDecompTreeNode using a DecompAlgo into a Python list.
Base class for DECOMP algorithms.
Definition: DecompAlgo.h:62