Re: [julia-users] Failing to update variable in while loop (Newbie)

2016-05-09 Thread Yichao Yu
On Mon, May 9, 2016 at 9:33 PM, David Enocksson  wrote:
> I have an issue in my program and I think it has to do with a nested while
> loop, related to the following situation:
>
> a = 1:1:10
> iter1 = 0
> iter2 = 0
>
> while iter1 < 10
>
>iter1 = iter1 + 1
>
>   while iter2 < 1
>
>  iter2 = iter2 + 1
>
>  print(a[iter1])

It should print a[1] a bunch of times here and never run the inner
loop again since the loop condition is false.

>
>   end
>
> end
>
>
> The problem is that a[iter1] is not updating. I want the result to be
>
>
> 1
>
> 2
>
> 3
>
> 4
>
> 5
>
> 6
>
> 7
>
> 8
>
> 9
>
>
> Any help would be very much appreciated.


[julia-users] Re: Newbie Question: Command Line Woes

2016-05-09 Thread Cedric St-Jean
hello.jl defines the hello() function, but you need to call it to get some 
output. For instance,

function hello()
   println("Hello World")
 return
end

hello()
hello()

will print "Hello World" twice.

On Monday, May 9, 2016 at 10:59:05 PM UTC-4, rich2...@gmail.com wrote:
>
> Newbie question: Why don't I get any output from the following programs 
> when I run them from the command line on my Macbook pro (OS 10.11.4) or two 
> different versions of Linux. Everything works as expected when the programs 
> are run in the REPL. 
>
> On the Mac I use the following in my PATH. 
>
> /Applications/Julia-0.4.5.app/Contents/Resources/julia/bin
>
> Command line: julia hello.jl
> function hello()
> println("Hello World")
> return
> end
>
> Command line: julia five.jl
> function five()
> return 5
> end
>
> The scripts run fine with no apparent errors or warnings. They just don't 
> produce any output. 
>
> Thanks,
> Rich
>


[julia-users] Newbie Question: Command Line Woes

2016-05-09 Thread rich2 . 7182
Newbie question: Why don't I get any output from the following programs 
when I run them from the command line on my Macbook pro (OS 10.11.4) or two 
different versions of Linux. Everything works as expected when the programs 
are run in the REPL. 

On the Mac I use the following in my PATH. 

/Applications/Julia-0.4.5.app/Contents/Resources/julia/bin

Command line: julia hello.jl
function hello()
println("Hello World")
return
end

Command line: julia five.jl
function five()
return 5
end

The scripts run fine with no apparent errors or warnings. They just don't 
produce any output. 

Thanks,
Rich


[julia-users] Failing to update variable in while loop (Newbie)

2016-05-09 Thread David Enocksson
I have an issue in my program and I think it has to do with a nested while 
loop, related to the following situation:

a = 1:1:10
iter1 = 0
iter2 = 0

while iter1 < 10

   iter1 = iter1 + 1

  while iter2 < 1

 iter2 = iter2 + 1

 print(a[iter1])

  end

end


The problem is that a[iter1] is not updating. I want the result to be


1

2

3

4

5

6

7

8

9


Any help would be very much appreciated.


[julia-users] Re: IJulia- Failed to precompile IJulia to C:\Users\....\.julia\lib\v0.4\IJulia.ji in error at error.jl:21

2016-05-09 Thread Steven G. Johnson
Were you editing the src/IJulia.jl file for debugging purposes or 
something?  What does `Pkg.status()` say?


[julia-users] IJulia- Failed to precompile IJulia to C:\Users\....\.julia\lib\v0.4\IJulia.ji in error at error.jl:21

2016-05-09 Thread ÜÖ



IJulia does not start at Julia. It gives the following error.  I am using 
 0.4.3 on Windows 10,  x86_64-w64-mingw32. Thank you for your kind help. 

julia> using IJulia
INFO: Precompiling module IJulia...
ERROR: LoadError: syntax: extra token "set_verbose" after end of expression
 in include at boot.jl:261
 in include_from_node1 at loading.jl:304
 [inlined code] from none:2
 in anonymous at no file:0
 in process_options at client.jl:257
 in _start at client.jl:378
