Dip 0.95.0
Loading...
Searching...
No Matches
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>
11using namespace std;
12
13// Some convenience functions for converting between Python objects and
14// C/C++ data structures
15
23PyObject* pyTupleList_FromDoubleArray(const double* values, PyObject* pList);
24
33PyObject* pyTupleList_FromNode(DecompAlgo* algo, DecompStatus decompStatus);
34
42void pyColDict_AsPairedVector(PyObject* pColDict, vector< pair<int, double> >& vector, map<PyObject*, int> indices);
43
52int pyColDict_AsPackedArrays(PyObject* pColDict, map<PyObject*, int> indices, int** inds, double** vals);
53
54int 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
69void addTupleToPyList(PyObject* pList, PyObject* key, PyObject* value);
70
74void insertTupleToPyList(PyObject* pList, unsigned position, PyObject* key, PyObject* value);
75
76#endif
DecompStatus
Definition: Decomp.h:184
DecompVarType
Definition: Decomp.h:269
PyObject * pyTupleList_FromDoubleArray(const double *values, PyObject *pList)
Convert a double array to a Python tuple list.
void pyColDict_AsPairedVector(PyObject *pColDict, vector< pair< int, double > > &vector, map< PyObject *, int > indices)
Convert a column dictionary to a (int, double) vector.
void addTupleToPyList(PyObject *pList, PyObject *key, PyObject *value)
Creates a (key,value) tuple and appends to a Python list of tuples *.
PyObject * pyTupleList_FromNode(DecompAlgo *algo, DecompStatus decompStatus)
Package a AlpsDecompTreeNode using a DecompAlgo into a Python list.
void insertTupleToPyList(PyObject *pList, unsigned position, PyObject *key, PyObject *value)
Creates a (key,value) tuple and inserts in a Python list of tuples *.
int pyColDict_AsPackedArrays(PyObject *pColDict, map< PyObject *, int > indices, int **inds, double **vals)
Convert a column dictionary to packed arrays.
CoinPackedMatrix * pyConstraints_AsPackedMatrix(PyObject *pRowList, map< PyObject *, int > rowIndices, map< PyObject *, int > colIndices)
Convert a list of Python constraints to a CoinPackedMatrix.
Base class for DECOMP algorithms.
Definition: DecompAlgo.h:62