I am a bit new to Julia but I have some knowledge in Python. I am now learning Julia and I want to know how to represent the Python function "zeros_like" from Numpy in Julia. The python code is below:
import numpy as np
a = [3] #vector of one number
b = np.zeros_like(a)
Base.zero
function returns the zero element (the "additive identity element" in the doc) for the type of its input argument:
julia> a = [3]
1-element Array{Int64,1}:
3
julia> zero(a)
1-element Array{Int64,1}:
0
or
julia> zeros(Int, size(a))
1-element Array{Int64,1}:
0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With