Re: [julia-users] llvm call error

2016-10-25 Thread Yichao Yu
On Tue, Oct 25, 2016 at 3:55 PM, wrote: > I need some part of my julia code to be executed at run time and be loaded > as llvm IR (or assembly). It is allowed to be IR or assembly code but not > julia source code or c source code. Why does it have to be IR or assembly? >

Re: [julia-users] parse Unicode string to Float64

2016-10-25 Thread Chris Stook
The StringEncodings package solves the problem. Thank all, Chris

[julia-users] Profile.print() options for easier reading of profile output data

2016-10-25 Thread Angel de Vicente
Hi, I'm trying to profile a simple code I wrote that has just two functions. When I call Profile.print() I get a lot of detail about modules that (at least at this point) I'm not interested in profiling (in this case, for example the Primes module, and the REPL itself). , | julia>

[julia-users] stop reading input from script

2016-10-25 Thread David van Leeuwen
Hello, is there a way in Julia for a file that is `include`d to signal that the rest of the file should be ignored? Something like `\endinput` in TeX. I could use this in running testing scripts, putting such and `endinput` further to the back while debugging the script. Currently I wrap

Re: [julia-users] stop reading input from script

2016-10-25 Thread Abel Siqueira
Wrap the script in a function (functions) and use return? Abel Soares Siqueira 2016-10-25 19:27 GMT-02:00 David van Leeuwen : > Hello, > > is there a way in Julia for a file that is `include`d to signal that the > rest of the file should be ignored? Something like

Re: [julia-users] Re: ImageView very slow

2016-10-25 Thread Paul B.
Tim, when you say you fixed this, you mean the deprecation warnings? I'll definitely use the new version of Images. I haven't had a chance yet since posting this. Images and related libraries look great. The graphics functionality in Julia that deal with bitmaps like ImageView and pcolor in

[julia-users] Which data structure do you suggest for handling this data?

2016-10-25 Thread MP
Hi all, I have a grid network with a number nodes with (x,y) coordinates, and I have a couple of individuals that visit these nodes in the network. For instance, individual 1 visits nodes (1,3), (4,5), (8,9) and individual 2 visits (4,3), (2,5). I need to access these nodes for each

[julia-users] ANN: best practices choosing and using names

2016-10-25 Thread Jeffrey Sarnoff
from the introduction: It is easier to understand what `facial_recognition` does than it is to > understand what `facer` does. These brief guides collect information on best practices and sound > approaches using names with Julia. The material is available here

Re: [julia-users] llvm call error

2016-10-25 Thread iceblue25 . 1
I need some part of my julia code to be executed at run time and be loaded as llvm IR (or assembly). It is allowed to be IR or assembly code but not julia source code or c source code. Are there other options like the output-bc option that can work for me? What other approaches I can

Re: [julia-users] Binary read

2016-10-25 Thread Michele Zaffalon
You open the file in the correct way. To read the integer, do read(f, Int32) followed by read(f, Float64, 1_000_000) to read the million floats. See the manual at http://docs.julialang.org/en/release-0.5/stdlib/io-network/ On Tue, Oct 25, 2016 at 10:05 PM, Aleksandr Mikheev

[julia-users] Re: ANN: ParallelAccelerator v0.2 for Julia 0.5 released.

2016-10-25 Thread Todd Anderson
Actually, it seems that the pull request into Julia metadata to set the default ParallelAccelerator version has not yet been merged. So, if you want the simplest package update or to get the correct version with a simple Pkg.add then hold off until the merge happens. I'll post here again

[julia-users] Binary read

2016-10-25 Thread Aleksandr Mikheev
Hello, sorry if this question have already been asked, but I could not find a similar thread. So, I have a .dat ("numbers.dat") file, which I should open. I believe I should do something like this: f = open("numbers.dat") And after that I tried to read it: readlines(f) However, Julia

Re: [julia-users] Binary read

