Michele De Stefano's C++ Utilities
boost::numeric::ublas::NumPy1DArray< T > Class Template Reference

Wrapper class for NumPy 1D arrays. More...

#include <mds_utils/python/ublas/numpy_array.hpp>

Inheritance diagram for boost::numeric::ublas::NumPy1DArray< T >:
mds_utils::python::Obj

Public Types

typedef npy_intp size_type
 
typedef npy_intp difference_type
 
typedef T value_type
 
typedef const T & const_reference
 
typedef T & reference
 
typedef T * pointer
 
typedef const T * const_pointer
 
typedef pointer array_type
 
typedef const vector_reference< const self_typeconst_closure_type
 
typedef vector_reference< self_typeclosure_type
 
typedef self_type vector_temporary_type
 
typedef dense_tag storage_category
 
typedef indexed_iterator< self_type, dense_random_access_iterator_tag > iterator
 
typedef indexed_const_iterator< self_type, dense_random_access_iterator_tag > const_iterator
 
typedef reverse_iterator_base< const_iterator > const_reverse_iterator
 
typedef reverse_iterator_base< iterator > reverse_iterator
 

Public Member Functions

PyArrayObject * getPyArrayObject () const
 Returns the underlying PyArrayObject.
 
 operator PyArrayObject * () const
 Automatic type conversion operator.
 
void incref ()
 Increments the reference count using Py_XINCREF. More...
 
void decref ()
 Decrements the reference count using Py_XDECREF.
 
PyObject * transfer ()
 Returns the Python object with transferred ownership. More...
 
BOOST_UBLAS_INLINE NumPy1DArray ()
 Default constructor. More...
 
BOOST_UBLAS_INLINE NumPy1DArray (size_type n)
 Constructor of a vector with a predefined size. More...
 
template<class FwIt >
BOOST_UBLAS_INLINE NumPy1DArray (FwIt b, FwIt e)
 Constructor of a vector by copying from another container. More...
 
BOOST_UBLAS_INLINE NumPy1DArray (size_type n, const_reference init)
 Constructor of a vector with a unique initial value. More...
 
BOOST_UBLAS_INLINE size_type size () const
 Return the size of the vector. More...
 
BOOST_UBLAS_INLINE NumPy1DArray (const NumPy1DArray &rhs)
 Copy-constructor. More...
 
BOOST_UBLAS_INLINE NumPy1DArray (NumPy1DArray &&rhs)
 Move constructor. More...
 
template<class AE >
BOOST_UBLAS_INLINE NumPy1DArray (const vector_expression< AE > &ae)
 Copy-constructor of a NumPy1DArray from a vector_expression. More...
 
 NumPy1DArray (PyObject *rhs)
 Constructor from PyObject. More...
 
BOOST_UBLAS_INLINE pointer find_element (size_type i)
 Return a pointer to the element $i$. More...
 
BOOST_UBLAS_INLINE const_pointer find_element (size_type i) const
 Return a const pointer to the element $i$. More...
 
BOOST_UBLAS_INLINE const_reference operator() (size_type i) const
 Return a const reference to the element $i$. More...
 
BOOST_UBLAS_INLINE reference operator() (size_type i)
 Return a reference to the element $i$. More...
 
BOOST_UBLAS_INLINE const_reference operator[] (size_type i) const
 Return a const reference to the element $i$. More...
 
BOOST_UBLAS_INLINE reference operator[] (size_type i)
 Return a reference to the element $i$. More...
 
BOOST_UBLAS_INLINE void clear ()
 Clear the vector, i.e. set all values to the zero value. More...
 
template<class AE >
BOOST_UBLAS_INLINE NumPy1DArrayassign (const vector_expression< AE > &ae)
 Assign the result of a vector_expression to the vector. More...
 
BOOST_UBLAS_INLINE NumPy1DArrayassign_temporary (NumPy1DArray &rhs)
 Assign a full vector (RHS-vector) to the current vector (LHS-vector). More...
 
BOOST_UBLAS_INLINE NumPy1DArrayoperator= (const NumPy1DArray &rhs)
 Assign a full vector (RHS-vector) to the current vector (LHS-vector). More...
 
BOOST_UBLAS_INLINE NumPy1DArrayoperator= (NumPy1DArray &&rhs)
 Move assignment of a full vector (RHS-vector) to the current vector (LHS-vector). More...
 
NumPy1DArrayoperator= (PyObject *rhs)
 Assign a NumPy array (RHS-vector) to the current vector (LHS-vector). More...
 
template<class val_T >
NumPy1DArrayoperator= (const val_T &val)
 Assignment from a value. More...
 
template<class C >
BOOST_UBLAS_INLINE NumPy1DArrayoperator= (const vector_container< C > &rhs)
 Assign a full vector (RHS-vector) to the current vector (LHS-vector). More...
 
template<class AE >
BOOST_UBLAS_INLINE NumPy1DArrayoperator= (const vector_expression< AE > &ae)
 Assign the result of a vector_expression to the vector. More...
 
template<class AE >
BOOST_UBLAS_INLINE NumPy1DArrayoperator+= (const vector_expression< AE > &ae)
 Assign the sum of the vector and a vector_expression to the vector. More...
 
template<class C >
BOOST_UBLAS_INLINE NumPy1DArrayoperator+= (const vector_container< C > &v)
 Assign the sum of the vector and a vector_container to the vector. More...
 
template<class AE >
BOOST_UBLAS_INLINE NumPy1DArrayplus_assign (const vector_expression< AE > &ae)
 Assign the sum of the vector and a vector_expression to the vector. More...
 
template<class AE >
BOOST_UBLAS_INLINE NumPy1DArrayoperator-= (const vector_expression< AE > &ae)
 Assign the difference of the vector and a vector_expression to the vector. More...
 
template<class C >
BOOST_UBLAS_INLINE NumPy1DArrayoperator-= (const vector_container< C > &v)
 Assign the difference of the vector and a vector_container to the vector. More...
 
template<class AE >
BOOST_UBLAS_INLINE NumPy1DArrayminus_assign (const vector_expression< AE > &ae)
 Assign the difference of the vector and a vector_expression to the vector. More...
 
template<class AT >
BOOST_UBLAS_INLINE NumPy1DArrayoperator*= (const AT &at)
 Assign the product of the vector and a scalar to the vector. More...
 
template<class AT >
BOOST_UBLAS_INLINE NumPy1DArrayoperator/= (const AT &at)
 Assign the division of the vector by a scalar to the vector. More...
 
BOOST_UBLAS_INLINE void swap (NumPy1DArray &rhs)
 Swap the content of the vector with another vector. More...
 
BOOST_UBLAS_INLINE const_iterator find (size_type i) const
 Return a const iterator to the element i. More...
 
BOOST_UBLAS_INLINE iterator find (size_type i)
 Return an iterator to the element i. More...
 
BOOST_UBLAS_INLINE const_iterator begin () const
 return an iterator on the first element of the vector
 
BOOST_UBLAS_INLINE const_iterator end () const
 return an iterator after the last element of the vector
 
BOOST_UBLAS_INLINE iterator begin ()
 Return an iterator on the first element of the vector.
 
BOOST_UBLAS_INLINE iterator end ()
 Return an iterator at the end of the vector.
 
BOOST_UBLAS_INLINE const_reverse_iterator rbegin () const
 Return a const reverse iterator before the first element of the reversed vector (i.e. end() of normal vector)
 
BOOST_UBLAS_INLINE const_reverse_iterator rend () const
 Return a const reverse iterator on the end of the reverse vector (i.e. first element of the normal vector)
 
BOOST_UBLAS_INLINE reverse_iterator rbegin ()
 Return a const reverse iterator before the first element of the reversed vector (i.e. end() of normal vector)
 
BOOST_UBLAS_INLINE reverse_iterator rend ()
 Return a const reverse iterator on the end of the reverse vector (i.e. first element of the normal vector)
 
- Public Member Functions inherited from mds_utils::python::Obj
 Obj ()
 Default constructor.
 
 Obj (const Obj &rhs)
 The copy-constructor. More...
 
 Obj (Obj &&rhs)
 Move constructor. More...
 
 Obj (ProxyAttr &&rhs)
 Move constructor from ProxyAttr objects. More...
 
 Obj (PyObject *po)
 Construct from a Python object. More...
 
Objoperator= (const Obj &rhs)
 Standard assignment.
 
Objoperator= (Obj &&rhs)
 Move assignment.
 
