Coverage for docs/source/examples/vectorization.py: 100%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"Example Vectorize usage, from gpkit/tests/t_vars.py"
2from gpkit import Variable, Vectorize, VectorVariable
4with Vectorize(3):
5 with Vectorize(5):
6 y = Variable("y")
7 x = VectorVariable(2, "x")
8 z = VectorVariable(7, "z")
10assert(y.shape == (5, 3))
11assert(x.shape == (2, 5, 3))
12assert(z.shape == (7, 3))