2016-10-25 Thread Yichao Yu
On Tue, Oct 25, 2016 at 4:05 PM, Aleksandr Mikheev wrote: > Hello, sorry if this question have already been asked, but I could not find > a similar thread. So, I have a .dat ("numbers.dat") file, which I should > open. I believe I should do something like this: > >> f =

Re: [julia-users] Binary read

2016-10-25 Thread Michele Zaffalon
The three read commands are reading the first, the second and the third element of the file (and interpret them as Int32). That the values are in general different should not be a surprise. Yes, after you finish reading the file, you should close it: f = open("numbers.dat") anInt = read(f, Int32)

Re: [julia-users] Binary read

2016-10-25 Thread Aleksandr Mikheev
Thank you very much, Michele! One more question, if you do not mind. If I do something like this: f = open("numbers.dat") a = read(f, Int32) a = read(f, Int32) a = read(f, Int32) then a is different each time. I believe I read something about that you should use command close() each you

[julia-users] ANN: best practices choosing and using names

2016-10-25 Thread Jeffrey Sarnoff
from the introduction: It is easier to understand what `facial_recognition` does than it is to > understand what `facer` does. These brief guides collect information on best practices and sound > approaches using names with Julia. The material is available

[julia-users] Re: CoinOptServices

2016-10-25 Thread Tony Kelman
do you have the lapack dll opened by some other julia process?

Re: [julia-users] Re: Nemo AcbField error

2016-10-25 Thread Jeffrey Sarnoff
What happens if you restart that Julia from the windows menu (if that does not launch cygwin terminal) and do >Pkg.build("Nemo") again? On Tue, Oct 25, 2016 at 7:37 PM, digxx wrote: > Sry but I followed precisely ur steps i.e.: > I installed a completely new version in

Re: [julia-users] Re: Nemo AcbField error

2016-10-25 Thread Jeffrey Sarnoff
send me all the messages output, please On Tue, Oct 25, 2016 at 7:41 PM, Jeffrey Sarnoff wrote: > What happens if you restart that Julia from the windows menu (if that does > not launch cygwin terminal) > and do >Pkg.build("Nemo") again? > > On Tue, Oct 25, 2016 at

[julia-users] stop reading input from script

2016-10-25 Thread Steven G. Johnson
Wrap the unwanted code in a comment via #= . . =#

Re: [julia-users] Re: Nemo AcbField error

2016-10-25 Thread digxx
Sry but I followed precisely ur steps i.e.: I installed a completely new version in D:\Julia\Julia-0.5.0 and added an environment variable JULIA_PKGDIR within D:\Julia because I didn't like the default one. I then initialized by Pkg.init() I ran Pkg.update() (prob not needed here coz its new) I

Re: [julia-users] use macros like a preprocessor directive?

2016-10-25 Thread Steven G. Johnson
You can use @static to implement a parse-time conditional

[julia-users] Re: stop reading input from script

2016-10-25 Thread Ethan Anderes
I don’t know the answer to your question…but it sounds similar to some functionality I was looking for a while back. I wanted to be able to pass a range of line numbers to include and only have those lines executed. Sometime like include(script.jl, 1:100) which would only run lines 1-100. I

Re: [julia-users] Re: ImageView very slow

2016-10-25 Thread Tim Holy
Yes, it should be pretty responsive now---ImageView doesn't have to go through a Python layer, so I think it's a bit snappier. It's been a while since I've used Matlab, but at least when I first compared them ImageView was considerably better than Matlab for interactive display of movies, etc. But

[julia-users] Re: Importing Python data to Julia

2016-10-25 Thread Steven G. Johnson
Don't evaluate Julia code as strings. Just call Julia functions directly. j.inv(randMat) should work

[julia-users] promote_op seems flakey (in a pure context)

