__ array_interface__ should be a property (instance variable), not a method. Therefore, in C ++ or wherever the sprint.Matrix object is specified, change it so that instead:
print X.__array_interface__ #<bound method Matrix.__array_interface__ of <sprint.Matrix object at 0x107c5c320>>
you have
print X.__array_interface__
An alternative would be to define a custom wrapper class:
class SprintMatrixWrapper(object): def __init__(self, sprint_matrix): self.__array_interface__ = sprint_matrix.__array_interface__()
and then just do:
numpy.array(SprintMatrixWrapper(X))
source share