Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Mantid::PythonInterface::Converters::PyObjectToMatrix Struct Reference

Takes a Python object and if it supports indexing and is two dimensional it attempts to convert it to a Kernel::Matrix object. More...

#include <PyObjectToMatrix.h>

Public Member Functions

Kernel::Matrix< double > operator() ()
 Produces a V3D object from the given PyObject. More...
 
 PyObjectToMatrix (const boost::python::object &p)
 Construct the converter object with the given Python object. More...
 

Private Attributes

bool m_alreadyMatrix
 Is the object a wrapped instance of Matrix<double> More...
 
const boost::python::object & m_obj
 A reference to the object. More...
 

Detailed Description

Takes a Python object and if it supports indexing and is two dimensional it attempts to convert it to a Kernel::Matrix object.

Note, this currently only suuports Matrix<double>

Definition at line 22 of file PyObjectToMatrix.h.

Constructor & Destructor Documentation

◆ PyObjectToMatrix()

Mantid::PythonInterface::Converters::PyObjectToMatrix::PyObjectToMatrix ( const boost::python::object &  p)

Construct the converter object with the given Python object.

Parameters
p:: A boost::python object is either a wrapped Kernel::Matrix or 2D numpy array Throws std::invalid_argument if not if that is not the case.

Definition at line 31 of file PyObjectToMatrix.cpp.

References Mantid::PythonInterface::NDArray::check(), and m_alreadyMatrix.

Member Function Documentation

◆ operator()()

Kernel::Matrix< double > Mantid::PythonInterface::Converters::PyObjectToMatrix::operator() ( )

Produces a V3D object from the given PyObject.

Returns a V3D object from the Python object given to the converter.

Returns
A newly constructed V3D object converted from the PyObject.

Definition at line 60 of file PyObjectToMatrix.cpp.

References m_alreadyMatrix, and m_obj.

Member Data Documentation

◆ m_alreadyMatrix

bool Mantid::PythonInterface::Converters::PyObjectToMatrix::m_alreadyMatrix
private

Is the object a wrapped instance of Matrix<double>

Definition at line 31 of file PyObjectToMatrix.h.

Referenced by operator()(), and PyObjectToMatrix().

◆ m_obj

const boost::python::object& Mantid::PythonInterface::Converters::PyObjectToMatrix::m_obj
private

A reference to the object.

Definition at line 29 of file PyObjectToMatrix.h.

Referenced by operator()().


The documentation for this struct was generated from the following files: