Prev Next numpy2vec

@(@\newcommand{\B}[1]{ {\bf #1} } \newcommand{\R}[1]{ {\rm #1} }@)@
Convert a Numpy Array to a cppad_py Vector

Syntax
vec = cppad_py.utility.numpy2vec(
     
arraydtypeshapesyntaxname
)


array
This is either a vector (only one index) or a matrix (has two indices) that we are converting to a vector. If this array does not match the conditions below, an exception is raised with an appropriate error message.

dtype
This is the expected data type for the elements of the array. It must be one of the following: bool, int, float or cppad_py.a_double.

shape
This either a int or a tuple of int with length one or two. If it is an int, array is expected to be a vector. If it is a tuple with length one, array is expected to be a vector. Otherwise a matrix is expected.

syntax
This is the syntax that array appears in. It is a str that is used for error reporting.

name
This is the name used for array in syntax . It is a str that is used for error reporting.

vec
This is the values of array as a vector is row major order. It has type vec_double if dtype is float, and vec_a_double if dtype is a_double.
Input File: lib/python/utility.py