[julia-users] Re: Indexing problem

2016-11-16 Thread Jeffrey Sarnoff
good things to know about how indexing works The indices for a Vector, or a column or row of a Matrix start at *1* ``` length(avector) # gets the number of elements in avector avector[1]# gets the first item in avector avector[end] # gets the final item in avector avector[1:end]

Re: [julia-users] R's update(Update and Re-fit a Model) in Julia?

2016-11-16 Thread Hongwei
Thanks a million, Milan!!! Hongwei On Tuesday, November 15, 2016 at 1:32:36 PM UTC-5, Milan Bouchet-Valat wrote: > > Le lundi 14 novembre 2016 à 14:18 -0800, Hongwei Liu a écrit : > > Hi guys, > > > > I am new to Julia and I have trouble in finding a similar function in > > Julia that has th

Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-16 Thread Yichao Yu
On Wed, Nov 16, 2016 at 7:24 PM, Kevin Liu wrote: > Hi Yichao! In general there's nothing from the code you posted that shows what you want to do. > > Here is the function from FactorOperations.jl > > function FactorDropMargin(A::Factor, Remove_var::Vector{String}) > Remove_dims = indexin(Re

Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-16 Thread Kevin Liu
Hi Yichao! Here is the function from FactorOperations.jl function FactorDropMargin(A::Factor, Remove_var::Vector{String}) Remove_dims = indexin(Remove_var, A.var) if any(Remove_dims==0) error("Wrong variable!") end Remain_var = symdiff(A.var, Remove_var) Remain_dims =

Re: [julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-16 Thread Yichao Yu
On Wed, Nov 16, 2016 at 6:50 PM, Kevin Liu wrote: > From this issue https://github.com/JuliaPy/PyPlot.jl/issues/157 I understand ^^ This is irrelevant unless you are using PyCall > > `Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims, Remain_dims)` > (line 85 of FactorOperations.jl) s

[julia-users] Got an exception of type ErrorException outside of a @test: type DataType has no field FactorMargin

2016-11-16 Thread Kevin Liu
>From this issue https://github.com/JuliaPy/PyPlot.jl/issues/157 I understand `Factor[:FactorMargin](A, Remove_var, Remain_var, Remove_dims, Remain_dims)` (line 85 of FactorOperations.jl) should pass, as it does on Atom, but not on the REPL, which throws Got an exception of type ErrorExceptio

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

2016-11-16 Thread 'Bill Hart' via julia-users
It's just telling you that you modified the file. If you don't want it to happen, save the file somewhere (so you don't lose the changes you made) and do git checkout windows_build.txt and it should stop happening. Bill. On 16 November 2016 at 20:10, digxx wrote: > Hello Bill, > Sorry to grap o

Re: [julia-users] Re: unsafe_wrap from a pointer from a Julia array

2016-11-16 Thread Sheehan Olver
Though that code works too for FixedSizeArrays > On 17 Nov. 2016, at 8:53 am, Sheehan Olver wrote: > > Oh wait, I was referring to Vec from FixedSizeArrays.jl , not from SIMD > > >> On 16 Nov. 2016, at 6:39 pm, Gunnar Farnebäck > > wrote: >> >> Is this what you'

Re: [julia-users] Re: unsafe_wrap from a pointer from a Julia array

2016-11-16 Thread Sheehan Olver
Oh wait, I was referring to Vec from FixedSizeArrays.jl , not from SIMD > On 16 Nov. 2016, at 6:39 pm, Gunnar Farnebäck wrote: > > Is this what you're looking for? > > julia> using SIMD > > julia> v = rand(2, 5) > 2×5 Array{Float64,2}: > 0.391832 0.785861 0.352291 0.874891 0.874593 > 0.

Re: [julia-users] How to tell if Val{T} is using a fast route

2016-11-16 Thread Chris Rackauckas
The top level scope of a module is still a global (interactive scope). On Wednesday, November 16, 2016 at 7:59:04 AM UTC-8, FANG Colin wrote: > > Typo, should be > > module ... > > ff(x::Type{Val{1}}) = 1 > > x = 1 > a = ff(Val{x}) > > const y = 1 > a = ff(Val{y}) > > end > >> >>

[julia-users] Re: Use of special characters in labels of plots.jl

2016-11-16 Thread Chris Rackauckas
Use LaTeXStrings.jl's L_str macro: L"$10^{10}" I know this works with the PyPlot backend, and I think GR. On Wednesday, November 16, 2016 at 4:37:16 AM UTC-8, Ferran Mazzanti wrote: > > ...and please notice that I'm not looking for explicit LaTeX suppport. > Just wanted to know if there is an

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

2016-11-16 Thread digxx
Hello Bill, Sorry to grap out that thread again. I just did that Pkg.update thingy again, mainly git stash - git stash apply...In the end after I git stash apply it tells me On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add ..." to upd

[julia-users] Indexing problem

2016-11-16 Thread Patrik Waldmann
Hi, I'm an R user trying to learn Julia. I got hold of some code from the Knet package that I was playing around with. My goal is to set values to zero in a loop based on a logical expression, but I cannot figure out how the indexing works. Any help would be appreciated (the problem lies in w[

[julia-users] Re: How to tell if Val{T} is using a fast route

2016-11-16 Thread Simon Danisch
... And really should be, if you want to use code typed: # module scope ff(x::Type{Val{1}}) = 1 const y = 1 function test() # local scope x = 1 a = ff(Val{x}) c = ff(Val{y}) d = ff(Val{1}) end @code_warntype test() Best, Simon Am Mittwoch, 16. November 2016 16:06:31 UTC

Re: [julia-users] How to tell if Val{T} is using a fast route

2016-11-16 Thread FANG Colin
Typo, should be module ... ff(x::Type{Val{1}}) = 1 x = 1 a = ff(Val{x}) const y = 1 a = ff(Val{y}) end > >

Re: [julia-users] How to tell if Val{T} is using a fast route

2016-11-16 Thread Yichao Yu
On Wed, Nov 16, 2016 at 10:06 AM, FANG Colin wrote: > In performance tips, it says > > Essentially, Val{T}works only when T is either hard-coded (Val{3}) or > already specified in the type-domain. > > Suppose I have > > ff(::Type{Val{1}}) = 1 > > I guess the following is on a slower route. > > x =

[julia-users] How to tell if Val{T} is using a fast route

2016-11-16 Thread FANG Colin
In performance tips, it says Essentially, Val{T}works only when T is either hard-coded (Val{3}) or already specified in the type-domain. Suppose I have ff(::Type{Val{1}}) = 1 I guess the following is on a slower route. x = 1 a = ff(::Type{Val{x}}) And maybe this one can be determined in comp

Re: [julia-users] Good way to organize constants?

2016-11-16 Thread Milan Bouchet-Valat
Le mercredi 16 novembre 2016 à 13:38 +, FANG Colin a écrit : > Is there going to be overhead if I create constant group modules and > use them via module_name.abc? Not that I know of. Regards > On 16 November 2016 at 13:31, Milan Bouchet-Valat > wrote: > > Le mercredi 16 novembre 2016 à 04:

[julia-users] Re: [Announcement] Moving to Discourse

2016-11-16 Thread Valentin Churavy
It is similar to Github. You can also switch languages by ```python, Julia is set as the default though :) using Base: @deprecate @deprecate google_groups discourse (thanks Alex A. :) ) On Wednesday, 16 November 2016 22:50:14 UTC+9, Uwe Fechner wrote: > > Thanks! > > On Wednesday, November 16, 2