template<class T >
Objoperator= (const T &val)
 Assignment from a value. More...
 
virtual ~Obj ()
 Destructor.
 
PyObject * getPyObject () const
 Returns the underlying PyObject. More...
 
 operator PyObject * () const
 Automatic type conversion towards a Python object. More...
 
void reset ()
 Resets the object to the state given by the default constructor.
 
void get_ownership ()
 Used in place of incref, when the wrapped PyObject* was increfed already.
 
bool has_attr (const std::string &name) const
 Tests if the object has a particular attribute.
 
ProxyAttr attr (const std::string &name)
 Retrieves an attribute. More...
 
bool is_callable () const
 Checks if the object is callable. More...
 
Obj operator() ()
 Calling operator. More...
 
Obj operator() (const Obj &args)
 Calling operator, with positional arguments. More...
 
Obj operator() (const Obj &args, const Obj &kw)
 Calling operator, with positional and keyword arguments. More...
 

Friends

BOOST_UBLAS_INLINE friend void swap (NumPy1DArray &v1, NumPy1DArray &v2)
 Swap the content of two vectors. More...
 

Additional Inherited Members

- Protected Member Functions inherited from mds_utils::python::Obj
void check_callable ()
 Checks if the object is callable. More...
 
void check_call_result (PyObject *result)
 Checks if the result of the object call was successful. More...
 
- Protected Attributes inherited from mds_utils::python::Obj
size_t decref_on_destroy
 
PyObject * m_po
 Underlying pointer to the wrapped Python object.
 

Detailed Description

template<class T>
class boost::numeric::ublas::NumPy1DArray< T >

Wrapper class for NumPy 1D arrays.

It allows to use uBLAS with NumPy 1D arrays. Thanks to automatic type conversions, it can be directly used also with the NumPy C API.

Remarks
This class is an uBLAS adaptor of a standard 1D NumPy array. It does not perform any copy of the data, that continue to live into the original array.
Author
Michele De Stefano
Date
24/09/2014

Definition at line 55 of file numpy_array.hpp.

Constructor & Destructor Documentation

template<class T >
BOOST_UBLAS_INLINE boost::numeric::ublas::NumPy1DArray< T >::NumPy1DArray ( )
inline

Default constructor.

Author
Michele De Stefano
Date
25/08/2014

Definition at line 131 of file numpy_array.hpp.

template<class T >
BOOST_UBLAS_INLINE boost::numeric::ublas::NumPy1DArray< T >::NumPy1DArray ( size_type  n)
inlineexplicit

Constructor of a vector with a predefined size.

By default, its elements are randomly initialized.

Parameters
nThe size of the vector.
Author
Michele De Stefano
Date
24/09/2014

Definition at line 145 of file numpy_array.hpp.

References mds_utils::python::Obj::get_ownership().

template<class T >
template<class FwIt >
BOOST_UBLAS_INLINE boost::numeric::ublas::NumPy1DArray< T >::NumPy1DArray ( FwIt  b,
FwIt  e 
)
inline

Constructor of a vector by copying from another container.

Parameters
bStart iterator for the source container.
ePast-the-end iterator for the source container.
Author
Michele De Stefano
Date
28/08/2014

Definition at line 164 of file numpy_array.hpp.

References boost::numeric::ublas::NumPy1DArray< T >::getPyArrayObject().

template<class T >
BOOST_UBLAS_INLINE boost::numeric::ublas::NumPy1DArray< T >::NumPy1DArray ( size_type  n,
const_reference  init 
)
inlineexplicit

Constructor of a vector with a unique initial value.

Parameters
nThe size.
initThe initialization value.
Author
Michele De Stefano
Date
28/08/2014

Definition at line 183 of file numpy_array.hpp.

References boost::numeric::ublas::NumPy1DArray< T >::getPyArrayObject().

template<class T >
BOOST_UBLAS_INLINE boost::numeric::ublas::NumPy1DArray< T >::NumPy1DArray ( const NumPy1DArray< T > &  rhs)
inline

Copy-constructor.

Creates a new vector and physically copies the rhs elements into it.

Parameters
rhsThe vector to be copied.
Author
Michele De Stefano
Date
28/08/2014

Definition at line 220 of file numpy_array.hpp.

References boost::numeric::ublas::NumPy1DArray< T >::getPyArrayObject().

template<class T >
BOOST_UBLAS_INLINE boost::numeric::ublas::NumPy1DArray< T >::NumPy1DArray ( NumPy1DArray< T > &&  rhs)
inline

Move constructor.

Creates a new vector from an rvalue reference.

Parameters
rhsThe vector to be copied.
Author
Michele De Stefano
Date
24/09/2014

Definition at line 238 of file numpy_array.hpp.

template<class T >
template<class AE >
BOOST_UBLAS_INLINE boost::numeric::ublas::NumPy1DArray< T >::NumPy1DArray ( const vector_expression< AE > &  ae)
inline

Copy-constructor of a NumPy1DArray from a vector_expression.

Depending on the vector_expression, this constructor can have the cost of the computations of the expression (trivial to say it, but it is to take into account in your complexity calculations).

Parameters
aeThe vector_expression which values will be duplicated into the vector.
Author
Michele De Stefano
Date
25/08/2014

Definition at line 254 of file numpy_array.hpp.

template<class T >
boost::numeric::ublas::NumPy1DArray< T >::NumPy1DArray ( PyObject *  rhs)
inlineexplicit

Constructor from PyObject.

It wraps around a PyObject, without duplicating it. Simply takes the reference to the rhs vector and increfs it.

Parameters
rhsThe PyObject vector to use.
Author
Michele De Stefano
Date
24/09/2014

Definition at line 271 of file numpy_array.hpp.

References mds_utils::python::Obj::getPyObject(), boost::numeric::ublas::NumPy1DArray< T >::incref(), and boost::numeric::ublas::NumPy1DArray< T >::size().

Member Function Documentation

template<class T >
template<class AE >
BOOST_UBLAS_INLINE NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::assign ( const vector_expression< AE > &  ae)
inline

Assign the result of a vector_expression to the vector.

This is lazy-compiled and will be optimized out by the compiler on any type of expression.

Template Parameters
AEThe type of the vector_expression
Parameters
aeA const reference to the vector_expression
Returns
A reference to the resulting vector.
Author
Michele De Stefano
Date
26/08/2014

Definition at line 427 of file numpy_array.hpp.

Referenced by boost::numeric::ublas::NumPy1DArray< T >::operator=().

template<class T >
BOOST_UBLAS_INLINE NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::assign_temporary ( NumPy1DArray< T > &  rhs)
inline

Assign a full vector (RHS-vector) to the current vector (LHS-vector).

Parameters
rhsThe source vector.
Returns
A reference to the destination vector.
Author
Michele De Stefano
Date
24/09/2014

Definition at line 443 of file numpy_array.hpp.

References mds_utils::python::Obj::getPyObject(), and boost::numeric::ublas::NumPy1DArray< T >::incref().

Referenced by boost::numeric::ublas::NumPy1DArray< T >::operator+=(), boost::numeric::ublas::NumPy1DArray< T >::operator-=(), and boost::numeric::ublas::NumPy1DArray< T >::operator=().

template<class T >
BOOST_UBLAS_INLINE void boost::numeric::ublas::NumPy1DArray< T >::clear ( )
inline

Clear the vector, i.e. set all values to the zero value.

Author
Michele De Stefano
Date
24/09/2014

Definition at line 398 of file numpy_array.hpp.

References boost::numeric::ublas::NumPy1DArray< T >::getPyArrayObject().

template<class T >
BOOST_UBLAS_INLINE const_iterator boost::numeric::ublas::NumPy1DArray< T >::find ( size_type  i) const
inline

Return a const iterator to the element i.

Parameters
iIndex of the element.
Author
Michele De Stefano
Date
27/08/2014

Definition at line 848 of file numpy_array.hpp.

Referenced by boost::numeric::ublas::NumPy1DArray< T >::begin(), and boost::numeric::ublas::NumPy1DArray< T >::end().

template<class T >
BOOST_UBLAS_INLINE iterator boost::numeric::ublas::NumPy1DArray< T >::find ( size_type  i)
inline

Return an iterator to the element i.

Parameters
iIndex of the element.
Author
Michele De Stefano
Date
27/08/2014

Definition at line 861 of file numpy_array.hpp.