while loading C:\Users\uozden\.julia\v0.4\IJulia\src\IJulia.jl, in 
expression starting on line 7
ERROR: Failed to precompile IJulia to 
C:\Users\uozden\.julia\lib\v0.4\IJulia.ji
 in error at error.jl:21

julia> 




[julia-users] Slicing arrays with slicedim

2016-05-09 Thread Davide Lasagna
Hi, 

on v0.4.5, why is slicedim not dropping singleton dimensions as slice does?

Example:

julia> A = randn(3, 4)

3x4 Array{Float64,2}:

  2.31181   -1.7222-0.654665  -0.836633 

 -0.236305   0.389242   0.613524  -0.0398548

  0.670851  -0.53761   -1.608110.117274 

julia> slice(A, 1, :)

4-element SubArray{Float64,1,Array{Float64,2},Tuple{Int64,Colon},2}:

  2.31181 

 -1.7222  

 -0.654665

 -0.836633

julia> slicedim(A, 1, 1)

1x4 Array{Float64,2}:

 2.31181  -1.7222  -0.654665  -0.836633



Thanks







Re: [julia-users] Hopefully simple plotting question (for my 9 yr old son's science project!)

2016-05-09 Thread Scott Jones


On Monday, May 9, 2016 at 11:09:27 AM UTC-4, Tom Breloff wrote:
>
> I haven't ever needed to plot
>
>
> Wh---whaaat?? ;)
>

Yeah, seriously!  Give me Emacs (or something with good Emacs 
bindings+extensibility), a C/C++ compiler (now Julia), and a debugger, and 
I'm a happy man. ;-)
I think all the plotting stuff is beautiful, but until now, for my 
low-level performance work (lots of bit twiddling), never needed it.  Now 
that I do have a need for it,
glad to see there is such a nice package available for Julia (Thanks Tom! 
Also thanks to everybody else making the plotting packages / backends!)

Thanks so much, that's exactly what he needed to finish his science project!
I just have to make sure that he's collected more data today, he only had 2 
8-year olds, and both got 0's, kind of skews the results!
His hypothesis, was that the young kids wouldn't do so well, but that 
neither would the old people (like his science teacher and me ;-) ), 
however, everybody over 13 so far as gotten a perfect score!

-Scott


[julia-users] Re: Best way to get indices and values at sorting (rows/columns of) a matrix?

2016-05-09 Thread Hakuna M.
Am Montag, 9. Mai 2016 19:03:18 UTC+2 schrieb Steven G. Johnson:
>
>
>
> No, I think sortperm(A, dim) would need to return an array of single-index 
> indices (i.e. to be used with A[i]).  I posted a sample implementation for 
> 2d arrays in the issue linked above, which should suffice for your use.
>

Ah, ok that could be usefull as well. For current task I need the indices 
without offset for later usage. It could depend on the number of output 
parameters like Matlab.


[julia-users] Re: Best way to get indices and values at sorting (rows/columns of) a matrix?

2016-05-09 Thread Steven G. Johnson


On Monday, May 9, 2016 at 9:53:29 AM UTC-4, Hakuna M. wrote:
>
> would be nearly the same as:
> mapslices(sortperm, A, dim);
> or?
>

No, I think sortperm(A, dim) would need to return an array of single-index 
indices (i.e. to be used with A[i]).  I posted a sample implementation for 
2d arrays in the issue linked above, which should suffice for your use.




Re: [julia-users] Julia SQL

2016-05-09 Thread Alex Mellnik
To expand on what Jacob said, you can read a DataFrame into an in-memory 
SQLite table and then run SQL commands on that.  However, unless you really 
need to use SQL there's probably a way to do the same operation faster (and 
with less code) using native DataFrame operations.  If you can provide some 
examples we're happy to help translate them.  -A

