Re: [julia-users] SymTridiagonal
Semantically, ones(n,1) creates a vector and not a matrix. Why is ones(n,1) different from ones(n)? The type system is very confusing and non-intuitive. On Sunday, November 16, 2014 7:28:28 PM UTC-5, Andreas Noack wrote: The input should be two Vectors, but your first argument is a Matrix 2014-11-16 19:25 GMT-05:00 Eka Palamadai ekan...@gmail.com javascript: : SymTridiagonal does not seem to work properly. For e.g, the following snippet fails. julia n=10 ; A=SymTridiagonal(2*ones(n,1), -1*ones(n-1)); ERROR: `convert` has no method matching convert(::Type{SymTridiagonal{T}}, ::Array{Float64,2}, ::Array{Float64,1}) in call at base.jl:34 Any thoughts?
Re: [julia-users] SymTridiagonal
Semantically, ones(n,1) creates a vector and not a matrix. I'd rather say that in MATLAB ones(n,1) creates a vector. This has been discussed many times on the list and in issues. In particular, see the famous https://github.com/JuliaLang/julia/issues/4774. In Julia, Vector{T} and Matrix{T} are aliases for Array{T,1} and Array{T,2} which I think is reasonable. The questions are to what extend a nx1 Matrix should work similarly to a Vector and a Vector should work similarly to a nx1 Matrix. That is the discussion in the issue mentioned, and it is actually more subtle than one would expect. 2014-11-17 12:04 GMT-05:00 Eka Palamadai ekanat...@gmail.com: Semantically, ones(n,1) creates a vector and not a matrix. Why is ones(n,1) different from ones(n)? The type system is very confusing and non-intuitive. On Sunday, November 16, 2014 7:28:28 PM UTC-5, Andreas Noack wrote: The input should be two Vectors, but your first argument is a Matrix 2014-11-16 19:25 GMT-05:00 Eka Palamadai ekan...@gmail.com: SymTridiagonal does not seem to work properly. For e.g, the following snippet fails. julia n=10 ; A=SymTridiagonal(2*ones(n,1), -1*ones(n-1)); ERROR: `convert` has no method matching convert(::Type{SymTridiagonal{T}}, ::Array{Float64,2}, ::Array{Float64,1}) in call at base.jl:34 Any thoughts?
Re: [julia-users] SymTridiagonal
which I think is reasonable is a subjective argument. It would be helpful if the type system is intuitive and non-confusing to programmers. On Monday, November 17, 2014 12:24:58 PM UTC-5, Andreas Noack wrote: Semantically, ones(n,1) creates a vector and not a matrix. I'd rather say that in MATLAB ones(n,1) creates a vector. This has been discussed many times on the list and in issues. In particular, see the famous https://github.com/JuliaLang/julia/issues/4774 . In Julia, Vector{T} and Matrix{T} are aliases for Array{T,1} and Array{T,2} which I think is reasonable. The questions are to what extend a nx1 Matrix should work similarly to a Vector and a Vector should work similarly to a nx1 Matrix. That is the discussion in the issue mentioned, and it is actually more subtle than one would expect. 2014-11-17 12:04 GMT-05:00 Eka Palamadai ekan...@gmail.com javascript: : Semantically, ones(n,1) creates a vector and not a matrix. Why is ones(n,1) different from ones(n)? The type system is very confusing and non-intuitive. On Sunday, November 16, 2014 7:28:28 PM UTC-5, Andreas Noack wrote: The input should be two Vectors, but your first argument is a Matrix 2014-11-16 19:25 GMT-05:00 Eka Palamadai ekan...@gmail.com: SymTridiagonal does not seem to work properly. For e.g, the following snippet fails. julia n=10 ; A=SymTridiagonal(2*ones(n,1), -1*ones(n-1)); ERROR: `convert` has no method matching convert(::Type{SymTridiagonal{T}}, ::Array{Float64,2}, ::Array{Float64,1}) in call at base.jl:34 Any thoughts?
Re: [julia-users] SymTridiagonal
What's intuitive is very dependent upon your background. If you're coming from Matlab, for example, everything is a matrix and Matlab does this extraordinarily-confusing thing: ones(3,3,3) gives me a 3d array; ones(3,3) gives me a 2d array; but ones(3) ans = 1 1 1 1 1 1 1 1 1 Why the heck did it give me a 2d matrix when I asked for a 1-dimensional vector of 1s? Julia is much more consistent: the dimensionality of the created object is equal to the number of indices you supply. If you ask for something that's 3x1, that's the size you'll get out; perforce, that is a 2d array. --Tim On Monday, November 17, 2014 09:41:10 AM Eka Palamadai wrote: which I think is reasonable is a subjective argument. It would be helpful if the type system is intuitive and non-confusing to programmers. On Monday, November 17, 2014 12:24:58 PM UTC-5, Andreas Noack wrote: Semantically, ones(n,1) creates a vector and not a matrix. I'd rather say that in MATLAB ones(n,1) creates a vector. This has been discussed many times on the list and in issues. In particular, see the famous https://github.com/JuliaLang/julia/issues/4774 . In Julia, Vector{T} and Matrix{T} are aliases for Array{T,1} and Array{T,2} which I think is reasonable. The questions are to what extend a nx1 Matrix should work similarly to a Vector and a Vector should work similarly to a nx1 Matrix. That is the discussion in the issue mentioned, and it is actually more subtle than one would expect. 2014-11-17 12:04 GMT-05:00 Eka Palamadai ekan...@gmail.com javascript: Semantically, ones(n,1) creates a vector and not a matrix. Why is ones(n,1) different from ones(n)? The type system is very confusing and non-intuitive. On Sunday, November 16, 2014 7:28:28 PM UTC-5, Andreas Noack wrote: The input should be two Vectors, but your first argument is a Matrix 2014-11-16 19:25 GMT-05:00 Eka Palamadai ekan...@gmail.com: SymTridiagonal does not seem to work properly. For e.g, the following snippet fails. julia n=10 ; A=SymTridiagonal(2*ones(n,1), -1*ones(n-1)); ERROR: `convert` has no method matching convert(::Type{SymTridiagonal{T}}, ::Array{Float64,2}, ::Array{Float64,1}) in call at base.jl:34 Any thoughts?
Re: [julia-users] SymTridiagonal
I don't know what matlab does. As a user, ones(n,1) and ones(n) both return me a vector, and it is confusing to find that ones(n,1) != ones(n). On Monday, November 17, 2014 12:53:25 PM UTC-5, Tim Holy wrote: What's intuitive is very dependent upon your background. If you're coming from Matlab, for example, everything is a matrix and Matlab does this extraordinarily-confusing thing: ones(3,3,3) gives me a 3d array; ones(3,3) gives me a 2d array; but ones(3) ans = 1 1 1 1 1 1 1 1 1 Why the heck did it give me a 2d matrix when I asked for a 1-dimensional vector of 1s? Julia is much more consistent: the dimensionality of the created object is equal to the number of indices you supply. If you ask for something that's 3x1, that's the size you'll get out; perforce, that is a 2d array. --Tim On Monday, November 17, 2014 09:41:10 AM Eka Palamadai wrote: which I think is reasonable is a subjective argument. It would be helpful if the type system is intuitive and non-confusing to programmers. On Monday, November 17, 2014 12:24:58 PM UTC-5, Andreas Noack wrote: Semantically, ones(n,1) creates a vector and not a matrix. I'd rather say that in MATLAB ones(n,1) creates a vector. This has been discussed many times on the list and in issues. In particular, see the famous https://github.com/JuliaLang/julia/issues/4774 . In Julia, Vector{T} and Matrix{T} are aliases for Array{T,1} and Array{T,2} which I think is reasonable. The questions are to what extend a nx1 Matrix should work similarly to a Vector and a Vector should work similarly to a nx1 Matrix. That is the discussion in the issue mentioned, and it is actually more subtle than one would expect. 2014-11-17 12:04 GMT-05:00 Eka Palamadai ekan...@gmail.com javascript: Semantically, ones(n,1) creates a vector and not a matrix. Why is ones(n,1) different from ones(n)? The type system is very confusing and non-intuitive. On Sunday, November 16, 2014 7:28:28 PM UTC-5, Andreas Noack wrote: The input should be two Vectors, but your first argument is a Matrix 2014-11-16 19:25 GMT-05:00 Eka Palamadai ekan...@gmail.com: SymTridiagonal does not seem to work properly. For e.g, the following snippet fails. julia n=10 ; A=SymTridiagonal(2*ones(n,1), -1*ones(n-1)); ERROR: `convert` has no method matching convert(::Type{SymTridiagonal{T}}, ::Array{Float64,2}, ::Array{Float64,1}) in call at base.jl:34 Any thoughts?
Re: [julia-users] SymTridiagonal
Your best bet, then, is to decide as quickly as possible whether you want to use Julia. If you start reading here: http://docs.julialang.org/en/latest/manual/faq/#what-does-type-stable-mean you'll maximize your chances of quickly discovering other things that will likely annoy you :-). While only the section I directly linked to is necessary to understand why `ones(n,1)` can't return a Vector, you should also be sure to read the next 2 sections on DomainErrors and machine arithmetic, just to make sure you've drunk the full cup's worth of annoyance. Then you'll be in a good position to make an informed judgment about whether you want to accept the hassles in exchange for the benefits the type system provides. Best, --Tim On Monday, November 17, 2014 10:02:07 AM Eka Palamadai wrote: I don't know what matlab does. As a user, ones(n,1) and ones(n) both return me a vector, and it is confusing to find that ones(n,1) != ones(n). On Monday, November 17, 2014 12:53:25 PM UTC-5, Tim Holy wrote: What's intuitive is very dependent upon your background. If you're coming from Matlab, for example, everything is a matrix and Matlab does this extraordinarily-confusing thing: ones(3,3,3) gives me a 3d array; ones(3,3) gives me a 2d array; but ones(3) ans = 1 1 1 1 1 1 1 1 1 Why the heck did it give me a 2d matrix when I asked for a 1-dimensional vector of 1s? Julia is much more consistent: the dimensionality of the created object is equal to the number of indices you supply. If you ask for something that's 3x1, that's the size you'll get out; perforce, that is a 2d array. --Tim On Monday, November 17, 2014 09:41:10 AM Eka Palamadai wrote: which I think is reasonable is a subjective argument. It would be helpful if the type system is intuitive and non-confusing to programmers. On Monday, November 17, 2014 12:24:58 PM UTC-5, Andreas Noack wrote: Semantically, ones(n,1) creates a vector and not a matrix. I'd rather say that in MATLAB ones(n,1) creates a vector. This has been discussed many times on the list and in issues. In particular, see the famous https://github.com/JuliaLang/julia/issues/4774 . In Julia, Vector{T} and Matrix{T} are aliases for Array{T,1} and Array{T,2} which I think is reasonable. The questions are to what extend a nx1 Matrix should work similarly to a Vector and a Vector should work similarly to a nx1 Matrix. That is the discussion in the issue mentioned, and it is actually more subtle than one would expect. 2014-11-17 12:04 GMT-05:00 Eka Palamadai ekan...@gmail.com javascript: Semantically, ones(n,1) creates a vector and not a matrix. Why is ones(n,1) different from ones(n)? The type system is very confusing and non-intuitive. On Sunday, November 16, 2014 7:28:28 PM UTC-5, Andreas Noack wrote: The input should be two Vectors, but your first argument is a Matrix 2014-11-16 19:25 GMT-05:00 Eka Palamadai ekan...@gmail.com: SymTridiagonal does not seem to work properly. For e.g, the following snippet fails. julia n=10 ; A=SymTridiagonal(2*ones(n,1), -1*ones(n-1)); ERROR: `convert` has no method matching convert(::Type{SymTridiagonal{T}}, ::Array{Float64,2}, ::Array{Float64,1}) in call at base.jl:34 Any thoughts?
Re: [julia-users] SymTridiagonal
On Monday, November 17, 2014 12:02:07 PM UTC-6, Eka Palamadai wrote: I don't know what matlab does. As a user, ones(n,1) and ones(n) both return me a vector, and it is confusing to find that ones(n,1) != ones(n). As Andreas and Tim have tried to say, your claim that ones(n,1) and ones(n) both return me a vector is incorrect. julia ones(3,1) 3x1 Array{Float64,2}: 1.0 1.0 1.0 julia ones(3) 3-element Array{Float64,1}: 1.0 1.0 1.0 The first is a matrix with 3 rows and 1 column. The second is a vector. That's why they are not equal. On Monday, November 17, 2014 12:53:25 PM UTC-5, Tim Holy wrote: What's intuitive is very dependent upon your background. If you're coming from Matlab, for example, everything is a matrix and Matlab does this extraordinarily-confusing thing: ones(3,3,3) gives me a 3d array; ones(3,3) gives me a 2d array; but ones(3) ans = 1 1 1 1 1 1 1 1 1 Why the heck did it give me a 2d matrix when I asked for a 1-dimensional vector of 1s? Julia is much more consistent: the dimensionality of the created object is equal to the number of indices you supply. If you ask for something that's 3x1, that's the size you'll get out; perforce, that is a 2d array. --Tim On Monday, November 17, 2014 09:41:10 AM Eka Palamadai wrote: which I think is reasonable is a subjective argument. It would be helpful if the type system is intuitive and non-confusing to programmers. On Monday, November 17, 2014 12:24:58 PM UTC-5, Andreas Noack wrote: Semantically, ones(n,1) creates a vector and not a matrix. I'd rather say that in MATLAB ones(n,1) creates a vector. This has been discussed many times on the list and in issues. In particular, see the famous https://github.com/JuliaLang/julia/issues/4774 . In Julia, Vector{T} and Matrix{T} are aliases for Array{T,1} and Array{T,2} which I think is reasonable. The questions are to what extend a nx1 Matrix should work similarly to a Vector and a Vector should work similarly to a nx1 Matrix. That is the discussion in the issue mentioned, and it is actually more subtle than one would expect. 2014-11-17 12:04 GMT-05:00 Eka Palamadai ekan...@gmail.com javascript: Semantically, ones(n,1) creates a vector and not a matrix. Why is ones(n,1) different from ones(n)? The type system is very confusing and non-intuitive. On Sunday, November 16, 2014 7:28:28 PM UTC-5, Andreas Noack wrote: The input should be two Vectors, but your first argument is a Matrix 2014-11-16 19:25 GMT-05:00 Eka Palamadai ekan...@gmail.com: SymTridiagonal does not seem to work properly. For e.g, the following snippet fails. julia n=10 ; A=SymTridiagonal(2*ones(n,1), -1*ones(n-1)); ERROR: `convert` has no method matching convert(::Type{SymTridiagonal{T}}, ::Array{Float64,2}, ::Array{Float64,1}) in call at base.jl:34 Any thoughts?
Re: [julia-users] SymTridiagonal
As a user, ones(n,1) and ones(n) both return me a vector, and it is confusing to find that ones(n,1) != ones(n) I was where you are now a few months ago. It's a learning cure thing, I think, because now I don't make that mistake anymore or I'm like, oh yea, of course and change it 2 seconds later. But to a new user it can be uninviting and not easily solved with just more documentation. The question to me is what is the tradeoff? For a semi-experienced user like me, it looks like Julia is trying to pick a spot of convenience while trying to retain access to optimization. The convenience part is the REPL, no requirement for variable type declaration, no function type return declaration, and on the other hand types and an options for variable type declaration to allow the JIT to better optimize. Your experience sits right where those to conflicting things are fighting it out right now, and this wall-of-text doesn't help you out any. I think this might be helped by having more verbose error messages (optionally).
Re: [julia-users] SymTridiagonal
Thanks. Fortunately (or unfortunately) i have to use julia, and will have to make noise where something is confusing. On Monday, November 17, 2014 1:26:09 PM UTC-5, Tim Holy wrote: Your best bet, then, is to decide as quickly as possible whether you want to use Julia. If you start reading here: http://docs.julialang.org/en/latest/manual/faq/#what-does-type-stable-mean you'll maximize your chances of quickly discovering other things that will likely annoy you :-). While only the section I directly linked to is necessary to understand why `ones(n,1)` can't return a Vector, you should also be sure to read the next 2 sections on DomainErrors and machine arithmetic, just to make sure you've drunk the full cup's worth of annoyance. Then you'll be in a good position to make an informed judgment about whether you want to accept the hassles in exchange for the benefits the type system provides. Best, --Tim On Monday, November 17, 2014 10:02:07 AM Eka Palamadai wrote: I don't know what matlab does. As a user, ones(n,1) and ones(n) both return me a vector, and it is confusing to find that ones(n,1) != ones(n). On Monday, November 17, 2014 12:53:25 PM UTC-5, Tim Holy wrote: What's intuitive is very dependent upon your background. If you're coming from Matlab, for example, everything is a matrix and Matlab does this extraordinarily-confusing thing: ones(3,3,3) gives me a 3d array; ones(3,3) gives me a 2d array; but ones(3) ans = 1 1 1 1 1 1 1 1 1 Why the heck did it give me a 2d matrix when I asked for a 1-dimensional vector of 1s? Julia is much more consistent: the dimensionality of the created object is equal to the number of indices you supply. If you ask for something that's 3x1, that's the size you'll get out; perforce, that is a 2d array. --Tim On Monday, November 17, 2014 09:41:10 AM Eka Palamadai wrote: which I think is reasonable is a subjective argument. It would be helpful if the type system is intuitive and non-confusing to programmers. On Monday, November 17, 2014 12:24:58 PM UTC-5, Andreas Noack wrote: Semantically, ones(n,1) creates a vector and not a matrix. I'd rather say that in MATLAB ones(n,1) creates a vector. This has been discussed many times on the list and in issues. In particular, see the famous https://github.com/JuliaLang/julia/issues/4774 . In Julia, Vector{T} and Matrix{T} are aliases for Array{T,1} and Array{T,2} which I think is reasonable. The questions are to what extend a nx1 Matrix should work similarly to a Vector and a Vector should work similarly to a nx1 Matrix. That is the discussion in the issue mentioned, and it is actually more subtle than one would expect. 2014-11-17 12:04 GMT-05:00 Eka Palamadai ekan...@gmail.com javascript: Semantically, ones(n,1) creates a vector and not a matrix. Why is ones(n,1) different from ones(n)? The type system is very confusing and non-intuitive. On Sunday, November 16, 2014 7:28:28 PM UTC-5, Andreas Noack wrote: The input should be two Vectors, but your first argument is a Matrix 2014-11-16 19:25 GMT-05:00 Eka Palamadai ekan...@gmail.com: SymTridiagonal does not seem to work properly. For e.g, the following snippet fails. julia n=10 ; A=SymTridiagonal(2*ones(n,1), -1*ones(n-1)); ERROR: `convert` has no method matching convert(::Type{SymTridiagonal{T}}, ::Array{Float64,2}, ::Array{Float64,1}) in call at base.jl:34 Any thoughts?
[julia-users] SymTridiagonal
SymTridiagonal does not seem to work properly. For e.g, the following snippet fails. julia n=10 ; A=SymTridiagonal(2*ones(n,1), -1*ones(n-1)); ERROR: `convert` has no method matching convert(::Type{SymTridiagonal{T}}, ::Array{Float64,2}, ::Array{Float64,1}) in call at base.jl:34 Any thoughts?
Re: [julia-users] SymTridiagonal
The input should be two Vectors, but your first argument is a Matrix 2014-11-16 19:25 GMT-05:00 Eka Palamadai ekanat...@gmail.com: SymTridiagonal does not seem to work properly. For e.g, the following snippet fails. julia n=10 ; A=SymTridiagonal(2*ones(n,1), -1*ones(n-1)); ERROR: `convert` has no method matching convert(::Type{SymTridiagonal{T}}, ::Array{Float64,2}, ::Array{Float64,1}) in call at base.jl:34 Any thoughts?