Hi, I have two questions.
First question: I have a fairly simple problem which can be solved in many ways. To begin I have a vector z1=Array(Float64,1,0) I have Z=1:0.01:100 I would like to generate a vector in which each element is repeated length(Z) times i.e., [1 1 1 1....length(Z) times 1.01 1.01 1.01....length(Z) times and so on When I do for j=1:length(Z) z1=[z1 repmat([Z[j]],1,length(Z)] end and compare the time for this exact code with Matlab's/Octave, Julia takes 7 seconds in comparison to 1.5 seconds for Matlab/Octave. Of course I did not see any improvement using z1=[z1 ones(1,length(Z))*Z[j]] It took practically the same time. However, this reduced to fraction of a second...i.e., after I generated a vector of zeros and just replaced the zeros appropriately. z1=zeros(1,length(Z)^2) length(Z)=dd for j=1:dd v=1:dd:(dd-1)*dd z1[1,v[j]:(v[j+dd-1])]=Z[j]; end Of course even Octave/Matlab became equally fast with this code. So what gives in repmat for Julia? Why is it slow? Have I gone wrong with my first code? Question 2: If I start with A=[] How do I vcat or hcat a row or a column vector to A in a for loop form a MATRIX. say my vector is A(10x1) and I want to make B=[A[1] A[2] A[3] A[4]] which is a 10x4 matrix. In Octave I would do B=[] B=[B A[j]] in a for loop. Thanks
