[julia-users] Re: changing the package name

2016-04-26 Thread Tony Kelman
Git LFS is https://git-lfs.github.com/ - you didn't enable anything? What 
kind of github account do you have? I wonder if you may have installed some 
git extension, or if homebrew-cask's version of Julia is using its own 
customized git rather than the bundled one?


On Tuesday, April 26, 2016 at 8:13:47 PM UTC-7, Chang Kwon wrote:
>
> "VariationalInequality.jl" is a new name. 
>
> When I did Pkg.publish(), I obtained this error:
>
> This repository is configured for Git LFS but 'git-lfs' was not found on 
> your path. If you no longer wish to use Git LFS, remove this hook by 
> deleting .git/hooks/pre-push.
>
>
> error: failed to push some refs to '
> https://github.com/chkwon/VariationalInequality.jl.git'
>
> ERROR: failed process: Process(`git 
> --work-tree=/Users/chkwon/.julia/v0.4/VariationalInequality 
> --git-dir=/Users/chkwon/.julia/v0.4/VariationalInequality/.git push -q 
> origin refs/tags/v0.0.1:refs/tags/v0.0.1`, ProcessExited(1)) [1]
>
>  in pipeline_error at process.jl:555
>
>  in run at process.jl:531
>
>  [inlined code] from pkg/entry.jl:389
>
>  in anonymous at task.jl:447
>
>  in sync_end at 
> /opt/homebrew-cask/Caskroom/julia/0.4.5/Julia-0.4.5.app/Contents/Resources/julia/lib/julia/sys.dylib
>
>  [inlined code] from task.jl:422
>
>  in publish at pkg/entry.jl:374
>
>  in anonymous at pkg/dir.jl:31
>
>  in cd at file.jl:22
>
>  in cd at pkg/dir.jl:31
>
>  in publish at pkg.jl:61
>
> As suggested, after removing .git/hooks/pre-push, I retried Pkg.publish(), 
> and it went well. I don't know what Git LFS is. 
>
>
>
>

[julia-users] Re: Fbls - a simple but flexible Julia DB

2016-04-26 Thread Ismael Venegas Castelló
what's up

Fbls is an attempt at adding more degrees of freedom to the database 
paradigm, it's an itch I've been scratching for a while now. I'm all for 
standards as interfaces and theory as a starting point; but I'm drawing a 
line in the sand right here, the madness has to stop. All I ever really 
cared about was the ability to store, index and retrieve my data. I'm sick 
and tired of having feature check lists, academia and arbitrary limitations 
shoved down my throat; of being forced to bend ideas backwards around hairy 
solutions to the wrong problem, just to gain basic persistence.


Amen! :D

El martes, 19 de abril de 2016, 11:30:49 (UTC-5), fblscode escribió:
>
> Hi Juliets,
> Just started working on my first major Julia project and thought I'd share 
> some of the results so far:
>
> https://github.com/fblscode/Fbls.jl
>
> A few issues that I'm still struggling with:
>
> 1) I would like to add support for using arrays, dicts and other kinds of 
> sequences as field values. The problem I'm having is figuring out if a 
> value is iterable / associable. I'm aware of the informal protocols, but 
> using method_exists to check for them on concrete values isn't working. 
>
> 2) The Fbls event type specifies the types of the arguments it expects as 
> a Tuple{...}. Is there any way to steal the tuple parametric magic to avoid 
> having to leak information about using Tuples? What I'm looking for a way 
> to specify a type as having an arbitrary number of type parameters and 
> being able to them to generate tuple types.
>
> 3) Is there any way to specify parametric function types? The Function 
> type takes no type parameters, and I can't find anything else.
>
> 4) The whole experience was so Lisp like that I found myself reaching for 
> special vars, without success. Is there anything comparable lurking in 
> there somewhere?
>
> Any help appreciated...
>
> Peace
>


Re: [julia-users] Re: automatic export of all enum values

2016-04-26 Thread David P. Sanders
Thanks. Tricky! 


Re: [julia-users] How to print out the expression of a simple function

2016-04-26 Thread Yichao Yu
On Wed, Apr 27, 2016 at 12:08 AM, Ismael Venegas Castelló <
ismael.vc1...@gmail.com> wrote:

> Does the field code has a use for non anon funcs? I can see that the
> g.code object is a LambdaStaticData, so only for anon funcs. I was trying
> to understand the implementation differences.
>
Not afaik and thing have changed a lot on master


> ​
>
> Ismael Venegas Castelló
>
> *Data Analyst*
>
> Cel. 044 55 6434 0229
>
> ivene...@richit.com.mx
>
> Cerro San Francisco 357, C.P. 04200
>
> Campestre Churubusco, Coyoacán
>
> Ciudad de México
>
> 
>
> 
> 
>   
>
> Tel. 6718 1818
> richit.com.mx
>
> 2016-04-26 22:52 GMT-05:00 Yichao Yu :
>
>> On Tue, Apr 26, 2016 at 10:42 PM, Ismael Venegas Castelló
>>  wrote:
>> > Why is `f.code` an `UndefRefError`?
>> >
>> > julia> f.code
>> >
>> > ERROR: UndefRefError: access to undefined reference
>> >
>>
>> Because it doesn't exist.
>>
>> >
>> >
>> > El martes, 26 de abril de 2016, 18:27:50 (UTC-5), Yichao Yu escribió:
>> >>
>> >> On Tue, Apr 26, 2016 at 6:39 PM,   wrote:
>> >> > I wonder how to print the expression of a function, e.g. x.^2 for the
>> >> > following example.
>> >> >
>> >> > julia> f(x) = x.^2
>> >> > f (generic function with 1 method)
>> >> >
>> >> > julia> f
>> >> > f (generic function with 1 method)
>> >> >
>> >> > If it is not possible for the expression of a function as simple as
>> the
>> >> > above to be printed, is there a way to display more info for a
>> function,
>> >> > instead of just the reference of the container f?
>> >> >
>> >> > I searched in the past threads and didn't any similar question. But
>> this
>> >> > may
>> >> > be the case because what I'm asking is, again, a dumb question.
>> >> >
>> >> > Thanks.
>> >>
>> >>
>> >>
>> http://julia.readthedocs.org/en/latest/search/?q=code_lowered_keywords=yes=default#
>> >>
>> >> >
>> >> > Calvin
>>
>
>


Re: [julia-users] How to print out the expression of a simple function

2016-04-26 Thread Ismael Venegas Castelló
Does the field code has a use for non anon funcs? I can see that the g.code
object is a LambdaStaticData, so only for anon funcs. I was trying to
understand the implementation differences.
​

Ismael Venegas Castelló

*Data Analyst*

Cel. 044 55 6434 0229

ivene...@richit.com.mx

Cerro San Francisco 357, C.P. 04200

Campestre Churubusco, Coyoacán

Ciudad de México




  

Tel. 6718 1818
richit.com.mx

2016-04-26 22:52 GMT-05:00 Yichao Yu :

> On Tue, Apr 26, 2016 at 10:42 PM, Ismael Venegas Castelló
>  wrote:
> > Why is `f.code` an `UndefRefError`?
> >
> > julia> f.code
> >
> > ERROR: UndefRefError: access to undefined reference
> >
>
> Because it doesn't exist.
>
> >
> >
> > El martes, 26 de abril de 2016, 18:27:50 (UTC-5), Yichao Yu escribió:
> >>
> >> On Tue, Apr 26, 2016 at 6:39 PM,   wrote:
> >> > I wonder how to print the expression of a function, e.g. x.^2 for the
> >> > following example.
> >> >
> >> > julia> f(x) = x.^2
> >> > f (generic function with 1 method)
> >> >
> >> > julia> f
> >> > f (generic function with 1 method)
> >> >
> >> > If it is not possible for the expression of a function as simple as
> the
> >> > above to be printed, is there a way to display more info for a
> function,
> >> > instead of just the reference of the container f?
> >> >
> >> > I searched in the past threads and didn't any similar question. But
> this
> >> > may
> >> > be the case because what I'm asking is, again, a dumb question.
> >> >
> >> > Thanks.
> >>
> >>
> >>
> http://julia.readthedocs.org/en/latest/search/?q=code_lowered_keywords=yes=default#
> >>
> >> >
> >> > Calvin
>


Re: [julia-users] How to print out the expression of a simple function

2016-04-26 Thread Yichao Yu
On Tue, Apr 26, 2016 at 10:42 PM, Ismael Venegas Castelló
 wrote:
> Why is `f.code` an `UndefRefError`?
>
> julia> f.code
>
> ERROR: UndefRefError: access to undefined reference
>

Because it doesn't exist.

>
>
> El martes, 26 de abril de 2016, 18:27:50 (UTC-5), Yichao Yu escribió:
>>
>> On Tue, Apr 26, 2016 at 6:39 PM,   wrote:
>> > I wonder how to print the expression of a function, e.g. x.^2 for the
>> > following example.
>> >
>> > julia> f(x) = x.^2
>> > f (generic function with 1 method)
>> >
>> > julia> f
>> > f (generic function with 1 method)
>> >
>> > If it is not possible for the expression of a function as simple as the
>> > above to be printed, is there a way to display more info for a function,
>> > instead of just the reference of the container f?
>> >
>> > I searched in the past threads and didn't any similar question. But this
>> > may
>> > be the case because what I'm asking is, again, a dumb question.
>> >
>> > Thanks.
>>
>>
>> http://julia.readthedocs.org/en/latest/search/?q=code_lowered_keywords=yes=default#
>>
>> >
>> > Calvin


[julia-users] Re: REQUIRE specification for allowing installation in OS X only

2016-04-26 Thread Chang Kwon
How shall I flag an error in deps/build.jl? Can I do something like

if os != :Darwin
   @error("...")
end





On Tuesday, April 26, 2016 at 11:10:42 PM UTC-4, Tony Kelman wrote:
>
> This doesn't exist right now. You can't prevent users on unsupported OSes 
> from installing your package, though you could flag an error in 
> deps/build.jl or at module load time.



[julia-users] Re: changing the package name

2016-04-26 Thread Chang Kwon
"VariationalInequality.jl" is a new name. 

When I did Pkg.publish(), I obtained this error:

This repository is configured for Git LFS but 'git-lfs' was not found on 
your path. If you no longer wish to use Git LFS, remove this hook by 
deleting .git/hooks/pre-push.


error: failed to push some refs to 
'https://github.com/chkwon/VariationalInequality.jl.git'

ERROR: failed process: Process(`git 
--work-tree=/Users/chkwon/.julia/v0.4/VariationalInequality 
--git-dir=/Users/chkwon/.julia/v0.4/VariationalInequality/.git push -q 
origin refs/tags/v0.0.1:refs/tags/v0.0.1`, ProcessExited(1)) [1]

 in pipeline_error at process.jl:555

 in run at process.jl:531

 [inlined code] from pkg/entry.jl:389

 in anonymous at task.jl:447

 in sync_end at 
/opt/homebrew-cask/Caskroom/julia/0.4.5/Julia-0.4.5.app/Contents/Resources/julia/lib/julia/sys.dylib

 [inlined code] from task.jl:422

 in publish at pkg/entry.jl:374

 in anonymous at pkg/dir.jl:31

 in cd at file.jl:22

 in cd at pkg/dir.jl:31

 in publish at pkg.jl:61

As suggested, after removing .git/hooks/pre-push, I retried Pkg.publish(), 
and it went well. I don't know what Git LFS is. 





[julia-users] REQUIRE specification for allowing installation in OS X only

2016-04-26 Thread Tony Kelman
This doesn't exist right now. You can't prevent users on unsupported OSes from 
installing your package, though you could flag an error in deps/build.jl or at 
module load time.

[julia-users] REQUIRE specification for allowing installation in OS X only

2016-04-26 Thread Chang Kwon
My working package currently works only in OS X. Can I specify this in the 
REQUIRE file? 

@osx seems only provide an "if" condition.



