Python Module OverviewΒΆ

You can write your documentation in a python notebook. I much prefer writing documentation this way!

[14]:
import numpy as np
import cpplib
print("My version is {}".format(cpplib.__version__))
My version is 1.0.1

Now we can use the cpplib library! Here are the available methods:

[7]:
print(dir(cpplib))
['VectorDouble', 'VectorInt', 'VectorULongInt', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', 'get_cpplib_version', 'hello', 'multiply_by_scalar_double', 'multiply_by_scalar_int', 'multiply_by_scalar_size_t', 'pkg_resources']

Heres an example of multiplying an array

[13]:
input_array = cpplib.VectorDouble([0.1, 1.0, 2.0])
cpplib.multiply_by_scalar_double(input_array, 2.0)
[13]:
VectorDouble[0.2, 2, 4]
[15]:
input_array = cpplib.VectorDouble(np.array([0.1, 1.0, 2.0]))
cpplib.multiply_by_scalar_double(input_array, 2.0)
[15]:
VectorDouble[0.2, 2, 4]

Heres an example of returning a string

[18]:
cpplib.hello("Jeremy")
[18]:
'Hello Jeremy'