ones(A)

ones(A)

Create an array of all ones with the same element type and shape as A.

Examples

julia> ones(Float16, (2,2))
2x2 Array{Float16,2}:
 1.0    1.0
 1.0    1.0
julia> foo = zeros(Int8, 2);
julia> ones(foo)
2-element Array{Int8,1}:
 1
 1

See Also

Array, broadcast, cat, combinations, conj!, digits!, fieldnames, fill, fill!, last, length, maximum, minimum, ones, parent, parentindexes, partitions, permutations, pointer, pointer_to_array, promote_shape, rand!, reshape, scale, similar, sum, sum_kbn, takebuf_array, transpose!, vec, zeros,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: