Description Usage Arguments Details Examples
julia_array
is a helper function to create Julia arrays including vectors, matrices and etc.
And it can be used in functions to facilitate automatic differentiation.
1 | julia_array(data, n1, n2, ...)
|
data |
the data to create the array. |
n1, n2, ... |
the dimensions. |
If n1 is missing, then all the dimensions will be ignored, and the result will be a Julia array coresponding to the data argument. If n1, n2, ... are given, they will determine the shape of the result, and data will be used for the content.
1 2 3 4 5 | ## setup is quite time consuming
julia_array(0, 3) ## will return a Julia vector with length 3 and filled with 0
julia_array(0, 3, 4) ## will return a Julia matrix of 3x4 and filled with 0
julia_array(matrix(1, 2, 2)) ## dimension is not given, will return a Julia matrix
julia_array(matrix(1, 2, 2), 4) ## dimension is given, will return a Julia vector
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.