Of course, that's the best way to do it -- Thanks.
-- mb
On Tue, Oct 14, 2014 at 7:34 AM, Johan Sigfrids
wrote:
> You can tell ones to construct a array on Ints by passing it a type
> parameter:
>
> ones(Int, 1, 3)
>
> With a length of three it doesn't make much difference but with a bigger
> a
You can tell ones to construct a array on Ints by passing it a type
parameter:
ones(Int, 1, 3)
With a length of three it doesn't make much difference but with a bigger
array you save a lot of time avoiding the conversion.
On Tuesday, October 14, 2014 3:14:38 AM UTC+3, Miguel Bazdresch wrote:
>
Just wanted to point out a little-known way to achieve the same with the
`kron` (Kronecker product) command:
julia> x=[1 2 3 4]
1x4 Array{Int64,2}:
1 2 3 4
julia> kron(x,int(ones(1,3)))
1x12 Array{Int64,2}:
1 1 1 2 2 2 3 3 3 4 4 4
-- mb
On Mon, Oct 13, 2014 at 6:05 PM, Rajn wro
Hi Rajn
First of all, I think you might have a typo in your range. Alternatively,
you computer is quite a bit faster than mine. If I set Z = 1:0.1:100
instead, the timings match yours.
Your solution for constructing z1 must win the prize for most inefficient
solution possible :-). Also, please no
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 1length(Z) time