How do I get Julia to treat all elements of matrices as "floats" (like C type float)


#1

I have code that typically looks like the one below.
How do I get Julia to treat all matrix entries and consecutive algebra as “floats”, like in C declaration; float A (as opposed to “double” or any other type)

# Pseudo code example:
i = 4                 # Initialize system size
j = 4

A = zeros(i,j)	      # Matrix initialization 
X =  zeros(i,j)
Y =  zeros(i,j)

# A and X get some values
# <some code>
#

AT = transpose(A)
Y = A*X*AT

# <more code>

#2
julia> # type "? zeros" to get help on zeros function

help?> zeros
search: zeros spzeros nonzeros dropzeros dropzeros! count_zeros set_zero_subnormals get_zero_subnormals leading_zeros trailing_zeros zero RoundToZero RoundFromZero

  zeros(type, dims)

  Create an array of all zeros of specified type. The type defaults to Float64 if not specified.

  zeros(A)

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

julia> zeros(Float32,4,4)
4×4 Array{Float32,2}:
 0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0
 0.0  0.0  0.0  0.0

julia> 


#3

You can pass the type at the beginning of the constructor in zeros

...
A = zeros(Float32,i,j)	      # Matrix initialization 
X =  zeros(Float32,i,j)
Y =  zeros(Float32,i,j)
...