template<class T >
BOOST_UBLAS_INLINE pointer boost::numeric::ublas::NumPy1DArray< T >::find_element ( size_type  i)
inline

Return a pointer to the element $i$.

Parameters
iIndex of the element.
Warning
This semantic is not the one expected by the name of this method.
Author
Michele De Stefano
Date
25/08/2014

Definition at line 306 of file numpy_array.hpp.

template<class T >
BOOST_UBLAS_INLINE const_pointer boost::numeric::ublas::NumPy1DArray< T >::find_element ( size_type  i) const
inline

Return a const pointer to the element $i$.

Parameters
iIndex of the element.
Author
Michele De Stefano
Date
25/08/2014

Definition at line 320 of file numpy_array.hpp.

References boost::numeric::ublas::NumPy1DArray< T >::getPyArrayObject().

template<class T >
void boost::numeric::ublas::NumPy1DArray< T >::incref ( )
inlinevirtual

Increments the reference count using Py_XINCREF.

Author
Michele De Stefano
Date
24/09/2014

Reimplemented from mds_utils::python::Obj.

Definition at line 93 of file numpy_array.hpp.

References mds_utils::python::Obj::decref_on_destroy, and mds_utils::python::Obj::getPyObject().

Referenced by boost::numeric::ublas::NumPy1DArray< T >::assign_temporary(), and boost::numeric::ublas::NumPy1DArray< T >::NumPy1DArray().

template<class T >
template<class AE >
BOOST_UBLAS_INLINE NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::minus_assign ( const vector_expression< AE > &  ae)
inline

Assign the difference of the vector and a vector_expression to the vector.

This is lazy-compiled and will be optimized out by the compiler on any type of expression. No temporary is created. Computations are done and stored directly into the resulting vector.

Template Parameters
AEThe type of the vector_expression
Parameters
aeA const reference to the vector_expression
Returns
A reference to the resulting vector
Author
Michele De Stefano
Date
26/08/2014

Definition at line 723 of file numpy_array.hpp.

Referenced by boost::numeric::ublas::NumPy1DArray< T >::operator-=().

template<class T >
BOOST_UBLAS_INLINE const_reference boost::numeric::ublas::NumPy1DArray< T >::operator() ( size_type  i) const
inline

Return a const reference to the element $i$.

Parameters
iIndex of the element.
Author
Michele De Stefano
Date
25/08/2014

Definition at line 339 of file numpy_array.hpp.

References boost::numeric::ublas::NumPy1DArray< T >::getPyArrayObject().

template<class T >
BOOST_UBLAS_INLINE reference boost::numeric::ublas::NumPy1DArray< T >::operator() ( size_type  i)
inline

Return a reference to the element $i$.

Parameters
iIndex of the element.
Author
Michele De Stefano
Date
25/08/2014

Definition at line 354 of file numpy_array.hpp.

References boost::numeric::ublas::NumPy1DArray< T >::getPyArrayObject().

template<class T >
template<class AT >
BOOST_UBLAS_INLINE NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::operator*= ( const AT &  at)
inline

Assign the product of the vector and a scalar to the vector.

This is lazy-compiled and will be optimized out by the compiler on any type of expression. No temporary is created. Computations are done and stored directly into the resulting vector.

Template Parameters
ATThe type of the scalar
Parameters
atA const reference to the scalar
Returns
A reference to the resulting vector
Author
Michele De Stefano
Date
26/08/2014

Definition at line 745 of file numpy_array.hpp.

template<class T >
template<class AE >
BOOST_UBLAS_INLINE NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::operator+= ( const vector_expression< AE > &  ae)
inline

Assign the sum of the vector and a vector_expression to the vector.

This is lazy-compiled and will be optimized out by the compiler on any type of expression. A temporary is created for the computations.

Template Parameters
AEThe type of the vector_expression
Parameters
aeA const reference to the vector_expression
Returns
a reference to the resulting vector.
Author
Michele De Stefano
Date
26/08/2014

Definition at line 616 of file numpy_array.hpp.

References boost::numeric::ublas::NumPy1DArray< T >::assign_temporary().

template<class T >
template<class C >
BOOST_UBLAS_INLINE NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::operator+= ( const vector_container< C > &  v)
inline

Assign the sum of the vector and a vector_container to the vector.

