[julia-users] Re: Julia-i18n logo proposal

2016-09-30 Thread Kenta Sato
"朱" means a kind of red colors in Japanese 
(https://ja.wikipedia.org/wiki/%E6%9C%B1%E8%89%B2). You placed it at the 
best circle of the logo. 

On Friday, September 30, 2016 at 9:47:04 AM UTC+9, Waldir Pimenta wrote:
>
> Hi all. I made a proposal for the logo for the Julia-i18n organization: 
> http://imgh.us/julia-i18n_1.svg
>
> It uses the three most used scripts worldwide, and the characters are 
> actually the start of the word “Julia” as written in each of those scripts.
>
> Looking forward to know what you guys think.
>
> --Waldir
>


[julia-users] Re: Master list of constants

2016-07-05 Thread Kenta Sato
eulergamma is the ASCII alias for γ.

julia> γ
γ = 0.5772156649015...


julia> eulergamma
γ = 0.5772156649015...


julia> γ === eulergamma
true


If you are interested in generating the list of constants, you can use this 
script: 
https://github.com/isagalaev/highlight.js/blob/d506d1d305e18809b2f5002967a18693780581b0/src/languages/julia.js#L23-L51
.

On Tuesday, July 5, 2016 at 7:52:52 PM UTC+9, esproff wrote:
>
> I wasn't able to find a master list of all the constants in Julia.  I'm 
> specifically looking for the ascii name for the Euler-Mascheroni constant γ. 
>  Similar to how the golden ratio is both φ and golden.
>


[julia-users] Re: Tensorflow like dataflow graphs for Julia?

2016-06-27 Thread Kenta Sato
You may be interested in Merlin.jl: https://github.com/hshindo/Merlin.jl. 
This supports describing computation graphs in Julia and optimization.

On Saturday, June 25, 2016 at 8:27:31 AM UTC+9, Gabriel Goh wrote:
>
> I'm wondering if a library in Julia exists where I can specify dataflow 
> graphs which can be compiled and differenciated, similar to what tensorflow 
> does. Thanks a lot!
>


[julia-users] Re: Modifying large vectors of repeated data

2016-04-14 Thread Kenta Sato
I guess what you want is RLEVector of RLEVectors.jl: 
https://github.com/phaverty/RLEVectors.jl.
This does run-length encoding for repeated elements and hence applying a 
function to all elements would be fast.


julia> v = RLEVector(vcat(zeros(1), ones(1)))
RLEVectors.RLEVector{Float64,Int64}
run values: [0.0,1.0]
run ends:   [1,2]

julia> map!(x -> x + 1, v)
RLEVectors.RLEVector{Float64,Int64}
run values: [1.0,2.0]
run ends:   [1,2]



On Thursday, April 14, 2016 at 11:48:48 PM UTC+9, Terry Seaward wrote:
>
> Hi,
>
> I have a large vector of repeated data (dates in my case, but I'd like to 
> keep this generic). In R I can apply a function to the elements efficiently 
> using something like this:
>
> myfun <- function(x, fun, ...) {
> ux <- unique(x); 
> fun(ux, ...)[match(x, ux)]
> }
>
> myfun(x, as.character)
>
> So basically apply the function to the unique elements then use match to 
> recreate x. 
>
> What's the best way to do this in Julia?
>
> -- Terry
>


[julia-users] Re: a good IDE for Julia ? (Julia Studio does not work with Julia v 0.3.0)

2016-01-26 Thread Kenta Sato
This may be an off-the-topic suggestion, but Spacemacs with ESS layer is 
almost an IDE to me.
I started to use it a few days ago (so I may missing something important) 
and found it includes features like:

* REPL integration
* Completing names from imported modules
* Document viewer
* etc.

I believe it is worth checking if you have never tried it.


On Friday, September 19, 2014 at 5:58:26 PM UTC+9, Ján Dolinský wrote:
>
> Hello guys,
>
> After upgrading to Julia 0.3.0 Julia Studio stopped working (I changed the 
> symbolic links in Julia Studio directory but nevertheless ...). Can 
> somebody suggest any workaround ? Is it true that Julia Studio will not 
> support newer versions of Julia ?
> What are you guys using now ? 
>
> Thanks a lot,
> Jan 
>


[julia-users] Running multiple scripts in parallel Julia sessions

2016-01-24 Thread Kenta Sato
I think GNU parallel is the best tool for that purpose. 
http://www.gnu.org/software/parallel/

You can pass -j option to control the number of maximum jobs at a time.

[julia-users] Re: Bio package - open function error

2016-01-17 Thread Kenta Sato
Hi, Elmo,

Thank you for using our Bio.jl package.

I guess that is because you didn't run `using Bio.Seq` before opening a 
FASTA file. Types and functions related to biological sequences are defined 
in the`Bio.Seq` module, not `Bio`.
And, you don't have to install neither Colm nor Ragel in order to use 
Bio.jl. Those tools are required only when you need to write your own 
Ragel-based parser. The FASTA parser generated from Ragel is already 
bundled in Bio.jl.

On Sunday, January 17, 2016 at 2:46:51 PM UTC+9, St Elmo Wilken wrote:
>
> Hi,
>
> I am brand new to the Bio package and wanted to play with it a bit. I have 
> some transcription data in a FASTA file which I want to read. Based on the 
> docs I tried:
> stream = open("somefile.fasta", FASTA)
> but all this generates is  
> ERROR: UndefVarError: FASTA not defined
> Am I doing something wrong?
>
> Also, do I need to have colm and ragel installed for Bio to work?
>
> Thanks!
>


[julia-users] Re: PriorityQueue allowing multiple elements with same priority

2016-01-08 Thread Kenta Sato
The priority queue in Base is different from priority queues in other 
languages.
I think you can use a plain priority queue (or heap) defined the 
DataStructures.jl package.
To pair priority and state, `priority => state` would be helpful. This 
paired values are ordered by the first element (priority) and then the 
second element (state). So you can push and pop according to the priority.

Here is an example:

julia> Base.isless(s1::State, s2::State) = isless(s1.a, s1.a) || (s1.a == s2
.b && isless(s
1.a, s2.b))
isless (generic function with 32 methods)


julia> h = binary_minheap(Pair{Int,State})
DataStructures.BinaryHeap{Pair{Int64,State},DataStructures.LessThan}(
DataStructures.LessTh
an(),Pair{Int64,State}[])


julia> push!(h, 4 => State(5, 3))


julia> push!(h, 2 => State(5, 3))


julia> top(h)
2=>State(5,3)


julia> pop!(h)
2=>State(5,3)


julia> top(h)
4=>State(5,3)



On Friday, January 8, 2016 at 6:32:11 PM UTC+9, Tomas Lycken wrote:
>
> I tried this today:
>
> immutable State
> a::Int
> b::Int
> end
>
> import Base.Collections: PriorityQueue, enqueue!, dequeue!, peek
>
> pq = PriorityQueue(Int,Int)
>
> enqueue!(pq, State(5,3), 4)
> enqueue!(pq, State(5,3), 2)
>
> but it fails with the error
>
> LoadError: ArgumentError: PriorityQueue keys must be unique
>
> I assume this is because the states are immutable, and thus compare equal 
> if all their values compare equal. Is there a way to make a priority queue 
> insert the same state on several priorities, i.e. to support my example 
> above?
>
> // T
> ​
>


[julia-users] Re: PriorityQueue allowing multiple elements with same priority

2016-01-08 Thread Kenta Sato
Sorry, I meant:

Base.isless(s1::State, s2::State) = isless(s1.a, s2.a) || (s1.a == s2.a && 
isless(s1.b, s2.b))



On Friday, January 8, 2016 at 7:56:51 PM UTC+9, Kenta Sato wrote:
>
> The priority queue in Base is different from priority queues in other 
> languages.
> I think you can use a plain priority queue (or heap) defined the 
> DataStructures.jl package.
> To pair priority and state, `priority => state` would be helpful. This 
> paired values are ordered by the first element (priority) and then the 
> second element (state). So you can push and pop according to the priority.
>
> Here is an example:
>
> julia> Base.isless(s1::State, s2::State) = isless(s1.a, s1.a) || (s1.a == 
> s2.b && isless(s
> 1.a, s2.b))
> isless (generic function with 32 methods)
>
>
> julia> h = binary_minheap(Pair{Int,State})
> DataStructures.BinaryHeap{Pair{Int64,State},DataStructures.LessThan}(
> DataStructures.LessTh
> an(),Pair{Int64,State}[])
>
>
> julia> push!(h, 4 => State(5, 3))
>
>
> julia> push!(h, 2 => State(5, 3))
>
>
> julia> top(h)
> 2=>State(5,3)
>
>
> julia> pop!(h)
> 2=>State(5,3)
>
>
> julia> top(h)
> 4=>State(5,3)
>
>
>
> On Friday, January 8, 2016 at 6:32:11 PM UTC+9, Tomas Lycken wrote:
>>
>> I tried this today:
>>
>> immutable State
>> a::Int
>> b::Int
>> end
>>
>> import Base.Collections: PriorityQueue, enqueue!, dequeue!, peek
>>
>> pq = PriorityQueue(Int,Int)
>>
>> enqueue!(pq, State(5,3), 4)
>> enqueue!(pq, State(5,3), 2)
>>
>> but it fails with the error
>>
>> LoadError: ArgumentError: PriorityQueue keys must be unique
>>
>> I assume this is because the states are immutable, and thus compare equal 
>> if all their values compare equal. Is there a way to make a priority queue 
>> insert the same state on several priorities, i.e. to support my example 
>> above?
>>
>> // T
>> ​
>>
>

[julia-users] Re: Parsing large XML files

2016-01-05 Thread Kenta Sato
I've never tried, but you may be able to use streaming XML parsing of the 
LibExpat.jl package to parse such a large XML file. 
See https://github.com/amitmurthy/LibExpat.jl#streaming-xml-parsing.

On Tuesday, January 5, 2016 at 11:55:52 PM UTC+9, Brandon Booth wrote:
>
> I'm trying to parse a series of XML files and write selected values to an 
> SQLite database. My code works on smaller files, but crashes when I get to 
> anything above about 1 GB. 
>
> I'm using Atom with the Hydrogen plugin on Julia 0.4.2.
>
> Any suggestions on what is going wrong or alternative approaches?
>
> Thanks.
>
> Brandon
>
>
> using LightXML
>
>
> function iparse(file)  f = open(file)  n = countlines(f)  vals = 
> Array(ASCIIString,n,3)  seekstart(f)  c = 1  while !eof(f)try  st = 
> parse_string(readline(f))  r = root(st)  l1 = 
> get_elements_by_tagname(r, "firstlevel)
>
>   l2 = find_element(l1[1], "secondlevel")
>
>   vals[c,1] = content(find_element(l2, "thirdlevel1")
>
>   vals[c,2] = content(find_element(l2, "thirdlevel2")
>
>   vals[c,1] = content(find_element(l2, "thirdlevel3")  c += 1
> catch  nothingend  end  return vals  close(f)end
>
>

Re: [julia-users] JuliaML

2015-11-12 Thread Kenta Sato
Thank you, Viral! I've joined the group and will move my package this 
weekend.


On Thursday, November 12, 2015 at 6:28:01 PM UTC+9, Viral Shah wrote:
>
> Sent you the invite to JuliaML. Would be nice to start populating it with 
> existing packages by moving them. 
>
> -viral
>
> On Thursday, November 12, 2015 at 5:00:34 AM UTC+5:30, Kenta Sato wrote:
>>
>> JuliaML! sounds cool!
>> I can offer the JuliaML organization my random forest package (
>> https://github.com/bicycle1885/RandomForests.jl).
>> I will have enough time to update and maintain the package, but I'm not a 
>> specialist in machine learning. So, if anyone has much better 
>> implementation ideas, it may be better to create a new package from scratch.
>>
>> On Thursday, November 12, 2015 at 5:33:06 AM UTC+9, Stefan Karpinski 
>> wrote:
>>>
>>> There's not really a group, there's a GitHub organization. Organizations 
>>> contain packages and have people who have various permissions with respect 
>>> to those packages. If you contribute to packages that end up there, you'll 
>>> have commit access to at least those packages. Anyone can watch any of the 
>>> packages and see what goes on there since they're all public.
>>>
>>> On Wed, Nov 11, 2015 at 3:27 PM, Alireza Nejati <alire...@gmail.com> 
>>> wrote:
>>>
>>>> Hello,
>>>>
>>>> I'd like to join the JuliaML group. My github account name is anj1.
>>>>
>>>> Regards,
>>>> Al Nejati
>>>>
>>>
>>>

Re: [julia-users] JuliaML

2015-11-11 Thread Kenta Sato
JuliaML! sounds cool!
I can offer the JuliaML organization my random forest package (
https://github.com/bicycle1885/RandomForests.jl).
I will have enough time to update and maintain the package, but I'm not a 
specialist in machine learning. So, if anyone has much better 
implementation ideas, it may be better to create a new package from scratch.

On Thursday, November 12, 2015 at 5:33:06 AM UTC+9, Stefan Karpinski wrote:
>
> There's not really a group, there's a GitHub organization. Organizations 
> contain packages and have people who have various permissions with respect 
> to those packages. If you contribute to packages that end up there, you'll 
> have commit access to at least those packages. Anyone can watch any of the 
> packages and see what goes on there since they're all public.
>
> On Wed, Nov 11, 2015 at 3:27 PM, Alireza Nejati  > wrote:
>
>> Hello,
>>
>> I'd like to join the JuliaML group. My github account name is anj1.
>>
>> Regards,
>> Al Nejati
>>
>
>

[julia-users] Return value discrepancy between `foo[i] = x` and `setindex!(foo, x, i)`

2015-08-16 Thread Kenta Sato
I thought that `foo[i] = x` is a syntax sugar of `setindex!(foo, x, i)` and 
hence the return values are identical in both cases. This is suggested in a 
section of the manual: 
http://julia.readthedocs.org/en/release-0.3/stdlib/collections/#indexable-collections
.

setindex!(*collection*, *value*, *key...*)

 Store the given value at the given key or index within a collection. The 
 syntax a[i,j,...] = x is converted by the compiler to setindex!(a, x, i, 
 j, ...).


But the following code doesn't work as such:

type Foo; end

function Base.setindex!(foo::Foo, x, i)
return 100
end

let
foo = Foo()
@show (foo[1] = 1)
@show (setindex!(foo, 1, 1))
end

Actual:
foo[1] = 1 = 1
setindex!(foo,1,1) = 100


Expected:
foo[1] = 1 = 100
setindex!(foo,1,1) = 100


So my question is which is the intended behavior?
I think it is unreasonable for `setindex!` to ignore the specified return 
value when written as `foo[i] = x` if `foo[i] = x` is really converted to 
`setindex!(foo, x, i)`.


[julia-users] Are there smart pointers in Julia?

2014-03-15 Thread Kenta Sato
Hi everyone,

I'm wondering if there are smart pointers like C++ in Julia.
Calling C functions often require managing raw pointers allocated in the C 
functions.
After allocating a pointer, I want to wrap it up with a smart pointer, 
which automatically frees the raw pointer when the smart pointer itself is 
removed with a garbage collector.
As for pointers to an array, the `pointer_to_array` method seems to be 
suitable in this case (
http://docs.julialang.org/en/latest/stdlib/base/#Base.pointer_to_array).

More generally speaking, I want a functionality that is something like a 
destructor to manage resources more readily.
Is it possible to call a function just before a Julia object is destructed?

Thanks.


[julia-users] Re: Are there smart pointers in Julia?

2014-03-15 Thread Kenta Sato
Thanks for your reply.

I didn't know finalizer(), and that seemed just to be the thing I wanted.
Sadly, I couldn't use it for freeing a pointer:

julia finalizer(c_malloc(1024), c_free)
ERROR: objects of type Ptr{None} cannot be finalized


And this also wouldn't work:

immutable SmartPointer{T}
pointer::Ptr{T}

function SmartPointer(p::Ptr{T})
smart_p = new(p)
finalizer(smart_p, p - c_free(p.pointer))
end
end

p = SmartPointer{Uint8}(convert(Ptr{Uint8}, c_malloc(1024)))

Am I doing something wrong?


On Sunday, March 16, 2014 12:12:31 AM UTC+9, Patrick O'Leary wrote:

 Maybe finalizer() will do what you need? 
 http://julia.readthedocs.org/en/latest/stdlib/base/#Base.finalizer

 On Saturday, March 15, 2014 9:49:56 AM UTC-5, Kenta Sato wrote:

 Hi everyone,

 I'm wondering if there are smart pointers like C++ in Julia.
 Calling C functions often require managing raw pointers allocated in the 
 C functions.
 After allocating a pointer, I want to wrap it up with a smart pointer, 
 which automatically frees the raw pointer when the smart pointer itself is 
 removed with a garbage collector.
 As for pointers to an array, the `pointer_to_array` method seems to be 
 suitable in this case (
 http://docs.julialang.org/en/latest/stdlib/base/#Base.pointer_to_array).

 More generally speaking, I want a functionality that is something like a 
 destructor to manage resources more readily.
 Is it possible to call a function just before a Julia object is 
 destructed?

 Thanks.



Re: [julia-users] Re: Are there smart pointers in Julia?

2014-03-15 Thread Kenta Sato
You are quite right!
Changing `immutable` to `type` fixed the problem:

type SmartPointer{T}
pointer::Ptr{T}

function SmartPointer(p::Ptr{T})
smart_p = new(p)
finalizer(smart_p, p - c_free(p.pointer))
smart_p
end
end 

This seems to work perfectly, prevents the memory leak in my sample code.
Thanks a lot!


On Sunday, March 16, 2014 12:52:00 AM UTC+9, Jameson wrote:

 The Julia GC doesn't track immutable types, so it can't finalize them. You 
 must use a regular type if you want it to be tracked by the GC.


 On Sat, Mar 15, 2014 at 3:44 PM, Kenta Sato bicyc...@gmail.comjavascript:
  wrote:

 Thanks for your reply.

 I didn't know finalizer(), and that seemed just to be the thing I wanted.
 Sadly, I couldn't use it for freeing a pointer:

 julia finalizer(c_malloc(1024), c_free)
 ERROR: objects of type Ptr{None} cannot be finalized


 And this also wouldn't work:

 immutable SmartPointer{T}
 pointer::Ptr{T}

 function SmartPointer(p::Ptr{T})
 smart_p = new(p)
 finalizer(smart_p, p - c_free(p.pointer))
 end
 end

 p = SmartPointer{Uint8}(convert(Ptr{Uint8}, c_malloc(1024)))

 Am I doing something wrong?


 On Sunday, March 16, 2014 12:12:31 AM UTC+9, Patrick O'Leary wrote:

 Maybe finalizer() will do what you need? http://julia.readthedocs.org/
 en/latest/stdlib/base/#Base.finalizer

 On Saturday, March 15, 2014 9:49:56 AM UTC-5, Kenta Sato wrote:

 Hi everyone,

  I'm wondering if there are smart pointers like C++ in Julia.
 Calling C functions often require managing raw pointers allocated in 
 the C functions.
 After allocating a pointer, I want to wrap it up with a smart pointer, 
 which automatically frees the raw pointer when the smart pointer itself is 
 removed with a garbage collector.
 As for pointers to an array, the `pointer_to_array` method seems to be 
 suitable in this case (http://docs.julialang.org/en/
 latest/stdlib/base/#Base.pointer_to_array).

 More generally speaking, I want a functionality that is something like 
 a destructor to manage resources more readily.
 Is it possible to call a function just before a Julia object is 
 destructed?

 Thanks.




[julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-09 Thread Kenta Sato
Hi,

I'm new to the Julia language, and I'm now trying the Julia C API in order 
to call Julia functions from Python.
I've become successful with calling some basic Julia functions such as (*) 
and sqrt() and converting the returned values to corresponding ones in 
Python.
But I've got into a trouble to check whether a return value from Julia is 
`nothing` or not.

In the julia.h header, there seems to be a related macro named 
`jl_is_null(v)`, but I'm not sure that this is the predicate I want because 
its name is not `jl_is_nothing(v)` as expected.

In addition, when I called `jl_is_null(v)`, I got a dynamic linking error, 
which said:

Traceback (most recent call last):
   File sample.py, line 2, in module
 import libjulia as jl
 ImportError: dlopen(/Users/kenta/myapp/libjulia/libjulia.so, 2): Symbol 
 not found: _jl_null
   Referenced from: /Users/kenta/myapp/libjulia/libjulia.so
   Expected in: flat namespace
  in /Users/kenta/myapp/libjulia/libjulia.so


Please note that `libjulia.so` is the name of my python library.

 libjulia.dylib contains `_jl_null` symbol but it is local one:

/Users/kenta/vendor/julia% nm usr/lib/libjulia.dylib| grep jl_null 
 [master]
 00c2a3f0 s _jl_null


I've got stuck at this point. Could you give me some advice?

Julia: commit b52f17544d70ebc41508d6776ab3ca0ac26ccb3
OS: Mac OS X 10.9.2 (Mavericks)


Re: [julia-users] How to check whether a values is nothing using the Julia C API?

2014-03-09 Thread Kenta Sato
Thank you for your reply.

I know that pyjulia exists, but I didn't try it.
The core idea of pyjulia seems to be incorporated into IJulia, but they 
does not share the source code.
I'm going to investigate the functionality of PyCall.jl.
Thanks again!


On Monday, March 10, 2014 2:05:42 AM UTC+9, Isaiah wrote:

 You might also consider starting from and contributing to - or at least 
 looking at - this:
  
 https://github.com/jakebolewski/pyjulia

 The important idea there is to use the existing PyCall machinery to do 
 conversions, which will save you a lot of headache (also, it does 
 everything using ctypes which will make cross-platform deployment much 
 simpler).


 On Sat, Mar 8, 2014 at 10:11 PM, Kenta Sato bicyc...@gmail.comjavascript:
  wrote:

 Hi,

 I'm new to the Julia language, and I'm now trying the Julia C API in 
 order to call Julia functions from Python.
 I've become successful with calling some basic Julia functions such as 
 (*) and sqrt() and converting the returned values to corresponding ones in 
 Python.
 But I've got into a trouble to check whether a return value from Julia is 
 `nothing` or not.

 In the julia.h header, there seems to be a related macro named 
 `jl_is_null(v)`, but I'm not sure that this is the predicate I want because 
 its name is not `jl_is_nothing(v)` as expected.

 In addition, when I called `jl_is_null(v)`, I got a dynamic linking 
 error, which said:

 Traceback (most recent call last):
   File sample.py, line 2, in module
 import libjulia as jl
 ImportError: dlopen(/Users/kenta/myapp/libjulia/libjulia.so, 2): Symbol 
 not found: _jl_null
   Referenced from: /Users/kenta/myapp/libjulia/libjulia.so
   Expected in: flat namespace
  in /Users/kenta/myapp/libjulia/libjulia.so


 Please note that `libjulia.so` is the name of my python library.

  libjulia.dylib contains `_jl_null` symbol but it is local one:

 /Users/kenta/vendor/julia% nm usr/lib/libjulia.dylib| grep jl_null   
   [master]
 00c2a3f0 s _jl_null


 I've got stuck at this point. Could you give me some advice?

 Julia: commit b52f17544d70ebc41508d6776ab3ca0ac26ccb3
 OS: Mac OS X 10.9.2 (Mavericks)




[julia-users] [ANN] Docopt.jl - a new port of docopt in Julia

2014-03-09 Thread Kenta Sato
Hi,

A few days ago, I released a new port of docopt written in Julia.
This is my first package written in Julia, so the code can contain some bad 
practice.
The package is currently not registered as an official package, but 
available from my repository (https://github.com/bicycle1885/Docopt.jl).
Of course, I'm planning to list it as an official package.

docopt is a command-line parser library that parses a help message and 
generates a parser for command-line arguments.
The original implementation of docopt was written in Python, but its idea 
is so cool that there are many ports in various languages (e.g. Ruby, 
Javascript, Go and so on).

I won't explain about the details of the grammar of docopt. The full 
explanation is available from http://docopt.org/.
Anyone who has experience of having to parse complicated command-line 
arguments and being annoyed with synchronizing your parser and help message 
will like Docopt.jl so much.
Also, please note that the current release only supports Julia v0.3 
prerelease, not v0.2.

I planned to announce it after the docopt community has accepted it as a 
rightful member of the docopt family. Unfortunately, there is no response 
for three days up to now (https://github.com/docopt/docopt/issues/183).

Thanks.