[julia-users] Re: applying non zero boundary conditions in FEM

2016-08-23 Thread Chris Rackauckas
In Julia you use [] for dereference. So changes things to K[udofs,:]=0 . Comments are #. Semicolins aren't necessary in scripts. You might want to check out this page of the manual: http://docs.julialang.org/en/release-0.4/manual/noteworthy-differences/ On Tuesday, August 23, 2016 at 9:29:52

[julia-users] applying non zero boundary conditions in FEM

2016-08-23 Thread Nguyen Vinh Phu
Hello all, I am implementing a finite element solver in Julia. I have computed the stiffness matrix (as a sparse matrix K) and the force vector (F). I have some non zero boundary conditions on the unknown. In Matlab, here is what I do: bcwt=mean(diag(K)); % a measure of the average size of an

Re: [julia-users] New to Julia - Need some basic help

2016-08-23 Thread Jeffrey Sarnoff
As Steven mentioned, starting the program from the directory where the files reside allows you to include the file using its filename without the full path. If that is easy for you, it is probably best. An alternative is to do it with code. Let me know if you need that. On Monday, August

[julia-users] Re: Julia Plugin System

2016-08-23 Thread Cedric St-Jean
I think we need a more complete description of your problem, because a plugin can be a lot of things, and I don't know about Salt. In any case, re. plugin(hub, "subsystem.module.function")(args/kwargs) You're right, that doesn't look very Julian. Would something like this work? module

Re: [julia-users] New to Julia - Need some basic help

2016-08-23 Thread Jeffrey Sarnoff
As Steven mentioned, starting the program from the directory where the files reside allows you to include the file using its filename without the full path. If that is easy for you, it is probably best. An alternative is to do it with code. Let me know if you need that. On Mon, Aug 22, 2016 at

[julia-users] Pkg.update() error, 0.4.6

2016-08-23 Thread Liye zhang
When I run Pkg.update(), I got the following error: fata;: read error: Invalid argument ERROR: failed process: Process('git pull --rebase -q', ProcessExited(1)) [1] in pipeline_error at process.jl:555 windows 7, Julia0.4.6

Re: [julia-users] Performant methods for enclosing parameters?

2016-08-23 Thread Erik Schnetter
`gelelementptr inbounds` takes as input a pointer to a C struct (or equivalent) as well as the offset to a field in that struct, and returns the pointer to that field. It's how LLVM accesses fields in a struct. This usually becomes a single add instruction, and can often be folded into other

Re: [julia-users] Performant methods for enclosing parameters?

2016-08-23 Thread Chris Rackauckas
Oh, I see what happened... in my example I did h(u,t,α) = α*u α = 1.01 g = (u,t) -> h(u,t,α) but since α was also defined in the global scope, this picked up that global α and resulted in the horrible output. Sorry for making such a fuss! Makes me feel better to know that closures actually

[julia-users] Re: Julia Plugin System

2016-08-23 Thread JColn
Why not use nested modules? Also- will there be a salt.jl :p? On Tuesday, August 23, 2016 at 7:21:54 PM UTC-4, Thomas Hatch wrote: > > I am asking this just to look for some opinions or ideas on the most > Julia-like way to do something, as usual, I have no complaints with Julia :) > > I am

Re: [julia-users] Performant methods for enclosing parameters?

2016-08-23 Thread Andrew
I tried moving k outside. julia> outside_k(u::Float64,t::Float64,α) = α*u outside_k (generic function with 1 method) julia> function test(α, k) G = (u,t) -> k(u,t,1.01) G2 = (u,t)->k(u,t,α) const β = 1.01 G3 = (u,t)->k(u,t,β) @code_llvm G(1., 2.)

[julia-users] Re: Using Latex Symbols (unicode characters) as Julia operators

2016-08-23 Thread Steven G. Johnson
You can just look in http://docs.julialang.org/en/latest/manual/unicode-input/#man-unicode-input Pretty much anything that looks like an infix operator is parsed as one. (Note that a dictionary of these symbols can be found in Base.REPLCompletions.latex_symbols)

Re: [julia-users] Performant methods for enclosing parameters?