On Sunday, May 8, 2016 at 9:01:07 AM UTC-7, Jacob Quinn wrote:
>
> Also checkout the SQLite.jl package. It provides methods for reading CSV 
> files into an SQLite table and then running SQLite SQL commands on those 
> tables. You can then export the SQLite to a CSV or Data.Table/DataFrame.
>
> -Jacob
> On May 8, 2016 4:32 AM, "Tero Frondelius"  > wrote:
>
>> Maybe this thread is relevant:
>> https://groups.google.com/forum/m/#!topic/julia-users/QjxiCO-Lv-0
>
>

[julia-users] Re: Macro as decorators

2016-05-09 Thread Andras Niedermayer
It's possible to have a macro in Julia that emulates Python decorators. But 
it's a separate question whether you really want to do it, there might be 
more efficient/elegant ways to achieve the same in Julia for a specific use 
case.

Here's a macro that emulates Python decorators and an example how to use it:

julia> macro decorator(dec, func)
 name = func.args[1].args[1]
 hiddenname = gensym()
 func.args[1].args[1] = hiddenname
 quote
   $func
   const $(esc(name)) = $dec($hiddenname)
 end
   end
julia> foo(f) = x->2*f(x+10)
julia> @decorator foo function bar(x)
 return x+1
   end
julia> bar(0)
22

This is the same as in Python
In [2]: def foo(f):
   ...: return lambda x: 2*f(x+10)
   ...: 


In [3]: @foo
   ...: def bar(x):
   ...: return x+1
   ...: 


In [4]: bar(0)
Out[4]: 22

