-
Notifications
You must be signed in to change notification settings - Fork 439
L_1wi
[INTERNAL]::
mapaccum(self, int N, dict opts) -> Function mapaccum(self, str name, int N, dict opts) -> Function mapaccum(self, str name, int N, int n_accum, dict opts) -> Function mapaccum(self, str name, int n, [str] accum_in, [str] accum_out, dict opts) -> Function mapaccum(self, str name, int n, [int] accum_in, [int] accum_out, dict opts) -> FunctionCreate a mapaccumulated version of this function.
Suppose the function has a signature of:
::
f: (x, u) -> (x_next , y )The the mapaccumulated version has the signature:
::
F: (x0, U) -> (X , Y ) with U: horzcat([u0, u1, ..., u_(N-1)]) X: horzcat([x1, x2, ..., x_N]) Y: horzcat([y0, y1, ..., y_(N-1)]) and x1, y0 <- f(x0, u0) x2, y1 <- f(x1, u1) ... x_N, y_(N-1) <- f(x_(N-1), u_(N-1))Mapaccum has the following benefits over writing an equivalent for- loop:
much faster at construction time
potentially much faster compilation times (for codegen)
offers a trade-off between memory and evaluation time
The base (settable through the options dictionary, default 10), is used to create a tower of function calls, containing unrolled for- loops of length maximum base.
This technique is much more scalable in terms of memory-usage, but slightly slower at evaluation, than a plain for-loop. The effect is similar to that of a for-loop with a check-pointing instruction after each chunk of iterations with size base.
Set base to -1 to unroll all the way; no gains in memory efficiency here.
.......
::
mapaccum(self, int N, dict opts)[INTERNAL] Create a mapaccumulated version of this function.
Suppose the function has a signature of:
::
f: (x, u) -> (x_next , y )The the mapaccumulated version has the signature:
::
F: (x0, U) -> (X , Y ) with U: horzcat([u0, u1, ..., u_(N-1)]) X: horzcat([x1, x2, ..., x_N]) Y: horzcat([y0, y1, ..., y_(N-1)]) and x1, y0 <- f(x0, u0) x2, y1 <- f(x1, u1) ... x_N, y_(N-1) <- f(x_(N-1), u_(N-1))Mapaccum has the following benefits over writing an equivalent for- loop:
much faster at construction time
potentially much faster compilation times (for codegen)
offers a trade-off between memory and evaluation time
The base (settable through the options dictionary, default 10), is used to create a tower of function calls, containing unrolled for- loops of length maximum base.
This technique is much more scalable in terms of memory-usage, but slightly slower at evaluation, than a plain for-loop. The effect is similar to that of a for-loop with a check-pointing instruction after each chunk of iterations with size base.
Set base to -1 to unroll all the way; no gains in memory efficiency here.
.............
.......
::
mapaccum(self, str name, int N, dict opts)[INTERNAL] Create a mapaccumulated version of this function.
Suppose the function has a signature of:
::
f: (x, u) -> (x_next , y )The the mapaccumulated version has the signature:
::
F: (x0, U) -> (X , Y ) with U: horzcat([u0, u1, ..., u_(N-1)]) X: horzcat([x1, x2, ..., x_N]) Y: horzcat([y0, y1, ..., y_(N-1)]) and x1, y0 <- f(x0, u0) x2, y1 <- f(x1, u1) ... x_N, y_(N-1) <- f(x_(N-1), u_(N-1))Mapaccum has the following benefits over writing an equivalent for- loop:
much faster at construction time
potentially much faster compilation times (for codegen)
offers a trade-off between memory and evaluation time
The base (settable through the options dictionary, default 10), is used to create a tower of function calls, containing unrolled for- loops of length maximum base.
This technique is much more scalable in terms of memory-usage, but slightly slower at evaluation, than a plain for-loop. The effect is similar to that of a for-loop with a check-pointing instruction after each chunk of iterations with size base.
Set base to -1 to unroll all the way; no gains in memory efficiency here.
.............
.......
::
mapaccum(self, str name, int N, int n_accum, dict opts)[INTERNAL] Create a mapaccumulated version of this function.
Suppose the function has a signature of:
::
f: (x, u) -> (x_next , y )The the mapaccumulated version has the signature:
::
F: (x0, U) -> (X , Y ) with U: horzcat([u0, u1, ..., u_(N-1)]) X: horzcat([x1, x2, ..., x_N]) Y: horzcat([y0, y1, ..., y_(N-1)]) and x1, y0 <- f(x0, u0) x2, y1 <- f(x1, u1) ... x_N, y_(N-1) <- f(x_(N-1), u_(N-1))Mapaccum has the following benefits over writing an equivalent for- loop:
much faster at construction time
potentially much faster compilation times (for codegen)
offers a trade-off between memory and evaluation time
The base (settable through the options dictionary, default 10), is used to create a tower of function calls, containing unrolled for- loops of length maximum base.
This technique is much more scalable in terms of memory-usage, but slightly slower at evaluation, than a plain for-loop. The effect is similar to that of a for-loop with a check-pointing instruction after each chunk of iterations with size base.
Set base to -1 to unroll all the way; no gains in memory efficiency here.
.............
.......
::
mapaccum(self, str name, int n, [str] accum_in, [str] accum_out, dict opts)[INTERNAL] Create a mapaccumulated version of this function.
Suppose the function has a signature of:
::
f: (x, u) -> (x_next , y )The the mapaccumulated version has the signature:
::
F: (x0, U) -> (X , Y ) with U: horzcat([u0, u1, ..., u_(N-1)]) X: horzcat([x1, x2, ..., x_N]) Y: horzcat([y0, y1, ..., y_(N-1)]) and x1, y0 <- f(x0, u0) x2, y1 <- f(x1, u1) ... x_N, y_(N-1) <- f(x_(N-1), u_(N-1))Mapaccum has the following benefits over writing an equivalent for- loop:
much faster at construction time
potentially much faster compilation times (for codegen)
offers a trade-off between memory and evaluation time
The base (settable through the options dictionary, default 10), is used to create a tower of function calls, containing unrolled for- loops of length maximum base.
This technique is much more scalable in terms of memory-usage, but slightly slower at evaluation, than a plain for-loop. The effect is similar to that of a for-loop with a check-pointing instruction after each chunk of iterations with size base.
Set base to -1 to unroll all the way; no gains in memory efficiency here.
.............
.......
::
mapaccum(self, str name, int n, [int] accum_in, [int] accum_out, dict opts)[INTERNAL] Create a mapaccumulated version of this function.
Suppose the function has a signature of:
::
f: (x, u) -> (x_next , y )The the mapaccumulated version has the signature:
::
F: (x0, U) -> (X , Y ) with U: horzcat([u0, u1, ..., u_(N-1)]) X: horzcat([x1, x2, ..., x_N]) Y: horzcat([y0, y1, ..., y_(N-1)]) and x1, y0 <- f(x0, u0) x2, y1 <- f(x1, u1) ... x_N, y_(N-1) <- f(x_(N-1), u_(N-1))Mapaccum has the following benefits over writing an equivalent for- loop:
much faster at construction time
potentially much faster compilation times (for codegen)
offers a trade-off between memory and evaluation time
The base (settable through the options dictionary, default 10), is used to create a tower of function calls, containing unrolled for- loops of length maximum base.
This technique is much more scalable in terms of memory-usage, but slightly slower at evaluation, than a plain for-loop. The effect is similar to that of a for-loop with a check-pointing instruction after each chunk of iterations with size base.
Set base to -1 to unroll all the way; no gains in memory efficiency here.
.............
[INTERNAL]::
fold(self, int N, dict opts) -> FunctionCreate a mapaccumulated version of this function.
Suppose the function has a signature of:
::
f: (x, u) -> (x_next , y )The the mapaccumulated version has the signature:
::
F: (x0, U) -> (X , Y ) with U: horzcat([u0, u1, ..., u_(N-1)]) X: horzcat([x1, x2, ..., x_N]) Y: horzcat([y0, y1, ..., y_(N-1)]) and x1, y0 <- f(x0, u0) x2, y1 <- f(x1, u1) ... x_N, y_(N-1) <- f(x_(N-1), u_(N-1))Mapaccum has the following benefits over writing an equivalent for- loop:
much faster at construction time
potentially much faster compilation times (for codegen)
offers a trade-off between memory and evaluation time
The base (settable through the options dictionary, default 10), is used to create a tower of function calls, containing unrolled for- loops of length maximum base.
This technique is much more scalable in terms of memory-usage, but slightly slower at evaluation, than a plain for-loop. The effect is similar to that of a for-loop with a check-pointing instruction after each chunk of iterations with size base.
Set base to -1 to unroll all the way; no gains in memory efficiency here.
To edit, see writing tips.