This is lazy-compiled and will be optimized out by the compiler on any type of expression. No temporary is created. Computations are done and stored directly into the resulting vector.

Template Parameters
AEThe type of the vector_expression
Parameters
vA const reference to a vector_container
Returns
A reference to the resulting vector.
Author
Michele De Stefano
Date
26/08/2014

Definition at line 637 of file numpy_array.hpp.

References boost::numeric::ublas::NumPy1DArray< T >::plus_assign().

template<class T >
template<class AE >
BOOST_UBLAS_INLINE NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::operator-= ( const vector_expression< AE > &  ae)
inline

Assign the difference of the vector and a vector_expression to the vector.

This is lazy-compiled and will be optimized out by the compiler on any type of expression. A temporary is created for the computations.

Template Parameters
AEThe type of the vector_expression
Parameters
aeA const reference to the vector_expression
Author
Michele De Stefano ()
Date
26/08/2014

Definition at line 679 of file numpy_array.hpp.

References boost::numeric::ublas::NumPy1DArray< T >::assign_temporary().

template<class T >
template<class C >
BOOST_UBLAS_INLINE NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::operator-= ( const vector_container< C > &  v)
inline

Assign the difference of the vector and a vector_container to the vector.

This is lazy-compiled and will be optimized out by the compiler on any type of expression. No temporary is created. Computations are done and stored directly into the resulting vector.

Template Parameters
AEThe type of the vector_expression
Parameters
vA const reference to a vector_container
Returns
A reference to the resulting vector
Author
Michele De Stefano
Date
26/08/2014

Definition at line 701 of file numpy_array.hpp.

References boost::numeric::ublas::NumPy1DArray< T >::minus_assign().

template<class T >
template<class AT >
BOOST_UBLAS_INLINE NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::operator/= ( const AT &  at)
inline

Assign the division of the vector by a scalar to the vector.

This is lazy-compiled and will be optimized out by the compiler on any type of expression. No temporary is created. Computations are done and stored directly into the resulting vector.

Template Parameters
ATThe type of the scalar
Parameters
atA const reference to the scalar
Returns
A reference to the resulting vector
Author
Michele De Stefano
Date
26/08/2014

Definition at line 767 of file numpy_array.hpp.

template<class T >
BOOST_UBLAS_INLINE NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::operator= ( const NumPy1DArray< T > &  rhs)
inline

Assign a full vector (RHS-vector) to the current vector (LHS-vector).

This method physically copies the rhs elements into the current object.

Parameters
rhsThe source vector.
Returns
A reference to the destination vector.
Author
Michele De Stefano
Date
24/09/2014

Definition at line 463 of file numpy_array.hpp.

References mds_utils::python::Obj::get_ownership(), boost::numeric::ublas::NumPy1DArray< T >::getPyArrayObject(), mds_utils::python::Obj::m_po, mds_utils::python::Obj::reset(), and boost::numeric::ublas::NumPy1DArray< T >::size().

template<class T >
BOOST_UBLAS_INLINE NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::operator= ( NumPy1DArray< T > &&  rhs)
inline

Move assignment of a full vector (RHS-vector) to the current vector (LHS-vector).

Parameters
rhsThe source vector.
Returns
A reference to the destination vector.
Author
Michele De Stefano
Date
24/09/2014

Definition at line 495 of file numpy_array.hpp.

References mds_utils::python::Obj::operator=().

template<class T >
NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::operator= ( PyObject *  rhs)
inlinevirtual

Assign a NumPy array (RHS-vector) to the current vector (LHS-vector).

This method only takes the reference to the rhs object and it does not incref it.

Parameters
rhsThe source NumPy array.
Returns
A reference to the destination vector.
Author
Michele De Stefano
Date
24/09/2014

Reimplemented from mds_utils::python::Obj.

Definition at line 515 of file numpy_array.hpp.

References mds_utils::python::Obj::getPyObject(), and mds_utils::python::Obj::operator=().

template<class T >
template<class val_T >
NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::operator= ( const val_T &  val)
inline

Assignment from a value.

Sets all the elements of the array to the passed value.

Parameters
valThe value to assign.
Returns
The current vector.
Author
Michele De Stefano
Date
24/09/2014

Definition at line 540 of file numpy_array.hpp.