Of course, one can also use this for something useful :-), like:
julia> logger(f) = x-> (println("input: $x"); result = f(x); println("output: 
$result"); result)
logger (generic function with 1 method)


julia> @decorator logger baz(x)=x+1
(anonymous function)


julia> baz(3)
input: 3
output: 4
4




On Monday, May 9, 2016 at 3:42:22 PM UTC+2, Ford Ox wrote:
>
> Is it possible to write macro that will work as python decorator? 



Re: [julia-users] Hopefully simple plotting question (for my 9 yr old son's science project!)

2016-05-09 Thread Tom Breloff
>
> I haven't ever needed to plot


Wh---whaaat?? ;)

This is pretty straightforward:


​
​
​
Note: you might need to checkout master or dev of Plots (I'm on dev)... I
can't ever remember when I implemented anything.

On Mon, May 9, 2016 at 10:24 AM, Scott Jones 
wrote:

> My son Alex is building on what he did last year for his science project,
> where he used Julia to help do the calculations on the data he'd collected
> (basically, he's lazy [in a good way], he'd rather work with his dad to
> learn how to program something rather than do all all the basic arithmetic
> to calculate things like the averages for his plots, and Julia made it
> trivial).
> This year, in math class, he's learned about calculating also the median,
> mode(s), and the ranges, and he'd like to be able to plot the results
> directly in Julia (last year, since I didn't know how, he ended up doing
> the plotting by hand).
>
> He's written a program (with a little help from me) that inputs the data
> from a CSV file (thanks, Jacob Quinn, for the CSV.jl package!) that he's
> entered with Excel.
> The data is simply a value, integer 0 - 7 (for the number of digits
> remembered correctly after seeing a card with 7 digits for 30 seconds, and
> reciting the alphabet).
>
> The program first makes of sorted vector of the unique ages in the data
> set, and then creates a Vector of Vector of Int, each element having all of
> the results for that age.
> Then it uses that to create 4 vectors, mean_by_age, median_by_age,
> low_range, and high_range.
>
> What we want to do, is to plot the ages on the X axis, with the results on
> the Y axis, as a line segment from the low_range to the high_range (with
> the top and bottom marked off with small horizontal lines),
> and also have plotted mean_by_age, and median_by_age with different
> colored lines with different markers (maybe diamonds and squares).
> He might also want to display the mode(s) for each age (might be nice to
> have those done as circles of different radius depending on how many
> samples at that mode value)
>
> I haven't ever needed to plot, so I haven't been able to help him very
> much, so far I'll I've been able to do is just call `plot(ages,
> mean_by_age, linewidth=3)` and `plot(ages, median_by_age, linewidth= 3)` do
> display two of the things he wants.
>
> Any help will be greatly appreciated!
>
> Thanks,
> Scott (proud father of a beginning Julia ;-) )
>
>
>


Re: [julia-users] Hopefully simple plotting question (for my 9 yr old son's science project!)

2016-05-09 Thread Miguel Bazdresch
>  a line segment from the low_range to the high_range (with the top and
bottom marked off with small horizontal lines),

Gaston has support for plotting with error bars, which is exactly this type
of plot. Current documentation is here:
https://bitbucket.org/mbaz/gaston/downloads/gastondoc-0.5.5.pdf See also
the gaston_demo() for examples of many types of plots.

If you decide to use it, be sure to checkout the Master branch -- there's
lots of bug fixes not in the current release (there's a few last features I
need to complete before I put a new release out).

-- mb

On Mon, May 9, 2016 at 10:24 AM, Scott Jones 
wrote:

> My son Alex is building on what he did last year for his science project,
> where he used Julia to help do the calculations on the data he'd collected
> (basically, he's lazy [in a good way], he'd rather work with his dad to
> learn how to program something rather than do all all the basic arithmetic
> to calculate things like the averages for his plots, and Julia made it
> trivial).
> This year, in math class, he's learned about calculating also the median,
> mode(s), and the ranges, and he'd like to be able to plot the results
> directly in Julia (last year, since I didn't know how, he ended up doing
> the plotting by hand).
>
> He's written a program (with a little help from me) that inputs the data
> from a CSV file (thanks, Jacob Quinn, for the CSV.jl package!) that he's
> entered with Excel.
> The data is simply a value, integer 0 - 7 (for the number of digits
> remembered correctly after seeing a card with 7 digits for 30 seconds, and
> reciting the alphabet).
>
> The program first makes of sorted vector of the unique ages in the data
> set, and then creates a Vector of Vector of Int, each element having all of
> the results for that age.
> Then it uses that to create 4 vectors, mean_by_age, median_by_age,
> low_range, and high_range.
>
> What we want to do, is to plot the ages on the X axis, with the results on
> the Y axis, as a line segment from the low_range to the high_range (with
> the top and bottom marked off with small horizontal lines),
> and also have plotted mean_by_age, and median_by_age with different
> colored lines with different markers (maybe diamonds and squares).
> He might also want to display the mode(s) for each age (might be nice to
> have those done as circles of different radius depending on how many
> samples at that mode value)
>
> I haven't ever needed to plot, so I haven't been able to help him very
> much, so far I'll I've been able to do is just call `plot(ages,
> mean_by_age, linewidth=3)` and `plot(ages, median_by_age, linewidth= 3)` do
> display two of the things he wants.
>
> Any help will be greatly appreciated!
>
> Thanks,
> Scott (proud father of a beginning Julia ;-) )
>
>
>


[julia-users] Hopefully simple plotting question (for my 9 yr old son's science project!)

2016-05-09 Thread Scott Jones
My son Alex is building on what he did last year for his science project, 
where he used Julia to help do the calculations on the data he'd collected 
(basically, he's lazy [in a good way], he'd rather work with his dad to 
learn how to program something rather than do all all the basic arithmetic 
to calculate things like the averages for his plots, and Julia made it 
trivial).
This year, in math class, he's learned about calculating also the median, 
mode(s), and the ranges, and he'd like to be able to plot the results 
directly in Julia (last year, since I didn't know how, he ended up doing 
the plotting by hand).

He's written a program (with a little help from me) that inputs the data 
from a CSV file (thanks, Jacob Quinn, for the CSV.jl package!) that he's 
entered with Excel.
The data is simply a value, integer 0 - 7 (for the number of digits 
remembered correctly after seeing a card with 7 digits for 30 seconds, and 
reciting the alphabet).

The program first makes of sorted vector of the unique ages in the data 
set, and then creates a Vector of Vector of Int, each element having all of 
the results for that age.
Then it uses that to create 4 vectors, mean_by_age, median_by_age, 
low_range, and high_range.

What we want to do, is to plot the ages on the X axis, with the results on 
the Y axis, as a line segment from the low_range to the high_range (with 
the top and bottom marked off with small horizontal lines),
and also have plotted mean_by_age, and median_by_age with different colored 
lines with different markers (maybe diamonds and squares).
He might also want to display the mode(s) for each age (might be nice to 
have those done as circles of different radius depending on how many 
samples at that mode value)

I haven't ever needed to plot, so I haven't been able to help him very 
much, so far I'll I've been able to do is just call `plot(ages, 
mean_by_age, linewidth=3)` and `plot(ages, median_by_age, linewidth= 3)` do 
display two of the things he wants.

Any help will be greatly appreciated!

Thanks,
Scott (proud father of a beginning Julia ;-) )




Re: [julia-users] Macro as decorators

2016-05-09 Thread Kevin Squire
Possibly.

Do you have a specific example in mind?  That will probably get you a less
ambivalent answer. :-)

Cheers,
   Kevin

On Monday, May 9, 2016, Ford Ox  wrote:

> Is it possible to write macro that will work as python decorator?


[julia-users] Re: Best way to get indices and values at sorting (rows/columns of) a matrix?

2016-05-09 Thread Hakuna M.


Am Montag, 9. Mai 2016 15:26:48 UTC+2 schrieb Steven G. Johnson:
>
> Actually, see https://github.com/JuliaLang/julia/issues/16273
>
Thanks for your answer. Sry, about my strange postings, there was an error, 
you have seen the other two postings below?.

sortperm(A, dim) 
would be nearly the same as:
mapslices(sortperm, A, dim);
or?
But then I still need the values of the sorted matrix.
How can I get these? (maybe sortperm!)




[julia-users] Macro as decorators

2016-05-09 Thread Ford Ox
Is it possible to write macro that will work as python decorator? 

[julia-users] Re: Best way to get indices and values at sorting (rows/columns of) a matrix?

2016-05-09 Thread Steven G. Johnson
Actually, see https://github.com/JuliaLang/julia/issues/16273


[julia-users] Re: Best way to get indices and values at sorting (rows/columns of) a matrix?

2016-05-09 Thread Steven G. Johnson
See https://github.com/JuliaLang/julia/issues/9258


[julia-users] Re: Best way to get indices and values at sorting (rows/columns of) a matrix?

2016-05-09 Thread Hakuna M.
but I don't like the storage allocation of 'offset'. Is there a better way 
to do it? 
I would like to avoid for-loops.

Is there a way to access the current index of mapslices (ciom) ? And do 
something like this:

mapslices(x - > m[ x[:, ciom ], ciom], i, 1);

or do i need to do a for?

for ciom=1:c;  v[:,ciom] =m [ i[:, ciom ], ciom] ; end


other ideas?


[julia-users] Re: Best way to get indices and values at sorting (rows/columns of) a matrix?

2016-05-09 Thread Hakuna M.
currently I'm using:
i = mapslices(sortperm, m, 1);
offset=repmat( (0:(c-1))'.*r ,r, 1); #'
v = m[offset+i];



[julia-users] Re: Best way to get indices and values at sorting (rows/columns of) a matrix?

2016-05-09 Thread Hakuna M.
currently I'm using:

i = mapslices(sortperm, m, 1);
offset=repmat( (0:(c-1))'.*r ,r, 1);
v = m[offset+i];



[julia-users] Best way to get indices and values at sorting (rows/columns of) a matrix?

2016-05-09 Thread Hakuna M.
Hi there, I'm new to Julia but have some experience with Matlab.

To sort each column of a matrix M ( r rows, c columns) I can write in 
Matlab:
test


Re: [julia-users] How to display the value of a variable in the title of a plot?

2016-05-09 Thread chobbes158
Steven - Sorry. I just saw your last reply. 

Thanks for the hints. `close("all")` works absolutely superbly. But Qt 
backend is far beyond my universe. 

Thanks again! 

On Friday, May 6, 2016 at 6:17:12 PM UTC+1, Steven G. Johnson wrote:
>
>
>
> On Friday, May 6, 2016 at 12:55:45 PM UTC-4, chobb...@gmail.com wrote:
>>
>> Tom and Steven,
>>
>> Thanks the hints!!
>>
>> Still, how could I show all current figures by command? That is something 
>> like 'shg' in Matlab. 
>>
>
> I don't think Matplotlib supports this; the only things I could find were 
> specific to the Qt backend:
>
>
> http://stackoverflow.com/questions/8202228/make-matplotlib-plotting-window-pop-up-as-the-active-one
> https://github.com/matplotlib/matplotlib/issues/596
>  
>
>> Also, is there a command to close all current figures, i.e. a counterpart 
>> of 'clf' in Matlab?
>>>
>>>
> close("all") in PyPlot (from the Matplotlib docs). 
>
> In general, if you are using PyPlot and want to know how to do something, 
> just google the matplotlib documentation, and then translate the syntax 
> back to Julia.
>


[julia-users] Re: Set PATH in windows 10

2016-05-09 Thread Duane Wilson
Hi Tony,

If you want to set a PATH environment variable in windows you need to do 
the following:

1) Go to Control Panel, System
2) Click advanced system settings
3) On the advanced tab click Environment Variables
4) Click edit on the PATH variable
5) Add a new folder path that points to the .\bin in the folder where you 
installed Julia.



