[julia-users] how to move Julia packages from Ubuntu to OSX?
I just installed Julia on a MacBook Pro running OSX 10.0.3 (I am new to OSX). Installed Julia in the Applications folder. But for the packages that I have been using on Ubuntu, I copied the whole directory ~/.julia from Ubuntu to the Mac. Then I did a Pkg.build() in Julia. Things seem OK except for a problem with no font on plots, - I got a warning message pango-warning failed to choose a font. I searched and followed this link https://github.com/JuliaLang/Cairo.jl/issues/46 trying to reinstall pango but it didn't help. So I guess perhaps my way of moving the packages is wrong. Or is it? What is a proper way to do it given that I have quite many packages.
[julia-users] how to check if a type has a certain field
type Tech cl::Array{Float64,1} function Tech() this = new() this.cl=[1:4] this end end tech = Tech() How can I check if tech.asf is not a valid field?
[julia-users] Re: help with include_string
I hope to be able to easily plot some variables or formula based on a combination of variables. Typing in the ones at run time seems very convenient. On Wednesday, May 13, 2015, Yichao Yu yyc1...@gmail.com wrote: On Tue, May 12, 2015 at 5:21 PM, K leo cnbiz...@gmail.com javascript:; wrote: In this test case yes, but my intention is to input that string ( tech.cl in this test case) at run time, so in the real case, no. Is what you want executing arbitrary code from user input? Or do you only want to accept only a limit set of input. On Tuesday, May 12, 2015, Yichao Yu yyc1...@gmail.com javascript:; wrote: Can't you just use `y1 = tech.cl` here?
[julia-users] Re: help with include_string
In this test case yes, but my intention is to input that string (tech.cl in this test case) at run time, so in the real case, no. On Tuesday, May 12, 2015, Yichao Yu yyc1...@gmail.com wrote: Can't you just use `y1 = tech.cl` here?
[julia-users] Re: help with include_string
Is is broken, or is there something I did wrong? _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.8 (2015-04-30 23:40 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org release |__/ | x86_64-linux-gnu On Sunday, May 10, 2015, K leo cnbiz...@gmail.com wrote: I try read in a variable at run time and use include_string to assign it to another variable, but I got errors. Originally, the following code works: y1 = tech.cl But when I try to include from input with this code: println(Input the variable) tt=\n while tt==\n tt=readline(STDIN) end println(tt) y1 = include_string(tt) then I get the following output and error: Input the variable tech.cl tech.cl ERROR: tech not defined in include_string at loading.jl:100 What is wrong here?
[julia-users] Re: help with include_string
Thanks for the answer. I did the following test, which I believe quite resembles my real code, and it works: [/code] type Tech cl::Int cm::Int function Tech() this = new() this.cl=1 this.cm=2 this end end tech = Tech() while true println(input a choice) ch = read(STDIN, Char) if ch=='l' y1 = include_string(tech.cl) println(y1) elseif ch=='m' y1 = include_string(tech.cm) println(y1) elseif ch=='q' break end end[/code] But in my real code, [/code]y1 = include_string(tech.cl)[/code] doesn't work, complaining that 'tech' is not defined, but [/code]y1 = tech.cl[/code] in the same place works. How can I find out what is wrong? On Tuesday, May 12, 2015, Isaiah Norton isaiah.nor...@gmail.com wrote: (but, it should be said, that this is a very roundabout way to do things. look at `parse` and `eval`) On Mon, May 11, 2015 at 9:20 PM, Isaiah Norton isaiah.nor...@gmail.com javascript:_e(%7B%7D,'cvml','isaiah.nor...@gmail.com'); wrote: What is `tech`? julia module tech cl = 1 end julia yy = include_string(tech.cl) 1 On Mon, May 11, 2015 at 8:50 PM, K leo cnbiz...@gmail.com javascript:_e(%7B%7D,'cvml','cnbiz...@gmail.com'); wrote: Is is broken, or is there something I did wrong? _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.8 (2015-04-30 23:40 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org release |__/ | x86_64-linux-gnu On Sunday, May 10, 2015, K leo cnbiz...@gmail.com javascript:_e(%7B%7D,'cvml','cnbiz...@gmail.com'); wrote: I try read in a variable at run time and use include_string to assign it to another variable, but I got errors. Originally, the following code works: y1 = tech.cl But when I try to include from input with this code: println(Input the variable) tt=\n while tt==\n tt=readline(STDIN) end println(tt) y1 = include_string(tt) then I get the following output and error: Input the variable tech.cl tech.cl ERROR: tech not defined in include_string at loading.jl:100 What is wrong here?
[julia-users] Re: help with include_string
I guess I found the problem, but don't know a solution. The following test code (same as the previous one except that I put them in a function) now produces the same problem as my real code. type Tech cl::Array{Float64,1} cm::Array{Float64,1} function Tech() this = new() this.cl=[1:4] this.cm=[6:10] this end end function mytest() tech = Tech() while true println(input a choice) ch = read(STDIN, Char) if ch=='l' y1 = include_string(tech.cl) println(y1) elseif ch=='m' y1 = include_string(tech.cm) println(y1) elseif ch=='q' break end end end - _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.8 (2015-04-30 23:40 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org release |__/ | x86_64-linux-gnu julia include(test.jl) mytest (generic function with 1 method) julia mytest() input a choice l ERROR: tech not defined in mytest at /home//Coding/Julia/test.jl:19 while loading string, in expression starting on line 1
[julia-users] help with include_string
I try read in a variable at run time and use include_string to assign it to another variable, but I got errors. Originally, the following code works: y1 = tech.cl But when I try to include from input with this code: println(Input the variable) tt=\n while tt==\n tt=readline(STDIN) end println(tt) y1 = include_string(tt) then I get the following output and error: Input the variable tech.cl tech.cl ERROR: tech not defined in include_string at loading.jl:100 What is wrong here?
[julia-users] Re: Error: zeros(UTF8String, 5)
I want the array to be initialized with every element being . Can't say about 0.3.4, but it definitely worked under 0.3.3. Are there any other easy ways for what I want? On Friday, January 16, 2015, Milan Bouchet-Valat nalimi...@club.fr wrote: Le vendredi 16 janvier 2015 à 14:29 +0800, K leo a écrit : julia A=zeros(UTF8String, 5) ERROR: `zero` has no method matching zero(::Type{UTF8String}) in zeros at array.jl:169 This used to work, but with the new update it doesn't. Any idea? Doesn't work on 0.3.4 either. But what would you expect zero(UTF8String) to return? A string isn't a number. More broadly, why do you need this feature? Regards _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.5 (2015-01-08 22:33 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org release |__/ | x86_64-linux-gnu
[julia-users] Error: zeros(UTF8String, 5)
julia A=zeros(UTF8String, 5) ERROR: `zero` has no method matching zero(::Type{UTF8String}) in zeros at array.jl:169 This used to work, but with the new update it doesn't. Any idea? _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.5 (2015-01-08 22:33 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org release |__/ | x86_64-linux-gnu
Re: [julia-users] Later methods definition replaces the previous one?
I noticed that too, and initially it costed me quite some effort in finding out what went wrong. Is it possible for julia to warn at run time that there are multiple method definitions? On Tuesday, January 13, 2015, Petr Krysl krysl.p...@gmail.com wrote: I have two nested modules, both of them export a function of the same name. The functions have arguments of different types. Both functions are also exported from the parent module. At least that is the intent, but it fails. Only the latest definition is visible outside (unqualified).
[julia-users] Re: how to input array or convert string to array?
Seems an easy way is to input 1:10, read it in with realine, then split the string and reconstruct the array. Anyone would suggest more intelligent ways? On Monday, January 12, 2015, K leo cnbiz...@gmail.com wrote: Is there a way to input at STDIN an array? Suppose, I type in [1:10] at STDIN I would like the program to assign A=[1:10]. Or, I know realine can take it as a string [1:10], so is there a way to convert the string to an array? Somewhat similar to converting a string to an Int?
[julia-users] Re: how to input array or convert string to array?
That is awesome, thank Peter. On Monday, January 12, 2015, Peter Simon psimon0...@gmail.com wrote: julia t = include_string([1:10]) 10-element Array{Int64,1}: 1 2 3 4 5 6 7 8 9 10 On Sunday, January 11, 2015 at 8:49:43 PM UTC-8, K leo wrote: Is there a way to input at STDIN an array? Suppose, I type in [1:10] at STDIN I would like the program to assign A=[1:10]. Or, I know realine can take it as a string [1:10], so is there a way to convert the string to an array? Somewhat similar to converting a string to an Int?
[julia-users] how to input array or convert string to array?
Is there a way to input at STDIN an array? Suppose, I type in [1:10] at STDIN I would like the program to assign A=[1:10]. Or, I know realine can take it as a string [1:10], so is there a way to convert the string to an array? Somewhat similar to converting a string to an Int?
Re: [julia-users] Speeding up Floating Point Operations in Julia
Might be slightly off-topic, but closely related. Does anyone find the logic to run a code first just to compile it and then do the real run afterwards somewhat flawed, or am I missing anything? Suppose I have a code that takes a day to finish after being compiled. So the first run (since it is being compiled) might take say 5 days. But after that 5 days I have got the results and there is no need to run it the second time. So the supposedly fast execution after compile is not going to be necessary anyway, and hence provides no benefits. On Wednesday, January 7, 2015, Christoph Ortner christophortn...@gmail.com wrote: Maybe run test() then tic() testf() toc() so that the code is compiled first? Just a guess Christoph
[julia-users] Is there a null IOStream?
At times I don't want to output anything, so I pass a null IOStream to a function that requires an IOStream. How to do that?
Re: [julia-users] Re: Is there a null IOStream?
Even if I could check something like the following is better: isopen(DevNull) On 2014年12月08日 11:08, Matt Bauman wrote: It'd be nice if the DevNull object (http://docs.julialang.org/en/latest/stdlib/base/#Base.DevNull) would work for this, but it seems like it only works for command redirection right now: | julia run(`echo Hello` | DevNull) julia print(DevNull, Hello) ERROR: type DevNullStream has no field status in isopen at stream.jl:286 in check_open at stream.jl:293 in write at stream.jl:730 in print at ascii.jl:93 | On Sunday, December 7, 2014 7:24:53 PM UTC-5, K leo wrote: At times I don't want to output anything, so I pass a null IOStream to a function that requires an IOStream. How to do that?
Re: [julia-users] Missing newline in file output?
in my case it works perfectly. _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.3 (2014-10-21 20:18 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org release |__/ | x86_64-linux-gnu On 2014年12月08日 11:37, Greg Plowman wrote: Hi Are newlines missing from the following output to file? Or am I missing something? fileout = open(test.txt, w) println(fileout, Hello) println(fileout, World) close(fileout) File test.txt contains: HelloWorld and not what I expected: Hello World Cheers, Greg
Re: [julia-users] Re: Text editor for coding Julia: Atom vs Light Table vs Bracket
I also found it very resource hungry. I have 7 tabs open. When the cursor is not in it it uses about 20% of CPU (on one core I think). When the cursor is in it, it uses about 50% of CPU. In total it uses 600MB of memory. Not sure what is wrong? On 2014年11月29日 21:32, J Luis wrote: I once installed Atom but when I realized that it was eating me 200 Mb of RAM without even a file loaded I uninstalled it right away. I'm not buying (expensive) laptop RAM to be wasted that way.
Re: [julia-users] Floating-point array types
I remember somewhere it mentioned that there is a performance reason not to have things like Array{Float64} : Array{FloatingPoint}. Does this mean the parametric types (defined with T) are slower? On 2014年11月30日 05:04, Andreas Noack wrote: You are welcome. It is explained better than I'm able to do here http://julia.readthedocs.org/en/latest/manual/methods/#parametric-methods 2014-11-29 15:59 GMT-05:00 Petr Krysl krysl.p...@gmail.com mailto:krysl.p...@gmail.com: Thanks, I hear you guys. These are the concepts, and Julia implements them: The two are concrete types, and hence cannot be derived from each other. But here it is: An array of floating-point numbers is an array of floating-point numbers. So how would you write the function so that it is Julia-style and works with any floating-point number? Thanks a lot, Petr
Re: [julia-users] Re: Text editor for coding Julia: Atom vs Light Table vs Bracket
Just tried Atom. It appears very good, but I am not sure what advantages it has over Kate which is what I have been using? On 2014年11月29日 00:54, Pileas wrote: I use Atom. It resembles so much with Sublime (maybe the same people work there). I tried Light Table. It is faster when it opens (this is a problem that Atom has so far: it is a little slow), but I find Atom easier to work with. Easy to install packages and themes. Supports many languages syntax (Fortran and Julia included). I don't know about Bracket. Τη Παρασκευή, 28 Νοεμβρίου 2014 11:39:43 π.μ. UTC-5, ο χρήστης Daniel Carrera έγραψε: Hi everyone, Can anyone here comment or share opinions on the newer text editors -- Atom, Light Table, Bracket -- that seem to be trying to supplant Sublime Text? A lot of the information you find online seems to be geared toward web development, but my interest is programming with Julia (and Fortran). That's why I asking for opinions on the Julia mailing list. I currently use Sublime Text, and I am very happy with it. But I am curious about the others, since they seem to intentionally copy the most important features from Sublime Text. If you have experience with these editors and can tell me why you like one better than another, I would love to hear it. Cheers, Daniel.
Re: [julia-users] Re: Is Dict{ASCIIString, Any} not a superset of Dict{ASCIIString, Float64}?
I ran into similar mental difficulty regarding whether type Any is a superset of any other types. I did not find anything to read, but simply accepted the fact through painstaking experiments. I think the word Any here is confusing. The English definition of it means that it ought to include any types. Perhaps we should seek other word to define this type. Word like Mixed might be more appropriate for this? On 2014年11月27日 08:17, Patrick O'Leary wrote: You've hit type invariance. In Julia, parametric types are invariant--that is, Dict{ASCIIString,Float64} is not a subtype of Dict{ASCIIString,Any}. For more information on why we use invariant parametric types, search the list for parametric invariant or similar; there have been a few discussions on the topic. Patrick
Re: [julia-users] Re: Is Dict{ASCIIString, Any} not a superset of Dict{ASCIIString, Float64}?
Thanks, now I understand it. The problem I had was this, which I imagine to exist with many other non-computer scientists new to Julia. This topic is discussed under the parametric type section of the manual, and since I had not attempted to use parametric types (the things with the mysterious T), I didn't bother to read that section. I ran into the problem with mostly arrays, and it is not obvious that things like Array{Any,1} is a parametric type. So it became very strange to me when Array{Int,1} can not be passed in the place of Array{Any,1}. On 2014年11月27日 12:19, ele...@gmail.com wrote: It is demonstrated in the manual at http://docs.julialang.org/en/release-0.3/manual/types/#parametric-composite-types that parametric types do not have any relationship even if their parameter types have some relationship. Perhaps it would be better emphasise that and to explain it simply and clearly for the non-*computer* scientists as something like: Two parametric types Sometype{T1} and Sometype{T2} have no subtype or supertype relationship even if T1 has a subtype or supertype relationship to T2. Cheers Lex On Thursday, November 27, 2014 1:37:53 PM UTC+10, John Myles White wrote: All types do have Any as a parent. It is clear that many people are confused about what covariance, contravariance and invariance mean in computer science. As such, I very strongly encourage everyone who isn't sure that they understand Julia's type system to read through the wikipedia article on covariance and contravariance: http://en.wikipedia.org/wiki/Covariance_and_contravariance_%28computer_science%29 http://en.wikipedia.org/wiki/Covariance_and_contravariance_%28computer_science%29 Perhaps the Julia manual should have a prerequisites section that lists all of the concepts that readers are assumed to already understand. -- John On Nov 26, 2014, at 7:27 PM, K Leo cnbi...@gmail.com javascript: wrote: I ran into similar mental difficulty regarding whether type Any is a superset of any other types. I did not find anything to read, but simply accepted the fact through painstaking experiments. I think the word Any here is confusing. The English definition of it means that it ought to include any types. Perhaps we should seek other word to define this type. Word like Mixed might be more appropriate for this? On 2014年11月27日 08:17, Patrick O'Leary wrote: You've hit type invariance. In Julia, parametric types are invariant--that is, Dict{ASCIIString,Float64} is not a subtype of Dict{ASCIIString,Any}. For more information on why we use invariant parametric types, search the list for parametric invariant or similar; there have been a few discussions on the topic. Patrick
Re: [julia-users] [Offtopic:] Why you did choose the name Julia?
results = search(Julia) for result in results if contains(result, program) println(result) end end On 2014年11月25日 15:40, Francesco Bonazzi wrote: The problem with the name Julia is that you find a lot of other stuff unrelated to programming when you look on Google.
[julia-users] how to do array (or collection) of functions
I have a bunch of functions with same signature. I would like to invoke them one by one at run time. What is the best way of doing this? Can I put them all in an array or some other collection and loop through it at the run time?
Re: [julia-users] [Offtopic:] Why you did choose the name Julia?
Very likely Julia was a significant person in that someone's mind. Perhaps we should find out who she was. On 2014年11月25日 06:28, Isaiah Norton wrote: Alan Edelman told me specifically that it was not named after the fractal, and in fact that Julia doesn't refer to anything in particular. Apparently, it just came up in a random conversation years ago when someone suggested arbitrarily that Julia would be a good name for a programming language. https://groups.google.com/d/msg/julia-users/6xEWQz_mK10/XrCkLV-7O_sJ
Re: [julia-users] How Julia do math operations
julia 2*10.97 + 23.9985 45.9385005 julia 2*10.97 + 23.9985 == 45.9385005 true Amazing. I never expected this. Is floating point comparison going to be guaranteed? On 2014年11月05日 08:48, Stefan Karpinski wrote: Some systems round their answers as John said but it's easy to check that it's a lie: R version 3.1.0 (2014-04-10) -- Spring Dance 2*10.97 + 23.9985 [1] 45.9385 2*10.97 + 23.9985 == 45.9385 [1] FALSE This is perl 5, version 16, subversion 2 (v5.16.2) DB1 x 2*10.97 + 23.9985 0 45.9385 DB2 x 2*10.97 + 23.9985 == 45.9385 0 '' I don't have a working copy of Matlab right now, but I think it does this too. On Tue, Nov 4, 2014 at 8:31 PM, Neil Devadasan ndeva...@gmail.com mailto:ndeva...@gmail.com wrote: Thanks On Tuesday, November 4, 2014 2:13:37 PM UTC-5, John Myles White wrote: Hi Neil, Julie does math the same way that all computers do math. You're probably coming from another language where a lot of effort is invested into pretending that computers offer a closer approximation to abstract mathematics than they actually do. Those systems have been lying to you. Put another way: you just took the red pill by using Julia. -- John On Nov 4, 2014, at 11:06 AM, Neil Devadasan ndev...@gmail.com wrote: julia f(x::Float64, y::Float64) = 2x + y; julia f(10.97,23.9985) 45.9385005 The above method execution of function f returns an answer that I cannot understand. Can someone clarify? Thank you.
Re: [julia-users] How Julia do math operations
I meant this: to check whether 2 floating point valuables equal I had always had to do something like abs(x-y)1.e-5 (never simply x==y) in other languages. I wonder whether checking x==y would be sufficient in Julia? On 2014年11月05日 09:30, Stefan Karpinski wrote: On Wed, Nov 5, 2014 at 2:06 AM, K Leo cnbiz...@gmail.com mailto:cnbiz...@gmail.com wrote: julia 2*10.97 + 23.9985 45.9385005 julia 2*10.97 + 23.9985 == 45.9385005 true Amazing. I never expected this. Is floating point comparison going to be guaranteed? What's shocking about this? What do you mean by floating point comparison being guaranteed? We always print individual floating-point numbers with enough digits to reconstruct their exact value (moreover, they are always printed with the minimal number of digits necessary to do so). Floating-point arrays are printed truncated.
Re: [julia-users] Multiple Plots with Winston
pw=plot() oplot(x1, copy(z1), r) oplot(x1, copy(z2), g) display(pw) On 2014年11月05日 13:34, yaoismyh...@gmail.com wrote: Just getting into plotting data in Julia today. Gravitating towards Winston because of the similarity of its syntax to that of Matplotlib. Anyhow, I did have a question about how to do multiple plots (on separate figures) for Winston. In Matplotlib, I can use plt.figure(1) ... plt.figure(2) In Winston, I first just tried plot(x-array,y-array) plot(x2-array,y2-array) though then the first plot just got overwritten. Thanks.
[julia-users] DataFrames io error
I have a small program that uses DataFrames to read in a file, does some simple computation and then plots some variables using Winston. I run it with the following: julia include(PlotBasics.jl) PlotBasics (generic function with 1 method) julia PlotBasics() It runs fine the first time, but if I change the variables for plot and run it the second time, I got the following errors now (it used to run perfectly before). If I restart julia and run it again, it runs fine the first time. julia PlotBasics() ERROR: `convert` has no method matching convert(::Type{Array{Float64,N}}, ::Array{Int64,1}) in convert at base.jl:13 in builddf at /home/xxx/.julia/DataFrames/src/dataframe/io.jl:583 in readtable! at /home/xxx/.julia/DataFrames/src/dataframe/io.jl:783 in readtable at /home/xxx/.julia/DataFrames/src/dataframe/io.jl:868 in readtable at /home/xxx/.julia/DataFrames/src/dataframe/io.jl:935 _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.2 (2014-10-21 20:18 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org release |__/ | x86_64-linux-gnu
Re: [julia-users] type confusions in list comprehensions (and how to work around it?)
I found that I often have to force this conversion, which is not too difficult. The question why comprehension has to build with type Any? On 2014年11月04日 07:06, Miguel Bazdresch wrote: How could I force the type of gxs1 to be of an array of Float64? The simplest way is: gxs1 = Float64[g(x) for x in xs] -- mb On Mon, Nov 3, 2014 at 6:01 PM, Evan Pu evanthebou...@gmail.com mailto:evanthebou...@gmail.com wrote: Consider the following interaction: julia g(x) = 1 / (1 + x) g (generic function with 1 method) julia typeof(g(1.0)) Float64 julia xs = [1.0, 2.0, 3.0, 4.0] 4-element Array{Float64,1}: 1.0 2.0 3.0 4.0 julia gxs1 = [g(x) for x in xs] 4-element Array{Any,1}: 0.5 0.33 0.25 0.2 Why isn't gxs1 type of Array{Float64,1}? How could I force the type of gxs1 to be of an array of Float64? julia gxs2 = [convert(Float64,g(x)) for x in xs] 4-element Array{Any,1}: 0.5 0.33 0.25 0.2 somehow this doesn't seem to work...
[julia-users] is for iteration very expensive?
I have a sparse array (roughly 1/5 filled say). If I simply loop through it, it is about 10 times slower than if I loop through only the nonzero elements. Compare the following codes, the first is 10 times slower, even with the multiplications. = for i=1:length(A) if abs(A[i])0. val += (A[i] - s) * (x + y) end end iA = findn(A) for i=1:length(iA) val += (A[iA[i]] - s) * (x + y) end =
Re: [julia-users] Re: is for iteration very expensive?
My codes are actually within a function. They are not in global scope. On 2014年10月17日 14:32, Ivar Nesje wrote: Did you run the test in global scope? Does the following code show the same performance characteristics? = function test1(A, s, x, y) for i=1:length(A) if abs(A[i])0. val += (A[i] - s) * (x + y) end end end @time test1(A, s, x, y) function test2(A, s, x, y) iA = findn(A) for i=1:length(iA) val += (A[iA[i]] - s) * (x + y) end end @time test2(A, s, x, y) = kl. 08:21:40 UTC+2 fredag 17. oktober 2014 skrev K leo følgende: I have a sparse array (roughly 1/5 filled say). If I simply loop through it, it is about 10 times slower than if I loop through only the nonzero elements. Compare the following codes, the first is 10 times slower, even with the multiplications. = for i=1:length(A) if abs(A[i])0. val += (A[i] - s) * (x + y) end end iA = findn(A) for i=1:length(iA) val += (A[iA[i]] - s) * (x + y) end =
Re: [julia-users] Re: is for iteration very expensive?
Actually, when taking my second approach, my entire code (not just this demo part) is 10 times faster. Of course, this part in within the most inner loop. On 2014年10月17日 14:35, K Leo wrote: My codes are actually within a function. They are not in global scope. On 2014年10月17日 14:32, Ivar Nesje wrote: Did you run the test in global scope? Does the following code show the same performance characteristics? = function test1(A, s, x, y) for i=1:length(A) if abs(A[i])0. val += (A[i] - s) * (x + y) end end end @time test1(A, s, x, y) function test2(A, s, x, y) iA = findn(A) for i=1:length(iA) val += (A[iA[i]] - s) * (x + y) end end @time test2(A, s, x, y) = kl. 08:21:40 UTC+2 fredag 17. oktober 2014 skrev K leo følgende: I have a sparse array (roughly 1/5 filled say). If I simply loop through it, it is about 10 times slower than if I loop through only the nonzero elements. Compare the following codes, the first is 10 times slower, even with the multiplications. = for i=1:length(A) if abs(A[i])0. val += (A[i] - s) * (x + y) end end iA = findn(A) for i=1:length(iA) val += (A[iA[i]] - s) * (x + y) end =
[julia-users] Re: is for iteration very expensive?
I didn't cook up my demo code correctly - sorry. They should be as follows (within a function). If someone wants to test them, the first is much slower than the second. = for i=1:length(A) if abs(A[i])1. val += (A[i] - s) * (x + y) end end iA = findn(A)[1] for i=1:length(iA) val += (A[iA[i]] - s) * (x + y) end = On 2014年10月17日 14:21, K Leo wrote: I have a sparse array (roughly 1/5 filled say). If I simply loop through it, it is about 10 times slower than if I loop through only the nonzero elements. Compare the following codes, the first is 10 times slower, even with the multiplications. = for i=1:length(A) if abs(A[i])0. val += (A[i] - s) * (x + y) end end iA = findn(A) for i=1:length(iA) val += (A[iA[i]] - s) * (x + y) end =
Re: [julia-users] Re: is for iteration very expensive?
Many thanks Mauro for the explanation and guide. If I use the efficient iteration, is there a way to get the index of the nonzero element, i.e. the i of A[i] when A[i] is nonzero? On 2014年10月17日 15:03, Mauro wrote: However, if you just need to iterate over the non-zero values, it can be done much more efficiently: for nz in A.nzval if abs(nz)1. val += (nz - s) * (x + y) end end We should probably add an iterator to sparsematrix.jl which does that.
Re: [julia-users] Re: is for iteration very expensive?
Just checked the sparse matrix section of the Julia manual. My question is whether what you explained only applies to actually declared sparse matrix? In my case, the A is not declared as a sparse matrix even though it has a lot of zeros in it - issparse(A) returns false. On 2014年10月17日 15:03, Mauro wrote: The operation A[i] for a sparse matrix is quite a bit more expensive than for a dense array (where it is trivial). It first needs to convert [i] it to a [k,m] index and then look it up in the sparse matrix. See: https://github.com/JuliaLang/julia/blob/master/base/sparse/sparsematrix.jl#L841 However, if you just need to iterate over the non-zero values, it can be done much more efficiently: for nz in A.nzval if abs(nz)1. val += (nz - s) * (x + y) end end We should probably add an iterator to sparsematrix.jl which does that.
[julia-users] randperm very expensive, any alternative?
I need to permute the indexes of an array, so I found function randperm very convenient. But it turns out very slow. The following test shows time increased 60 times. Is there an alternative to permute an array? - tic() f=0. A=[1:100] for i=1:1000 f += A[20] end toc() elapsed time: 0.891431009 seconds - tic() f=0. A=[1:100] for i=1:1000 A = randperm(100) f += A[20] end toc() elapsed time: 60.348117087 seconds
Re: [julia-users] randperm very expensive, any alternative?
OK I take it that randperm is fine. Actually I just found the slow performance of my code was due to something else. Thanks for your attention. On 2014年10月17日 11:46, Kevin Squire wrote: I'm curious how much faster you expect it to be? Your example shows is that permuting 100 indices, an array access, and a sum take about 70 times longer than an array access and a sum by themselves. Seems reasonable to me... Kevin On Thursday, October 16, 2014, K Leo cnbiz...@gmail.com mailto:cnbiz...@gmail.com wrote: I need to permute the indexes of an array, so I found function randperm very convenient. But it turns out very slow. The following test shows time increased 60 times. Is there an alternative to permute an array? - tic() f=0. A=[1:100] for i=1:1000 f += A[20] end toc() elapsed time: 0.891431009 seconds - tic() f=0. A=[1:100] for i=1:1000 A = randperm(100) f += A[20] end toc() elapsed time: 60.348117087 seconds
[julia-users] cp problem
It does not remove the target file first, but simply writes content on top of it and keeps the remaining contents. Look at the following example on Xubuntu 14.04: $ more test1.txt asdasfd sfasf asdad sdsdg gsdg $ more test2.txt dfs sdfs sdffsdfsgs sdgsgsdgds gsdgs sdgs sdgsdsdh $ julia _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.1 (2014-09-21 21:30 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org release |__/ | x86_64-linux-gnu julia cp(test1.txt, test2.txt) File(test2.txt,false,-1) julia quit() $ more test2.txt asdasfd sfasf asdad sdsdg gsdggsdgs sdgs sdgsdsdh
[julia-users] error of std function
_ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.1 (2014-09-21 21:30 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org release |__/ | x86_64-linux-gnu julia A=rand(100) 100-element Array{Float64,1}: 0.419648 0.526901 0.860331 0.13469 ⋮ 0.77506 0.32526 0.462945 julia std(A, 10) 100-element Array{Float64,1}: NaN NaN NaN NaN ⋮ NaN NaN NaN
Re: [julia-users] Re: error of std function
I am hoping to get the std's of every 10 consecutive elements in A. std(v[, region]) Compute the sample standard deviation of a vector or array v, optionally along dimensions in region. The algorithm returns an estimator of the generative distribution’s standard deviation under the assumption that each entry of v is an IID drawn from that generative distribution. This computation is equivalent to calculating sqrt(sum((v - mean(v)).^2) / (length(v) - 1)). Note: Julia does not ignore NaN values in the computation. For applications requiring the handling of missing data, the DataArray package is recommended. On 2014年10月10日 06:49, Patrick O'Leary wrote: On Thursday, October 9, 2014 5:42:40 PM UTC-5, K leo wrote: julia std(A, 10) A only has elements along the first dimension. What behavior do you expect here?
Re: [julia-users] Re: error of std function
Thanks to both for explanations. along dimensions in region sounds pretty confusing to me. Can that be stated more clearly? Pardon my English. I guess this is what I wanted. julia [std(A[i:i+9]) for i=1:length(A)-9] 91-element Array{Any,1}: 0.395761 0.391694 0.392545 0.363307 ⋮ 0.322292 0.325662 0.345799 On 2014年10月10日 07:17, Simon Kornblith wrote: Or alternatively: | std(reshape(A,10,div(length(A),10)),1) | Simon On Thursday, October 9, 2014 7:10:11 PM UTC-4, Patrick O'Leary wrote: optionally *along dimensions in region* (emphasis mine). You are attempting to read along the tenth dimension of the array. You're trying to split the array into groups of ten elements, it sounds like. [std(A[10(n-1)+1:10n]) for n in 1:length(A)./10] On Thursday, October 9, 2014 5:56:01 PM UTC-5, K leo wrote: I am hoping to get the std's of every 10 consecutive elements in A. std(v[, region]) Compute the sample standard deviation of a vector or array v, optionally along dimensions in region. The algorithm returns an estimator of the generative distribution’s standard deviation under the assumption that each entry of v is an IID drawn from that generative distribution. This computation is equivalent to calculating sqrt(sum((v - mean(v)).^2) / (length(v) - 1)). Note: Julia does not ignore NaN values in the computation. For applications requiring the handling of missing data, the DataArray package is recommended. On 2014年10月10日 06:49, Patrick O'Leary wrote: On Thursday, October 9, 2014 5:42:40 PM UTC-5, K leo wrote: julia std(A, 10) A only has elements along the first dimension. What behavior do you expect here?
Re: [julia-users] PPA for Ubuntu 14.04 (Trusty Tahr)
On Xubuntu 14.04 64, it seems to work fine: _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.1 (2014-09-21 21:30 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org release |__/ | x86_64-linux-gnu On 2014年10月09日 08:50, Helios De Rosario wrote: Hi again, I saw that the 0.3.1 version of Julia was already available to install from the juliareleases repository, and tried to install it. But when I start Julia now it crashes. It generates a core file and suggests sending a report (I accepted). Somebody else has experienced this? I am using Lubuntu 14.04 in an i386 machine. Julia 0.2.1 from the main Ubuntu repository worked normally. How could I report more details to help debug this problem? Thanks for your support Helios De Rosario
[julia-users] how to check if an variable is defined?
Hope to avoid the following: julia s ERROR: s not defined I guess this may be simple, but I don't know where to find.
[julia-users] congratulations to Indian dost
for the wonderful achievement with Mangalyaan! With a budget less than a Hollywood movie, I bet they must have largely used (and supported?) open sources - Julia included?
Re: [julia-users] Re: issues with println to file
Sorry for double posting. There is nothing special with the print statement. It has been simply: println(file, A, ,, B, ,, C) And with that I usually got: 162038.8,160.2,0.26118204 The update came in today from the julia release PPA for Ubuntu: https://launchpad.net/~staticfloat/+archive/ubuntu/juliareleases?field.series_filter=trusty I wonder if there is a way to revert back? On 2014年09月23日 16:51, Ivar Nesje wrote: Please don't double post your questions https://github.com/JuliaLang/julia/issues/8445. How did you update Julia? http://julialang.org/downloads/ has not yet been updated https://github.com/JuliaLang/julialang.github.com/pull/146 with links to 0.3.1, and your version of Julia identifies itself as a 11 days old nightly version. What link did you use to get the wrong version? It is hard to know whether the printing is correct, when you don't provide example code. It seems like you are printing Float32 and Float16 values, and they intentionally print differently from the normal Float64 values. Ivar kl. 07:42:01 UTC+2 tirsdag 23. september 2014 skrev K leo følgende: A number like these messes up DataFrames, which considers it as a string which then can not be easily converted to a float. Any advice on what to do? On 2014年09月23日 09:31, K Leo wrote: Just updated to reportedly 0.3.1 but displayed as 0.4.0-dev+543. println to file now get something like the following. Is this intended? How can I get normal decimals? 162038.8f0,float16(160.2),0.26118204f0 _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.4.0-dev+543 (2014-09-11 13:47 UTC) _/ |\__'_|_|_|\__'_| | Commit c79e349 (11 days old master) |__/ | x86_64-linux-gnu
Re: [julia-users] Re: issues with println to file
Removed the binary update and compiled julia from the 0.3.0+6 source. Things become usual. On 2014年09月23日 18:55, K Leo wrote: Sorry for double posting. There is nothing special with the print statement. It has been simply: println(file, A, ,, B, ,, C) And with that I usually got: 162038.8,160.2,0.26118204 The update came in today from the julia release PPA for Ubuntu: https://launchpad.net/~staticfloat/+archive/ubuntu/juliareleases?field.series_filter=trusty I wonder if there is a way to revert back? On 2014年09月23日 16:51, Ivar Nesje wrote: Please don't double post your questions https://github.com/JuliaLang/julia/issues/8445. How did you update Julia? http://julialang.org/downloads/ has not yet been updated https://github.com/JuliaLang/julialang.github.com/pull/146 with links to 0.3.1, and your version of Julia identifies itself as a 11 days old nightly version. What link did you use to get the wrong version? It is hard to know whether the printing is correct, when you don't provide example code. It seems like you are printing Float32 and Float16 values, and they intentionally print differently from the normal Float64 values. Ivar kl. 07:42:01 UTC+2 tirsdag 23. september 2014 skrev K leo følgende: A number like these messes up DataFrames, which considers it as a string which then can not be easily converted to a float. Any advice on what to do? On 2014年09月23日 09:31, K Leo wrote: Just updated to reportedly 0.3.1 but displayed as 0.4.0-dev+543. println to file now get something like the following. Is this intended? How can I get normal decimals? 162038.8f0,float16(160.2),0.26118204f0 _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.4.0-dev+543 (2014-09-11 13:47 UTC) _/ |\__'_|_|_|\__'_| | Commit c79e349 (11 days old master) |__/ | x86_64-linux-gnu
[julia-users] issues with println to file
Just updated to reportedly 0.3.1 but displayed as 0.4.0-dev+543. println to file now get something like the following. Is this intended? How can I get normal decimals? 162038.8f0,float16(160.2),0.26118204f0 _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.4.0-dev+543 (2014-09-11 13:47 UTC) _/ |\__'_|_|_|\__'_| | Commit c79e349 (11 days old master) |__/ | x86_64-linux-gnu
[julia-users] Re: issues with println to file
A number like these messes up DataFrames, which considers it as a string which then can not be easily converted to a float. Any advice on what to do? On 2014年09月23日 09:31, K Leo wrote: Just updated to reportedly 0.3.1 but displayed as 0.4.0-dev+543. println to file now get something like the following. Is this intended? How can I get normal decimals? 162038.8f0,float16(160.2),0.26118204f0 _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.4.0-dev+543 (2014-09-11 13:47 UTC) _/ |\__'_|_|_|\__'_| | Commit c79e349 (11 days old master) |__/ | x86_64-linux-gnu
[julia-users] issue with hist
Sometimes hist does not output the right number of elements. Why is this? e, h = hist(c, 10) println(e, , h) -8.0:2.0:4.0 [1,6,76,805,193,2]
[julia-users] how to use union!(s, iterable)
Say I have a 2-dimensional array B, I suppose it is an iterable, but how do I construct s?
[julia-users] strange influence on speed
julia cl 485-element Array{Float64,1}: 4555.0 4601.0 4693.0 4678.0 ⋮ 5821.0 5854.0 5828.0 julia lagcl = [0, cl[1:end-1]] 485-element Array{Float64,1}: 0.0 4555.0 4601.0 4693.0 ⋮ 5842.0 5821.0 5854.0 Then thinking to make the types of elements to be the same, I changed the above to the following (notice it is 0.0 instead of 0 at the first element). lagcl is only a temp array in a function that is called only at initialization time and lagcl[1] is actually not referenced at all. But the speed of my app after the initialization dropped to half. Nothing else was changed, and I verified it by changing 0.0 back to 0 at the first element. Could anyone explain? julia lagcl = [0.0, cl[1:end-1]] 485-element Array{Float64,1}: 0.0 4555.0 4601.0 4693.0 ⋮ 5842.0 5821.0 5854.0
Re: [julia-users] Re: strange influence on speed
Thanks for the analysis. My understanding is about the same as yours. But, as I described earlier, speed drops (after this initialization section) if I use 0.0 at the first element. That is what puzzles me. On 2014年08月26日 21:30, Tomas Lycken wrote: Looking at those statements with the |@time| macro will give you some useful information. I did the following: |julia cl = rand(485) 485-element Array{Float64,1}: 0.186576 ⋮ 0.299499 julia lagcl_precompilation_1 = [0, cl[1:end-1]] julia lagcl_precompilation_2 = [0.0, cl[1:end-1]] julia @time lagcl1 = [0, cl[1:end-1]] elapsed time: 0.000862835 seconds (23496 bytes allocated) julia @time lagcl2 = [0.0, cl[1:end-1]] elapsed time: 6.5775e-5 seconds (9696 bytes allocated) | As you can see, a lot more memory was allocated when using |0| for the first element rather than |0.0|. The reason for this is that when you use |0.0|, all elements are the same type (|Float64|) so Julia only needs to allocate memory for the output once. I’m not 100% sure on exactly which approach is actually taken for the other case, but I can imagine it would be something like 1) allocate an array for |Int64|s, since the first element is |Int64| 2) notice that the second element is not an |Int64|, so allocate an array of |Any| instead (i.e. an array of pointers to the actual elements) 3) fill the |Any| array with the data from input 4) check the type of all elements, and realize that the array type can be tightened to |Float64| 5) Allocate space for a |Float64| array, copy all data to it and return it Julia is probably slightly smarter than this, so don’t take the above description as a definitive description of how the language actually works. However, just by looking at the first two steps you can see that if the type of the first element is the same as the type of all other elements, we’ll be able to skip a bunch of intermediate steps and still get the same result: an array of |Float64|s. Of course, if we only allocate and copy once, everything is going to be much faster. Type stability http://docs.julialang.org/en/latest/manual/performance-tips/#write-type-stable-functions is one of the things that many new Julians struggle with in the beginning, so it’s really worth reading up on. Writing type stable code is really key to utilize all the good things about Julia’s performance. // T On Tuesday, August 26, 2014 3:14:54 PM UTC+2, K leo wrote: julia cl 485-element Array{Float64,1}: 4555.0 4601.0 4693.0 4678.0 ⋮ 5821.0 5854.0 5828.0 julia lagcl = [0, cl[1:end-1]] 485-element Array{Float64,1}: 0.0 4555.0 4601.0 4693.0 ⋮ 5842.0 5821.0 5854.0 Then thinking to make the types of elements to be the same, I changed the above to the following (notice it is 0.0 instead of 0 at the first element). lagcl is only a temp array in a function that is called only at initialization time and lagcl[1] is actually not referenced at all. But the speed of my app after the initialization dropped to half. Nothing else was changed, and I verified it by changing 0.0 back to 0 at the first element. Could anyone explain? julia lagcl = [0.0, cl[1:end-1]] 485-element Array{Float64,1}: 0.0 4555.0 4601.0 4693.0 ⋮ 5842.0 5821.0 5854.0
[julia-users] problem with array of arrays
What is wrong with the following? julia A 4-element Array{Array{Int64,1},1}: [-1,2,4] [-1,2,7] [-1,2,8] [1,-2,10] julia findin(A, A[3]) 0-element Array{Int64,1}
Re: [julia-users] suggestion for good algorithms?
Thanks for the response, but sorry, can you clarify what that formula means? On 2014年08月23日 09:24, Tony Fong wrote: Er, there is an almost-close-form solution no? Start with (n(odd))C(n/2+-2.5) Tony
Re: [julia-users] Announcing Julia 0.3.0 final
It is great now that we have 0.3 released. Thank you all very much! A question on future updates. In the past months, I have been using julia nightlies PPA to get the most updated builds. Generally, it has been working well for me. The nightlies have not caused big problems for my applications. Now the nightlies will be the early builds of 0.4. Is that reasonable to assume these early builds will be less reliable and so I should better stay with 0.3 for some time? On 2014年08月21日 07:45, Elliot Saba wrote: We are pleased to announce the immediate release of Julia 0.3.0. This release contains numerous improvements across the board from standard library changes to pure performance enhancements as well as an expanded ecosystem of packages as compared to the 0.2 releases. A summary of changes is available in NEWS.md https://github.com/JuliaLang/julia/blob/021d87dc7290ef2804a01660c561c8a6ce522d02/NEWS.md in our main repository, and binaries are now available on our main download page http://julialang.org/downloads/. We are now transitioning into the 0.4 development cycle, and encourage users to use the 0.3.X line if they need a stable julia environment. Many breaking changes will be entering the environment over the course of the next few months, and to denote this builds will have use the versioning scheme 0.4.0-dev. Once the major breaking changes have been merged and the development cycle progresses towards a stable release, the version will shift to 0.4.0-pre, at which point package authors and users should start to think about transitioning the codebases over to the 0.4.X line. The release-0.3 branch of the codebase will remain open for bugfixes during this time, and we encourage users facing problems to open issues on our GitHub tracker https://github.com/JuliaLang/julia/issues, or email the julia-users mailing list https://groups.google.com/forum/#%21forum/julia-users. Happy coding.
[julia-users] why sum(abs(A)) is very slow
A is a 1-dimensional array. I used to compute sum(abs(A)). But when I changed to the following, the speed increased nearly 10 fold. Why is that? sumA=0 for i=1:length(A) sumA = sumA + abs(A[i]) end
[julia-users] Package built errors
What to do with the following? I am on Xubuntu 14.04 64bits. == _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.0-rc3+14 (2014-08-13 16:01 UTC) _/ |\__'_|_|_|\__'_| | release-0.3/0a5db5f (fork: 14 commits, 5 days) |__/ | x86_64-linux-gnu julia Pkg.update() INFO: Building Cairo Installing dependency libglib2.0-0 via `sudo apt-get install libglib2.0-0`: [sudo] password for : Reading package lists... Done Building dependency tree Reading state information... Done libglib2.0-0 is already the newest version. The following packages were automatically installed and are no longer required: baloo fonts-mathjax libakonadi-kde4 libakonadi-kmime4 libakonadiprotocolinternals1 libapr1 libaprutil1 libchm1 libjs-mathjax libjs-sphinxdoc libjs-underscore libkabc4 libkcalcore4 libkldap4 libkmime4 libkpimutils4 libkresources4 libpodofo0.9.0 libserf-1-1 libsvn1 linux-headers-3.13.0-32 linux-headers-3.13.0-32-generic linux-image-3.13.0-32-generic linux-image-extra-3.13.0-32-generic linux-image-generic nautilus-script-manager python-apsw python-cherrypy3 python-cssselect python-dnspython python-keybinder python-markdown python-mechanize python-netifaces python-pygments python-repoze.lru python-routes python-webob subversion Use 'apt-get autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded. [ ERROR: Cairo ]=== Provider AptGet failed to satisfy dependency gobject while loading ~/.julia/Cairo/deps/build.jl, in expression starting on line 136 INFO: Building Images [ ERROR: Images ] None of the selected providers can install dependency libMagickWand. Use BinDeps.debug(package_name) to see available providers while loading ~/.julia/Images/deps/build.jl, in expression starting on line 36 [ BUILD ERRORS ]== WARNING: Images and Cairo had build errors. - packages with build errors remain installed in ~/.julia - build a package and all its dependencies with `Pkg.build(pkg)` - build a single package by running its `deps/build.jl` script ===
Re: [julia-users] Re: question about array comparison
Thanks to both for the responses. Related questions: how does one turn a 2-dimensional array into a 1-dimensional array of row arrays? Also, the default behavior of julia is that a row of a 2-dimensional array is also a 2-dimensional array. Would anyone comment why this is the case? Should it better be a 1-dimensional array? On 2014年08月07日 19:59, Ethan Anderes wrote: Here is another one…slightly different: |in(x[1,:], Matrix[x[k,:] for k=1:size(x,2)] ) | To be honest, the custom for loop is probably your best bet in terms of performance: |function isrow(row, x::Matrix) for k=1:size(x,1) if row == x[k,:] return true end end false end | On Thursday, August 7, 2014 1:36:08 AM UTC-7, Gunnar Farnebäck wrote: Is this easy enough? julia x = reshape(1:16, 4, 4) 4x4 Array{Int64,2}: 1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16 julia a = x[1,:] 1x4 Array{Int64,2}: 1 5 9 13 julia [a == x[k,:] for k = 1:size(x,1)] 4-element Array{Any,1}: true false false false julia any([a == x[k,:] for k = 1:size(x,1)]) true julia find([a == x[k,:] for k = 1:size(x,1)]) 1-element Array{Int64,1}: 1 Den torsdagen den 7:e augusti 2014 kl. 06:09:23 UTC+2 skrev K leo: julia x 4x4 Array{Int64,2}: 1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16 julia in(x[1,:], x) false julia x[1,:] 1x4 Array{Int64,2}: 1 5 9 13 How can I check if x[1,:] is in x easily? And with the row index in x?
[julia-users] question about array comparison
julia x 4x4 Array{Int64,2}: 1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16 julia in(x[1,:], x) false julia x[1,:] 1x4 Array{Int64,2}: 1 5 9 13 How can I check if x[1,:] is in x easily? And with the row index in x?
[julia-users] Re: random machine freeze
Sorry, but really don't know what is going on. Today I had two sessions of julia each running a program (single processing), then the machine froze with no mouse and keyboard. This type of thing happened a few times in the past though not every time I run 2 julia sessions. I don't know how to determine the real cause, but suspect it has to do with julia. Hasn't anyone had similar experiences? I am running Xubuntu 14.04. $ julia _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() to list help topics | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.0-rc1+54 (2014-07-17 05:40 UTC) _/ |\__'_|_|_|\__'_| | Commit 4e92487 (14 days old master) |__/ | x86_64-linux-gnu
Re: [julia-users] Re: random machine freeze
Thanks for the response, but that should not be the problem. I have a display of RAM and CPU usage on screen. The 8GB of physical memory was only used less than half. The system seemed to run normally prior to the sudden freeze. On 2014年07月31日 21:43, Simon Kornblith wrote: I suspect you are running out of RAM and your system is thrashing http://en.wikipedia.org/wiki/Thrashing_%28computer_science%29. On Thursday, July 31, 2014 3:06:31 AM UTC-4, K leo wrote: Sorry, but really don't know what is going on. Today I had two sessions of julia each running a program (single processing), then the machine froze with no mouse and keyboard. This type of thing happened a few times in the past though not every time I run 2 julia sessions. I don't know how to determine the real cause, but suspect it has to do with julia. Hasn't anyone had similar experiences? I am running Xubuntu 14.04. $ julia _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() to list help topics | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.0-rc1+54 (2014-07-17 05:40 UTC) _/ |\__'_|_|_|\__'_| | Commit 4e92487 (14 days old master) |__/ | x86_64-linux-gnu