Re: [julia-users] Re: Syntax sugar for composite type decomposition?

2016-11-16 Thread Tom Breloff
https://github.com/JuliaML/StochasticOptimization.jl/blob/master/src/utils.jl#L2-L16 Don't use it though. :) On Wed, Nov 16, 2016 at 8:07 AM, Mauro wrote: > On Wed, 2016-11-16 at 14:02, FANG Colin wrote: > > Macro seems to have answered this in a different thread > > https://github.com/mau

[julia-users] Re: [Announcement] Moving to Discourse

2016-11-16 Thread Uwe Fechner
Thanks! On Wednesday, November 16, 2016 at 12:39:02 PM UTC+1, Johan Sigfrids wrote: > > You can put the code inside triple back ticks: > > ``` > function hello() > "Hello" > end > ``` > > On Wednesday, November 16, 2016 at 12:49:09 PM UTC+2, Uwe Fechner wrote: >> >> Hello, >> how can I paste J

Re: [julia-users] Good way to organize constants?

2016-11-16 Thread FANG Colin
Is there going to be overhead if I create constant group modules and use them via module_name.abc? On 16 November 2016 at 13:31, Milan Bouchet-Valat wrote: > Le mercredi 16 novembre 2016 à 04:18 -0800, FANG Colin a écrit : > > Say, I have a few constants > > > > const VTYPE_BINARY = 'B' > > cons

Re: [julia-users] Good way to organize constants?

2016-11-16 Thread Milan Bouchet-Valat
Le mercredi 16 novembre 2016 à 04:18 -0800, FANG Colin a écrit : > Say, I have a few constants > > const VTYPE_BINARY = 'B' > const VTYPE_INTEGER = 'I' > const VTYPE_CONTINUOUS = 'C' > > What's a good way to have a namespace on it? > > So that I can use Vtype.BINARY, Vtype.INTEGER, Vtype.CONTINU

Re: [julia-users] Re: Syntax sugar for composite type decomposition?

2016-11-16 Thread Mauro
On Wed, 2016-11-16 at 14:02, FANG Colin wrote: > Macro seems to have answered this in a different thread > https://github.com/mauro3/Parameters.jl lol: Yes that package contains "macros" but my name is Mauro :-) > On Wednesday, November 16, 2016 at 1:01:32 PM UTC, FANG Colin wrote: >> >> Do