On Friday, May 6, 2016 at 2:19:59 AM UTC-3, Yu Tony wrote:

> Hello everyone!
> I'm a beginner in programming; i have trouble finding the bin folder and 
> setting PATH environment variales for Julia;
> Can anyone please tell me where to find the bin folder and what is the 
> directory to set the PATH environment variable to ?
>
> Thankyou for your help,
> Tony
>


[julia-users] Re: Pkg.publish problem

2016-05-09 Thread Robert DJ
It works -- and so is publish. Thanks!

On Monday, May 9, 2016 at 9:45:52 AM UTC+2, Kristoffer Carlsson wrote:
>
> You can delete the tag and recreate it or force push to update the tag. 
> This thread seems to have a lot of good information: 
> http://stackoverflow.com/questions/19298600/tag-already-exists-in-the-remote-error-after-recreating-the-git-tag



Re: [julia-users] Set PATH in windows 10

2016-05-09 Thread Michele Zaffalon
When Julia installs, it creates a link in the Start menu. If you right
click on the Julia icon, you should be able to figure out the path to the
Julia executable, julia.exe. That path should be ending with
...\bin\julia.exe.


On Fri, May 6, 2016 at 6:56 AM, Yu Tony  wrote:

> Hello everyone!
> I'm a beginner in programming; i have trouble finding the bin folder and
> setting PATH environment variales for Julia;
> Can anyone please tell me where to find the bin folder and what is the
> directory to set the PATH environment variable to ?
>
> Thankyou for your help,
> Tony
>