References boost::numeric::ublas::NumPy1DArray< T >::begin(), boost::numeric::ublas::NumPy1DArray< T >::end(), and boost::numeric::ublas::NumPy1DArray< T >::size().

template<class T >
template<class C >
BOOST_UBLAS_INLINE NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::operator= ( const vector_container< C > &  rhs)
inline

Assign a full vector (RHS-vector) to the current vector (LHS-vector).

It physically copies the elements.

Parameters
vThe source vector container.
Returns
A Reference to the destination vector.
Author
Michele De Stefano
Date
26/08/2014

Definition at line 566 of file numpy_array.hpp.

References boost::numeric::ublas::NumPy1DArray< T >::assign(), and boost::numeric::ublas::NumPy1DArray< T >::size().

template<class T >
template<class AE >
BOOST_UBLAS_INLINE NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::operator= ( const vector_expression< AE > &  ae)
inline

Assign the result of a vector_expression to the vector.

This is lazy-compiled and will be optimized out by the compiler on any type of expression.

Template Parameters
AEThe type of the vector_expression.
Parameters
aeA const reference to the vector_expression.
Returns
A reference to the resulting vector.
Author
Michele De Stefano
Date
28/08/2014

Definition at line 590 of file numpy_array.hpp.

References boost::numeric::ublas::NumPy1DArray< T >::assign_temporary().

template<class T >
BOOST_UBLAS_INLINE const_reference boost::numeric::ublas::NumPy1DArray< T >::operator[] ( size_type  i) const
inline

Return a const reference to the element $i$.

Parameters
iIndex of the element.
Author
Michele De Stefano
Date
25/08/2014

Definition at line 369 of file numpy_array.hpp.

template<class T >
BOOST_UBLAS_INLINE reference boost::numeric::ublas::NumPy1DArray< T >::operator[] ( size_type  i)
inline

Return a reference to the element $i$.

Parameters
iIndex of the element.
Author
Michele De Stefano
Date
25/08/2014

Definition at line 383 of file numpy_array.hpp.

template<class T >
template<class AE >
BOOST_UBLAS_INLINE NumPy1DArray& boost::numeric::ublas::NumPy1DArray< T >::plus_assign ( const vector_expression< AE > &  ae)
inline

Assign the sum of the vector and a vector_expression to the vector.

This is lazy-compiled and will be optimized out by the compiler on any type of expression. No temporary is created. Computations are done and stored directly into the resulting vector.

Template Parameters
AEThe type of the vector_expression
Parameters
aeA const reference to the vector_expression
Returns
A reference to the resulting vector.
Author
Michele De Stefano
Date
26/08/2014

Definition at line 659 of file numpy_array.hpp.

Referenced by boost::numeric::ublas::NumPy1DArray< T >::operator+=().

template<class T >
BOOST_UBLAS_INLINE size_type boost::numeric::ublas::NumPy1DArray< T >::size ( ) const
inline
template<class T >
BOOST_UBLAS_INLINE void boost::numeric::ublas::NumPy1DArray< T >::swap ( NumPy1DArray< T > &  rhs)
inline

Swap the content of the vector with another vector.

Parameters
rhsThe vector to be swapped with.
Author
Michele De Stefano
Date
24/09/2014

Definition at line 786 of file numpy_array.hpp.

References boost::numeric::ublas::NumPy1DArray< T >::getPyArrayObject().

template<class T >
PyObject* boost::numeric::ublas::NumPy1DArray< T >::transfer ( )
inlinevirtual

Returns the Python object with transferred ownership.

Returns
The Python object.
Author
Michele De Stefano
Date
24/09/2014

Reimplemented from mds_utils::python::Obj.

Definition at line 114 of file numpy_array.hpp.

References mds_utils::python::Obj::getPyObject(), and mds_utils::python::Obj::reset().

Friends And Related Function Documentation

template<class T >
BOOST_UBLAS_INLINE friend void swap ( NumPy1DArray< T > &  v1,
NumPy1DArray< T > &  v2 
)
friend

Swap the content of two vectors.

Parameters
v1The first vector. It takes values from v2.
v2The second vector. It takes values from v1.
Author
Michele De Stefano
Date
26/08/2014

Definition at line 815 of file numpy_array.hpp.


The documentation for this class was generated from the following file: