block_vector
Implementation of a general “block vector”
The pyomo.contrib.pynumero.sparse.block_vector module includes methods
that extend linear algebra operations in numpy for case of structured
problems where linear algebra operations present an inherent block
structure. This interface consider vectors of the form:
\[v = [v_1, v_2, v_3, ... , v_n]\]
where v_i are numpy arrays of dimension 1
Contents
Methods specific to BlockVector:
Attributes specific to BlockVector:
NumPy compatible methods:
For example,
>>> import numpy as np
>>> from pyomo.contrib.pynumero.sparse import BlockVector
>>> v = BlockVector(2)
>>> v.set_block(0, np.random.normal(size=100))
>>> v.set_block(1, np.random.normal(size=30))
>>> avg = v.mean()
NumPy compatible functions:
log10()
sin()
cos()
exp()
ceil()
floor()
tan()
arctan()
arcsin()
arccos()
sinh()
cosh()
abs()
tanh()
arccosh()
arcsinh()
arctanh()
fabs()
sqrt()
log()
log2()
absolute()
isfinite()
isinf()
isnan()
log1p()
logical_not()
expm1()
exp2()
sign()
rint()
square()
positive()
negative()
rad2deg()
deg2rad()
conjugate()
reciprocal()
signbit()
add()
multiply()
divide()
subtract()
greater()
greater_equal()
less()
less_equal()
not_equal()
maximum()
minimum()
fmax()
fmin()
equal()
logical_and()
logical_or()
logical_xor()
logaddexp()
logaddexp2()
remainder()
heaviside()
hypot()
For example,
>>> import numpy as np
>>> from pyomo.contrib.pynumero.sparse import BlockVector
>>> v = BlockVector(2)
>>> v.set_block(0, np.random.normal(size=100))
>>> v.set_block(1, np.random.normal(size=30))
>>> inf_norm = np.max(np.abs(v))
Classes
Exceptions
Functions