Re: [julia-users] newbie: Problem installing IJulia
This is not a problem with IJulia, but with Anaconda Python on Mac specifically. Try setting these environment variables before calling notebook(): using IJulia ENV[“LC_ALL”] = “en_US.UTF-8” ENV[“LANG”] = “en_US.UTF-8” notebook() I don’t know exactly the source of this issue and not everyone running Yosemite has the same problem, but apparently you are not alone: http://stackoverflow.com/questions/19961239/pelican-3-3-pelican-quickstart-error-valueerror-unknown-locale-utf-8 Best, João On Dec 15, 2014, at 8:05 AM, Eric Forgy eric.fo...@gmail.com wrote: Hi everyone, I am new to Julia (and Python for that matter) and, after watching some nice MIT lectures on YouTube, was inspired to try to install IJulia, but am having some difficulties. I'm on a MacBook Pro running OS X Yosemite (10.10.1). I tried to follow the instructions here: https://github.com/JuliaLang/IJulia.jl I did not have Python installed, so I downloaded and installed Anaconda and ran conda update ipython Everything seemed fine. If I run ipython from the command line, I get a command prompt and can enter 1+1 and get an output 2, which seems encouraging. Then I launch Julia and enter: julia Pkg.add(IJulia) It seems ok. Then I enter: julia using IJulia It seems ok. Then I enter: julia notebook() I get a bunch of scary error messages (pasted below). I am pretty sure there is something very simple/embarrassing I'm missing. Any ideas? Thank you for any help. Best regards, Eric julia notebook() Traceback (most recent call last): File //anaconda/bin/ipython, line 6, in module sys.exit(start_ipython()) File //anaconda/lib/python2.7/site-packages/IPython/__init__.py, line 120, in start_ipython return launch_new_instance(argv=argv, **kwargs) File //anaconda/lib/python2.7/site-packages/IPython/config/application.py, line 563, in launch_instance app.initialize(argv) File string, line 2, in initialize File //anaconda/lib/python2.7/site-packages/IPython/config/application.py, line 92, in catch_config_error return method(app, *args, **kwargs) File //anaconda/lib/python2.7/site-packages/IPython/terminal/ipapp.py, line 321, in initialize super(TerminalIPythonApp, self).initialize(argv) File string, line 2, in initialize File //anaconda/lib/python2.7/site-packages/IPython/config/application.py, line 92, in catch_config_error return method(app, *args, **kwargs) File //anaconda/lib/python2.7/site-packages/IPython/core/application.py, line 381, in initialize self.parse_command_line(argv) File //anaconda/lib/python2.7/site-packages/IPython/terminal/ipapp.py, line 316, in parse_command_line return super(TerminalIPythonApp, self).parse_command_line(argv) File string, line 2, in parse_command_line File //anaconda/lib/python2.7/site-packages/IPython/config/application.py, line 92, in catch_config_error return method(app, *args, **kwargs) File //anaconda/lib/python2.7/site-packages/IPython/config/application.py, line 475, in parse_command_line return self.initialize_subcommand(subc, subargv) File string, line 2, in initialize_subcommand File //anaconda/lib/python2.7/site-packages/IPython/config/application.py, line 92, in catch_config_error return method(app, *args, **kwargs) File //anaconda/lib/python2.7/site-packages/IPython/config/application.py, line 406, in initialize_subcommand subapp = import_item(subapp) File //anaconda/lib/python2.7/site-packages/IPython/utils/importstring.py, line 42, in import_item module = __import__(package, fromlist=[obj]) File //anaconda/lib/python2.7/site-packages/IPython/html/notebookapp.py, line 81, in module from IPython.consoleapp import IPythonConsoleApp File //anaconda/lib/python2.7/site-packages/IPython/consoleapp.py, line 43, in module from IPython.kernel.zmq.kernelapp import ( File //anaconda/lib/python2.7/site-packages/IPython/kernel/zmq/kernelapp.py, line 54, in module from .ipkernel import Kernel File //anaconda/lib/python2.7/site-packages/IPython/kernel/zmq/ipkernel.py, line 40, in module from .zmqshell import ZMQInteractiveShell File //anaconda/lib/python2.7/site-packages/IPython/kernel/zmq/zmqshell.py, line 36, in module from IPython.core.payloadpage import install_payload_page File //anaconda/lib/python2.7/site-packages/IPython/core/payloadpage.py, line 24, in module from docutils.core import publish_string File //anaconda/lib/python2.7/site-packages/docutils/core.py, line 20, in module from docutils import frontend, io, utils, readers, writers File //anaconda/lib/python2.7/site-packages/docutils/frontend.py, line 41, in module import docutils.utils File
Re: [julia-users] newbie: Problem installing IJulia
I do not have any experience with LightTable, so I’ll let the experts answer this one :) Did you try Sublime Text 3? I had no problems using it with this package: https://sublime.wbond.net/packages/IJulia. However, I ended up using a combination of Vim + Julia REPL + IJulia for my interactive needs. On Dec 15, 2014, at 9:54 AM, Eric Forgy eric.fo...@gmail.com wrote: Wow. Thank you João. IJulia seems to be working now. I've really been struggling all evening. After not being able to get IJulia to work, I tried to install LightTable with Juno. After modifying user.behaviors, I restart LT and get an error: Couldn't connect to Julia. A window pops up and Julia starts, but LT cannot connect to it. Any ideas? Could that also be a bad environment variable? THEN, I tried to install Sublime Text 2. When I go to Preferences - Browse Packages... it crashes. Not a great start. Three IDEs not working. I'm sure it has more to do with my inexperience than anything, but THANK YOU for at least letting me go home with a glimmer of hope after seeing IJulia working :) On Monday, December 15, 2014 10:13:08 PM UTC+8, João Felipe Santos wrote: This is not a problem with IJulia, but with Anaconda Python on Mac specifically. Try setting these environment variables before calling notebook(): using IJulia ENV[“LC_ALL”] = “en_US.UTF-8” ENV[“LANG”] = “en_US.UTF-8” notebook() I don’t know exactly the source of this issue and not everyone running Yosemite has the same problem, but apparently you are not alone: http://stackoverflow.com/questions/19961239/pelican-3-3-pelican-quickstart-error-valueerror-unknown-locale-utf-8 http://stackoverflow.com/questions/19961239/pelican-3-3-pelican-quickstart-error-valueerror-unknown-locale-utf-8 Best, João On Dec 15, 2014, at 8:05 AM, Eric Forgy eric@gmail.com javascript: wrote: Hi everyone, I am new to Julia (and Python for that matter) and, after watching some nice MIT lectures on YouTube, was inspired to try to install IJulia, but am having some difficulties. I'm on a MacBook Pro running OS X Yosemite (10.10.1). I tried to follow the instructions here: https://github.com/JuliaLang/IJulia.jl https://github.com/JuliaLang/IJulia.jl I did not have Python installed, so I downloaded and installed Anaconda and ran conda update ipython Everything seemed fine. If I run ipython from the command line, I get a command prompt and can enter 1+1 and get an output 2, which seems encouraging. Then I launch Julia and enter: julia Pkg.add(IJulia) It seems ok. Then I enter: julia using IJulia It seems ok. Then I enter: julia notebook() I get a bunch of scary error messages (pasted below). I am pretty sure there is something very simple/embarrassing I'm missing. Any ideas? Thank you for any help. Best regards, Eric julia notebook() Traceback (most recent call last): File //anaconda/bin/ipython, line 6, in module sys.exit(start_ipython()) File //anaconda/lib/python2.7/site-packages/IPython/__init__.py, line 120, in start_ipython return launch_new_instance(argv=argv, **kwargs) File //anaconda/lib/python2.7/site-packages/IPython/config/application.py, line 563, in launch_instance app.initialize(argv) File string, line 2, in initialize File //anaconda/lib/python2.7/site-packages/IPython/config/application.py, line 92, in catch_config_error return method(app, *args, **kwargs) File //anaconda/lib/python2.7/site-packages/IPython/terminal/ipapp.py, line 321, in initialize super(TerminalIPythonApp, self).initialize(argv) File string, line 2, in initialize File //anaconda/lib/python2.7/site-packages/IPython/config/application.py, line 92, in catch_config_error return method(app, *args, **kwargs) File //anaconda/lib/python2.7/site-packages/IPython/core/application.py, line 381, in initialize self.parse_command_line(argv) File //anaconda/lib/python2.7/site-packages/IPython/terminal/ipapp.py, line 316, in parse_command_line return super(TerminalIPythonApp, self).parse_command_line(argv) File string, line 2, in parse_command_line File //anaconda/lib/python2.7/site-packages/IPython/config/application.py, line 92, in catch_config_error return method(app, *args, **kwargs) File //anaconda/lib/python2.7/site-packages/IPython/config/application.py, line 475, in parse_command_line return self.initialize_subcommand(subc, subargv) File string, line 2, in initialize_subcommand File //anaconda/lib/python2.7/site-packages/IPython/config/application.py, line 92, in catch_config_error return method(app, *args, **kwargs) File //anaconda/lib/python2.7/site-packages/IPython/config/application.py, line 406, in initialize_subcommand subapp = import_item(subapp) File //anaconda/lib/python2.7/site-packages
Re: [julia-users] obscure error in Julia 0.3.3
You may need to clean and rebuild the dependencies as well as core Julia. On Dec 15, 2014, at 12:08 PM, Andrei Berceanu andreiberce...@gmail.com wrote: Hi all, I recently upgraded to Julia Version 0.3.3 on my Arch Linux box and sometimes get this strange error, followed by a kernel crash - what gives? julia: symbol lookup error: /usr/bin/../lib/julia/libcholmod.so: undefined symbol: zpotrf_ //A
Re: [julia-users] Julia on android
Biggest issue will be that most Android devices have an ARM processor, and ARM support is not complete at the moment. You may have more luck with Intel Android devices, though. João On Dec 11, 2014, at 10:17 AM, Benjamin Lind lind.benja...@gmail.com wrote: I haven't tried it, but it might be possible with GNURoot https://play.google.com/store/apps/details?id=champion.gnuroot and one of its Linux distributions like Debian https://play.google.com/store/apps/details?id=champion.gnuroot.wheezy. On Wednesday, December 10, 2014 9:59:24 AM UTC+3, googler wrote: Hi all Do anyone knows how I can run a julia program in android platform? Is there any support given? Any help is appreciated!! Thanks and Regards googler
Re: [julia-users] Gadfly conflict with JLD
As in the issue posted by Isaiah, this is a problem with the Color package (or interaction between Color and another package). In my case, updating Color did not work, so I pinned it to v0.3.9. João On Dec 3, 2014, at 9:57 AM, xiongji...@gmail.com wrote: I guess maybe some packages Gadfly used forgot importing base.convert but exported it in somewhere. On Wednesday, December 3, 2014 3:51:54 PM UTC+1, xiong...@gmail.com wrote: I found that after using Gadfly, the load funciton in JLD can not work, as below: julia using Gadfly julia using HDF5,JLD julia save(tempfile.jld,var,[1,2,3]) julia load(tempfile.jld,var) ERROR: `convert` has no method matching convert(::Type{Int64...}, ::UInt64) in convert at base.jl:44 in read at /home/JXiong/.julia/v0.4/HDF5/src/JLD.jl:330 in read at /home/JXiong/.julia/v0.4/HDF5/src/JLD.jl:313 in anonymous at /home/JXiong/.julia/v0.4/HDF5/src/JLD.jl:972 in jldopen at /home/JXiong/.julia/v0.4/HDF5/src/JLD.jl:234 in load at /home/JXiong/.julia/v0.4/HDF5/src/JLD.jl:971 However, if I run using HDF5, JLD before using Gadfly, everything will be fine. FYI: julia versioninfo() Julia Version 0.4.0-dev+1928 Commit b1c99af* (2014-12-03 08:58 UTC) Platform Info: System: Linux (x86_64-redhat-linux) CPU: Intel(R) Xeon(R) CPU E7- 4830 @ 2.13GHz WORD_SIZE: 64 BLAS: libopenblas (USE64BITINT NO_AFFINITY NEHALEM) LAPACK: libopenblas LIBM: libopenlibm LLVM: libLLVM-3.3
Re: [julia-users] Difference in constructing immutable types between 0.3 and 0.4?
Hello all, I actually fixed the problem by adding type specifications to all function calls and immutable types involved. Maybe this was also fixed in Julia 0.4 in the time being, but I was not able to follow as I follow the recommendation of developing all my package code in 0.3 and just testing it in 0.4. I’m sorry for not having notified the list as I got it sorted out, but since I got no replies in 5 days I thought I was just being silly and the solution was somehow obvious (instead of it being a bug in call overloading). Best, João On Nov 14, 2014, at 7:03 AM, Stefan Karpinski ste...@karpinski.org wrote: I'm not sure but it's quite possible that this was fixed independently of this email. Jeff has been doing most of the work on call overloading and he doesn't (afaik) read julia-users very often. Sorry that you wasted time on that and thanks for looking into this. On Fri, Nov 14, 2014 at 8:57 AM, Micky Latowicki bio...@gmail.com mailto:bio...@gmail.com wrote: I started looking through your commit histories to find what was the line that caused the problem. I saw that you fixed the problem since then. It would have been courteous to note that your problem has been solved. On Sunday, November 9, 2014 12:18:20 AM UTC+2, João Felipe Santos wrote: Hi, I have a module (called Auditory) which exports an immutable type (called ModulationFilter) which is only a container for a vector of BiquadFilters (a type exported by another module, DSP). It also exports a helper function for constructing ModulationFilter, defined here: https://github.com/jfsantos/Auditory.jl/blob/master/src/ModulationFilterbank.jl#L23 https://github.com/jfsantos/Auditory.jl/blob/master/src/ModulationFilterbank.jl#L23) The code for the whole module is available here: https://github.com/jfsantos/Auditory.jl https://github.com/jfsantos/Auditory.jl. On Julia 0.3, all tests pass. However, when using 0.4, I get the following error when calling make_modulation_filter (which simply creates a vector of BiquadFilters and calls the default constructor for ModulationFilterbank): ERROR: `convert` has no method matching convert(::Type{ModulationFilterbank{T}}, ::Array{BiquadFilter{T},1}) in modulation_filterbank at /Users/jfsantos/.julia/v0.4/Auditory/src/ModulationFilterbank.jl:24 Calling methods(ModulationFilterbank) in Julia 0.3 returns: # 1 method for generic function ModulationFilterbank: ModulationFilterbank{T}(filters::Array{BiquadFilter{T},1}) but in 0.4, I get instead: 2-element Array{Any,1}: call{T}(::Type{ModulationFilterbank{T}},filters::Array{BiquadFilter{T},1}) call{T}(::Type{T},args...) at base.jl:34 I thought there was a difference in how 0.3 and 0.4 deal with the “default constructor”, so I tried replicating the example with a sillier module: module Foo export Bar immutable Bar{T} x::Vector{T} end end However, I am able to create elements of this immutable type with a default constructor either in 0.3 or 0.4. Of course, in this case I don’t have the additional complication of using a type defined in a second module. Can anyone point out where I am making a mistake here? Thanks! Best regards João
Re: [julia-users] Contributing to a Julia Package
Hi Tim, you have to create a fork on Github and then push your new branch to your personal fork. Then, on Github, switch to that fork and the interface will show a Pull request button if your personal fork is ahead of the upstream repository. Best -- João Felipe Santos On Mon, Nov 10, 2014 at 2:17 PM, Tim Wheeler timwheeleronl...@gmail.com wrote: Hello Julia Users, I wrote some code that I would like to submit via pull request to a Julia package. The thing is, I am new to this and do not understand the pull request process. What I have done: - used Pkg.add to obtain a local version of said package - ran `git branch mybranch` to create a local git branch - created my code additions and used `git add` to include them. Ran `git commit -m` I am confused over how to continue. The instructions on git for issuing a pull request require that I use their UI interface, but my local branch is not going to show up when I select new pull request because it is, well, local to my machine. Do I need to fork the repository first? When I try creating a branch through the UI I do not get an option to create one like they indicate in the tutorial https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/#creating-a-branch, perhaps because I am not a repo owner. Thank you.
[julia-users] Difference in constructing immutable types between 0.3 and 0.4?
Hi, I have a module (called Auditory) which exports an immutable type (called ModulationFilter) which is only a container for a vector of BiquadFilters (a type exported by another module, DSP). It also exports a helper function for constructing ModulationFilter, defined here: https://github.com/jfsantos/Auditory.jl/blob/master/src/ModulationFilterbank.jl#L23 https://github.com/jfsantos/Auditory.jl/blob/master/src/ModulationFilterbank.jl#L23) The code for the whole module is available here: https://github.com/jfsantos/Auditory.jl. On Julia 0.3, all tests pass. However, when using 0.4, I get the following error when calling make_modulation_filter (which simply creates a vector of BiquadFilters and calls the default constructor for ModulationFilterbank): ERROR: `convert` has no method matching convert(::Type{ModulationFilterbank{T}}, ::Array{BiquadFilter{T},1}) in modulation_filterbank at /Users/jfsantos/.julia/v0.4/Auditory/src/ModulationFilterbank.jl:24 Calling methods(ModulationFilterbank) in Julia 0.3 returns: # 1 method for generic function ModulationFilterbank: ModulationFilterbank{T}(filters::Array{BiquadFilter{T},1}) but in 0.4, I get instead: 2-element Array{Any,1}: call{T}(::Type{ModulationFilterbank{T}},filters::Array{BiquadFilter{T},1}) call{T}(::Type{T},args...) at base.jl:34 I thought there was a difference in how 0.3 and 0.4 deal with the “default constructor”, so I tried replicating the example with a sillier module: module Foo export Bar immutable Bar{T} x::Vector{T} end end However, I am able to create elements of this immutable type with a default constructor either in 0.3 or 0.4. Of course, in this case I don’t have the additional complication of using a type defined in a second module. Can anyone point out where I am making a mistake here? Thanks! Best regards João
Re: [julia-users] using filter function
You just need to write a function that returns false for the elements you want to filter out. Here’s an example that does what you want: julia myfilter(x) = x != 0 myfilter (generic function with 1 method) julia A = [1, 2, 0, 4, 5, 0] 6-element Array{Int64,1}: 1 2 0 4 5 0 julia filter(myfilter, A) 4-element Array{Int64,1}: 1 2 4 5 On Nov 3, 2014, at 10:15 AM, Zahirul ALAM zahirul.a...@gmail.com wrote: The documentation says: filter(function, collection) Return a copy of collection, removing elements for which function is false. For associative collections, the function is passed two arguments (key and value). how to write the fucntion? I am trying to get elements which are nonzero. Any Help is much appreciated!
[julia-users] Is there something similar to IPython's Audio display in IJulia?
Hi, I would like to add an HTML5 audio player to my IJulia notebooks, similarly to what is done in IPython notebooks. In IPython notebooks, there’s two possibilities: you can either pass the path to an audio file (which is easy) or a Numpy array (rendered as data:audio/wav;base64 straight into the HTML file). Is there something similar in IJulia already? If negative, where can I find more info on how to add this to IJulia? Cheers, João
[julia-users] Re: Is there something similar to IPython's Audio display in IJulia?
Just in case it may be useful for anyone else, I ended up implementing this straight in Julia (code here: https://gist.github.com/jfsantos/a39ed69a7894876f1e04 https://gist.github.com/jfsantos/a39ed69a7894876f1e04). I posted this to IJulia’s issue tracker in case the developers are interested in adding it to the module. Cheers, João On Nov 3, 2014, at 6:04 PM, João Felipe Santos joao@gmail.com wrote: Hi, I would like to add an HTML5 audio player to my IJulia notebooks, similarly to what is done in IPython notebooks. In IPython notebooks, there’s two possibilities: you can either pass the path to an audio file (which is easy) or a Numpy array (rendered as data:audio/wav;base64 straight into the HTML file). Is there something similar in IJulia already? If negative, where can I find more info on how to add this to IJulia? Cheers, João
Re: [julia-users] Julia off-line documentation
You can build the docs as a PDF or as HTML and read them on your computer. Check https://github.com/JuliaLang/julia/tree/release-0.3/doc -- João Felipe Santos On Thu, Oct 2, 2014 at 11:59 AM, Charles Novaes de Santana charles.sant...@gmail.com wrote: Dear all, I was wondering if there is any official Julia documentation that can be accessed off-line. What do you recommend to use if I want to read the docs without connecting to internet. I looked for documents like these but I couldn't find a good general one so far. Thanks in advance for any comment! Best, Charles -- Um axé! :) -- Charles Novaes de Santana, PhD http://www.imedea.uib-csic.es/~charles
Re: [julia-users] Help with Clang.jl for a C beginner
You need to do ccalls using Ptr{Uint8}. What you can do actually is wrap the Clang.jl-generated functions with your own functions with an alternative signature, and then convert from ASCIIString to Ptr{Uint8}. Note that you probably will need to do it anyways to wrap the return types, since you probably do not want to work with pointers from Julia :) In that specific example, if m and k are ASCIIStrings, conversions will be done automatically: testurl = GEThttp%3A%2F%2Fphotos.example.net %2Fphotosfile%3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal testkey = kd94hf93k423kf44pfkkdhi9sl3r4s00 b64d = ccall((:oauth_sign_hmac_sha1, liboauth), Ptr{Uint8}, (Ptr{Uint8}, Ptr{Uint8}), testurl, testkey) Note that b64d here will be a Ptr{Uint8}, which you can convert to a Julia string by using bytestring(b64d). -- João Felipe Santos On Mon, Sep 1, 2014 at 9:55 AM, Randy Zwitch randy.zwi...@fuqua.duke.edu wrote: To make it a bit more concrete, the C library has this test function: testurl = GEThttp%3A%2F%2Fphotos.example.net%2Fphotosfile%3D vacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce %3Dkllo9940pd9333jh%26oauth_signature_method%3DHMAC-SHA1%26o auth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk %26oauth_version%3D1.0%26size%3Doriginal; testkey = kd94hf93k423kf44pfkkdhi9sl3r4s00; b64d = oauth_sign_hmac_sha1(testurl , testkey); In Julia, I have this generated from Clang.jl: liboauth = dlopen(/usr/local/lib/liboauth.dylib) function oauth_sign_hmac_sha1(m::Ptr{Uint8},k::Ptr{Uint8}) ccall((:oauth_sign_hmac_sha1,liboauth),Ptr{Uint8},(Ptr{Uint8},Ptr{Uint8}),m,k) end What modifications do I need to make to the Clang Julia code to run this test? On Monday, September 1, 2014 8:54:59 AM UTC-4, Randy Zwitch wrote: Thanks for the detailed response João! As it turns out, I didn't have any .dylib files as part of the downloaded code, but I was able to figure out how to compile the code and I believe I've got the library installed locally now. When you reference that most of my Ptr{Uint8} values are really just looking for string inputs, can I modify the Julia function signature to take ::ASCIIString instead? Or is this something where I have the leave the type signatures as they are, but understand what the function is actually looking for from the documentation? On Sunday, August 31, 2014 9:19:21 PM UTC-4, João Felipe Santos wrote: Hello Randy, the following comes from my experience with ccall and Julia documentation. Please anyone correct me if I explained any of the internals wrong! The API seems to be really simple so pretty much everything can be done with standard Julia types. Clang.jl seems to have generated correct code for it. Regarding 2, liboauth.dylib (or .dll, or .so on Linux) has to be loaded and passed to ccall. You can load it by hand using dlopen, like this: liboauth = dlopen(/path/of/liboauth.dylib) This will raise an error if the path is not valid. If the library is in your environment's standard path, you can pass its name to ccall as a string instead of creating a pointer with dlopen. Most of the Ptr{Uint8} you got in the code generated by Clang.jl are actually mapping char *, which are C strings (ASCII, not Unicode). For example, let's say you wanted to call puts from libc, which is a function that gets a string as its argument, prints it to the screen followed by a newline, and returns the number of printed characters. You could do it like this: ccall((:puts, libc), Cint, (Ptr{Uint8},), Hello, Randy) So, you basically can pass your string as the function argument and it should work. You don't need to pass a pointer, but it's good to know that your Julia ASCIIString was converted to Ptr{Uint8} internally. With this you should be able to call functions, but you still need to be able to recover their output. The second argument to ccall is the C function return type, but note that often C functions do not return their output in the return type, but in a variable which was passed by reference as one of its arguments. I don't know enough of liboauth to know what's the case, so you will need to check the documentation. See the sections http://docs.julialang.org/en/release-0.3/manual/calling-c- and-fortran-code/#accessing-data-through-a-pointer and http://docs.julialang.org/en/release-0.3/manual/calling-c- and-fortran-code/#passing-pointers-for-modifying-inputs for more details on that. -- João Felipe Santos On Sun, Aug 31, 2014 at 8:17 PM, Randy Zwitch randy@fuqua.duke.edu wrote: Hi all - I've been trying to learn more about C and how Julia interacts and decided to play around with Clang.jl. I decided I was going to wrap liboauth from here: http
Re: [julia-users] Help with Clang.jl for a C beginner
I'm sorry, there was a mistake in my example. The dlopen step should be used just to check whether the file is accessible as a shared library. ccall expects the full path to the .dylib file in case the library is not at a standard location. Do something like this instead: const liboauth = /path/to/liboauth (dlopen_e(liboauth) == C_NULL) error(Unable to load shared library at the given path.) b64d = ccall((:oauth_sign_hmac_sha1, liboauth), Ptr{Uint8}, (Ptr{Uint8}, Ptr{Uint8}), testurl, testkey) println(bytestring(b64d)) Note that you have to use bytestring and not string. string will create a string from printing the pointer (which will show something like Ptr{Uint8} @0x012345). bytestring converts a C string from a pointer to an ASCIIString, which is what you want. -- João Felipe Santos On Mon, Sep 1, 2014 at 4:24 PM, Randy Zwitch randy.zwi...@fuqua.duke.edu wrote: Thanks for the suggestions everyone. Unfortunately, neither the code from Ivar nor João worked for me. liboauth = dlopen(/usr/local/lib/liboauth.dylib) Out[8]: Ptr{Void} @0x7fdc665c5ca0 In [9]: function oauth_sign_hmac_sha1(m::String,k::String) res = ccall((:oauth_sign_hmac_sha1,liboauth),Ptr{Uint8},(Ptr{Uint8},Ptr{Uint8}),m,k) if res == C_NULL error(oauth_sign_hmac_sha1 failed) end return string(res) end testurl = GEThttp%3A%2F%2Fphotos.example.net%2Fphotosfile%3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal testkey = kd94hf93k423kf44pfkkdhi9sl3r4s00 oauth_sign_hmac_sha1(testurl, testkey) type: oauth_sign_hmac_sha1: in ccall: first argument not a pointer or valid constant expression, expected DataType, got Type{(Any...,)} while loading In[9], in expression starting on line 11 in oauth_sign_hmac_sha1 at In[9]:2 testurl = GEThttp%3A%2F%2Fphotos.example.net%2Fphotosfile%3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal testkey = kd94hf93k423kf44pfkkdhi9sl3r4s00 b64d = ccall((:oauth_sign_hmac_sha1, liboauth), Ptr{Uint8}, (Ptr{Uint8}, Ptr{Uint8}), testurl, testkey) bytestring(b64d) type: anonymous: in ccall: first argument not a pointer or valid constant expression, expected DataType, got Type{(Any...,)} while loading In[10], in expression starting on line 3 in anonymous at no file Does this mean I compiled the library wrong? When I did the 'make' step, after it was complete, I did 'make installcheck' and the 3 tests reported that they completed successfully. At a higher level, I like Isaiah's suggestion of doing this process by hand to really get to understanding what is going on. Is there an eaier external library that one of you could suggest that I could use to walk through the entire process? I've done the examples in the manual using :clock and :getenv and understand what is going on, so now I want to work with a user-installed library to make sure I really get the process. I started with OAuth to see if I could make something usable to work with my Twitter package, but maybe it's not the best starting place. On Monday, September 1, 2014 10:47:22 AM UTC-4, João Felipe Santos wrote: You need to do ccalls using Ptr{Uint8}. What you can do actually is wrap the Clang.jl-generated functions with your own functions with an alternative signature, and then convert from ASCIIString to Ptr{Uint8}. Note that you probably will need to do it anyways to wrap the return types, since you probably do not want to work with pointers from Julia :) In that specific example, if m and k are ASCIIStrings, conversions will be done automatically: testurl = GEThttp%3A%2F%2Fphotos.example.net%2Fphotosfile% 3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_ nonce%3Dkllo9940pd9333jh%26oauth_signature_method% 3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26oauth_token% 3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal testkey = kd94hf93k423kf44pfkkdhi9sl3r4s00 b64d = ccall((:oauth_sign_hmac_sha1, liboauth), Ptr{Uint8}, (Ptr{Uint8}, Ptr{Uint8}), testurl, testkey) Note that b64d here will be a Ptr{Uint8}, which you can convert to a Julia string by using bytestring(b64d). -- João Felipe Santos
Re: [julia-users] Help with Clang.jl for a C beginner
Exactly. The first argument to ccall is a tuple with a symbol pointing to the function name and a const string pointing either to the full path of the dynamic library or just its canonical name, in case it is in the standard path your OS uses to find libraries. I had installed liboauth from Homebrew, so it ended up in a standard OS location and I did not use that step, but mistakenly assumed that was what you were supposed to do for libs in non-standard places. Sorry for that, but I'm glad it worked in the end! -- João Felipe Santos On Mon, Sep 1, 2014 at 6:10 PM, Randy Zwitch randy.zwi...@fuqua.duke.edu wrote: Kevin, adding const in front gave me this error: type: ccall: expected Symbol, got Ptr{None} while loading In[3], in expression starting on line 3 Luckily João, your code finally worked for me! So if I understand this correctly, the problem was that we were originally passing a Ptr to ccall, when all I should've been doing is passing a string declared as a constant? On Monday, September 1, 2014 4:46:07 PM UTC-4, João Felipe Santos wrote: I'm sorry, there was a mistake in my example. The dlopen step should be used just to check whether the file is accessible as a shared library. ccall expects the full path to the .dylib file in case the library is not at a standard location. Do something like this instead: const liboauth = /path/to/liboauth (dlopen_e(liboauth) == C_NULL) error(Unable to load shared library at the given path.) b64d = ccall((:oauth_sign_hmac_sha1, liboauth), Ptr{Uint8}, (Ptr{Uint8}, Ptr{Uint8}), testurl, testkey) println(bytestring(b64d)) Note that you have to use bytestring and not string. string will create a string from printing the pointer (which will show something like Ptr{Uint8} @0x012345). bytestring converts a C string from a pointer to an ASCIIString, which is what you want. -- João Felipe Santos On Mon, Sep 1, 2014 at 4:24 PM, Randy Zwitch randy@fuqua.duke.edu wrote: Thanks for the suggestions everyone. Unfortunately, neither the code from Ivar nor João worked for me. liboauth = dlopen(/usr/local/lib/liboauth.dylib) Out[8]: Ptr{Void} @0x7fdc665c5ca0 In [9]: function oauth_sign_hmac_sha1(m::String,k::String) res = ccall((:oauth_sign_hmac_sha1,liboauth),Ptr{Uint8},(Ptr{Uint8},Ptr{Uint8}),m,k) if res == C_NULL error(oauth_sign_hmac_sha1 failed) end return string(res) end testurl = GEThttp%3A%2F%2Fphotos.example.net%2Fphotosfile%3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal testkey = kd94hf93k423kf44pfkkdhi9sl3r4s00 oauth_sign_hmac_sha1(testurl, testkey) type: oauth_sign_hmac_sha1: in ccall: first argument not a pointer or valid constant expression, expected DataType, got Type{(Any...,)} while loading In[9], in expression starting on line 11 in oauth_sign_hmac_sha1 at In[9]:2 testurl = GEThttp%3A%2F%2Fphotos.example.net%2Fphotosfile%3Dvacation.jpg%26oauth_consumer_key%3Ddpf43f3p2l4k3l03%26oauth_nonce%3Dkllo9940pd9333jh%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1191242096%26oauth_token%3Dnnch734d00sl2jdk%26oauth_version%3D1.0%26size%3Doriginal testkey = kd94hf93k423kf44pfkkdhi9sl3r4s00 b64d = ccall((:oauth_sign_hmac_sha1, liboauth), Ptr{Uint8}, (Ptr{Uint8}, Ptr{Uint8}), testurl, testkey) bytestring(b64d) type: anonymous: in ccall: first argument not a pointer or valid constant expression, expected DataType, got Type{(Any...,)} while loading In[10], in expression starting on line 3 in anonymous at no file Does this mean I compiled the library wrong? When I did the 'make' step, after it was complete, I did 'make installcheck' and the 3 tests reported that they completed successfully. At a higher level, I like Isaiah's suggestion of doing this process by hand to really get to understanding what is going on. Is there an eaier external library that one of you could suggest that I could use to walk through the entire process? I've done the examples in the manual using :clock and :getenv and understand what is going on, so now I want to work with a user-installed library to make sure I really get the process. I started with OAuth to see if I could make something usable to work with my Twitter package, but maybe it's not the best starting place. On Monday, September 1, 2014 10:47:22 AM UTC-4, João Felipe Santos wrote: You need to do ccalls using Ptr{Uint8}. What you can do actually is wrap the Clang.jl-generated functions with your own functions with an alternative signature, and then convert from ASCIIString to Ptr{Uint8}. Note that you probably will need to do it anyways to wrap the return types, since you probably do not want to work with pointers from Julia :) In that specific example, if m
Re: [julia-users] Help with Clang.jl for a C beginner
Hello Randy, the following comes from my experience with ccall and Julia documentation. Please anyone correct me if I explained any of the internals wrong! The API seems to be really simple so pretty much everything can be done with standard Julia types. Clang.jl seems to have generated correct code for it. Regarding 2, liboauth.dylib (or .dll, or .so on Linux) has to be loaded and passed to ccall. You can load it by hand using dlopen, like this: liboauth = dlopen(/path/of/liboauth.dylib) This will raise an error if the path is not valid. If the library is in your environment's standard path, you can pass its name to ccall as a string instead of creating a pointer with dlopen. Most of the Ptr{Uint8} you got in the code generated by Clang.jl are actually mapping char *, which are C strings (ASCII, not Unicode). For example, let's say you wanted to call puts from libc, which is a function that gets a string as its argument, prints it to the screen followed by a newline, and returns the number of printed characters. You could do it like this: ccall((:puts, libc), Cint, (Ptr{Uint8},), Hello, Randy) So, you basically can pass your string as the function argument and it should work. You don't need to pass a pointer, but it's good to know that your Julia ASCIIString was converted to Ptr{Uint8} internally. With this you should be able to call functions, but you still need to be able to recover their output. The second argument to ccall is the C function return type, but note that often C functions do not return their output in the return type, but in a variable which was passed by reference as one of its arguments. I don't know enough of liboauth to know what's the case, so you will need to check the documentation. See the sections http://docs.julialang.org/en/release-0.3/manual/calling-c-and-fortran-code/#accessing-data-through-a-pointer and http://docs.julialang.org/en/release-0.3/manual/calling-c-and-fortran-code/#passing-pointers-for-modifying-inputs for more details on that. -- João Felipe Santos On Sun, Aug 31, 2014 at 8:17 PM, Randy Zwitch randy.zwi...@fuqua.duke.edu wrote: Hi all - I've been trying to learn more about C and how Julia interacts and decided to play around with Clang.jl. I decided I was going to wrap liboauth from here: http://liboauth.sourceforge.net/oauth_8h_source.html I downloaded the C source, which resided in my OSX Downloads directory. Using the following Julia code generated a bunch of output: [1]: using Clang.wrap_c In [2]: context = wrap_c.init(; output_file=liboauth.jl, header_library=x-liboauth, common_file=liboauth.jl, clang_diagnostics=true) context.options.wrap_structs = true wrap_c.wrap_c_headers(context, [/Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h]) WARNING: wrap_c_headers: deprecated /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:112:46: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:138:54: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:138:86: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:315:67: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:315:81: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:320:66: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:320:80: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:519:28: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:532:30: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:670:61: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:688:57: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:715:43: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:717:70: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:717:77: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:717:77: error: redefinition of parameter 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:717:70: note: previous declaration is here /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:741:24: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:771:43: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:773:70: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:773:77: warning: type specifier missing, defaults to 'int' [-Wimplicit-int
Re: [julia-users] Semi-OT: Recommendations for learning just enough C for Julia
I once wrote a simple example of how to write and compile C code as a shared library and call from Julia using ccall. I could share it if you are interested, although it has no documentation at all at the moment besides a couple of comments. Main things you have to know from C are types, structs, arrays and pointers, passing arguments to functions by value and by reference, and the basics of memory allocation (this is almost the whole language, excluding standard libraries and quirkier parts of C99). Regarding the shared library part, you could probably live only knowing it is a way of exporting symbols from a binary file (.so on Linux, .dll on Windows, .dylib on OS X) in a way other programs can use them. I may have simplified or overcomplicated things, but I think these are the basic concepts one would need to write code that uses a shared library. -- João Felipe Santos On Fri, Aug 15, 2014 at 1:15 PM, Randy Zwitch randy.zwi...@fuqua.duke.edu wrote: I know the standard recommendation of KR for people who want to learn C. But what would people's recommendations be to learn *just enough* C to be comfortable using C libraries from within Julia? For example, the manual states: The code to be called must be available as a shared library. Most C and Fortran libraries ship compiled as shared libraries already... Having done almost nothing in C, this statement doesn't help me a whole lot, since I don't know what a shared library is. For instance, I've come across a few .h files as open-source projects, but I think the above statement is referring to .so files? So any recommendations how can I get enough knowledge about C to use ccall if I desire, without taking a ton of time away from Julia? I also know Python and R as a frame of reference.
Re: [julia-users] equivalent to numpy's fftfreq
Hi Andrei, you can use fftfreq in DSP.jl. The syntax is exactly the same as for your function: http://dspjl.readthedocs.org/en/latest/util.html#fftfreq. Best -- João Felipe Santos On Wed, Jul 2, 2014 at 9:28 AM, Andrei Berceanu andreiberce...@gmail.com wrote: I have written the following function to provide the same functionality as numpy's fftfreq ( http://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.fftfreq.html ) ``` function fftfreq(n::Int64, d::Float64) N = fld(n-1,2) p1 = [0:N] p2 = [-fld(n,2):-1] return [p1, p2]/(d*n) end ``` From the response on https://github.com/JuliaLang/julia/issues/7317, I understand that such a function is already implemented in the DSP.jl package, perhaps using the immutable Frequencies? I am not quite sure how to use that though, could anyone please provide a concrete example which reproduces the use of fftfreq? Tnx!
Re: [julia-users] equivalent to numpy's fftfreq
Oh, we will need a different implementation to support arrays as well as the Frequencies abstract array. Thanks for reporting this issue, by the way! -- João Felipe Santos On Wed, Jul 2, 2014 at 1:38 PM, Andrei Berceanu andreiberce...@gmail.com wrote: Ok, tnx :) But now `fftshift`, which before used to work, gives: fftshift(DSP.fftfreq(10)) type: circshift: in typeassert, expected Frequencies, got Array{Float64,1} in circshift at abstractarray.jl:417 in fftshift at dsp.jl:145 On Wednesday, July 2, 2014 5:01:01 PM UTC+2, João Felipe Santos wrote: Hi Andrei, you can use fftfreq in DSP.jl. The syntax is exactly the same as for your function: http://dspjl.readthedocs.org/en/latest/util.html#fftfreq. Best -- João Felipe Santos On Wed, Jul 2, 2014 at 9:28 AM, Andrei Berceanu andreib...@gmail.com wrote: I have written the following function to provide the same functionality as numpy's fftfreq (http://docs.scipy.org/doc/numpy/reference/generated/ numpy.fft.fftfreq.html) ``` function fftfreq(n::Int64, d::Float64) N = fld(n-1,2) p1 = [0:N] p2 = [-fld(n,2):-1] return [p1, p2]/(d*n) end ``` From the response on https://github.com/JuliaLang/julia/issues/7317, I understand that such a function is already implemented in the DSP.jl package, perhaps using the immutable Frequencies? I am not quite sure how to use that though, could anyone please provide a concrete example which reproduces the use of fftfreq? Tnx!
Re: [julia-users] PyPlot not working in Julia Studio
Try printing your $PATH and $PYTHONPATH environment variables from the JuliaStudio REPL. You may be setting them only for terminal sessions but not for graphical sessions. -- João Felipe Santos On Wed, Jun 25, 2014 at 7:12 AM, René Hiemstra rrhiems...@gmail.com wrote: Hi all, I have (on OS X) Julia Studio 0.4.4 installed and the Anaconda python 2.7 distribution and get the following error when I want to use PyPlot julia using PyPlot LoadError(/Users/rene/.julia/PyPlot/src/PyPlot.jl,32,PyError (PyImport_ImportModule) type 'exceptions.ImportError' ImportError('No module named matplotlib',) ) PyPlot works fine in an interactive Julia session in IJulia or the Julia 0.2 terminal. Any ideas? Thanks, Rene
Re: [julia-users] Remez algorithm
I wanted to do this for DSP.jl as this is used for filter design, but all opensource implementations I could find to use as a reference just wrapped the same old piece of Fortran code or a low-level translation of it to C (this is the case in Scipy). As I am not terribly familiar with the algorithm's internal workings and had other priorities at the moment, I ended up never working on it. I think that we could benefit from a nice and clean Julia rewrite of the algorithm, though. -- João Felipe Santos On Tue, Jun 17, 2014 at 8:13 AM, Hans W Borchers hwborch...@gmail.com wrote: *Is there an implementation of the Remez algorithm in Julia,or is someone working on this?* Sometimes it is important to have a (polynomial) *minmax approximation* to a curve or function (on a finite interval), i.e., an approximating polynomial of a certain maximum degree such that the maximum (absolute) error is minimized. A least-squares approach will not work. For example, given a hundred or more discrete points representing the Runge function on [-1, 1], package *CurveFit* will generate a polynomial of degree 10 that has a maximum distance of about 0.10..., while the true minimax solution will have a maximal distance of about 0.06... ! The Remez algorithm http://en.wikipedia.org/wiki/Remez_algorithm solves this problem applying an iterative procedure. As Nick Trefethen has once said about other implementations of this algorithm: One can find a few other computer programs in circulation, but overall, it seems that there is no widely-used program at present for computing best approximations The most reliable and accurate existing realization nowadays appears to be the one available in Trefethen's MATLAB toolbox *chebfun*, operating with Chebyshev approximations -- perhaps package *ApproxFun* would be a good starting point. I thought that Julia might be an appropriate scientific computing environment to realize an efficient and accurate version of the Remez algorithm. I am considering doing it myself, but would prefer if someone with a better command of Julia has already done this.
Re: [julia-users] Is there Code for Multi layer perceptron?
I've seen some simple examples of neural networks on Github but nothing seems to be complete and/or reliable. If I had infinite time, I would like to experiment with ForwardDiff.jl to do automatic differentiation of expressions to generate backprop expressions for arbitrary MLP architectures (something similar to what Theano does, even though Theano does much more than that). -- João Felipe Santos On Sat, Jun 7, 2014 at 12:11 PM, John Myles White johnmyleswh...@gmail.com wrote: I don’t think there’s any reliable neural network Julia code published so far. — John On Jun 7, 2014, at 1:18 AM, ccsv.1056...@gmail.com wrote: I am just wondering if there is code for multi layer perceptron anywhere in julia with parallel processing and iRprop+ for gradient decent?
Re: [julia-users] Re: building julia on OSX - gfortran issues
In my system it compiled correctly after installing XCode command line tools and gfortran from Homebrew (which was gfortran from GCC 4.8.2). I did not have to adjust any flags for it to work. -- João Felipe Santos On Mon, May 19, 2014 at 2:35 PM, Andreas Noack Jensen andreasnoackjen...@gmail.com wrote: I'd recommend not to set USE_SYSTEM_BLAS=1. OpenBLAS which is shipped with Julia is often faster. Gustavo L, have you tried to delete the deps/arpack directory before running make? 2014-05-19 20:31 GMT+02:00 Gustavo Camilo gcam...@gmail.com: I was able to compile using Apple's compiler: After you've installed command line toosls like it says in the Readme of the julia github, change in your Make.inc: USE_SYSTEM_BLAS=1 And try to compile again. On Monday, 19 May 2014 14:17:28 UTC-4, Gustavo Lacerda wrote: hi, I've installed gfortran-4.9.0-Mavericks.dmg I'm installing from source on OSX with: make OPENBLAS_TARGET_ARCH=NEHALEM but I get this error: \checking whether we are cross compiling... configure: error: in `/Users/gustavolacerda/Dropbox/projects/julia/deps/ arpack-ng-3.1.3': [13:28] configure: error: cannot run Fortran 77 compiled programs. Any ideas? Thanks. Gustavo -- Gustavo Lacerda http://www.optimizelife.com -- Med venlig hilsen Andreas Noack Jensen
[julia-users] Problem with BinDeps on OSX
Hi, I have a build.jl file that worked correctly on Linux but I am having trouble to get it to work on OSX. These are the three ways I tested it: 1. If my build process puts a .dylib instead of an .so at deps/usr/lib, BinDeps complains that the .so does not exist and the build process fails. 2. If I rename mylib.dylib to mylib.so, building the package also fails because dlopen_e fails. 3. If I add a symbolic link between mylib.dylib and mylib.so, it works! This is the patched build.jl file: https://gist.github.com/jfsantos/73bbfcfd81a0d83aec11 I tried reading the code for BinDeps but could not find anything related to dynamic library file extensions. Do I need specifically to say that the OS is :Darwin instead of :Unix if I want it to work with OSX? Thanks! -- João Felipe Santos
Re: [julia-users] Equivalent to R's seq()?
You can use a range, which works similarly to MATLAB's: seq = 5:5:20 where the number in the middle is the step size. This will create a range that can be iterated (e.g., in a for loop). If you need an array instead, you can use seq = [5:5:20] -- João Felipe Santos On Wed, Mar 12, 2014 at 11:40 PM, Ben Ward axolotlfan9...@gmail.com wrote: Hi all, In R if I want to generate a sequence of numbers, say 5, 10, 15, 20, in R seq(from=5, to=20, by=5) would achieve this. I've had a glance over the sections of the standard library functions doc and didn't see a function like this - (unless it has a totally different name or a package provides it). Is there a function like this for Julia that does this easily? Thanks, Ben.
Re: [julia-users] Linear convolution
We have some standard DSP stuff in https://github.com/JuliaDSP/DSP.jl. Our idea is to put everything DSP-related that is not application-specific in there, and then make other application-specific packages depend on it. -- João Felipe Santos On Tue, Mar 4, 2014 at 10:22 AM, Tobias Knopp tobias.kn...@googlemail.comwrote: I don't want to give a definate yes to it but will think a little bit how such a package could look like. My Cartesian macro foo is currently completely absent so that I would have to learn this first. Do you know of others efforts/packages that go into that direction? Am Dienstag, 4. März 2014 15:51:33 UTC+1 schrieb Tim Holy: I'm fine with that. Do you want to start it? --Tim
Re: [julia-users] Linear convolution
That's funny, because in my opinion the functions in scipy.ndimage.filters are also specialized, as most of the time they seem to be used in image processing (but also in time-series processing) :) In DSP.jl we mainly have functions for one-dimensional signal processing, though, and it would be nice to add multidimensional support to it. Filters such as max, min, median, and gaussian would also be interesting additions. -- João Felipe Santos On Tue, Mar 4, 2014 at 10:43 AM, Tobias Knopp tobias.kn...@googlemail.comwrote: Thanks for the hint. This seems to be a good start although the available functions already seem to be quite specialized. The ndimage module from scipy ( http://docs.scipy.org/doc/scipy/reference/ndimage.html#module-scipy.ndimage.filters) goes into a direction what in my mind could cover a Signal.jl package. Am Dienstag, 4. März 2014 16:32:38 UTC+1 schrieb João Felipe Santos: We have some standard DSP stuff in https://github.com/JuliaDSP/DSP.jl. Our idea is to put everything DSP-related that is not application-specific in there, and then make other application-specific packages depend on it. -- João Felipe Santos On Tue, Mar 4, 2014 at 10:22 AM, Tobias Knopp tobias...@googlemail.comwrote: I don't want to give a definate yes to it but will think a little bit how such a package could look like. My Cartesian macro foo is currently completely absent so that I would have to learn this first. Do you know of others efforts/packages that go into that direction? Am Dienstag, 4. März 2014 15:51:33 UTC+1 schrieb Tim Holy: I'm fine with that. Do you want to start it? --Tim
Re: [julia-users] ccall issues
Hi Isaiah, I have actually read your previous e-mails and they were very helpful! I am able to construct structs in Julia and pass them to C by mirroring the struct layout as a Julia immutable, but I still couldn't manage to get results back from C. I tried writing a simple library to make figuring this out easier ( https://gist.github.com/jfsantos/9136352) but it seems the null pointer I pass to C is not changed after ccall (i.e., it is still a pointer to C_NULL) (please ignore the last few lines in test_ccall.jl, they are supposed to work only after I am able to convert the pointer to Cdvec). Could you point out where is my mistake? Thanks! -- João Felipe Santos On Fri, Feb 21, 2014 at 10:30 AM, Isaiah Norton isaiah.nor...@gmail.comwrote: Sorry, I misread - ignore what I said about (1). On Fri, Feb 21, 2014 at 10:25 AM, Isaiah Norton isaiah.nor...@gmail.comwrote: For (1) see here: http://julia.readthedocs.org/en/latest/manual/calling-c-and-fortran-code/#passing-pointers-for-modifying-inputs For (2) you do basically the same thing (varout = Ptr[C_NULL]). You need to have the struct layout mirrored as an immutable in Julia... search the list history for my name, for a very recent email with a detailed explanation. On Fri, Feb 21, 2014 at 10:13 AM, John Myles White johnmyleswh...@gmail.com wrote: Re (1), check out the section on the operator in the docs: http://julia.readthedocs.org/en/latest/manual/calling-c-and-fortran-code/ It took me a while to figure out to use that operator, but I think it's what you'll need. Not sure about (2). -- John On Feb 21, 2014, at 7:06 AM, João Felipe Santos joao@gmail.com wrote: Hi, I am using ccall to write a wrapper for a C library in Julia and have a couple of questions: 1. One of the functions I am wrapping gets several pointers to long and double as arguments. Let's say I have a function signature as: int my_function(long* a, double* b). From the manual, I understood that I have to wrap it as: ccall((:my_function, mylib), Cint, (Ptr{Clong}, Ptr{Cdouble}, a, b) with a and b being Vector{Int64} and Vector{Float64} in Julia. However, when I try to use this, I am getting back this error message: no method convert(Type{Int64}, Array{Int64,1}), which is weird, since I don't try to do this conversion anywhere. What am I doing wrong? 2. Some functions in my library return pointers to structs and I would like to be able to read these structs from Julia. I implemented these strucs as bittypes but I'm not sure on how can I pass an empty pointer to struct and get back a pointer to a struct allocated in C after my ccall. Is it possible? Best regards -- João Felipe Santos
Re: [julia-users] ccall issues
That's what I expected, but it seems I am always getting null vectors from my C code, even though it is correctly changing the pointer value. -- João Felipe Santos On Fri, Feb 21, 2014 at 10:51 AM, Tobias Knopp tobias.kn...@googlemail.comwrote: if your function returns a pointer to a struct and you have replicated the struct in julia (with type annotations) it should be possible to use Ptr{MyReplicatedStruct} as return type and then do an unsafe_load to fill the struct. Am Freitag, 21. Februar 2014 16:41:47 UTC+1 schrieb João Felipe Santos: Hi Isaiah, I have actually read your previous e-mails and they were very helpful! I am able to construct structs in Julia and pass them to C by mirroring the struct layout as a Julia immutable, but I still couldn't manage to get results back from C. I tried writing a simple library to make figuring this out easier ( https://gist.github.com/jfsantos/9136352) but it seems the null pointer I pass to C is not changed after ccall (i.e., it is still a pointer to C_NULL) (please ignore the last few lines in test_ccall.jl, they are supposed to work only after I am able to convert the pointer to Cdvec). Could you point out where is my mistake? Thanks! -- João Felipe Santos On Fri, Feb 21, 2014 at 10:30 AM, Isaiah Norton isaiah...@gmail.comwrote: Sorry, I misread - ignore what I said about (1). On Fri, Feb 21, 2014 at 10:25 AM, Isaiah Norton isaiah...@gmail.comwrote: For (1) see here: http://julia.readthedocs.org/en/latest/manual/calling-c- and-fortran-code/#passing-pointers-for-modifying-inputs For (2) you do basically the same thing (varout = Ptr[C_NULL]). You need to have the struct layout mirrored as an immutable in Julia... search the list history for my name, for a very recent email with a detailed explanation. On Fri, Feb 21, 2014 at 10:13 AM, John Myles White johnmyl...@gmail.com wrote: Re (1), check out the section on the operator in the docs: http://julia.readthedocs.org/en/latest/manual/calling-c- and-fortran-code/ It took me a while to figure out to use that operator, but I think it's what you'll need. Not sure about (2). -- John On Feb 21, 2014, at 7:06 AM, João Felipe Santos joao...@gmail.com wrote: Hi, I am using ccall to write a wrapper for a C library in Julia and have a couple of questions: 1. One of the functions I am wrapping gets several pointers to long and double as arguments. Let's say I have a function signature as: int my_function(long* a, double* b). From the manual, I understood that I have to wrap it as: ccall((:my_function, mylib), Cint, (Ptr{Clong}, Ptr{Cdouble}, a, b) with a and b being Vector{Int64} and Vector{Float64} in Julia. However, when I try to use this, I am getting back this error message: no method convert(Type{Int64}, Array{Int64,1}), which is weird, since I don't try to do this conversion anywhere. What am I doing wrong? 2. Some functions in my library return pointers to structs and I would like to be able to read these structs from Julia. I implemented these strucs as bittypes but I'm not sure on how can I pass an empty pointer to struct and get back a pointer to a struct allocated in C after my ccall. Is it possible? Best regards -- João Felipe Santos
Re: [julia-users] ccall issues
Regarding the C code that I wrote, the real library I'm wrapping does not have such a newbie mistake (all memory is malloc'd correctly). I had also forgot that you need to pass pointers to pointers when passing structs. Thanks for all the help! -- João Felipe Santos On Fri, Feb 21, 2014 at 11:45 AM, Isaiah Norton isaiah.nor...@gmail.comwrote: Tobias is correct. The other issue is that needs to be `dvec** x` in your C signature, and then should declare `Cc = convert(Ptr{Ptr{Dvec}}, [Ptr[C_NULL]])` in Julia. After your call you need to do `Ccr = unsafe_load(Cc)`. Then you can print/work with Ccr.len and Ccr.val. On Fri, Feb 21, 2014 at 11:12 AM, Tobias Knopp tobias.kn...@googlemail.com wrote: line 20: dvec c = {cval, l}; This is a stack object which will be destroyed when the function returns. You have to do something like x.cval = (double*) malloc(sizeof(double)*l);
Re: [julia-users] Re: Unable to install IJulia
I'm running Arch also, LLVM 3.4 is what we have in the official repositories. I always build Julia straight from the Git repo without using system libraries as it is prone to problems such as this one. Did you use any system libraries when building Julia yourself (instead of using the AUR pkgbuild)? -- João Felipe Santos On Mon, Feb 3, 2014 at 9:30 AM, Keno Fischer kfisc...@college.harvard.eduwrote: What version of LLVM is Arch using? Given their reputation, I can see that they may have switched to 3.4, where we're still experiencing problems. On Mon, Feb 3, 2014 at 9:27 AM, Ismael VC ismael.vc1...@gmail.com wrote: I just tried building it again using the Arch AUR PKGBUILD, got segfault, when building Nettle: ismaelvc@toybox ~ julia _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() to list help topics | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.0-prerelease+1367 (2014-02-03 08:34 UTC) _/ |\__'_|_|_|\__'_| | Commit 793d769* (0 days old master) |__/ | i686-pc-linux-gnu julia Pkg.update() INFO: Initializing package repository /home/ismaelvc/.julia/v0.3 INFO: Cloning METADATA from git://github.com/JuliaLang/METADATA.jl INFO: Updating METADATA... INFO: Computing changes... INFO: No packages to install, update or remove julia Pkg.add(IJulia) INFO: Cloning cache of BinDeps from git:// github.com/JuliaLang/BinDeps.jl.git INFO: Cloning cache of IJulia from git:// github.com/JuliaLang/IJulia.jl.git INFO: Cloning cache of JSON from git://github.com/JuliaLang/JSON.jl.git INFO: Cloning cache of Nettle from git:// github.com/staticfloat/Nettle.jl.git INFO: Cloning cache of REPLCompletions from git:// github.com/loladiro/REPLCompletions.jl.git INFO: Cloning cache of URIParser from git:// github.com/loladiro/URIParser.jl.git INFO: Cloning cache of ZMQ from git://github.com/JuliaLang/ZMQ.jl.git INFO: Installing BinDeps v0.2.12 INFO: Installing IJulia v0.1.1 INFO: Installing JSON v0.3.3 INFO: Installing Nettle v0.1.3 INFO: Installing REPLCompletions v0.0.0 INFO: Installing URIParser v0.0.1 INFO: Installing ZMQ v0.1.8 INFO: Building Nettle fish: Job 1, 'julia' terminated by signal SIGSEGV (Address boundary error) ismaelvc@toybox ~ [139]
Re: [julia-users] Re: Unable to install IJulia
You should not need to. A manual install should download, compile, and install all the dependencies in the julia directory, not the system directories. I have LLVM/clang 3.4 and lots of other libraries used by Julia on my system path and they do not seem to interfere in Julia's functionality. For IJulia, however, you will need to install IPython. I got it working with Arch's ipython2 package (you'll need to install python2-tornado and python2-zmq manually as they are not required by the ipython2 package), with Anaconda's IPython, and with a manually installed IPython2.0.0-dev Hope it helps! -- João Felipe Santos On Mon, Feb 3, 2014 at 11:28 AM, Ismael VC ismael.vc1...@gmail.com wrote: I did try first to install manually, using make, I don't know if now I have a mess of libraries, should I remove every dependency with pacman? I will try again doing it manually and post back any issue. ismaelvc@toybox ~ [1] pacman -Qs llvm local/clang 3.4-1 C language family frontend for LLVM local/llvm 3.4-1 Low Level Virtual Machine local/llvm-libs 3.4-1 Low Level Virtual Machine (runtime library) ismaelvc@toybox ~
Re: [julia-users] Re: Unable to install IJulia
If you did not define any of the USE_SYSTEM_* flags when calling make, it will download and compile everything locally. You don't need to worry about removing system packages. -- João Felipe Santos On Mon, Feb 3, 2014 at 11:40 AM, Ismael VC ismael.vc1...@gmail.com wrote: Ok I'm starting fresh, it seems its going to build just a few deps, so I imagine it detects the rest from packages installed by pacman, should I remove all the packages listed here installed by pacman too?: https://github.com/JuliaLang/julia#Required-Build-Tools-External-Libraries Here is the AUR PKGBUILD: https://aur.archlinux.org/packages/ju/julia-git/PKGBUILD ismaelvc@toybox ~/Devel git clone git://github.com/JuliaLang/julia.git Cloning into 'julia'... remote: Reusing existing pack: 85027, done. remote: Counting objects: 14, done. remote: Compressing objects: 100% (14/14), done. remote: Total 85041 (delta 4), reused 0 (delta 0) Receiving objects: 100% (85041/85041), 29.58 MiB | 413.00 KiB/s, done. Resolving deltas: 100% (63564/63564), done. Checking connectivity... done. ismaelvc@toybox ~/Devel ls julia/ ismaelvc@toybox ~/Devel cd julia/ ismaelvc@toybox ~/D/julia (master) ls base/deps/etc/Makefile README.md test/Windows.inc contrib/ DISTRIBUTING.md examples/ Make.inc README.windows.md ui/ CONTRIBUTING.md doc/ LICENSE.md NEWS.md src/ VERSION ismaelvc@toybox ~/D/julia (master) make which: no gtar in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl) which: no gtar in (/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl) Submodule 'deps/Rmath' (git://github.com/JuliaLang/Rmath.git) registered for path 'deps/Rmath' Submodule 'deps/libuv' (git://github.com/JuliaLang/libuv.git) registered for path 'deps/libuv' Submodule 'deps/openlibm' (git://github.com/JuliaLang/openlibm.git) registered for path 'deps/openlibm' Submodule 'deps/openspecfun' (git://github.com/JuliaLang/openspecfun.git) registered for path 'deps/openspecfun' Submodule 'doc/juliadoc' (git://github.com/JuliaLang/JuliaDoc.git) registered for path 'doc/juliadoc' Cloning into 'deps/Rmath'... remote: Reusing existing pack: 332, done. remote: Total 332 (delta 0), reused 0 (delta 0) Receiving objects: 100% (332/332), 247.59 KiB | 321.00 KiB/s, done. Resolving deltas: 100% (217/217), done. Checking connectivity... done. Submodule path 'deps/Rmath': checked out '004e056e4562a8e8459b3d283f7de2f655f99a8b' Cloning into 'deps/libuv'...
Re: [julia-users] julia unable to install on Ubuntu 13.10
There is a conflict between Ubuntu's r-mathlib package and Julia's RMath package: they both want to install Rmath.h to the same path. If you can live without r-libmath, you can uninstall it and then install Julia. Having said that, I usually compile my own distribution and install it to my home directory. You can clone the repository from Github and then switch to 0.2.0. It takes a while but if your PC is not that old you'll be done in less than an hour. -- João Felipe Santos On Fri, Jan 24, 2014 at 10:30 PM, Rajn rjngrj2...@gmail.com wrote: After my several failed attempts to run PyPlot through Julia in Windows, I decided to give up and try Linux. Guess it was even worse. First I added to regular repository (not the nightlybuild) then added the dep-repository then updated and then installed julia Here's the latest: Unpacking librmath-dev (from .../librmath-dev_2.15.2-juliadeps2~raring_amd64.deb) ... dpkg: error processing /var/cache/apt/archives/librmath-dev_2.15.2-juliadeps2~raring_amd64.deb (--unpack): trying to overwrite '/usr/include/Rmath.h', which is also in package r-mathlib 3.0.1-3ubuntu1 No apport report written because MaxReports is reached already Selecting previously unselected package julia. Unpacking julia (from .../julia_0.2.0~saucyfinal1_amd64.deb) ... Processing triggers for man-db ... Errors were encountered while processing: /var/cache/apt/archives/librmath-dev_2.15.2-juliadeps2~raring_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1) Have no clue absolutely how to proceed. The same issue occurs when I try nightly builds.
Re: [julia-users] Generating Large LP Models Efficiently
Did you have a look at JuMP? I believe it is equivalent to PuLP, but written in Julia: https://github.com/JuliaOpt/JuMP.jl -- João Felipe Santos On Tue, Jan 14, 2014 at 2:52 PM, Andrew B. Martin andrew.brown.mar...@gmail.com wrote: Hello, I'm new to julia; I discovered it when I posted in the python pulp-or google group about generating large LP models. I currently use AMPL for model generation, but I'd like to switch to an open-source alternative. I first went to pulp-or because I'm familiar with python, but it's too slow; julia looks promising, but I'm concerned that since I don't have a solid grasp of the language I might code the constraints very inefficiently. The LP models I'm generating are about 1.5Gb as .lp files and take ~20 minutes to generate on an 8Gb machine using AMPL. It would help me get started if someone here could translate a piece of my AMPL code to julia. I think I can translate the whole model if I have an example to compare against. Anyone here interested? It would be about 10 lines of AMPL code, describing a variable defined by two derived sets. Regards, Andrew