/usr/include/openturns/swig/ComplexMatrix.i is in python-openturns-dev 1.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | // SWIG file ComplexMatrix.i
// @author schueller
// @date 2012-07-16 15:59:45 +0200 (Mon, 16 Jul 2012)
%{
#include "ComplexMatrix.hxx"
%}
%template(ComplexMatrixImplementationTypedInterfaceObject) OT::TypedInterfaceObject<OT::ComplexMatrixImplementation>;
%apply const NumericalScalarCollection & { const OT::ComplexMatrix::NumericalScalarCollection & };
%apply const NumericalComplexCollection & { const OT::ComplexMatrix::NumericalComplexCollection & };
%include ComplexMatrix.hxx
%pythoncode %{
# This code has been added to conform to Numpy ndarray interface
# that tries to reuse the data stored in the ComplexMatrix (zero copy)
# see http://docs.scipy.org/doc/numpy/reference/arrays.interface.html#arrays-interface
# for details.
# See python doc http://docs.python.org/reference/datamodel.html?highlight=getattribute#object.__getattribute__
# for details on how to write such a method.
def ComplexMatrix___getattribute__(self, name):
"""__getattribute__(self, name) -> value"""
if (name == '__array_interface__'):
self.__dict__['__array_interface__'] = { 'shape' : ( self.getNbRows(), self.getNbColumns() ),
'typestr' : "|c" + str(self.__elementsize__()),
'data' : ( int(self.__baseaddress__()), True),
'strides' : ( self.__stride__(0), self.__stride__(1) ),
'version' : 3,
}
return object.__getattribute__(self,name)
ComplexMatrix.__getattribute__ = ComplexMatrix___getattribute__
%}
namespace OT {
%extend ComplexMatrix {
ComplexMatrix(const ComplexMatrix & other) { return new OT::ComplexMatrix(other); }
ComplexMatrix(PyObject * pyObj) { return new OT::ComplexMatrix( OT::convert<OT::_PySequence_,OT::ComplexMatrix>(pyObj) ); }
OTMatrixAccessors(ComplexMatrix, NumericalComplex)
ComplexMatrix __rmul__(NumericalComplex s) { return s * (*self); }
ComplexMatrix __truediv__(NumericalComplex s) { return (*self) / s; }
} // ComplexMatrix
} // OT
|