2016-08-23 Thread Chris Rackauckas
In my scenarios, the function k is given by the user. So this method won't work. If you move that definition of k outside of test() and pass it into your test, you'll see that the LLVM code explodes (at least it does for me). The issue is defining a closure on a function which was defined

Re: [julia-users] Performant methods for enclosing parameters?

2016-08-23 Thread Andrew
I'm pretty confused about what you're trying to accomplish beyond standard closures. What is your ParameterHolder type for? I rewrote your first example wrapping everything in a function. Is this doing what you want it to? The LLVM looks fine. function test(α) k(u::Float64,t::Float64,α) = α*u G

[julia-users] Julia Plugin System

2016-08-23 Thread Thomas S Hatch
I am asking this just to look for some opinions or ideas on the most Julia-like way to do something, as usual, I have no complaints with Julia :) I am working on writing a plugin system in Julia and had a syntax question. The plugin system was originally written in python and was based loosely on

[julia-users] Recursive/Circular parametric types

2016-08-23 Thread Ben Ward
I'm doing some development and wondered if this kind of pattern is problematic: abstract AbstractNode abstract PhylogenyNode <: AbstractNode abstract NetworkNode <: AbstractNode abstract AbstractEdge abstract PhylogenyEdge <: AbstractEdge abstract NetworkEdge <: AbstractEdge type Branch{N <:

Re: [julia-users] Performant methods for enclosing parameters?

2016-08-23 Thread Chris Rackauckas
Yes, I am looking for a closure which has the least overhead possible (this was all in v0.5). For example, for re-ordering parameters: g = (du,u,t) -> f(t,u,du), or for enclosing parameter values as above. I'll give the Val method a try and see whether the compile time is significant (it will

Re: [julia-users] Make a histogram

2016-08-23 Thread Ahmed Mazari
but the x-axis must be ordered from the smallest to the largest value . My question know is how to determine the number of bins ? On Tuesday, August 23, 2016 at 4:46:22 PM UTC+2, Christof Stocker wrote: > > If you know the categories then one thing you could do is think about it > as a barplot >

[julia-users] Using Latex Symbols (unicode characters) as Julia operators

2016-08-23 Thread jandehaan500
I wanted to use a specific Unicode character as an operator. It took a little poking around, so I'm sharing my solution to save you some time. First I looked at the file github.com/JuliaLang/julia/blob/master/src/julia-parser.scm Starting on line 9 is a grouping of all the operators supported

Re: [julia-users] Performant methods for enclosing parameters?

2016-08-23 Thread Erik Schnetter
Chris I don't quite understand what you mean. Are you looking for a closure / lambda expression? ```Julia function myfunc(x0, x1, alpha) f(x) = alpha * x ODE.solve(f, x0, x1) end ``` Or is it important for your that your function `f` is optimized, i.e. you want to re-run the code

Re: [julia-users] creating a DataFrame from C now fails in 0.5 rc 1+1

2016-08-23 Thread Keno Fischer
If you create objects from C you need to be very careful to have appropriate gc roots, for all values involved before yielding control back to julia. On Tue, Aug 9, 2016 at 6:23 PM, wrote: > I'm contributing a bit to rjulia and I've run into some trouble creating > julia

[julia-users] Re: Correct way to use squeeze function

2016-08-23 Thread jonathan . bieler
Squeeze will remove s dimension of size one, so you can transform an array of size 5x1x4 into 5x4 by squeezing the dimension 2. In 0.4 the last dimension is automatically squeezed, and it seems that in 0.5 they all are.

[julia-users] Re: creating a DataFrame from C now fails in 0.5 rc 1+1

2016-08-23 Thread phaverty
Fixed by something in julia rc 3. Great! On Tuesday, August 9, 2016 at 5:28:08 PM UTC-7, phav...@gene.com wrote: > > I'm contributing a bit to rjulia and I've run into some trouble creating > julia DataFrames from C in 0.5 (rc 1+1) > > Creating a DataFrame from C like this: > > jl_value_t *ans

[julia-users] Performant methods for enclosing parameters?

2016-08-23 Thread Chris Rackauckas
Note: This looks long, but really just has a lot of LLVM IR! I have been digging into the issue recently of the best way to enclose parameters with a function . This is an issue that comes up a lot with scientific codes,

