julia_array: Create Julia Arrays.

Description Usage Arguments Details Examples

Description

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.

Usage

1
julia_array(data, n1, n2, ...)

Arguments

data

the data to create the array.

n1, n2, ...

the dimensions.

Details

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.

Examples

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

Non-Contradiction/autodiffr documentation built on May 10, 2019, 8:04 a.m.