# LowRankApprox.jl and sketch.jl

I only need to compute the sketching step below in pseudo-code:

``````function f(Q::StridedMatrix{Float32}, Qv::StridedVector{Float32},
Sv::StridedVector{Float32}, order::Int)
opts = LRAOptions()
opts.sketch = :randn
Sv[:,:] = sketch(:left, :n, Qv[:,:], order, opts)
mul!(Qv, Q, ...)
Sv[:,:] = sketch(:left, :n, Qv[:,:], order, opts)
end
``````

As you can see, Sv and Qv have to be update in-place. And this function is called in the loop below

``````A = randn(Float32, n, m)
order = 5*m
Q = deepcopy(A)
S = zeros(Formats[2], order, m)
for k in 1:m
f(view(Q, :, 1:k-1), view(Q, :, k),
view(S, :, k), order)
end
``````
1. Avoid regeneration of the random Gaussian Matrix
So I am calling 2m times the sketch() function how has to generate 2m times a random Gaussian matrix. There is a way to reuse the same Gaussian matrix without re-generate her? (Random.seed!() will not do the trick).
2. In case of a mixed precision process
when (typeof(Q)=typeof(Qv)) != typeof(Sv) for example:
``````f(Q::StridedMatrix{Float32}, Qv::StridedVector{Float32},
Sv::StridedVector{Float64}, order::Int)
``````

I will have to convert Qv into a Float64 Vector object-like, but there is no such method in julia when input type is a Strided object-like, right?