Prev Next vector_size_xam.py Headings

@(@\newcommand{\B}[1]{ {\bf #1} } \newcommand{\R}[1]{ {\rm #1} }@)@
Python: Size of Vectors: Example and Test
def vector_size_xam() :
     #
     # load the Cppad Swig library
     import py_cppad
     #
     # initialize return variable
     ok = True
     # ---------------------------------------------------------------------
     # create vectors
     bv = py_cppad.vec_bool()
     iv = py_cppad.vec_int(1)
     dv = py_cppad.vec_double(2)
     av = py_cppad.vec_a_double(3)
     #
     # check size of vectors
     ok = ok and bv.size() == 0 
     ok = ok and iv.size() == 1 
     ok = ok and dv.size() == 2 
     ok = ok and av.size() == 3 
     #
     return( ok )
#

Input File: build/lib/example/python/vector_size_xam.py