Initialization
Constructors for new NDArrays. Default floating-point type is Float32.
zeros
cuNumeric.zeros Function
cuNumeric.zeros([T=Float32,] dims::Int...)
cuNumeric.zeros([T=Float32,] dims::Tuple)Create an NDArray with element type T, of all zeros with size specified by dims. The default type is Float32 if not specified.
Examples
cuNumeric.zeros(2, 2)
cuNumeric.zeros(Float64, 3)
cuNumeric.zeros(Int32, (2,3))ones
cuNumeric.ones Function
cuNumeric.ones([T=Float32,] dims::Int...)
cuNumeric.ones([T=Float32,] dims::Tuple)Create an NDArray with element type T, of all zeros with size specified by dims. The default type is Float32 if not specified.
Examples
cuNumeric.ones(2, 2)
cuNumeric.ones(Float32, 3)
cuNumeric.ones(Int32, (2, 3))fill
cuNumeric.fill Function
cuNumeric.fill(val::T, dims::Dims)
cuNumeric.fill(val::T, dims::Int...)Create an NDArray filled with the scalar value val, with the shape specified by dims.
Examples
cuNumeric.fill(7.5, (2, 3))
cuNumeric.fill(0, 4)trues
cuNumeric.trues Function
cuNumeric.trues(dims::Tuple, val)
cuNumeric.trues(dim::Int, val)
cuNumeric.trues(dims::Int...)Create an NDArray filled with the true, with the shape specified by dims.
Examples
cuNumeric.trues(2, 3)falses
cuNumeric.falses Function
cuNumeric.falses(dims::Tuple, val)
cuNumeric.falses(dim::Int, val)
cuNumeric.falses(dims::Int...)Create an NDArray filled with the false, with the shape specified by dims.
Examples
cuNumeric.falses(2, 3)eye
cuNumeric.eye Function
cuNumeric.eye([T=Float32,] rows::Int)Create a 2D identity NDArray of size rows × rows with element type T. The default type is Float32 if not specified.
rand
cuNumeric.rand Function
cuNumeric.rand([T=Float32,] dims::Int...)
cuNumeric.rand([T=Float32,] dims::Tuple)Create a new NDArray filled with uniform random values.
The backend currently supports only Float64 draws. Other floating types are converted automatically.
Examples
cuNumeric.rand(2, 2)
cuNumeric.rand((4, 1))
A = cuNumeric.zeros(Float64, 2, 2); cuNumeric.rand!(A)rand!
Random.rand! Method
cuNumeric.rand!(arr::NDArray{Float64})Fill arr in-place with uniform random Float64 values.
The backend currently draws Float64 uniforms. cuNumeric.rand(Float32, dims...) converts for you. rand! on NDArray currently requires Float64 storage.