Hi all,
I would like to ask why there is a difference between Octave diag function 
and the function that julia provide. For example, in the following Octave 
session I get:

============================
octave:1> v = [1 2 3 4]
v =

   1   2   3   4

octave:2> a = diag(v)
a =

Diagonal Matrix

   1   0   0   0
   0   2   0   0
   0   0   3   0
   0   0   0   4
=============================

But in Julia I get:

=============================
julia> v = [1 2 3 4]
1x4 Array{Int64,2}:
 1  2  3  4

julia> a = diag(v)
1-element Array{Int64,1}:
 1


=============================


Why is this the case and how to get a similar effect of the octave code. 
Thank you.

Reply via email to