Re: [julia-users] How to print out the expression of a simple function

2016-04-26 Thread Ismael Venegas Castelló
This works with anonymous functions though:

julia> g = (x) -> x.^2
(anonymous function)

julia> g.code

AST(:($(Expr(:lambda, Any[:(x::Any)], Any[Any[Any[:x,:Any,0]],Any[],0,Any
[]], :(begin  # none, line 1:
return x .^ 2
end)





El martes, 26 de abril de 2016, 21:42:29 (UTC-5), Ismael Venegas Castelló 
escribió:
>
> Why is `f.code` an `UndefRefError`?
>
> julia> f.code
>
> ERROR: UndefRefError: access to undefined reference
>
>
>
> El martes, 26 de abril de 2016, 18:27:50 (UTC-5), Yichao Yu escribió:
>>
>> On Tue, Apr 26, 2016 at 6:39 PM,   wrote: 
>> > I wonder how to print the expression of a function, e.g. x.^2 for the 
>> > following example. 
>> > 
>> > julia> f(x) = x.^2 
>> > f (generic function with 1 method) 
>> > 
>> > julia> f 
>> > f (generic function with 1 method) 
>> > 
>> > If it is not possible for the expression of a function as simple as the 
>> > above to be printed, is there a way to display more info for a 
>> function, 
>> > instead of just the reference of the container f? 
>> > 
>> > I searched in the past threads and didn't any similar question. But 
>> this may 
>> > be the case because what I'm asking is, again, a dumb question. 
>> > 
>> > Thanks. 
>>
>>
>> http://julia.readthedocs.org/en/latest/search/?q=code_lowered_keywords=yes=default#
>>  
>>
>> > 
>> > Calvin 
>>
>

Re: [julia-users] How to print out the expression of a simple function

2016-04-26 Thread Ismael Venegas Castelló
Why is `f.code` an `UndefRefError`?

julia> f.code

ERROR: UndefRefError: access to undefined reference



El martes, 26 de abril de 2016, 18:27:50 (UTC-5), Yichao Yu escribió:
>
> On Tue, Apr 26, 2016 at 6:39 PM,   
> wrote: 
> > I wonder how to print the expression of a function, e.g. x.^2 for the 
> > following example. 
> > 
> > julia> f(x) = x.^2 
> > f (generic function with 1 method) 
> > 
> > julia> f 
> > f (generic function with 1 method) 
> > 
> > If it is not possible for the expression of a function as simple as the 
> > above to be printed, is there a way to display more info for a function, 
> > instead of just the reference of the container f? 
> > 
> > I searched in the past threads and didn't any similar question. But this 
> may 
> > be the case because what I'm asking is, again, a dumb question. 
> > 
> > Thanks. 
>
>
> http://julia.readthedocs.org/en/latest/search/?q=code_lowered_keywords=yes=default#
>  
>
> > 
> > Calvin 
>


Re: [julia-users] Why don't NaNs raise an error?

2016-04-26 Thread Tom Breloff
A NaN doesn't necessarily signify an error... Mathematically it can
represent the empty set when there is no solution to an equation.

On Tuesday, April 26, 2016, Anonymous  wrote:

> Why are NaNs allowed to be created without raising an error, and then
> allowed to propagate around your program corrupting basically all future
> computation.
>


Re: [julia-users] How to print out the expression of a simple function

2016-04-26 Thread Yichao Yu
On Tue, Apr 26, 2016 at 6:39 PM,   wrote:
> I wonder how to print the expression of a function, e.g. x.^2 for the
> following example.
>
> julia> f(x) = x.^2
> f (generic function with 1 method)
>
> julia> f
> f (generic function with 1 method)
>
> If it is not possible for the expression of a function as simple as the
> above to be printed, is there a way to display more info for a function,
> instead of just the reference of the container f?
>
> I searched in the past threads and didn't any similar question. But this may
> be the case because what I'm asking is, again, a dumb question.
>
> Thanks.

http://julia.readthedocs.org/en/latest/search/?q=code_lowered_keywords=yes=default#

>
> Calvin


[julia-users] PETSc.jl on Windows

2016-04-26 Thread E. Tadeu
Hi,

  Is there someone here using Julia + PETSc on Windows?

  If so, I'd like to know more details about your configuration (which
packages, versions, etc.).

  If not, where should I begin? I've noticed that there's the
`JuliaParallel/PETSc.jl` package, and also a (very simple) `PETSc.jl` from
inside the PETSc package.

  Thanks!


[julia-users] Re: Why does QR beat LU for sparse, square matrices?

2016-04-26 Thread Jonas Kersulis
Thanks for the tip! I'll try this out.

On Tuesday, April 26, 2016 at 10:30:10 AM UTC-4, Miles Lubin wrote:
>
> Hey Jonas,
>
> I don't have an answer to this, but if you're looking for state-of-the-art 
> performance for sparse linear algebra, I'd recommend using a proprietary 
> library like PARDISO .
>
> Miles
>
> On Monday, April 25, 2016 at 4:49:40 PM UTC-4, Jonas Kersulis wrote:
>>
>> Can someone explain why qrfact is faster and requires less memory than 
>> lufact for square, sparse matrices? LU is less computationally complex than 
>> QR, and with decent pivoting LU should be able to preserve sparsity better 
>> than QR, so I'm confused by what I'm seeing in practice.
>>
>> The plots below compare computation time, memory allocation, and garbage 
>> collection time for the two factorization methods. I generated them by 
>> factorizing sprand sparse matrices. The top plot shows results for matrices 
>> with 10% nonzeros; the bottom plot shows results for matrices with 50% 
>> nonzeros. The methods seem to converge in memory performance as density 
>> increases, but LU loses to QR in both cases.
>>
>> I have looked through the paper describing the multifrontal QR algorithm 
>> Julia calls, but I don't understand it fully. Before I spend more time 
>> studying it, I figured I would see if someone here knows the secret sauce 
>> that helps it beat LU.
>>
>> 
>>
>> 
>>
>>
>>

[julia-users] Re: Why does QR beat LU for sparse, square matrices?

2016-04-26 Thread Jonas Kersulis
Good point. The matrices I actually want to factorize are about 1% 
nonzeros. I changed the nonzero parameter to that value and re-ran the 
experiment. Now LU beats QR. 



On Tuesday, April 26, 2016 at 12:05:00 PM UTC-4, Steven G. Johnson wrote:
>
>
>
> On Monday, April 25, 2016 at 4:49:40 PM UTC-4, Jonas Kersulis wrote:
>>
>> Can someone explain why qrfact is faster and requires less memory than 
>> lufact for square, sparse matrices? LU is less computationally complex than 
>> QR, and with decent pivoting LU should be able to preserve sparsity better 
>> than QR, so I'm confused by what I'm seeing in practice.
>>
>
> 50% nonzeros is not sparse enough to exploit sparsity effectively, and 
> even 10% nonzeros is probably too much.  None of the sparse algorithms are 
> really going to work particularly well in such cases; you are better off 
> with dense matrices.I'm not sure comparing the sparse LU and QR 
> algorithms in such cases is particularly meaningful.
>
> A more realistic application of sparse matrices would be something like 
> discretizing a PDE on a 2d mesh.  A 100x100 grid with nearest-neighbor 
> interactions is a 1x1 matrix, with about 5*1 nonzero entries, 
> corresponding to 5/1 = 0.05% sparsity.
>
> (There is a famous Wilkinson quote: "A sparse matrix is any matrix with 
> enough zeros that is worthwhile to take advantage of them."   You don't 
> have enough zeros to be worth exploiting.)
>


[julia-users] Why don't NaNs raise an error?

2016-04-26 Thread Anonymous
Why are NaNs allowed to be created without raising an error, and then 
allowed to propagate around your program corrupting basically all future 
computation.


[julia-users] How to print out the expression of a simple function

2016-04-26 Thread chobbes158
I wonder how to print the expression of a function, e.g. x.^2 for the 
following example.

julia> f(x) = x.^2
f (generic function with 1 method)

julia> f
f (generic function with 1 method)

If it is not possible for the expression of a function as simple as the 
above to be printed, is there a way to display more info for a function, 
instead of just the reference of the container f? 

I searched in the past threads and didn't any similar question. But this 
may be the case because what I'm asking is, again, a dumb question.

Thanks.

Calvin


[julia-users] Re: Evaluation of boolean expression fails

2016-04-26 Thread Ali Rezaee
That's a very beautiful solution.
Thank you! 

On Tuesday, April 26, 2016 at 10:58:39 PM UTC+2, Josh Langsfeld wrote:

> eval works in global scope but returns its result locally, so something 
> like this works easily enough:
>
> rulestrs = ["x[1] && x[2]", "x[3] || x[4]", "x[1] && (x[2] || x[3])"]
>
> function evaluate(rules, boolList)
>   rulefuncs = [eval(parse(string("x -> ", rule))) for rule in rules]
>   Bool[rf(boolList) for rf in rulefuncs]
> end
>
> evaluate(rulestrs, [true, false, true, false])  #output: Array{Bool,1} - 
> [false, 
> true, true]
>
> Note the the Bool is required for the comprehension to get the correct 
> output type because the compiler has no idea that all the anonymous 
> functions return Bools.
>
> On Tuesday, April 26, 2016 at 2:24:18 PM UTC-4, Ali Rezaee wrote:
>>
>> Reading the rules from a file, how can I convert the strings to such 
>> anonymous functions?
>>
>> On Tuesday, April 26, 2016 at 6:48:21 PM UTC+2, Josh Langsfeld wrote:
>>>
>>> Maybe a better design would be to store the rules as anonymous functions 
>>> rather than code strings? Something like:
>>>
>>> ```
>>> rules = [(x -> x[1] && x[2]), (x -> x[3] || x[4])] #parentheses not 
>>> required
>>> result = [rule(boolList) for rule in rules]
>>> ```
>>>
>>> On Tuesday, April 26, 2016 at 12:09:33 PM UTC-4, Ali Rezaee wrote:


 Thanks for your replies.
 My objective is exactly what the code shows. I have a list of Boolean 
 expressions similar to the examples in the code, and I need to evaluate 
 them one by one based on x values.
 So writing a macro would be the only solution.

 Best regards
 On Tuesday, April 26, 2016 at 5:38:21 PM UTC+2, Ali Rezaee wrote:

> Hi everyone,
>
> I am trying to run the code below. When I try the code outside of a 
> function and in REPL, it runs successfully. However when I run it using a 
> function it throw an error.
> Why do I get the error? and how can I solve this problem?
>
> Thanks in advance for your help.
>
> rules = ["(x[1] && x[2])", "(x[3] || x[4])"]; # a list of boolean 
> expressions
> boolList = [false, true, false, true]; # a boolean vector for every x 
> in rules
>
> function evaluate(rules, boolList)
>   x = boolList
>   result = Array{Bool}(length(rules))
>   for (i, rule) in enumerate(rules)
> result[i] = eval(parse(rule))
>   end
>   return result
> end
>
> evaluate(rules, boolList)
> # ERROR: UndefVarError: x not defined
>
> # but This will work:
> x = boolList
> result = Array{Bool}(length(rules))
> for (i, rule) in enumerate(rules)
>   result[i] = eval(parse(rule))
> end
>
> result
> # 2-element Array{Bool,1}: false true
>
>
>

Re: [julia-users] Re: Good practices for constrained constructors

2016-04-26 Thread Stefan Karpinski
I would consider this a bug in Lint, not an actual problem. If a
constructor either doesn't return (i.e. errors) or returns the right type,
it still always returns the right type.

On Tue, Apr 26, 2016 at 5:10 PM, Jeffrey Sarnoff 
wrote:

> try this:
>
> type LoHiPair{T<:Real}
> lo::T
> hi::T
>
> function LoHiPair{A}(lo::A, hi::A)
> if lo > hi
>throw( error("out of order") )
>end
>new(lo, hi)
> end
> end
>
> LoHiPair{T<:Real}(lo::T, hi::T) = LoHiPair{T}(lo, hi)
>
>
> On Tuesday, April 26, 2016 at 3:57:59 PM UTC-4, CrocoDuck O'Ducks wrote:
>>
>> Hi there!
>>
>> I was reading this
>> 
>> and trying the code, which I saved into a file called test.jl:
>>
>> type OrderedPair
>>   x::Real
>>   y::Real
>>
>>   OrderedPair(x,y) = x > y ? error("out of order") : new(x,y)
>> end
>>
>>
>> If I use lintfile("test.jl") I get this:
>>
>> ConstrTest.jl:5 E611 : constructor doesn't seem to return the constructed
>> object
>>
>> I am implementing a similar constructor for a project of mine and I was
>> wondering whether, in general, the use of error() in the constructor is
>> good practice or if I should prefer other ways to solve the problem.
>>
>


[julia-users] Re: Good practices for constrained constructors

2016-04-26 Thread Jeffrey Sarnoff
try this:

type LoHiPair{T<:Real}
lo::T
hi::T

function LoHiPair{A}(lo::A, hi::A)
if lo > hi
   throw( error("out of order") )
   end
   new(lo, hi)
end
end

LoHiPair{T<:Real}(lo::T, hi::T) = LoHiPair{T}(lo, hi)


On Tuesday, April 26, 2016 at 3:57:59 PM UTC-4, CrocoDuck O'Ducks wrote:
>
> Hi there!
>
> I was reading this 
> 
>  
> and trying the code, which I saved into a file called test.jl:
>
> type OrderedPair
>   x::Real
>   y::Real
>
>   OrderedPair(x,y) = x > y ? error("out of order") : new(x,y)
> end
>
>
> If I use lintfile("test.jl") I get this:
>
> ConstrTest.jl:5 E611 : constructor doesn't seem to return the constructed 
> object
>
> I am implementing a similar constructor for a project of mine and I was 
> wondering whether, in general, the use of error() in the constructor is 
> good practice or if I should prefer other ways to solve the problem.
>


[julia-users] Re: Evaluation of boolean expression fails

2016-04-26 Thread Josh Langsfeld
eval works in global scope but returns its result locally, so something 
like this works easily enough:

rulestrs = ["x[1] && x[2]", "x[3] || x[4]", "x[1] && (x[2] || x[3])"]

function evaluate(rules, boolList)
  rulefuncs = [eval(parse(string("x -> ", rule))) for rule in rules]
  Bool[rf(boolList) for rf in rulefuncs]
end

evaluate(rulestrs, [true, false, true, false])  #output: Array{Bool,1} - 
[false, 
true, true]

Note the the Bool is required for the comprehension to get the correct 
output type because the compiler has no idea that all the anonymous 
functions return Bools.

On Tuesday, April 26, 2016 at 2:24:18 PM UTC-4, Ali Rezaee wrote:
>
> Reading the rules from a file, how can I convert the strings to such 
> anonymous functions?
>
> On Tuesday, April 26, 2016 at 6:48:21 PM UTC+2, Josh Langsfeld wrote:
>>
>> Maybe a better design would be to store the rules as anonymous functions 
>> rather than code strings? Something like:
>>
>> ```
>> rules = [(x -> x[1] && x[2]), (x -> x[3] || x[4])] #parentheses not 
>> required
>> result = [rule(boolList) for rule in rules]
>> ```
>>
>> On Tuesday, April 26, 2016 at 12:09:33 PM UTC-4, Ali Rezaee wrote:
>>>
>>>
>>> Thanks for your replies.
>>> My objective is exactly what the code shows. I have a list of Boolean 
>>> expressions similar to the examples in the code, and I need to evaluate 
>>> them one by one based on x values.
>>> So writing a macro would be the only solution.
>>>
>>> Best regards
>>> On Tuesday, April 26, 2016 at 5:38:21 PM UTC+2, Ali Rezaee wrote:
>>>
 Hi everyone,

 I am trying to run the code below. When I try the code outside of a 
 function and in REPL, it runs successfully. However when I run it using a 
 function it throw an error.
 Why do I get the error? and how can I solve this problem?

 Thanks in advance for your help.

 rules = ["(x[1] && x[2])", "(x[3] || x[4])"]; # a list of boolean 
 expressions
 boolList = [false, true, false, true]; # a boolean vector for every x 
 in rules

 function evaluate(rules, boolList)
   x = boolList
   result = Array{Bool}(length(rules))
   for (i, rule) in enumerate(rules)
 result[i] = eval(parse(rule))
   end
   return result
 end

 evaluate(rules, boolList)
 # ERROR: UndefVarError: x not defined

 # but This will work:
 x = boolList
 result = Array{Bool}(length(rules))
 for (i, rule) in enumerate(rules)
   result[i] = eval(parse(rule))
 end

 result
 # 2-element Array{Bool,1}: false true




Re: [julia-users] Pyplot and type definitions

2016-04-26 Thread samuel . huberman
In my jupyter notebook, sequentially, I define types:

workspace() # needed for redefining type
type State
position::Int
spin::Array{Any,2}
State() = new(0,[1 0]')
State(position,spin) = new(position,spin)
end

and functions on types

function +(s1::State, s2::State)
#Linear combination
if s1.position == s2.position
s=State(s1.position,s2.spin+s1.spin)
return s
else
return [s1,s2]
end
end

then when I call

using PyPlot

the warnings are (I get no plots, only PyObject 
)

WARNING: Method definition remotecall(Function, Main.Base.LocalProcess, 
Any...) in module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:822 
overwritten in module Compat at 
/Users//.julia/v0.4/Compat/src/Compat.jl:822.
WARNING: Method definition remotecall(Function, Main.Base.Worker, Any...) 
in module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:823 
overwritten in module Compat at 
/Users//.julia/v0.4/Compat/src/Compat.jl:823.
WARNING: Method definition remotecall(Function, Integer, Any...) in module 
Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:824 overwritten in 
module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:824.
WARNING: Method definition cor(AbstractArray{T<:Any, 2}, 
AbstractArray{T<:Any, 2}, Integer) in module Compat at 
/Users//.julia/v0.4/Compat/src/Compat.jl:888 overwritten in module Compat 
at /Users//.julia/v0.4/Compat/src/Compat.jl:888.
WARNING: Method definition cor(AbstractArray{T<:Any, 2}, Integer) in module 
Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:887 overwritten in 
module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:887.
WARNING: Method definition readavailable(Main.Base.IOStream) in module 
Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:905 overwritten in 
module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:905.
WARNING: Method definition 
readavailable(Main.Base.AbstractIOBuffer{Array{UInt8, 1}}) in module Compat 
at /Users//.julia/v0.4/Compat/src/Compat.jl:906 overwritten in module 
Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:906.
WARNING: Method definition remote_do(Function, Main.Base.LocalProcess, 
Any...) in module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:822 
overwritten in module Compat at 
/Users//.julia/v0.4/Compat/src/Compat.jl:822.
WARNING: Method definition remote_do(Function, Main.Base.Worker, Any...) in 
module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:823 overwritten 
in module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:823.
WARNING: Method definition remote_do(Function, Integer, Any...) in module 
Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:824 overwritten in 
module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:824.
WARNING: Method definition readlines(AbstractString) in module Compat at 
/Users//.julia/v0.4/Compat/src/Compat.jl:904 overwritten in module Compat 
at /Users//.julia/v0.4/Compat/src/Compat.jl:904.
WARNING: Method definition remotecall_wait(Function, 
Main.Base.LocalProcess, Any...) in module Compat at 
/Users//.julia/v0.4/Compat/src/Compat.jl:822 overwritten in module Compat 
at /Users//.julia/v0.4/Compat/src/Compat.jl:822.
WARNING: Method definition remotecall_wait(Function, Main.Base.Worker, 
Any...) in module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:823 
overwritten in module Compat at 
/Users//.julia/v0.4/Compat/src/Compat.jl:823.
WARNING: Method definition remotecall_wait(Function, Integer, Any...) in 
module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:824 overwritten 
in module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:824.
WARNING: Method definition cov(AbstractArray{T<:Any, 1}, 
AbstractArray{T<:Any, 1}, Bool) in module Compat at 
/Users//.julia/v0.4/Compat/src/Compat.jl:883 overwritten in module Compat 
at /Users//.julia/v0.4/Compat/src/Compat.jl:883.
WARNING: Method definition cov(AbstractArray{T<:Any, 2}, 
AbstractArray{T<:Any, 2}, Integer) in module Compat at 
/Users//.julia/v0.4/Compat/src/Compat.jl:884 overwritten in module Compat 
at /Users//.julia/v0.4/Compat/src/Compat.jl:884.
WARNING: Method definition cov(AbstractArray{T<:Any, 2}, 
AbstractArray{T<:Any, 2}, Integer, Bool) in module Compat at 
/Users//.julia/v0.4/Compat/src/Compat.jl:885 overwritten in module Compat 
at /Users//.julia/v0.4/Compat/src/Compat.jl:885.
WARNING: Method definition cov(AbstractArray{T<:Any, 1}, Bool) in module 
Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:880 overwritten in 
module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:880.
WARNING: Method definition cov(AbstractArray{T<:Any, 2}, Integer) in module 
Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:881 overwritten in 
module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:881.
WARNING: Method definition cov(AbstractArray{T<:Any, 2}, Integer, Bool) in 
module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:882 overwritten 
in module Compat at /Users//.julia/v0.4/Compat/src/Compat.jl:882.
WARNING: Method definition read!(AbstractString, 

Re: [julia-users] Pyplot and type definitions

2016-04-26 Thread Tom Breloff
It's hard to help without seeing your code, and more complete output.

On Tue, Apr 26, 2016 at 4:09 PM,  wrote:

> Hi,
>
> I'm trying to use PyPlot in a Jupyter notebook (Julia 0.4.5). I have some
> type definitions and I have some functions that overload functions from
> Base (i.e I define the + operator on my new types). When I try to call a
> plotting function after these definitions, I just get something like
>
> PyObject 
>
> with no plot displayed.
> If I declare "using PyPlot" after my type definitions, I get lots of
> warnings like:
>
> Method definition remotecall(Function, Main.Base.LocalProcess, Any...) in 
> module Compat at /Users/.julia/v0.4/Compat/src/Compat.jl:822 overwritten in 
> module Compat at /Users/.julia/v0.4/Compat/src/Compat.jl:822.
>
>
> So I guess my type definitions and overload functions are interfering with 
> PyPlot. Any ideas how to fix this?
>
>
> Thanks,
>
>


[julia-users] Pyplot and type definitions

2016-04-26 Thread samuel . huberman
Hi,

I'm trying to use PyPlot in a Jupyter notebook (Julia 0.4.5). I have some 
type definitions and I have some functions that overload functions from 
Base (i.e I define the + operator on my new types). When I try to call a 
plotting function after these definitions, I just get something like

PyObject 

with no plot displayed. 
If I declare "using PyPlot" after my type definitions, I get lots of 
warnings like:

Method definition remotecall(Function, Main.Base.LocalProcess, Any...) in 
module Compat at /Users/.julia/v0.4/Compat/src/Compat.jl:822 overwritten in 
module Compat at /Users/.julia/v0.4/Compat/src/Compat.jl:822.


So I guess my type definitions and overload functions are interfering with 
PyPlot. Any ideas how to fix this?


Thanks,



[julia-users] Good practices for constrained constructors

2016-04-26 Thread CrocoDuck O'Ducks
Hi there!

I was reading this 

 
and trying the code, which I saved into a file called test.jl:

type OrderedPair
  x::Real
  y::Real

  OrderedPair(x,y) = x > y ? error("out of order") : new(x,y)
end


If I use lintfile("test.jl") I get this:

ConstrTest.jl:5 E611 : constructor doesn't seem to return the constructed 
object

I am implementing a similar constructor for a project of mine and I was 
wondering whether, in general, the use of error() in the constructor is 
good practice or if I should prefer other ways to solve the problem.


Re: [julia-users] Re: Evaluation of boolean expression fails

2016-04-26 Thread Yichao Yu
On Tue, Apr 26, 2016 at 2:24 PM, Ali Rezaee  wrote:
> Reading the rules from a file, how can I convert the strings to such
> anonymous functions?

You need to `eval` in global scope. If you are more serious about
input validation and such, you might need to have your own parser
instead of trusting the user and evaluate arbitrary user input.
Otherwise parse and eval should be a easy and quick enough dirty
implementation.

>
>
> On Tuesday, April 26, 2016 at 6:48:21 PM UTC+2, Josh Langsfeld wrote:
>>
>> Maybe a better design would be to store the rules as anonymous functions
>> rather than code strings? Something like:
>>
>> ```
>> rules = [(x -> x[1] && x[2]), (x -> x[3] || x[4])] #parentheses not
>> required
>> result = [rule(boolList) for rule in rules]
>> ```
>>
>> On Tuesday, April 26, 2016 at 12:09:33 PM UTC-4, Ali Rezaee wrote:
>>>
>>>
>>> Thanks for your replies.
>>> My objective is exactly what the code shows. I have a list of Boolean
>>> expressions similar to the examples in the code, and I need to evaluate them
>>> one by one based on x values.
>>> So writing a macro would be the only solution.
>>>
>>> Best regards
>>> On Tuesday, April 26, 2016 at 5:38:21 PM UTC+2, Ali Rezaee wrote:

 Hi everyone,

 I am trying to run the code below. When I try the code outside of a
 function and in REPL, it runs successfully. However when I run it using a
 function it throw an error.
 Why do I get the error? and how can I solve this problem?

 Thanks in advance for your help.

 rules = ["(x[1] && x[2])", "(x[3] || x[4])"]; # a list of boolean
 expressions
 boolList = [false, true, false, true]; # a boolean vector for every x in
 rules

 function evaluate(rules, boolList)
   x = boolList
   result = Array{Bool}(length(rules))
   for (i, rule) in enumerate(rules)
 result[i] = eval(parse(rule))
   end
   return result
 end

 evaluate(rules, boolList)
 # ERROR: UndefVarError: x not defined

 # but This will work:
 x = boolList
 result = Array{Bool}(length(rules))
 for (i, rule) in enumerate(rules)
   result[i] = eval(parse(rule))
 end

 result
 # 2-element Array{Bool,1}: false true


>


[julia-users] Re: Improvements to GPU integration with Julia

2016-04-26 Thread Michael Jin
I've noticed that there are computer owners who only have access to an AMD 
GPU (Mac Pro 2013, 2015 iMac) and wish to tap into their GPUs for extra 
processing power for machine learning applications. 

cuBLAS won't help them and it appears that the state of out of the box 
(without much customizations required by the user) OpenCL tool development 
seems to lacking progress. I wish to change that.

On Tuesday, April 26, 2016 at 7:20:52 AM UTC-4, Chris Rackauckas wrote:
>
> I think the GPU integration libraries for Julia are already really good if 
> you're using CUDA. CUDArt.jl and Arrayfire.jl work quite well. I don't know 
> too much about the OpenCL side, but I don't tend to have a use for it.
>
> On Monday, April 25, 2016 at 6:06:10 PM UTC-7, Michael Jin wrote:
>>
>> (Reposted from julia-dev I was told that julia-user was a 
>> more appropriate place to have this thread.)
>>
>> Hi, I'm an undergraduate student and I've been using Julia since 2013. 
>> I've been trying to use the GPU seamlessly for projects involving Julia 
>> matrices. For that end, I have started working on my own OpenCL BLAS Julia 
>> library to test the clBLAS library at the lowest level possible for the GPU 
>> with the OpenCL C library.
>>
>> Here's a link to my project: https://github.com/mikhail-j/OpenCLBLAS.jl
>>
>> This project has been tested on a NVIDIA GTX 780 Ti.
>>
>> Any suggestions on what I can do to improve the state of GPU integration 
>> with Julia?
>>
>

[julia-users] Re: Evaluation of boolean expression fails

2016-04-26 Thread Ali Rezaee
Reading the rules from a file, how can I convert the strings to such 
anonymous functions?

On Tuesday, April 26, 2016 at 6:48:21 PM UTC+2, Josh Langsfeld wrote:
>
> Maybe a better design would be to store the rules as anonymous functions 
> rather than code strings? Something like:
>
> ```
> rules = [(x -> x[1] && x[2]), (x -> x[3] || x[4])] #parentheses not 
> required
> result = [rule(boolList) for rule in rules]
> ```
>
> On Tuesday, April 26, 2016 at 12:09:33 PM UTC-4, Ali Rezaee wrote:
>>
>>
>> Thanks for your replies.
>> My objective is exactly what the code shows. I have a list of Boolean 
>> expressions similar to the examples in the code, and I need to evaluate 
>> them one by one based on x values.
>> So writing a macro would be the only solution.
>>
>> Best regards
>> On Tuesday, April 26, 2016 at 5:38:21 PM UTC+2, Ali Rezaee wrote:
>>
>>> Hi everyone,
>>>
>>> I am trying to run the code below. When I try the code outside of a 
>>> function and in REPL, it runs successfully. However when I run it using a 
>>> function it throw an error.
>>> Why do I get the error? and how can I solve this problem?
>>>
>>> Thanks in advance for your help.
>>>
>>> rules = ["(x[1] && x[2])", "(x[3] || x[4])"]; # a list of boolean 
>>> expressions
>>> boolList = [false, true, false, true]; # a boolean vector for every x 
>>> in rules
>>>
>>> function evaluate(rules, boolList)
>>>   x = boolList
>>>   result = Array{Bool}(length(rules))
>>>   for (i, rule) in enumerate(rules)
>>> result[i] = eval(parse(rule))
>>>   end
>>>   return result
>>> end
>>>
>>> evaluate(rules, boolList)
>>> # ERROR: UndefVarError: x not defined
>>>
>>> # but This will work:
>>> x = boolList
>>> result = Array{Bool}(length(rules))
>>> for (i, rule) in enumerate(rules)
>>>   result[i] = eval(parse(rule))
>>> end
>>>
>>> result
>>> # 2-element Array{Bool,1}: false true
>>>
>>>
>>>

Re: [julia-users] Re: automatic export of all enum values

2016-04-26 Thread Yichao Yu
On Tue, Apr 26, 2016 at 1:56 PM, David P. Sanders  wrote:
>
>
> El martes, 26 de abril de 2016, 12:13:22 (UTC-4), Steven G. Johnson
> escribió:
>>
>>
>>
>> On Tuesday, April 26, 2016 at 11:07:45 AM UTC-4, Pieterjan Robbe wrote:
>>>
>>> Is it possible to export all values of an an enum defined inside a
>>> module?
>>> That is, without rewriting all values after 'export'.
>>
>>
>> for s in instances(WindDirection)
>>
>> @eval export $(symbol(s))
>>
>> end
>
>
>
> The instances function (that I didn't know about) doesn't seem to be shown
> by `methodswith` of the enumeration.
> How could we improve this?

You need to pass in the type of the argument, not the argument itself,
to methodswith

julia> @enum FRUIT apple=1 pear=2

julia> methodswith(Type{FRUIT})
5-element Array{TypeMapEntry,1}:
 convert(::Type{FRUIT}, x::Integer) at Enums.jl:79
 instances(::Type{FRUIT}) at Enums.jl:86
 typemax(x::Type{FRUIT}) at Enums.jl:83
 typemin(x::Type{FRUIT}) at Enums.jl:82
 writemime(io::IO, ::MIME{symbol("text/plain")}, ::Type{FRUIT}) at Enums.jl:103


>
> julia> @enum FRUIT apple=1 pear=2
>
> julia> methodswith(FRUIT)
> 3-element Array{Method,1}:
>  isless(::FRUIT, ::FRUIT) at Enums.jl:84
>  print(::IO, ::FRUIT) at Enums.jl:89
>  show(::IO, ::FRUIT) at Enums.jl:95
>
> julia> methodswith(FRUIT, true)
> 5-element Array{Method,1}:
>  convert{T<:Integer}(::Type{T<:Integer}, x::Enum) at Enums.jl:9
>  isless(::FRUIT, ::FRUIT) at Enums.jl:84
>  print(::IO, ::FRUIT) at Enums.jl:89
>  show(::IO, ::FRUIT) at Enums.jl:95
>  write(io::IO, x::Enum) at Enums.jl:11
>
> julia> instances(FRUIT)
> (apple::FRUIT,pear::FRUIT)


[julia-users] Re: Evaluation of boolean expression fails

2016-04-26 Thread Ali Rezaee
I am writing code for regulated Flux Balance Analysis. I need to read some 
regulatory rules from a file and predict the future state of the genes in 
the network. In this example x is a vector of genes being on or off, and 
each rule belongs to a reaction, i.e. if the rule is true, then the 
reaction is active.

On Tuesday, April 26, 2016 at 7:28:59 PM UTC+2, Steven G. Johnson wrote:
>
>
>
> On Tuesday, April 26, 2016 at 12:09:33 PM UTC-4, Ali Rezaee wrote:
>>
>> My objective is exactly what the code shows. I have a list of Boolean 
>> expressions similar to the examples in the code, and I need to evaluate 
>> them one by one based on x values.
>> So writing a macro would be the only solution.
>>
>
>  That's not an objective, that's an implementation.   What are you 
> actually trying to do in which evaluating lists of boolean expressions 
> arises?
>


[julia-users] Re: automatic export of all enum values

2016-04-26 Thread Pieterjan Robbe
nice solution, thanks!

Op dinsdag 26 april 2016 18:13:22 UTC+2 schreef Steven G. Johnson:
>
>
>
> On Tuesday, April 26, 2016 at 11:07:45 AM UTC-4, Pieterjan Robbe wrote:
>>
>> Is it possible to export all values of an an enum defined inside a module?
>> That is, without rewriting all values after 'export'.
>>
>
> for s in instances(WindDirection)
>
> @eval export $(symbol(s))
> end 
>


Re: [julia-users] Re: Evaluation of boolean expression fails

2016-04-26 Thread Milan Bouchet-Valat
Le mardi 26 avril 2016 à 13:22 -0400, Yichao Yu a écrit :
> On Tue, Apr 26, 2016 at 12:58 PM, Milan Bouchet-Valat  wrote:
> > 
> > Le mardi 26 avril 2016 à 12:52 -0400, Yichao Yu a écrit :
> > > 
> > > On Tue, Apr 26, 2016 at 12:09 PM, Ali Rezaee  wrote:
> > > > 
> > > > 
> > > > 
> > > > Thanks for your replies.
> > > > My objective is exactly what the code shows. I have a list of Boolean
> > > > expressions similar to the examples in the code, and I need to evaluate 
> > > > them
> > > > one by one based on x values.
> > > > So writing a macro would be the only solution.
> > > Just to be clear, a macro can't help here. You need to eval in global
> > > scope if you want to evaluate arbitrary expressions.
> > Well, a macro could replace "x" with the name of the first argument,
> > create a function from that and call it.
> Well, I assume the string is runtime value so there's nothing a macro
> can do. If it is compile time value, then you might as well write the
> code directly instead of storing it in strings...
I assume these expressions come from an external file. We've seen a
similar scenario recently on this list.


Regards

> > 
> > Though if possible creating anonymous functions is clearly a cleaner
> > solution.
> > 
> > 
> > Regards
> > 
> > > 
> > > > 
> > > > 
> > > > 
> > > > Best regards
> > > > 
> > > > On Tuesday, April 26, 2016 at 5:38:21 PM UTC+2, Ali Rezaee wrote:
> > > > > 
> > > > > 
> > > > > 
> > > > > Hi everyone,
> > > > > 
> > > > > I am trying to run the code below. When I try the code outside of a
> > > > > function and in REPL, it runs successfully. However when I run it 
> > > > > using a
> > > > > function it throw an error.
> > > > > Why do I get the error? and how can I solve this problem?
> > > > > 
> > > > > Thanks in advance for your help.
> > > > > 
> > > > > rules = ["(x[1] && x[2])", "(x[3] || x[4])"]; # a list of boolean
> > > > > expressions
> > > > > boolList = [false, true, false, true]; # a boolean vector for every x 
> > > > > in
> > > > > rules
> > > > > 
> > > > > function evaluate(rules, boolList)
> > > > >   x = boolList
> > > > >   result = Array{Bool}(length(rules))
> > > > >   for (i, rule) in enumerate(rules)
> > > > > result[i] = eval(parse(rule))
> > > > >   end
> > > > >   return result
> > > > > end
> > > > > 
> > > > > evaluate(rules, boolList)
> > > > > # ERROR: UndefVarError: x not defined
> > > > > 
> > > > > # but This will work:
> > > > > x = boolList
> > > > > result = Array{Bool}(length(rules))
> > > > > for (i, rule) in enumerate(rules)
> > > > >   result[i] = eval(parse(rule))
> > > > > end
> > > > > 
> > > > > result
> > > > > # 2-element Array{Bool,1}: false true
> > > > > 
> > > > > 


[julia-users] Re: Evaluation of boolean expression fails

2016-04-26 Thread Steven G. Johnson


On Tuesday, April 26, 2016 at 12:09:33 PM UTC-4, Ali Rezaee wrote:
>
> My objective is exactly what the code shows. I have a list of Boolean 
> expressions similar to the examples in the code, and I need to evaluate 
> them one by one based on x values.
> So writing a macro would be the only solution.
>

 That's not an objective, that's an implementation.   What are you actually 
trying to do in which evaluating lists of boolean expressions arises?


[julia-users] Re: Why does QR beat LU for sparse, square matrices?

2016-04-26 Thread Steven G. Johnson
I should also mention that the timings can be quite different (probably 
worse) for an sprand matrix than for a matrix that comes from discretizing 
a mesh, even with the same number of nonzeros.How well sparse-direct 
algorithms work depends a lot on the structure of the sparsity pattern.


Re: [julia-users] Re: Evaluation of boolean expression fails

2016-04-26 Thread Yichao Yu
On Tue, Apr 26, 2016 at 12:58 PM, Milan Bouchet-Valat  wrote:
> Le mardi 26 avril 2016 à 12:52 -0400, Yichao Yu a écrit :
>> On Tue, Apr 26, 2016 at 12:09 PM, Ali Rezaee  wrote:
>> >
>> >
>> > Thanks for your replies.
>> > My objective is exactly what the code shows. I have a list of Boolean
>> > expressions similar to the examples in the code, and I need to evaluate 
>> > them
>> > one by one based on x values.
>> > So writing a macro would be the only solution.
>> Just to be clear, a macro can't help here. You need to eval in global
>> scope if you want to evaluate arbitrary expressions.
> Well, a macro could replace "x" with the name of the first argument,
> create a function from that and call it.

Well, I assume the string is runtime value so there's nothing a macro
can do. If it is compile time value, then you might as well write the
code directly instead of storing it in strings...

>
> Though if possible creating anonymous functions is clearly a cleaner
> solution.
>
>
> Regards
>
>> >
>> >
>> > Best regards
>> >
>> > On Tuesday, April 26, 2016 at 5:38:21 PM UTC+2, Ali Rezaee wrote:
>> > >
>> > >
>> > > Hi everyone,
>> > >
>> > > I am trying to run the code below. When I try the code outside of a
>> > > function and in REPL, it runs successfully. However when I run it using a
>> > > function it throw an error.
>> > > Why do I get the error? and how can I solve this problem?
>> > >
>> > > Thanks in advance for your help.
>> > >
>> > > rules = ["(x[1] && x[2])", "(x[3] || x[4])"]; # a list of boolean
>> > > expressions
>> > > boolList = [false, true, false, true]; # a boolean vector for every x in
>> > > rules
>> > >
>> > > function evaluate(rules, boolList)
>> > >   x = boolList
>> > >   result = Array{Bool}(length(rules))
>> > >   for (i, rule) in enumerate(rules)
>> > > result[i] = eval(parse(rule))
>> > >   end
>> > >   return result
>> > > end
>> > >
>> > > evaluate(rules, boolList)
>> > > # ERROR: UndefVarError: x not defined
>> > >
>> > > # but This will work:
>> > > x = boolList
>> > > result = Array{Bool}(length(rules))
>> > > for (i, rule) in enumerate(rules)
>> > >   result[i] = eval(parse(rule))
>> > > end
>> > >
>> > > result
>> > > # 2-element Array{Bool,1}: false true
>> > >
>> > >


Re: [julia-users] changing the package name

2016-04-26 Thread Milan Bouchet-Valat
Le mardi 26 avril 2016 à 09:17 -0700, Chang Kwon a écrit :
> I was wondering what is the proper way to change the package name
> under development. This is often the case when I submit a package and
> then was recommended to revise the package name. Well, without much
> knowledge of git, I always mess up...
> 
> When I'm ready to develop a package, I generate a package:
> Pkg.generate("TestPkg", "MIT")
> 
> and keep developing. When I'm ready to publish it, I do:
> 
> Pkg.register("TestPkg")
> Pkg.tag("TestPkg")
> Pkg.publish()
> 
> Then, I make a pull request on GitHub.
> 
> Suppose then I need to change the package name to "NewPackageName".
> What do I do now? 
> Things to do might be:
> 
> - change name of the GitHub.com repository
> - change the folder name from .julia/v0.4/TestPkg to
> .julia/v0.4/NewPackageName
> - changing the remote repository address to https://github.com/chkwon
> /NewPackageName.jl.git
> 
> Then I usually have some complaints and errors from Pkg.update() and
> Pkg.publish() saying that TestPkg does not exist, etc. At this
> moment, I'm messed up with .julia/v0.4 folder and all other
> repositories. What is the proper order of making changes? 
I've followed this process recently, and I don't remember errors like
that. As long as there isn't any mention of TestPkg under .julia, you
should be fine (and grep -R can tell you that).

Could you post the exact errors you get?


Regards


Re: [julia-users] Re: Evaluation of boolean expression fails

2016-04-26 Thread Milan Bouchet-Valat
Le mardi 26 avril 2016 à 12:52 -0400, Yichao Yu a écrit :
> On Tue, Apr 26, 2016 at 12:09 PM, Ali Rezaee  wrote:
> > 
> > 
> > Thanks for your replies.
> > My objective is exactly what the code shows. I have a list of Boolean
> > expressions similar to the examples in the code, and I need to evaluate them
> > one by one based on x values.
> > So writing a macro would be the only solution.
> Just to be clear, a macro can't help here. You need to eval in global
> scope if you want to evaluate arbitrary expressions.
Well, a macro could replace "x" with the name of the first argument,
create a function from that and call it.

Though if possible creating anonymous functions is clearly a cleaner
solution.


Regards

> > 
> > 
> > Best regards
> > 
> > On Tuesday, April 26, 2016 at 5:38:21 PM UTC+2, Ali Rezaee wrote:
> > > 
> > > 
> > > Hi everyone,
> > > 
> > > I am trying to run the code below. When I try the code outside of a
> > > function and in REPL, it runs successfully. However when I run it using a
> > > function it throw an error.
> > > Why do I get the error? and how can I solve this problem?
> > > 
> > > Thanks in advance for your help.
> > > 
> > > rules = ["(x[1] && x[2])", "(x[3] || x[4])"]; # a list of boolean
> > > expressions
> > > boolList = [false, true, false, true]; # a boolean vector for every x in
> > > rules
> > > 
> > > function evaluate(rules, boolList)
> > >   x = boolList
> > >   result = Array{Bool}(length(rules))
> > >   for (i, rule) in enumerate(rules)
> > > result[i] = eval(parse(rule))
> > >   end
> > >   return result
> > > end
> > > 
> > > evaluate(rules, boolList)
> > > # ERROR: UndefVarError: x not defined
> > > 
> > > # but This will work:
> > > x = boolList
> > > result = Array{Bool}(length(rules))
> > > for (i, rule) in enumerate(rules)
> > >   result[i] = eval(parse(rule))
> > > end
> > > 
> > > result
> > > # 2-element Array{Bool,1}: false true
> > > 
> > > 


Re: [julia-users] Re: Evaluation of boolean expression fails

2016-04-26 Thread Yichao Yu
On Tue, Apr 26, 2016 at 12:09 PM, Ali Rezaee  wrote:
>
> Thanks for your replies.
> My objective is exactly what the code shows. I have a list of Boolean
> expressions similar to the examples in the code, and I need to evaluate them
> one by one based on x values.
> So writing a macro would be the only solution.

Just to be clear, a macro can't help here. You need to eval in global
scope if you want to evaluate arbitrary expressions.

>
> Best regards
>
> On Tuesday, April 26, 2016 at 5:38:21 PM UTC+2, Ali Rezaee wrote:
>>
>> Hi everyone,
>>
>> I am trying to run the code below. When I try the code outside of a
>> function and in REPL, it runs successfully. However when I run it using a
>> function it throw an error.
>> Why do I get the error? and how can I solve this problem?
>>
>> Thanks in advance for your help.
>>
>> rules = ["(x[1] && x[2])", "(x[3] || x[4])"]; # a list of boolean
>> expressions
>> boolList = [false, true, false, true]; # a boolean vector for every x in
>> rules
>>
>> function evaluate(rules, boolList)
>>   x = boolList
>>   result = Array{Bool}(length(rules))
>>   for (i, rule) in enumerate(rules)
>> result[i] = eval(parse(rule))
>>   end
>>   return result
>> end
>>
>> evaluate(rules, boolList)
>> # ERROR: UndefVarError: x not defined
>>
>> # but This will work:
>> x = boolList
>> result = Array{Bool}(length(rules))
>> for (i, rule) in enumerate(rules)
>>   result[i] = eval(parse(rule))
>> end
>>
>> result
>> # 2-element Array{Bool,1}: false true
>>
>>
>


[julia-users] Re: Evaluation of boolean expression fails

2016-04-26 Thread Josh Langsfeld
Maybe a better design would be to store the rules as anonymous functions 
rather than code strings? Something like:

```
rules = [(x -> x[1] && x[2]), (x -> x[3] || x[4])] #parentheses not required
result = [rule(boolList) for rule in rules]
```

On Tuesday, April 26, 2016 at 12:09:33 PM UTC-4, Ali Rezaee wrote:
>
>
> Thanks for your replies.
> My objective is exactly what the code shows. I have a list of Boolean 
> expressions similar to the examples in the code, and I need to evaluate 
> them one by one based on x values.
> So writing a macro would be the only solution.
>
> Best regards
> On Tuesday, April 26, 2016 at 5:38:21 PM UTC+2, Ali Rezaee wrote:
>
>> Hi everyone,
>>
>> I am trying to run the code below. When I try the code outside of a 
>> function and in REPL, it runs successfully. However when I run it using a 
>> function it throw an error.
>> Why do I get the error? and how can I solve this problem?
>>
>> Thanks in advance for your help.
>>
>> rules = ["(x[1] && x[2])", "(x[3] || x[4])"]; # a list of boolean 
>> expressions
>> boolList = [false, true, false, true]; # a boolean vector for every x in 
>> rules
>>
>> function evaluate(rules, boolList)
>>   x = boolList
>>   result = Array{Bool}(length(rules))
>>   for (i, rule) in enumerate(rules)
>> result[i] = eval(parse(rule))
>>   end
>>   return result
>> end
>>
>> evaluate(rules, boolList)
>> # ERROR: UndefVarError: x not defined
>>
>> # but This will work:
>> x = boolList
>> result = Array{Bool}(length(rules))
>> for (i, rule) in enumerate(rules)
>>   result[i] = eval(parse(rule))
>> end
>>
>> result
>> # 2-element Array{Bool,1}: false true
>>
>>
>>

[julia-users] Re: Why does QR beat LU for sparse, square matrices?

2016-04-26 Thread Kristoffer Carlsson
For completeness, cholesky factorization takes about 0.7 seconds.

On Tuesday, April 26, 2016 at 6:40:50 PM UTC+2, Kristoffer Carlsson wrote:
>
> For a 200 x 200 grid with a 2D elasticity PDE problem I get 2.4 seconds 
> for lufact and 8.2 seconds from qr. The resulting stiffness matrix has a 
> density of ~ 0.00022.
>
>
>
> On Monday, April 25, 2016 at 10:49:40 PM UTC+2, Jonas Kersulis wrote:
>>
>> Can someone explain why qrfact is faster and requires less memory than 
>> lufact for square, sparse matrices? LU is less computationally complex than 
>> QR, and with decent pivoting LU should be able to preserve sparsity better 
>> than QR, so I'm confused by what I'm seeing in practice.
>>
>> The plots below compare computation time, memory allocation, and garbage 
>> collection time for the two factorization methods. I generated them by 
>> factorizing sprand sparse matrices. The top plot shows results for matrices 
>> with 10% nonzeros; the bottom plot shows results for matrices with 50% 
>> nonzeros. The methods seem to converge in memory performance as density 
>> increases, but LU loses to QR in both cases.
>>
>> I have looked through the paper describing the multifrontal QR algorithm 
>> Julia calls, but I don't understand it fully. Before I spend more time 
>> studying it, I figured I would see if someone here knows the secret sauce 
>> that helps it beat LU.
>>
>> 
>>
>> 
>>
>>
>>

[julia-users] Re: changing the package name

2016-04-26 Thread Bart Janssens
You could first uninstall the package, then rename on Github and then clone 
from the new address.

Cheers,

Bart

On Tuesday, April 26, 2016 at 6:17:10 PM UTC+2, Chang Kwon wrote:
>
> I was wondering what is the proper way to change the package name under 
> development. This is often the case when I submit a package and then was 
> recommended to revise the package name. Well, without much knowledge of 
> git, I always mess up...
>
> When I'm ready to develop a package, I generate a package:
> Pkg.generate("TestPkg", "MIT")
>
> and keep developing. When I'm ready to publish it, I do:
>
> Pkg.register("TestPkg")
> Pkg.tag("TestPkg")
> Pkg.publish()
>
> Then, I make a pull request on GitHub.
>
> Suppose then I need to change the package name to "NewPackageName". What 
> do I do now? 
> Things to do might be:
>
> - change name of the GitHub.com repository
> - change the folder name from .julia/v0.4/TestPkg to 
> .julia/v0.4/NewPackageName
> - changing the remote repository address to 
> https://github.com/chkwon/NewPackageName.jl.git
>
> Then I usually have some complaints and errors from Pkg.update() and 
> Pkg.publish() saying that TestPkg does not exist, etc. At this moment, I'm 
> messed up with .julia/v0.4 folder and all other repositories. What is the 
> proper order of making changes? 
>
>

[julia-users] Re: Why does QR beat LU for sparse, square matrices?

2016-04-26 Thread Kristoffer Carlsson
For a 200 x 200 grid with a 2D elasticity PDE problem I get 2.4 seconds for 
lufact and 8.2 seconds from qr. The resulting stiffness matrix has a 
density of ~ 0.00022.



On Monday, April 25, 2016 at 10:49:40 PM UTC+2, Jonas Kersulis wrote:
>
> Can someone explain why qrfact is faster and requires less memory than 
> lufact for square, sparse matrices? LU is less computationally complex than 
> QR, and with decent pivoting LU should be able to preserve sparsity better 
> than QR, so I'm confused by what I'm seeing in practice.
>
> The plots below compare computation time, memory allocation, and garbage 
> collection time for the two factorization methods. I generated them by 
> factorizing sprand sparse matrices. The top plot shows results for matrices 
> with 10% nonzeros; the bottom plot shows results for matrices with 50% 
> nonzeros. The methods seem to converge in memory performance as density 
> increases, but LU loses to QR in both cases.
>
> I have looked through the paper describing the multifrontal QR algorithm 
> Julia calls, but I don't understand it fully. Before I spend more time 
> studying it, I figured I would see if someone here knows the secret sauce 
> that helps it beat LU.
>
> 
>
> 
>
>
>

[julia-users] changing the package name

2016-04-26 Thread Chang Kwon
I was wondering what is the proper way to change the package name under 
development. This is often the case when I submit a package and then was 
recommended to revise the package name. Well, without much knowledge of 
git, I always mess up...

When I'm ready to develop a package, I generate a package:
Pkg.generate("TestPkg", "MIT")

and keep developing. When I'm ready to publish it, I do:

Pkg.register("TestPkg")
Pkg.tag("TestPkg")
Pkg.publish()

Then, I make a pull request on GitHub.

Suppose then I need to change the package name to "NewPackageName". What do 
I do now? 
Things to do might be:

- change name of the GitHub.com repository
- change the folder name from .julia/v0.4/TestPkg to 
.julia/v0.4/NewPackageName
- changing the remote repository address to 
https://github.com/chkwon/NewPackageName.jl.git

Then I usually have some complaints and errors from Pkg.update() and 
Pkg.publish() saying that TestPkg does not exist, etc. At this moment, I'm 
messed up with .julia/v0.4 folder and all other repositories. What is the 
proper order of making changes? 



[julia-users] Re: automatic export of all enum values

2016-04-26 Thread Steven G. Johnson


On Tuesday, April 26, 2016 at 11:07:45 AM UTC-4, Pieterjan Robbe wrote:
>
> Is it possible to export all values of an an enum defined inside a module?
> That is, without rewriting all values after 'export'.
>

for s in instances(WindDirection)

@eval export $(symbol(s))
end 


[julia-users] Re: Why does QR beat LU for sparse, square matrices?

2016-04-26 Thread Steven G. Johnson


On Tuesday, April 26, 2016 at 12:05:00 PM UTC-4, Steven G. Johnson wrote:
>
> A more realistic application of sparse matrices would be something like 
> discretizing a PDE on a 2d mesh.  A 100x100 grid with nearest-neighbor 
> interactions is a 1x1 matrix, with about 5*1 nonzero entries, 
> corresponding to 5/1 = 0.05% sparsity.
>

(Note also that the sparsity is 5/n^2 for an nxn grid, so it gets more 
sparse as the matrix gets larger.)


[julia-users] Re: Why does QR beat LU for sparse, square matrices?

2016-04-26 Thread Steven G. Johnson


On Monday, April 25, 2016 at 4:49:40 PM UTC-4, Jonas Kersulis wrote:
>
> Can someone explain why qrfact is faster and requires less memory than 
> lufact for square, sparse matrices? LU is less computationally complex than 
> QR, and with decent pivoting LU should be able to preserve sparsity better 
> than QR, so I'm confused by what I'm seeing in practice.
>

50% nonzeros is not sparse enough to exploit sparsity effectively, and even 
10% nonzeros is probably too much.  None of the sparse algorithms are 
really going to work particularly well in such cases; you are better off 
with dense matrices.I'm not sure comparing the sparse LU and QR 
algorithms in such cases is particularly meaningful.

A more realistic application of sparse matrices would be something like 
discretizing a PDE on a 2d mesh.  A 100x100 grid with nearest-neighbor 
interactions is a 1x1 matrix, with about 5*1 nonzero entries, 
corresponding to 5/1 = 0.05% sparsity.

(There is a famous Wilkinson quote: "A sparse matrix is any matrix with 
enough zeros that is worthwhile to take advantage of them."   You don't 
have enough zeros to be worth exploiting.)


Re: [julia-users] Re: Arrow Keys when debugging

2016-04-26 Thread chobbes158
I'm thrilled. It worked! Thanks for the hint!

On Tuesday, April 26, 2016 at 2:46:42 PM UTC+1, Scott T wrote:
>
> Try setting
>
> ENV["EDITOR"] = "atom"
>
> in .juliarc. This works for me on a linux system but you may need a 
> different command name to launch atom on mac or windows.
>
>
> On Tuesday, 26 April 2016 12:16:36 UTC+1, chobb...@gmail.com wrote:
>>
>> I know @which, but not @edit. Thanks!
>>
>> Btw, I have a hard time setting the default editor for Julia, following 
>> the suggestion in the following thread.
>>
>>
>> https://groups.google.com/forum/#!searchin/julia-users/default$20editor/julia-users/00OlSKal6uY/7XjDuNnPMUAJ
>>
>> Could you let me know the exact line I need to add in .juliarc, if I want 
>> to set Atom as the default? 
>>
>> Thanks!! 
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Tuesday, April 26, 2016 at 8:38:00 AM UTC+1, Hans-Peter wrote:
>>>
>>> On Monday, 25 April 2016 23:34:03 UTC+2, chobb...@gmail.com wrote:

 ... want to see which constructor is called for construction, if 
 multiple constructors exist

>>>^ 
>>>
>>> Do you know the @which macro? E.g. @which DateTime(2016) or @which 
>>> DateTime("20151204"). To jump to the source code, there is @edit.
>>>
>>

[julia-users] Re: Evaluation of boolean expression fails

2016-04-26 Thread Steven G. Johnson


On Tuesday, April 26, 2016 at 11:38:21 AM UTC-4, Ali Rezaee wrote:
>
> Hi everyone,
>
> I am trying to run the code below. When I try the code outside of a 
> function and in REPL, it runs successfully. However when I run it using a 
> function it throw an error.
> Why do I get the error? and how can I solve this problem?
>

"eval" evaluates expressions in global scope, so local variables like those 
in functions are not accessible.

There is certainly a better way to do whatever you are trying to do.   What 
is your objective here? 


Re: [julia-users] Re: Intel MKL optimizations in default Julia builds?

2016-04-26 Thread Stefan Karpinski
TLDR: since MKL is a proprietary library, we cannot ship Julia with both
that and GPL libraries, and we still ship with a few of those.

On Tue, Apr 26, 2016 at 11:21 AM, Oliver Schulz <
oliver.sch...@tu-dortmund.de> wrote:

> Oh, sorry - kinda missed those. Thanks!
>
>
> On Tuesday, April 26, 2016 at 11:24:29 AM UTC+2, Kristoffer Carlsson wrote:
>>
>> See:
>>
>> https://github.com/JuliaLang/julia/issues/4272
>>
>> https://github.com/JuliaLang/julia/issues/10969
>>
>>
>> https://software.intel.com/en-us/articles/julia-with-intel-mkl-for-improved-performance
>>
>> On Tuesday, April 26, 2016 at 10:16:24 AM UTC+2, Oliver Schulz wrote:
>>>
>>> Apparently, Anaconda 2.5 builds now ship with Intel MKL optimizations:
>>>
>>>
>>> https://www.continuum.io/blog/developer-blog/anaconda-25-release-now-mkl-optimizations
>>>
>>> I wonder if this would be possible for the official Julia builds, too? I
>>> don't know about the MKL licensing conditions (and whether the Anaconda
>>> team had to buy one, or if they got it for free).
>>>
>>>


[julia-users] Evaluation of boolean expression fails

2016-04-26 Thread Ali Rezaee
Hi everyone,

I am trying to run the code below. When I try the code outside of a 
function and in REPL, it runs successfully. However when I run it using a 
function it throw an error.
Why do I get the error? and how can I solve this problem?

Thanks in advance for your help.

rules = ["(x[1] && x[2])", "(x[3] || x[4])"]; # a list of boolean 
expressions
boolList = [false, true, false, true]; # a boolean vector for every x in 
rules

function evaluate(rules, boolList)
  x = boolList
  result = Array{Bool}(length(rules))
  for (i, rule) in enumerate(rules)
result[i] = eval(parse(rule))
  end
  return result
end

evaluate(rules, boolList)
# ERROR: UndefVarError: x not defined

# but This will work:
x = boolList
result = Array{Bool}(length(rules))
for (i, rule) in enumerate(rules)
  result[i] = eval(parse(rule))
end

result
# 2-element Array{Bool,1}: false true




[julia-users] Re: Intel MKL optimizations in default Julia builds?

2016-04-26 Thread Oliver Schulz
Oh, sorry - kinda missed those. Thanks!

On Tuesday, April 26, 2016 at 11:24:29 AM UTC+2, Kristoffer Carlsson wrote:
>
> See:
>
> https://github.com/JuliaLang/julia/issues/4272
>
> https://github.com/JuliaLang/julia/issues/10969
>
>
> https://software.intel.com/en-us/articles/julia-with-intel-mkl-for-improved-performance
>
> On Tuesday, April 26, 2016 at 10:16:24 AM UTC+2, Oliver Schulz wrote:
>>
>> Apparently, Anaconda 2.5 builds now ship with Intel MKL optimizations:
>>
>>
>> https://www.continuum.io/blog/developer-blog/anaconda-25-release-now-mkl-optimizations
>>
>> I wonder if this would be possible for the official Julia builds, too? I 
>> don't know about the MKL licensing conditions (and whether the Anaconda 
>> team had to buy one, or if they got it for free).
>>
>>

[julia-users] automatic export of all enum values

2016-04-26 Thread Pieterjan Robbe
Is it possible to export all values of an an enum defined inside a module?
That is, without rewriting all values after 'export'.

julia> module Compass

export WindDirection

@enum WindDirection north east south west

end


julia> using Compass


julia> WindDirection

Compass.WindDirection


julia> north

ERROR: UndefVarError: north not defined






[julia-users] How to get access to Julia function calling it from matlab engine using MATLAB.jl

2016-04-26 Thread Maxim Barsukov


I have a problem with calling julia functions from matlab engine using 
MATLAB.jl .


In my project I have specific function which I must call outside of the 
engine.


In the simpliest form this problem can be demonstrated like this:


using MATLAB
function julia_func(arg::Integer)
  return argend
@matlab begin
  ans = exp(julia_func(3))end
@mget ans@show ans


After performing this code I get:

Undefined function or variable 'julia_func'.

How to make this work?


I already posted this to stackoverflow.com 
,
 you 
can post your answer there also and i will rate it.  


[julia-users] julia 0.4.5 very slow on ubuntu 16.04 (amd fx 8 -16Go RAM)

2016-04-26 Thread Henri Girard
When I try Gadfly (and specially plots) using Plots gadfly() , initialising 
is very slow about 3 mns to get the plots :

f(x) = exp(-x^2/2)
plot(f, -3, 3)  
Is it normal ?




[julia-users] Re: Why does QR beat LU for sparse, square matrices?

2016-04-26 Thread Miles Lubin
Hey Jonas,

I don't have an answer to this, but if you're looking for state-of-the-art 
performance for sparse linear algebra, I'd recommend using a proprietary 
library like PARDISO .

Miles

On Monday, April 25, 2016 at 4:49:40 PM UTC-4, Jonas Kersulis wrote:
>
> Can someone explain why qrfact is faster and requires less memory than 
> lufact for square, sparse matrices? LU is less computationally complex than 
> QR, and with decent pivoting LU should be able to preserve sparsity better 
> than QR, so I'm confused by what I'm seeing in practice.
>
> The plots below compare computation time, memory allocation, and garbage 
> collection time for the two factorization methods. I generated them by 
> factorizing sprand sparse matrices. The top plot shows results for matrices 
> with 10% nonzeros; the bottom plot shows results for matrices with 50% 
> nonzeros. The methods seem to converge in memory performance as density 
> increases, but LU loses to QR in both cases.
>
> I have looked through the paper describing the multifrontal QR algorithm 
> Julia calls, but I don't understand it fully. Before I spend more time 
> studying it, I figured I would see if someone here knows the secret sauce 
> that helps it beat LU.
>
> 
>
> 
>
>
>

Re: [julia-users] Re: Arrow Keys when debugging

2016-04-26 Thread Scott T
Try setting

ENV["EDITOR"] = "atom"

in .juliarc. This works for me on a linux system but you may need a 
different command name to launch atom on mac or windows.


On Tuesday, 26 April 2016 12:16:36 UTC+1, chobb...@gmail.com wrote:
>
> I know @which, but not @edit. Thanks!
>
> Btw, I have a hard time setting the default editor for Julia, following 
> the suggestion in the following thread.
>
>
> https://groups.google.com/forum/#!searchin/julia-users/default$20editor/julia-users/00OlSKal6uY/7XjDuNnPMUAJ
>
> Could you let me know the exact line I need to add in .juliarc, if I want 
> to set Atom as the default? 
>
> Thanks!! 
>
>
>
>
>
>
>
>
>
> On Tuesday, April 26, 2016 at 8:38:00 AM UTC+1, Hans-Peter wrote:
>>
>> On Monday, 25 April 2016 23:34:03 UTC+2, chobb...@gmail.com wrote:
>>>
>>> ... want to see which constructor is called for construction, if 
>>> multiple constructors exist
>>>
>>^ 
>>
>> Do you know the @which macro? E.g. @which DateTime(2016) or @which 
>> DateTime("20151204"). To jump to the source code, there is @edit.
>>
>

[julia-users] ANN: WinReg.jl

2016-04-26 Thread Simon Byrne
I've put together a small package for interfacing with the Windows registry:
https://github.com/simonbyrne/WinReg.jl

At the moment, it can only be used for querying the registry, but if you 
have other needs, please open a pull request.

-Simon


[julia-users] Re: Installation Problem

2016-04-26 Thread randmstring
Hi,

there's no problem with the installation of either Atom or Juno or Julia, 
it's just that your home dir seems to be on a network drive and that 
doesn't play well with Julia's package manager. You could try setting the 
JULIA_PKGDIR environement variable to a folder on a local hard drive and 
then call Pkg.init() 
.
 
After that, adding packages should work just like that. 

Am Dienstag, 26. April 2016 03:05:27 UTC+2 schrieb Nadir:
>
> Hi,
>
> I tried to install Juno,when trying to add uber-juno in Atom, I get the 
> following message:
>
> Go to the Packages → Julia → Open Terminal menu and
> run `Pkg.add("Atom")` in Julia, then try again.
> If you still see an issue, please report it to:
> julia...@googlegroups.com 
>
> After trying to add the package manually in the shell, I get the following 
> message after 30 mins ...
>
>
> julia> Pkg.add("Atom")
> INFO: Initializing package repository Q:\.julia\v0.4
> INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl
> fatal: The remote end hung up unexpectedly
> ERROR: failed process: Process(`git clone -q -b metadata-v2 git://
> github.com/Jul
> iaLang/METADATA.jl METADATA`, ProcessExited(128)) [128]
>  in run at process.jl:531
>
> julia>
>
> Is this a problem on my end/in my installation of atom?
>
> Thanks for your help and consideration.
>


[julia-users] Re: Improvements to GPU integration with Julia

2016-04-26 Thread Chris Rackauckas
I think the GPU integration libraries for Julia are already really good if 
you're using CUDA. CUDArt.jl and Arrayfire.jl work quite well. I don't know 
too much about the OpenCL side, but I don't tend to have a use for it.

On Monday, April 25, 2016 at 6:06:10 PM UTC-7, Michael Jin wrote:
>
> (Reposted from julia-dev I was told that julia-user was a 
> more appropriate place to have this thread.)
>
> Hi, I'm an undergraduate student and I've been using Julia since 2013. 
> I've been trying to use the GPU seamlessly for projects involving Julia 
> matrices. For that end, I have started working on my own OpenCL BLAS Julia 
> library to test the clBLAS library at the lowest level possible for the GPU 
> with the OpenCL C library.
>
> Here's a link to my project: https://github.com/mikhail-j/OpenCLBLAS.jl
>
> This project has been tested on a NVIDIA GTX 780 Ti.
>
> Any suggestions on what I can do to improve the state of GPU integration 
> with Julia?
>


Re: [julia-users] Re: Arrow Keys when debugging

2016-04-26 Thread chobbes158
I know @which, but not @edit. Thanks!

Btw, I have a hard time setting the default editor for Julia, following the 
suggestion in the following thread.

https://groups.google.com/forum/#!searchin/julia-users/default$20editor/julia-users/00OlSKal6uY/7XjDuNnPMUAJ

Could you let me know the exact line I need to add in .juliarc, if I want 
to set Atom as the default? 

Thanks!! 









On Tuesday, April 26, 2016 at 8:38:00 AM UTC+1, Hans-Peter wrote:
>
> On Monday, 25 April 2016 23:34:03 UTC+2, chobb...@gmail.com wrote:
>>
>> ... want to see which constructor is called for construction, if multiple 
>> constructors exist
>>
>^ 
>
> Do you know the @which macro? E.g. @which DateTime(2016) or @which 
> DateTime("20151204"). To jump to the source code, there is @edit.
>


[julia-users] Re: Arrow Keys when debugging

2016-04-26 Thread ming . chau

great news ! thanks !

Le lundi 25 avril 2016 16:20:33 UTC+2, Steven G. Johnson a écrit :
>
>
>
> That debugger is mostly a stopgap/prototype until we have a "real" 
> debugger based on LLDB, which allows you to run code at full speed until 
> you hit a break point.  Such a debugger was recently introduced for Julia 
> 0.5, and is much more full-featured than Debug.jl:
>
> https://github.com/Keno/Gallium.jl
>
>

Re: [julia-users] Re: build issue on v0.4.2

2016-04-26 Thread ming . chau

it worked ! RAM requirement for building julia from source is higher than 
1Gb. i put 4 Gb


[julia-users] Re: Intel MKL optimizations in default Julia builds?

2016-04-26 Thread Kristoffer Carlsson
See:

https://github.com/JuliaLang/julia/issues/4272

https://github.com/JuliaLang/julia/issues/10969

https://software.intel.com/en-us/articles/julia-with-intel-mkl-for-improved-performance

On Tuesday, April 26, 2016 at 10:16:24 AM UTC+2, Oliver Schulz wrote:
>
> Apparently, Anaconda 2.5 builds now ship with Intel MKL optimizations:
>
>
> https://www.continuum.io/blog/developer-blog/anaconda-25-release-now-mkl-optimizations
>
> I wonder if this would be possible for the official Julia builds, too? I 
> don't know about the MKL licensing conditions (and whether the Anaconda 
> team had to buy one, or if they got it for free).
>
>

[julia-users] Re: julia ?

2016-04-26 Thread Henri Girard
Thanks it works !
the typo errors !
So stupid errrors !
Usually I copy and paste... This time I probably type it myself
best regards
Henri

Le mardi 26 avril 2016 08:23:57 UTC+2, Henri Girard a écrit :
>
> Hi,
> It's really a pain to make julia (ijulia) works on native ubuntu 16.04. I 
> tried conda env but after adding modules in julia I got a lot of errors 
> specially with pycall pyplots ans scipy.
> Can you advice me to have a good stable working julia (ijulia) on ubuntu, 
> even if I must use conda doesn't matter. I am on this since few days and 
> it's getting worse !
> I even format my disk to make a fresh install... But I think it's worse ...
> Best regards,
> Henri
>


[julia-users] Re: julia ?

2016-04-26 Thread Lutfullah Tomak
Instruction from the error

  ENV["PYTHON"]=""
  Pkg.build("PyCall")

worked for me. Since sinecoef is defined I could not work out whole example but 
the rest worked 

with copy paste after above steps. If that does not work try removing and 
adding matplotlib with Conda.rm and Conda.add .

On Tuesday, April 26, 2016 at 11:14:10 AM UTC+3, Henri Girard wrote:
>
> Here is the code (sorry I forgot to join it ) : 
>
> using PyPlot
> n = 1:2:99 # odd integers from 1 to 99
> loglog(n, abs(sinecoef(f, n)), "bo")
> xlabel(L"n")
> ylabel(L"Fourier sine coefficient $|b_n|$")
> title(L"Sine series convergence for $f(x) = 0.5 - |x - 0.5|$")
> loglog(n, 1 ./ n.^2, "b--")
> legend([L"|b_n|", L"1/n^2"])
>
> Le mardi 26 avril 2016 08:23:57 UTC+2, Henri Girard a écrit :
>>
>> Hi,
>> It's really a pain to make julia (ijulia) works on native ubuntu 16.04. I 
>> tried conda env but after adding modules in julia I got a lot of errors 
>> specially with pycall pyplots ans scipy.
>> Can you advice me to have a good stable working julia (ijulia) on ubuntu, 
>> even if I must use conda doesn't matter. I am on this since few days and 
>> it's getting worse !
>> I even format my disk to make a fresh install... But I think it's worse 
>> ...
>> Best regards,
>> Henri
>>
>

[julia-users] Re: julia ?

2016-04-26 Thread Kaj Wiik
Oops, typo, shoud be

Pkg.build("PyPlot")



On Tuesday, April 26, 2016 at 11:34:09 AM UTC+3, Kaj Wiik wrote:
>
> You are missing matplotlib library, try:
>
> apt-get install python-matplotlib
>
> In REPL:
>
> Pkg.build(PyPlot")
>
> Kaj
>
>
> On Tuesday, April 26, 2016 at 10:59:01 AM UTC+3, Henri Girard wrote:
>>
>> Here is the kind of error I got :
>>
>> INFO: Recompiling stale cache file /home/pi/.julia/lib/v0.4/PyCall.ji for 
>> module PyCall.
>> INFO: Recompiling stale cache file /home/pi/.julia/lib/v0.4/PyPlot.ji for 
>> module PyPlot.
>>
>> LoadError: InitError: Failed to pyimport("matplotlib"): PyPlot will not work 
>> until you have a functioning matplotlib module.
>>
>> For automated Matplotlib installation, try configuring PyCall to use the 
>> Conda Python distribution within Julia.  Relaunch Julia and run:
>>   ENV["PYTHON"]=""
>>   Pkg.build("PyCall")
>>   using PyPlot
>>
>> pyimport exception was: PyError (:PyImport_ImportModule) > 'exceptions.ImportError'>
>> ImportError('No module named matplotlib',)
>>
>> during initialization of module PyPlot
>> while loading In[5], in expression starting on line 1
>>
>>
>>
>>
>>
>> Le mardi 26 avril 2016 08:23:57 UTC+2, Henri Girard a écrit :
>>>
>>> Hi,
>>> It's really a pain to make julia (ijulia) works on native ubuntu 16.04. 
>>> I tried conda env but after adding modules in julia I got a lot of errors 
>>> specially with pycall pyplots ans scipy.
>>> Can you advice me to have a good stable working julia (ijulia) on 
>>> ubuntu, even if I must use conda doesn't matter. I am on this since few 
>>> days and it's getting worse !
>>> I even format my disk to make a fresh install... But I think it's worse 
>>> ...
>>> Best regards,
>>> Henri
>>>
>>

[julia-users] Re: julia ?

2016-04-26 Thread Kaj Wiik
You are missing matplotlib library, try:

apt-get install python-matplotlib

In REPL:

Pkg.build(PyPlot")

Kaj


On Tuesday, April 26, 2016 at 10:59:01 AM UTC+3, Henri Girard wrote:
>
> Here is the kind of error I got :
>
> INFO: Recompiling stale cache file /home/pi/.julia/lib/v0.4/PyCall.ji for 
> module PyCall.
> INFO: Recompiling stale cache file /home/pi/.julia/lib/v0.4/PyPlot.ji for 
> module PyPlot.
>
> LoadError: InitError: Failed to pyimport("matplotlib"): PyPlot will not work 
> until you have a functioning matplotlib module.
>
> For automated Matplotlib installation, try configuring PyCall to use the 
> Conda Python distribution within Julia.  Relaunch Julia and run:
>   ENV["PYTHON"]=""
>   Pkg.build("PyCall")
>   using PyPlot
>
> pyimport exception was: PyError (:PyImport_ImportModule)  'exceptions.ImportError'>
> ImportError('No module named matplotlib',)
>
> during initialization of module PyPlot
> while loading In[5], in expression starting on line 1
>
>
>
>
>
> Le mardi 26 avril 2016 08:23:57 UTC+2, Henri Girard a écrit :
>>
>> Hi,
>> It's really a pain to make julia (ijulia) works on native ubuntu 16.04. I 
>> tried conda env but after adding modules in julia I got a lot of errors 
>> specially with pycall pyplots ans scipy.
>> Can you advice me to have a good stable working julia (ijulia) on ubuntu, 
>> even if I must use conda doesn't matter. I am on this since few days and 
>> it's getting worse !
>> I even format my disk to make a fresh install... But I think it's worse 
>> ...
>> Best regards,
>> Henri
>>
>

[julia-users] Intel MKL optimizations in default Julia builds?

2016-04-26 Thread Oliver Schulz
Apparently, Anaconda 2.5 builds now ship with Intel MKL optimizations:

  
 
https://www.continuum.io/blog/developer-blog/anaconda-25-release-now-mkl-optimizations

I wonder if this would be possible for the official Julia builds, too? I 
don't know about the MKL licensing conditions (and whether the Anaconda 
team had to buy one, or if they got it for free).



[julia-users] Re: julia ?

2016-04-26 Thread Henri Girard
Here is the code (sorry I forgot to join it ) : 

using PyPlot
n = 1:2:99 # odd integers from 1 to 99
loglog(n, abs(sinecoef(f, n)), "bo")
xlabel(L"n")
ylabel(L"Fourier sine coefficient $|b_n|$")
title(L"Sine series convergence for $f(x) = 0.5 - |x - 0.5|$")
loglog(n, 1 ./ n.^2, "b--")
legend([L"|b_n|", L"1/n^2"])

Le mardi 26 avril 2016 08:23:57 UTC+2, Henri Girard a écrit :
>
> Hi,
> It's really a pain to make julia (ijulia) works on native ubuntu 16.04. I 
> tried conda env but after adding modules in julia I got a lot of errors 
> specially with pycall pyplots ans scipy.
> Can you advice me to have a good stable working julia (ijulia) on ubuntu, 
> even if I must use conda doesn't matter. I am on this since few days and 
> it's getting worse !
> I even format my disk to make a fresh install... But I think it's worse ...
> Best regards,
> Henri
>


[julia-users] Re: julia ?

2016-04-26 Thread Henri Girard
Here is the kind of error I got :

INFO: Recompiling stale cache file /home/pi/.julia/lib/v0.4/PyCall.ji for 
module PyCall.
INFO: Recompiling stale cache file /home/pi/.julia/lib/v0.4/PyPlot.ji for 
module PyPlot.

LoadError: InitError: Failed to pyimport("matplotlib"): PyPlot will not work 
until you have a functioning matplotlib module.

For automated Matplotlib installation, try configuring PyCall to use the Conda 
Python distribution within Julia.  Relaunch Julia and run:
  ENV["PYTHON"]=""
  Pkg.build("PyCall")
  using PyPlot

pyimport exception was: PyError (:PyImport_ImportModule) 
ImportError('No module named matplotlib',)

during initialization of module PyPlot
while loading In[5], in expression starting on line 1





Le mardi 26 avril 2016 08:23:57 UTC+2, Henri Girard a écrit :
>
> Hi,
> It's really a pain to make julia (ijulia) works on native ubuntu 16.04. I 
> tried conda env but after adding modules in julia I got a lot of errors 
> specially with pycall pyplots ans scipy.
> Can you advice me to have a good stable working julia (ijulia) on ubuntu, 
> even if I must use conda doesn't matter. I am on this since few days and 
> it's getting worse !
> I even format my disk to make a fresh install... But I think it's worse ...
> Best regards,
> Henri
>


Re: [julia-users] Re: Arrow Keys when debugging

2016-04-26 Thread Hans-Peter
On Monday, 25 April 2016 23:34:03 UTC+2, chobb...@gmail.com wrote:
>
> ... want to see which constructor is called for construction, if multiple 
> constructors exist
>
   ^ 

Do you know the @which macro? E.g. @which DateTime(2016) or @which 
DateTime("20151204"). To jump to the source code, there is @edit.


[julia-users] Re: julia ?

2016-04-26 Thread Henri Girard
Sorry, for empty answers...
Thanks for you answers, I will send you errors when I meet them


Le mardi 26 avril 2016 08:23:57 UTC+2, Henri Girard a écrit :
>
> Hi,
> It's really a pain to make julia (ijulia) works on native ubuntu 16.04. I 
> tried conda env but after adding modules in julia I got a lot of errors 
> specially with pycall pyplots ans scipy.
> Can you advice me to have a good stable working julia (ijulia) on ubuntu, 
> even if I must use conda doesn't matter. I am on this since few days and 
> it's getting worse !
> I even format my disk to make a fresh install... But I think it's worse ...
> Best regards,
> Henri
>


[julia-users] Re: julia ?

2016-04-26 Thread Henri Girard


Le mardi 26 avril 2016 08:23:57 UTC+2, Henri Girard a écrit :
>
> Hi,
> It's really a pain to make julia (ijulia) works on native ubuntu 16.04. I 
> tried conda env but after adding modules in julia I got a lot of errors 
> specially with pycall pyplots ans scipy.
> Can you advice me to have a good stable working julia (ijulia) on ubuntu, 
> even if I must use conda doesn't matter. I am on this since few days and 
> it's getting worse !
> I even format my disk to make a fresh install... But I think it's worse ...
> Best regards,
> Henri
>


[julia-users] Re: julia ?

2016-04-26 Thread Lutfullah Tomak
I use  julia 0.4.5 from Ubuntu 16.04 repository without any problem. As an 
IDE I prefer Atom and it works very well
and IJulia works too. I have not tried any other python related package for 
that matter but if you post specific errors
it'd be better.
On Tuesday, April 26, 2016 at 9:23:57 AM UTC+3, Henri Girard wrote:
>
> Hi,
> It's really a pain to make julia (ijulia) works on native ubuntu 16.04. I 
> tried conda env but after adding modules in julia I got a lot of errors 
> specially with pycall pyplots ans scipy.
> Can you advice me to have a good stable working julia (ijulia) on ubuntu, 
> even if I must use conda doesn't matter. I am on this since few days and 
> it's getting worse !
> I even format my disk to make a fresh install... But I think it's worse ...
> Best regards,
> Henri
>


Re: [julia-users] julia ?

2016-04-26 Thread Tamas Papp
I don't know about ijulia, but julia works fine for me if I just
download and extract the binary.

Copy-pasting specific error messages would be more likely to result in
answers that help you. Reinstalling the OS is not necessary and unlikely
to be the easiest way to fix anything by a long shot.

Best,

Tamas

On Tue, Apr 26 2016, Henri Girard wrote:

> Hi,
> It's really a pain to make julia (ijulia) works on native ubuntu 16.04. I 
> tried conda env but after adding modules in julia I got a lot of errors 
> specially with pycall pyplots ans scipy.
> Can you advice me to have a good stable working julia (ijulia) on ubuntu, 
> even if I must use conda doesn't matter. I am on this since few days and 
> it's getting worse !
> I even format my disk to make a fresh install... But I think it's worse ...
> Best regards,
> Henri



[julia-users] julia ?

2016-04-26 Thread Henri Girard
Hi,
It's really a pain to make julia (ijulia) works on native ubuntu 16.04. I 
tried conda env but after adding modules in julia I got a lot of errors 
specially with pycall pyplots ans scipy.
Can you advice me to have a good stable working julia (ijulia) on ubuntu, 
even if I must use conda doesn't matter. I am on this since few days and 
it's getting worse !
I even format my disk to make a fresh install... But I think it's worse ...
Best regards,
Henri