[julia-users] Re: Syntax sugar for composite type decomposition?

2016-11-16 Thread FANG Colin
Macro seems to have answered this in a different thread https://github.com/mauro3/Parameters.jl On Wednesday, November 16, 2016 at 1:01:32 PM UTC, FANG Colin wrote: > > Do we have a decomposition syntax or macro that simplifies this > > > a = x.a > b = x.b > c = x.c > ... > > >

[julia-users] Syntax sugar for composite type decomposition?

2016-11-16 Thread FANG Colin
Do we have a decomposition syntax or macro that simplifies this a = x.a b = x.b c = x.c ...

Re: [julia-users] Good way to organize constants?

2016-11-16 Thread Mauro
Checkout my package: https://github.com/mauro3/Parameters.jl. Maybe of use. On Wed, 2016-11-16 at 13:18, FANG Colin wrote: > Say, I have a few constants > > const VTYPE_BINARY = 'B' > const VTYPE_INTEGER = 'I' > const VTYPE_CONTINUOUS = 'C' > > What's a good way to have a namespace on it? > > So

[julia-users] Use of special characters in labels of plots.jl

2016-11-16 Thread Ferran Mazzanti
...and please notice that I'm not looking for explicit LaTeX suppport. Just wanted to know if there is any way to add special characters and subscripts etc. Thanks again, Ferran.

Re: [julia-users] Plots.jl: layout of several plots, with more than one curve per plot

2016-11-16 Thread Scott T
Hi Tom, just to let you know that I'm putting together some subplot demos for ExamplePlots.jl. I was hoping to show some examples of linking axes, but I got a little overambitious and it's not quite the result I intended. I have popped the question on Discourse

[julia-users] Use of special characters in labels of plots.jl

2016-11-16 Thread Ferran Mazzanti
Hi again, I'm trying to use plots.jl for final plots ready for publication in scientific papers, and I was wondering what is the easiest way to write special strings in labels of plots. For instance, what LaTeX would render in $10^{-10}$, or include Angstrom symbols, or subscripts as in $W_{ij}

[julia-users] Good way to organize constants?

2016-11-16 Thread FANG Colin
Say, I have a few constants const VTYPE_BINARY = 'B' const VTYPE_INTEGER = 'I' const VTYPE_CONTINUOUS = 'C' What's a good way to have a namespace on it? So that I can use Vtype.BINARY, Vtype.INTEGER, Vtype.CONTINUOUS Should I put those in a separator module? or create a type and get an instanc

[julia-users] Re: [Announcement] Moving to Discourse

2016-11-16 Thread Johan Sigfrids
You can put the code inside triple back ticks: ``` function hello() "Hello" end ``` On Wednesday, November 16, 2016 at 12:49:09 PM UTC+2, Uwe Fechner wrote: > > Hello, > how can I paste Julia code in Discourse, such that it has syntax > highlighting? > > Uwe > > On Wednesday, November 16, 20

[julia-users] Re: [Announcement] Moving to Discourse

2016-11-16 Thread Uwe Fechner
Hello, how can I paste Julia code in Discourse, such that it has syntax highlighting? Uwe On Wednesday, November 16, 2016 at 3:45:55 AM UTC+1, Valentin Churavy wrote: > > I would like to accelerate the move of `julia-users` to > https://discourse.julialang.org. In the original announcement ( >

Re: [julia-users] Plots.jl: layout of several plots, with more than one curve per plot

2016-11-16 Thread Ferran Mazzanti
That's not the point but it doesn't really matter :) On Tuesday, November 15, 2016 at 12:41:54 PM UTC+1, Tom Breloff wrote: > > Serious "give a mouse a cookie syndrome". You can do what you want by > calling 'plot_6 = deepcopy(plot_5)' first. > > On Tuesday, November 15, 2016, Ferran Mazzanti

Re: [julia-users] Sharing experience on packages

2016-11-16 Thread Milan Bouchet-Valat
Le mardi 15 novembre 2016 à 02:02 -0800, Jérôme Collet a écrit : > Hi all, > > I am new to Julia, I used to use R. And using R packages, the main > difficulty for me is the choice of a package for a given task. Most > of the time, there are many packages solving the same problem, so we > have to c

Re: [julia-users] Re: unsafe_wrap from a pointer from a Julia array

2016-11-16 Thread Sheehan Olver
👍 Sent from my iPhone > On 16 Nov. 2016, at 18:39, Gunnar Farnebäck wrote: > > Is this what you're looking for? > > julia> using SIMD > > julia> v = rand(2, 5) > 2×5 Array{Float64,2}: > 0.391832 0.785861 0.352291 0.874891 0.874593 > 0.697768 0.51637 0.711525 0.400077 0.266559 > >