Re: [julia-users] Oracle ODBC

2016-05-09 Thread Stefan Karpinski
You have to install ODBC drivers yourself – the Julia package just provides
an interface to them.

On Mon, May 9, 2016 at 5:27 AM, John Kim  wrote:

> Hello
>
> I'm new to Julia and would like to start using it for various projects.
> One such project requires me to access an Oracle database.  when using the
> ODBC package, the listdrivers() command only shows PostgreSQL and MySQL
> drivers installed by default.  Are Oracle drivers available for Julia?
>


[julia-users] Oracle ODBC

2016-05-09 Thread John Kim
Hello

I'm new to Julia and would like to start using it for various projects. 
 One such project requires me to access an Oracle database.  when using the 
ODBC package, the listdrivers() command only shows PostgreSQL and MySQL 
drivers installed by default.  Are Oracle drivers available for Julia?  


[julia-users] Displaying lambdas, zetas, and the rest of the unicode staff in the formulas

2016-05-09 Thread Андрей Логунов
When testing some of the functionality involving lambdas I encountered a 
problem with displaying a math symbol for lambda, like in A*V[:,1] - 
λ[1]*V[:,1], and later on discovered a disheartening news that the whole 
thing doesn't work for me, including s = "\u2200 x \u2203 y" .  What I get 
is just question marks (?) in return. I'm using a 0.4.5 version and Windows 
8.1. And my default code table is cyrillic. I guess there is a solution to 
this which I do not know. 
Thanks in advsnce.