[julia-users] Correct way to use squeeze function

2016-08-23 Thread Sigurd Stoll
Hello everyone, I'm having some difficulties understanding the squeeze function, let's say I have a 3 dimensional array A of size 5x4x3, and I want to extract the elements corresponding to A[:,:,1]. I suppose I could do B = A[:,:,1], but what's the point of squeeze then? The Julia

Re: [julia-users] Proposed solution for writing Enums

2016-08-23 Thread Stefan Karpinski
On Tue, Aug 23, 2016 at 12:39 PM, Brian Rogoff wrote: > It's a bit surprising that Julia doesn't have built in enums and a > case/switch form. I'm glad that there's open > issue https://github.com/JuliaLang/julia/issues/5410 to address the lack > of case/switch. Is there any

[julia-users] Re: can't get pyjulia to work

2016-08-23 Thread Tim Wheeler
So here is what I did: in Julia v0.4.6: julia> Pkg.pin("PyCall", v"1.3.0") julia> Pkg.build("PyCall") removed core.py in /usr/local/lib/python2.7/dist-packages/julia/ created a new core.py containing these contents . running, in

[julia-users] Help wanted! Make sure the new testset PR *doesn't* break everything horribly!

2016-08-23 Thread Katie H
Hi everyone, I've been working on improvements to Base Julia's test system, so that we can use testsets and have pretty printing and parallelism and all kinds of wonderful things that start with p. As you can see, the base tests pass! However, I know lots of package maintainers use testsets. I

[julia-users] Re: Questions regarding Julia for general purpose programming (strings, modules, dispatch, inheritance)

2016-08-23 Thread Chris Rackauckas
I don't necessarily have a large project, but there are a few tidbits I think I can share. I'm not familiar with all the things strings, so I'll let someone else take that. 2. You can always do composition instead of inheritance. For many it's a preferred coding practice anyways

Re: [julia-users] Proposed solution for writing Enums

2016-08-23 Thread Jacob Quinn
Julia indeed has built-in enums: Just below here in the docs: http://docs.julialang.org/en/latest/stdlib/base/#Base.Val{c} On Tue, Aug 23, 2016 at 10:51 AM, Evan Fields wrote: > @enum doesn't do what you want for enums? >

Re: [julia-users] Proposed solution for writing Enums

2016-08-23 Thread Evan Fields
@enum doesn't do what you want for enums?

[julia-users] CDF of a multivariate normal distribution

2016-08-23 Thread jamesmnason
Hi: Can anyone suggest how to compute the cdf of a multivariate normal distribution in Julia? Distributions.jl provides the cdf function for univariate distributions, but I do not see a cdf function for multivariate distributions. Have I missed this? The cdf of a multivariate normal

Re: [julia-users] Proposed solution for writing Enums

2016-08-23 Thread Brian Rogoff
It's a bit surprising that Julia doesn't have built in enums and a case/switch form. I'm glad that there's open issue https://github.com/JuliaLang/julia/issues/5410 to address the lack of case/switch. Is there any hope that we may see these (or at least the built in case/switch) in 1.0? On

[julia-users] Re: ANN: Julia 0.5.0-rc2 now available

2016-08-23 Thread Tony Kelman
Release candidate 3 is now available: https://s3.amazonaws.com/julialang/bin/linux/x64/0.5/julia-0.5.0-rc3-linux-x86_64.tar.gz https://s3.amazonaws.com/julialang/bin/linux/x86/0.5/julia-0.5.0-rc3-linux-i686.tar.gz https://s3.amazonaws.com/julialang/bin/osx/x64/0.5/julia-0.5.0-rc3-osx10.7+.dmg

Re: [julia-users] Make a histogram

2016-08-23 Thread Christof Stocker
If you know the categories then one thing you could do is think about it as a barplot julia> UnicodePlots.barplot(a[:,1], a[:,2], symb = "▇") ┌┐ 7 │▇▇ 4│ 4 │▇▇▇ 2 │

[julia-users] Make a histogram

2016-08-23 Thread Ahmed Mazari
Hello, l have this matrix where the first column represents different values and second column represents the number of occurences of each value. How can plot a histogram x-axis : the different values, y-axis : the number of occurences. 10x2 Array{Int64,2}: 7 4 4 2 9

