[julia-users] Linear algebra question (shift rows to the right)
Sorry if it's out of topic of the group. What is the name of the operation which makes transformation : [a b c; d e f; g h t] -> [a b c; 0 d e; 0 0 g] It shifts rows to the right and fills left trailing values by zeros.
Re: [julia-users] What is the difference between { } and [ ]? What is {}?
Thanks! Does it mean that now curly braces { } are not used anymore in the version 0.4? On Friday, September 11, 2015 at 5:53:19 PM UTC+2, Yichao Yu wrote: > > On Fri, Sep 11, 2015 at 11:39 AM, Alex M <updat...@gmail.com > > wrote: > > Hello, > > I am learning Julia. > > > > Both are arrays but of different types: > > > > julia> {} > > 0-element Array{Any,1} > > > > julia> [] > > 0-element Array{None,1} > > > > > > julia> [] == {} > > true > > > > Now I am trying to push new data : > > > > > > julia> a = [] > > julia> b = {} > > > > > > julia> push!(a,"y") > > ERROR: [] cannot grow. Instead, initialize the array with "T[]", where T > is > > the desired element type. > > in push! at array.jl:457 (repeats 2 times) > > > > > > But for [] it works: > > > > julia> push!(b,"y") > > 1-element Array{Any,1}: > > "y" > > > > > > Also using {} I can create Dictionary: > > > > julia> {"a" => 3} > > Dict{Any,Any} with 1 entry: > > "a" => 3 > > > > > > Now I am very confused. > > > > 1) What is the meaning of { } ? is it a dictionary constructor or an > array > > constructor of type Any ? > > It was `Any[]` for 0.3. Deprecated for 0.4 > > > 2) Why can't I push into [ ] ? > > Because the type is None. `[]` on 0.4 returns `Array{Any,1}` and that > isn't a problem anymore. > > > > > Thank you in advance! >
[julia-users] What is the difference between { } and [ ]? What is {}?
Hello, I am learning Julia. Both are arrays but of different types: julia> {} 0-element *Array{Any,1}* julia> [] 0-element *Array{None,1}* julia> [] == {} *true * Now I am trying to push new data : julia> a = [] julia> b = {} julia> *push!(a,"y")* *ERROR: *[] cannot grow. Instead, initialize the array with "T[]", where T is the desired element type. in push! at array.jl:457 (repeats 2 times) But for [] it works: julia> *push!(b,"y")* 1-element Array{Any,1}: "y" Also using {} I can create Dictionary: julia> *{"a" => 3}* *Dict{Any,Any} with 1 entry:* "a" => 3 Now I am very confused. 1) What is the meaning of { } ? is it a dictionary constructor or an array constructor of type Any ? 2) Why can't I push into [ ] ? Thank you in advance!
[julia-users] Error in the Dict type declaration
Hello, I am trying to attach the type for a variable like that: julia> a::Dict{String, Array{Float64}} = { "y" => Float64[1.0, 2.0]} ERROR: type: typeassert: expected Dict{String,Array{Float64,N}}, got Array{Float64,1} julia> a::Dict{String, Array{Float64}} = { "y" => [1.0, 2.0]} ERROR: type: typeassert: expected Dict{String,Array{Float64,N}}, got Array{Float64,1} Why is it an error? Best regards, Alex