[julia-users] Displaying lambdas, zetas, and the rest of the unicode staff in the formulas

2016-05-09 Thread Андрей Логунов

When testing some of the functionality involving lambdas I encountered a 
problem with displaying a math symbol for lambda, like in A*V[:,1] - 
λ[1]*V[:,1], and later on discovered a disheartening news that the whole 
thing doesn't work for me, including s = "\u2200 x \u2203 y" .  What I get 
is just question marks (?) in return. I'm using a 0.4.5 version and Windows 
8.1. And my default code table is cyrillic. I guess there is a solution to 
this which I do not know. 
Thanks in advsnce.


[julia-users] Pkg.publish problem

2016-05-09 Thread Kristoffer Carlsson
You can delete the tag and recreate it or force push to update the tag. This 
thread seems to have a lot of good information: 
http://stackoverflow.com/questions/19298600/tag-already-exists-in-the-remote-error-after-recreating-the-git-tag

[julia-users] Pkg.publish problem

2016-05-09 Thread Robert DJ
I'm having a weird problem iwth Pkg.publish. I've successfully tagged a new 
package version

Pkg.tag("Deldir")
INFO: Tagging Deldir v0.0.3
INFO: Committing METADATA for Deldir


But when running `Pkg.publish()` (in Julia v0.4):

INFO: Validating METADATA
INFO: Pushing Deldir permanent tags: v0.0.3
To g...@github.com:robertdj/Deldir.jl.git
 ! [rejected]v0.0.3 -> v0.0.3 (already exists)