Re: [julia-users] { } vector syntax is discontinued?

2016-08-23 Thread Scott T
And again at lines 30 and 40 in that file. On Tuesday, 23 August 2016 14:11:44 UTC+1, Scott T wrote: > > Looks like like 5 uses the old syntax: > > flag = Sundials.CVodeSetUserData(mem, {f,r,d,p}) > > Try: > > flag = Sundials.CVodeSetUserData(mem, [f,r,d,p]) > > > On Tuesday, 23 August 2016

Re: [julia-users] { } vector syntax is discontinued?

2016-08-23 Thread Scott T
Looks like like 5 uses the old syntax: flag = Sundials.CVodeSetUserData(mem, {f,r,d,p}) Try: flag = Sundials.CVodeSetUserData(mem, [f,r,d,p]) On Tuesday, 23 August 2016 14:06:24 UTC+1, Simon Frost wrote: > > Thanks for the info; it still isn't clear to me how the (generic) call to > this

Re: [julia-users] { } vector syntax is discontinued?

2016-08-23 Thread Simon Frost
Thanks for the info; it still isn't clear to me how the (generic) call to this function should be changed: function cvode{f,r,T}(::Type{f},::Type{r},d::Array{Int64},p::Vector{T}, y0 ::Vector{Float64}, t::Vector{Float64}; reltol::Float64=1e-4, abstol::Float64 =1e-6) (from

[julia-users] Re: Distributions.jl : generating samples from stable distributions

2016-08-23 Thread Mirmu
Thx a lot ! Le lundi 22 août 2016 23:19:11 UTC+2, Rock Pereira a écrit : > > RCall is a simple two-step process: > >1. Write the R script inside Julia's R macrostrings >2. Copy the objects in R as objects in Julia > > The documentation is just one page. >

Re: [julia-users] Proposed way of doing Enums

2016-08-23 Thread Stefan Karpinski
The current behavior was chosen because it allows you to put the enum in a module or not. I agree that it's often nice to do so. One issue is that the module name and the enum name "want" to be the same, which doesn't work well, so you'd need to provide both an inner enum name and an outer module

Re: [julia-users] Proposed solution for writing Enums

2016-08-23 Thread Stefan Karpinski
Oh, I see that you have: https://groups.google.com/forum/#!topic/julia-users/fgzVlbGcw-o. On Tue, Aug 23, 2016 at 8:55 AM, Stefan Karpinski wrote: > The formatting on that came out pretty garbled. Can you repost with line > breaks and such? > > On Mon, Aug 22, 2016 at 5:03

Re: [julia-users] Proposed solution for writing Enums

2016-08-23 Thread Stefan Karpinski
The formatting on that came out pretty garbled. Can you repost with line breaks and such? On Mon, Aug 22, 2016 at 5:03 PM, Paul Sorensen wrote: > The following is my idea of writing enums that are better than the macro > because they give you a typesafe way of passing them to

Re: [julia-users] Re: Unexpected slowdown

2016-08-23 Thread Stefan Karpinski
You might want to check if a*a > n instead since multiplication is much cheaper than sqrt. On Mon, Aug 22, 2016 at 5:22 PM, Taylor Pospisil wrote: > It's memory allocation. If you don't make the whole array and just break > out of the loop early you can get it about 50x

Re: [julia-users] Invalid history file (~/.julia_history) format

2016-08-23 Thread Stefan Karpinski
The notion of what HOME is on Windows is a bit confusing and ambiguous. On Tue, Aug 23, 2016 at 8:51 AM, Stefan Karpinski wrote: > That's strange. Did it create a ~/.julia_history file after you deleted > the old one? If so, what's in it? > > I wonder if the

Re: [julia-users] Invalid history file (~/.julia_history) format

2016-08-23 Thread Stefan Karpinski
That's strange. Did it create a ~/.julia_history file after you deleted the old one? If so, what's in it? I wonder if the ~/.julia_history file you deleted was not the one that Julia's looking at. On Tue, Aug 23, 2016 at 8:10 AM, Andy Dobson wrote: > Hi All, > > This