2016-10-25 Thread Andy Ferris
I seem to be getting non-deterministic behaviour from `promote_op`, e.g. where the output of the function is different at the REPL, in a function and in a generated function. Inside the function generator it sometimes works to give the correct result and sometimes returns `Any`. I haven't seen

[julia-users] Comprehension (generator) with statement IF and the number of true

2016-10-25 Thread Martin Florek
Hi all, I'm new in Julia and I'm doing refactoring. I have the following function: function mapeBase_v1(A::Vector{Float64}, F::Vector{Float64}) s = 0.0 count = 0 for i in 1:length(A) if(A[i] != 0.0) s += abs( (A[i] - F[i]) / A[i]) count += 1 end end s, count end

[julia-users] Re: parse Unicode string to Float64

2016-10-25 Thread Chris Stook
The file ( https://github.com/cstook/LTspice.jl/blob/LTspiceXVII_compat/test/test1.log) is a .log file produced by LTspiceXVII ( http://www.linear.com/designtools/software/). I'm using regular expressions to parse the file. The code below shows the problem. io = open("test1.log","r") for line

[julia-users] Re: parse Unicode string to Float64

2016-10-25 Thread Jeffrey Sarnoff
I downloaded that software, did you create that log file? If so, how? It is likely that what is being stored in the log file is not a sequence of numbers in a vanilla format. So parsing it as a sequence of strings is not going to work. from their help: OK, that works for bitmaps, but can

[julia-users] Re: parse Unicode string to Float64

2016-10-25 Thread Chris Stook
The circuit file is test1.asc ( https://github.com/cstook/LTspice.jl/blob/master/test/test1.asc). You should be able to open it with LTspice and run the simulation to produce the log file. The log file is a human readable text file, which I am parsing to get the measurements. LTspiceIV used

[julia-users] Re: parse Unicode string to Float64

2016-10-25 Thread Jeffrey Sarnoff
I got this log file: Circuit: * C:\Users\Jeff\Documents\LTspiceXVII\examples\test.asc Direct Newton iteration for .op point succeeded. current: i(r1)=2.5 Date: Tue Oct 25 03:55:44 2016 Total elapsed time: 0.134 seconds. tnom = 27 temp = 27 method = modified trap totiter = 2091 traniter = 2088

[julia-users] Re: Comprehension (generator) with statement IF and the number of true

2016-10-25 Thread DNF
Could you explain why you are unhappy with v1? It seems like a near-optimal implementation to me. It is idiomatic Julia, clean, clear, and fast. Are you certain that you're not looking for a one-liner out of force of habit? On Tuesday, October 25, 2016 at 9:15:54 AM UTC+2, Martin Florek wrote:

[julia-users] Re: Comprehension (generator) with statement IF and the number of true

2016-10-25 Thread Jeffrey Sarnoff
this change saves some space: `count_zeros = length( find(x->x==0.0, actuals) )` On Tuesday, October 25, 2016 at 4:48:29 AM UTC-4, Jeffrey Sarnoff wrote: > > As given above, the time is in sum_reldiffs, the space is in the > count_zeros. > > On Tuesday, October 25, 2016 at 4:42:02 AM UTC-4,

[julia-users] Re: parse Unicode string to Float64

2016-10-25 Thread Simon Byrne
It seems like you have a bunch of null characters in the string for some reason. You could try stripping them out with replace: julia> x = "\x002\0.\x005\0" "\x002\0.\x005\0" julia> y = replace(x,"\0","") "2.5" julia> parse(Float64, y) 2.5 On Tuesday, 25 October 2016 05:44:34 UTC+1,

[julia-users] Re: Comprehension (generator) with statement IF and the number of true

2016-10-25 Thread Martin Florek
Thnaks, It is true, but when I apply @benchmark v3 is 6 times slower as v1, also has a large allocation and I do not want it. For me speed is important and v3 is not without visual noise, too. Any more thoughts? ben1 = @benchmark mapeBase_v1(a,f) BenchmarkTools.Trial: samples: 848

[julia-users] Re: parse Unicode string to Float64

2016-10-25 Thread Chris Stook
I just need a vector of the values. The names are known from the circuit file. The problem is really just with converting the string to a Float64 value when the file is Unicode from LTspiceXVII. Everything works fine with the ASCII from LTspiceIV. More specifically, the capturing block

Re: [julia-users] Re: Comprehension (generator) with statement IF and the number of true

2016-10-25 Thread Gregory Salvan
maybe with reduce ? ``` function mapeBase_v4(A::Vector{Float64}, F::Vector{Float64}) function abscount(prev, current) current[2] == 0.0 && return prev index, item = current (prev[1] + abs( 1 - F[index] / item), prev[2] + 1) end reduce(abscount, (0.0, 0), enumerate(A)) end ```

[julia-users] Re: Comprehension (generator) with statement IF and the number of true

2016-10-25 Thread Jeffrey Sarnoff
This may do what you want. function mapeBase_v3(actuals::Vector{Float64}, forecasts::Vector{Float64}) # actuals - actual target values # forecasts - forecasts (model estimations) sum_reldiffs = sumabs((x - y) / x for (x, y) in zip(actuals, forecasts) if x != 0.0) # Generator count_zeros =

Re: [julia-users] Trait for exactness of numbers

2016-10-25 Thread Mauro
You can use SimpleTraits.jl for this: using SimpleTraits # Using Jeffrey's function, define good defaults: function isexact{X}(::Type{X}) if X<:Integer || X<:Rational true elseif X<:Complex isexact(real(X)) else false end end @traitdef IsExact{X}

[julia-users] Re: Importing Python data to Julia

2016-10-25 Thread Christoph Ortner
I haven't tried, but I think it should be result = j.inv(randMat) On Tuesday, 25 October 2016 05:05:47 UTC+1, Corbin Foucart wrote: > > How? If you don't mind my asking. It doesn't seem that documentation > exists... Suppose in a python script, I have: > > [python imports] > [pyjulia

[julia-users] Re: CoinOptServices

2016-10-25 Thread Miles Lubin
Please open an issue on the CoinOptServices repository with as much information as you can to help reproduce the problem. On Tuesday, October 25, 2016 at 11:04:56 AM UTC-4, Frank Kampas wrote: > > When I run Pkg.build("CoinOptServices") using Julia 5.0 and Windows 10, I > get load errors and a

[julia-users] CoinOptServices

2016-10-25 Thread Frank Kampas
Is anybody working on fixing CoinOptServices?

[julia-users] Re: CoinOptServices

2016-10-25 Thread Miles Lubin
I'm not aware of any broken functionality in CoinOptServices, but it hasn't been updated to get rid of deprecation warnings on 0.5. We'd welcome a PR. On Tuesday, October 25, 2016 at 9:01:29 AM UTC-4, Frank Kampas wrote: > > Is anybody working on fixing CoinOptServices? >

[julia-users] Re: Importing Python data to Julia

2016-10-25 Thread Corbin Foucart
That worked; thanks! On Tuesday, October 25, 2016 at 6:36:25 AM UTC-4, Christoph Ortner wrote: > > I haven't tried, but I think it should be > > result = j.inv(randMat) > > > On Tuesday, 25 October 2016 05:05:47 UTC+1, Corbin Foucart wrote: >> >> How? If you don't mind my asking. It doesn't

[julia-users] [ANN] QuickTypes.jl: Concise type definitions with default arguments

2016-10-25 Thread Cedric St-Jean
Types are central to Julia programming, but the built-in `type` and `immutable` definitions can be cumbersome to write. QuickTypes.jl provides two alternative macros, *@qtype* and *@qimmutable, *with a more convenient syntax: Pkg.add("QuickTypes") #

[julia-users] Re: CoinOptServices

2016-10-25 Thread Frank Kampas
When I run Pkg.build("CoinOptServices") using Julia 5.0 and Windows 10, I get load errors and a build error message. On Tuesday, October 25, 2016 at 9:01:29 AM UTC-4, Frank Kampas wrote: > > Is anybody working on fixing CoinOptServices? >

[julia-users] Re: Comprehension (generator) with statement IF and the number of true

2016-10-25 Thread Cedric St-Jean
count_zeros = sum( map(x->(x==0.0), actuals) ) # can be rewritten count_zeros = sum(x==0.0 for x in actuals) This shouldn't allocate, because it's using a generator. I agree with DNF that _v1 is already straight-forward, as far as performance-sensitive code goes. On Tuesday, October 25,

Re: [julia-users] parse Unicode string to Float64

2016-10-25 Thread Milan Bouchet-Valat
Le lundi 24 octobre 2016 à 21:44 -0700, Chris Stook a écrit : > I'm trying to parse a text file which contains some floating point > numbers.  The number 2.5 is represented by the string > "\x002\0.\x005\0".  Parse will not convert this to a Float64.  Print > works (prints "2.5") in Atom and

Re: [julia-users] llvm call error

2016-10-25 Thread Yichao Yu
On Mon, Oct 24, 2016 at 8:15 PM, wrote: > Hi All, > > I am trying to call llvm ir generated from julia. > > Here is my function: > > function incr(a::Array{Int64}) a+1; end > > > thus: > > @code_llvm(incr([1 2 5 6 7])) > > returns: > > define %jl_value_t*

[julia-users] Re: Calling all users of ParallelAccelerator.

2016-10-25 Thread Todd Anderson
The next version of ParallelAccelerator for Julia 0.5 has just been released with experimental support for Julia native threading. Please see the new Julia users post for more details of the new release.

[julia-users] ANN: ParallelAccelerator v0.2 for Julia 0.5 released.

2016-10-25 Thread Todd Anderson
The High Performance Scripting team at Intel Labs is pleased to announce the release of version 0.2 of ParallelAccelerator.jl, a package for high-performance parallel computing in Julia, primarily oriented around arrays and stencils. In this release, we provide support for Julia 0.5 and

Re: [julia-users] llvm call error

2016-10-25 Thread iceblue25 . 1
Thanks, is it possible for julia to avoid generating jl_value_t When I use a scalar Int64 julia generates code with i64 as input and no jl_value_t appears. is it possible to do the same with arrays? Array{Float32,2} genrates a jl_value_t? Is there an array type that can do this? For example

Re: [julia-users] llvm call error

2016-10-25 Thread Stefan Karpinski
Julia can already generate static code: - http://juliacomputing.com/blog/2016/02/09/static-julia.html - http://juliacomputing.com/blog/2016/03/10/j2c-announcement.html However, Julia's @code_llvm output is not meant to be compilable. What are you trying to do? On Tue, Oct 25, 2016 at

[julia-users] Inclusion of local modules in pyjulia

2016-10-25 Thread Corbin Foucart
Suppose that I have a local module in the current directory called 'myModule.jl': module x() = "hello" end In a Julia console, I can do the following: > include("myModule.jl") > myModule.x() "hello" I can do a whos() to check that indeed myModule is in the namespace. I am attempting to call

[julia-users] Re: Trait for exactness of numbers

2016-10-25 Thread Ismael Venegas Castelló
Why not use dispatch instead? isexact(::Integer) = true isexact(::Rational) = true isexact(x::Complex) = isexact(x.re) isexact(::Any) = false

Re: [julia-users] Re: Trait for exactness of numbers

2016-10-25 Thread Tim Holy
> Why not use dispatch instead? Because subtyping isn't powerful enough for all needs. For example: julia> using Unitful julia> const mm = u"mm" mm julia> isa(3.2mm, AbstractFloat) false You'd probably like to use the fancy logic of `FloatRange` if you're constructing a range