error: failed to push some refs to 'g...@github.com:robertdj/Deldir.jl.git'
hint: Updates were rejected because the tag already exists in the remote.
ERROR: failed process: Process(`git 
--work-tree=/home/robert/.julia/v0.4/Deldir 
--git-dir=/home/robert/.julia/v0.4/Deldir/.git push -q origin 
refs/tags/v0.0.3:refs/tags/v0.0.3`, 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:388
 in sync_end at ./task.jl:413
 [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

Looking in the Git log it appears that a commit from a few months ago is 
tagged v0.0.3 (and I'm pretty sure that I have only tagged packages with 
Pkg.tag in Juila), but I can't remember if it was on a different computer. 
The v0.0.3 tag is still associated with the old commit, i.e., today's 
commit does not have a tag.

Is there any easy way to fix the problem? Deleting the repository on Github 
and uploading again (I'm the only contributor)?

Thanks,

Robert



Re: [julia-users] switch superior

2016-05-09 Thread Tamas Papp
Was there more recent discussion about switch? I think I missed it, last
thing I am aware of is #5410. And of course see Switch.jl.

In any case, I find the proposed syntax a bit obscure and
complicated. I would prefer using the result of

findfirst(x->input % x == 0,[2,3,5,7])

or if that does not help, then explicit currying,

input = 119
let d(x) = input % x == 0
if d(2)
# code
elseif d(3)
# code
elseif d(5)
# code
elseif d(7)
# code
end
end

Best,

Tamas



On Mon, May 09 2016, Ford Ox wrote:

> I have a little suggestion: If julia is going to have switch, could we make 
> it a bit better?
>
> Basically the switch would take two parameters : function and variable. On 
> each case it would would
> call the function with those two params, and if the functions would return 
> true, it would evaluate the case
> block.
>
> Note: the function has to return boolean.
>
> Example
>
> function divides(a, b)
>   return a % b == 0
> end
>
> input = 119
> switch(divides, input)
>   case 2 # this can be translated as ~ if(divides(input, 2))
>   case 3 # 3 divides input without remainder
>   case 5 # 5 divides input without remainder
>   case 7 # 7 divides input without remainder
> end
>
> Of course you could achieve the default switch behavior like this:
> switch(==, input)
> ...
>
> What do you think about it?


Re: [julia-users] Re: why's my julia code running slower than matlab, despite performance tips

2016-05-09 Thread Yichao Yu
On Mon, May 9, 2016 at 2:04 AM, Yichao Yu  wrote:
> On Mon, May 9, 2016 at 1:15 AM, Ford Ox  wrote:
>> I have checked the link and read the article. Am I right that the parallel
>> accelerator basically uses C code instead of julia to do the computation?
>> That would be kinda shame dont you think?
>
> No I don't think so.
>
> IIUC it uses C for the threading API, it even has a backend using the
> julia threading API. (And the julia threading API is very incomplete
> and experimental).
> And in general this is not so different from julia generating LLVM IR
> (especially since LLVM has a C backend). Generating C is just usually
> not the as efficient as generating LLVM IR since you'll have parser
> overhead, much less flexible and expressive, unless, as in this case,
> the function/API is in C.

Or in another word, it is at most a shame for LLVM IR for not having a
threading construct (which, admittedly, is a very hard problem but
people are working on it).

>
>>
>> Dne pondělí 9. května 2016 7:00:38 UTC+2 Christian Peel napsal(a):
>>>
>>> > The usual solution is to devectorized your code and to use loops (except
>>> > for matrix multiplication if you have large matrices).
>>>
>>> I am hopeful that ParallelAccelerator.jl [1][2] or similar projects can
>>> enable fast vectorized Julia code
>>>
>>> [1] https://github.com/IntelLabs/ParallelAccelerator.jl
>>> [2] http://julialang.org/blog/2016/03/parallelaccelerator
>>>
>>> On Sun, May 8, 2016 at 3:37 PM, feza  wrote:

 I mean the revised script runs just as fast if not a tad faster with the
 latest master as it does on 0.4.5 : )


 On Sunday, May 8, 2016 at 5:20:08 PM UTC-4, Patrick Kofod Mogensen wrote:
>
> Same as v0.4, or same as before you changed the code?
>
> On Sunday, May 8, 2016 at 8:55:00 PM UTC+2, feza wrote:
>>
>> roughly the same speed.
>>
>> On Sunday, May 8, 2016 at 2:44:19 PM UTC-4, Patrick Kofod Mogensen
>> wrote:
>>>
>>> out of curiosity, what about v0.5?
>>>
>>>
>>>
>>>
>>> --
>>> chris...@ieee.org


Re: [julia-users] Re: why's my julia code running slower than matlab, despite performance tips

2016-05-09 Thread Yichao Yu
On Mon, May 9, 2016 at 1:15 AM, Ford Ox  wrote:
> I have checked the link and read the article. Am I right that the parallel
> accelerator basically uses C code instead of julia to do the computation?
> That would be kinda shame dont you think?

No I don't think so.

IIUC it uses C for the threading API, it even has a backend using the
julia threading API. (And the julia threading API is very incomplete
and experimental).
And in general this is not so different from julia generating LLVM IR
(especially since LLVM has a C backend). Generating C is just usually
not the as efficient as generating LLVM IR since you'll have parser
overhead, much less flexible and expressive, unless, as in this case,
the function/API is in C.

>
> Dne pondělí 9. května 2016 7:00:38 UTC+2 Christian Peel napsal(a):
>>
>> > The usual solution is to devectorized your code and to use loops (except
>> > for matrix multiplication if you have large matrices).
>>
>> I am hopeful that ParallelAccelerator.jl [1][2] or similar projects can
>> enable fast vectorized Julia code
>>
>> [1] https://github.com/IntelLabs/ParallelAccelerator.jl
>> [2] http://julialang.org/blog/2016/03/parallelaccelerator
>>
>> On Sun, May 8, 2016 at 3:37 PM, feza  wrote:
>>>
>>> I mean the revised script runs just as fast if not a tad faster with the
>>> latest master as it does on 0.4.5 : )
>>>
>>>
>>> On Sunday, May 8, 2016 at 5:20:08 PM UTC-4, Patrick Kofod Mogensen wrote:

 Same as v0.4, or same as before you changed the code?

 On Sunday, May 8, 2016 at 8:55:00 PM UTC+2, feza wrote:
>
> roughly the same speed.
>
> On Sunday, May 8, 2016 at 2:44:19 PM UTC-4, Patrick Kofod Mogensen
> wrote:
>>
>> out of curiosity, what about v0.5?
>>
>>
>>
>>
>> --
>> chris...@ieee.org