[julia-users] Proposed way of doing Enums

2016-08-23 Thread Paul Sorensen
The following code is my idea for doing enums in julia, I tried pasting the code but google groups breaks it: http://pastebin.com/Vxw0KdmC Let me know what you think. Is it a good idea?

Re: [julia-users] Re: Why aren't multiple const definitions allowed on a line?

2016-08-23 Thread Stefan Karpinski
These syntaxes should be more uniform: https://github.com/JuliaLang/julia/issues/18197. On Tue, Aug 23, 2016 at 12:59 AM, 'Greg Plowman' via julia-users < julia-users@googlegroups.com> wrote: > global const u = 7, v = 11, w = 13 > seems to work. > >

[julia-users] Re: Unexpected slowdown

2016-08-23 Thread Taylor Pospisil
It's memory allocation. If you don't make the whole array and just break out of the loop early you can get it about 50x faster on my machine. Also I took the liberty of fixing a bug; you should check for <= sqrt(n). function a() pl = [2] n = 3 ct = 1 while ct < 10001

[julia-users] Questions regarding Julia for general purpose programming (strings, modules, dispatch, inheritance)

2016-08-23 Thread JColn
Hello, I'm looking at Julia for general purpose programming and things look good so far. However, I want to see if I can elicit feedback from those that have ventured deeper into larger projects before moving further. Below are questions regarding areas of concern I've seen cited and I'm

[julia-users] Re: Using Interpolations.jl How to define the behavior when out of bounds?

2016-08-23 Thread Carlo Galli
Thanks! Very helpful. Looks like however evaluating the extrapolation object below on a Array ( itp = extrapolate(interpolate(...), NaN)[-3.5,-3.4] for example ) throws an error, while this works well with interpolation objects. A solution would be to use a comprehension

[julia-users] Proposed solution for writing Enums

2016-08-23 Thread Paul Sorensen
The following is my idea of writing enums that are better than the macro because they give you a typesafe way of passing them to a functionbaremodule EnumNameimmutable enumnamex::UInt8end const Value_A = enumname(0)const Value_B = enumname(1)end# usage examplebaremodule

[julia-users] Invalid history file (~/.julia_history) format

2016-08-23 Thread Andy Dobson
Hi All, This morning when starting Julia 0.4.3 (which I've been using daily since February) I received this error message : - ERROR: Invalid history file (~/.julia_history) format: If you have a history file left over from an

[julia-users] Re: ANN: Documenter.jl 0.3

2016-08-23 Thread Michael Hatherly
Just an extra note to add: we've set up a Gitter chat room [1] for the JuliaDocs packages, so if anyone has questions that aren't really "issues", but rather just usage questions or requests for help when setting up your package docs, then feel free to ask them there. [1]:

Re: [julia-users] Re: ANN: Documenter.jl 0.3

2016-08-23 Thread Michael Hatherly
> Maybe it is a bit redundant to have the base module name before all the type and function names? That was done to avoid getting two docstrings for objects with the same name but from different modules appearing together, which, though probably an unlikely situation, would be a bit confusing

[julia-users] Re: help with deepcopy_internal

2016-08-23 Thread Tommy Hofmann
Why do you think that deepcopy works on SelfReferential without defining deepcopy_internal? Line 8 of deepcopy.jl is: deepcopy(x) = deepcopy_internal(x, ObjectIdDict()) On Tuesday, August 23, 2016 at 10:52:35 AM UTC+2, Chris Stook wrote: > > I created this simple example to try to understand

[julia-users] help with deepcopy_internal

2016-08-23 Thread Chris Stook
I created this simple example to try to understand deepcopy_internal. type SelfReferential obj::SelfReferential SelfReferential() = (x = new(); x.obj = x) end function deepcopy_internal(sr::SelfReferential, oidd::ObjectIdDict) # if haskey(oidd,sr) #return oidd[sr] # else new_obj =

[julia-users] Re: JupyterLab

2016-08-23 Thread Michael Borregaard
They have updated to 0.2. It works fine for me, I just had to get used to that to start a julia notebook, I have to first open a new Notebook that opens with the Python2 kernel, and the 'switch kernel'.