1 // SWIG file CorrelationMatrix.i 2 3 %{ 4 #include "openturns/CorrelationMatrix.hxx" 5 %} 6 7 %include CorrelationMatrix_doc.i 8 9 %apply const ScalarCollection & { const OT::CorrelationMatrix::ScalarCollection & }; 10 11 %typemap(in) const CorrelationMatrix & ($1_basetype temp) { 12 if (!SWIG_IsOK(SWIG_ConvertPtr($input, (void **) &$1, $1_descriptor, SWIG_POINTER_NO_NULL))) { 13 try { 14 temp = OT::convert<OT::_PySequence_, OT::CorrelationMatrix>($input); 15 $1 = &temp; catch(OT::InvalidArgumentException &)16 } catch (OT::InvalidArgumentException &) { 17 SWIG_exception(SWIG_TypeError, "Object passed as argument is not convertible to a CorrelationMatrix"); 18 } 19 } 20 } 21 22 %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) const CorrelationMatrix & { 23 $1 = (SWIG_IsOK(SWIG_ConvertPtr($input, NULL, $1_descriptor, SWIG_POINTER_NO_NULL)) || 24 OT::isAPythonBufferOf<OT::Scalar, 2>($input) || OT::isAPythonSequenceOf<OT::_PySequence_>($input)); 25 } 26 27 %include openturns/CorrelationMatrix.hxx 28 29 namespace OT { 30 31 %extend CorrelationMatrix { 32 CorrelationMatrix(const CorrelationMatrix & other)33 CorrelationMatrix(const CorrelationMatrix & other) { return new OT::CorrelationMatrix(other); } 34 CorrelationMatrix(PyObject * pyObj)35 CorrelationMatrix(PyObject * pyObj) { return new OT::CorrelationMatrix(OT::convert<OT::_PySequence_, OT::CorrelationMatrix>(pyObj)); } 36 OTMatrixAccessors()37 OTMatrixAccessors() 38 39 // These should be inherited from CovarianceMatrix 40 Point __mul__(Point p) { return (*self) * p; } __mul__(Scalar s)41 Matrix __mul__(Scalar s) { return (*self) * s; } 42 43 } // CorrelationMatrix 44 } // OT 45