Re: [julia-users] Re: how to undefine variable in composite types

2016-02-04 Thread Tomas Lycken
My main concern is predictability. 

Imagine that I define a type Foo and start playing around with it - define some 
functions that work on foot, perhaps one or two types that hold foos, and 
manipulate a bunch of Foo instances.

Then, I redefine the Foo type - say, I add a field. Which of the other things 
that I have defined are still valid?

If I understand the motivation for this feature correctly, it's to make 
exploratory programming easier. However, I think it would actually make it a 
lot more difficult - it would basically give you a bazooka so heavy that the 
only thing you can reasonably aim at is your own foot... 

//T 

[julia-users] Re: PyCall Seaborn error

2016-02-04 Thread St Elmo Wilken
The website indicates that numpy, scipy, pandas, matplotlib and optionally 
statsmodels are required. I tried to @pyimport them all before I @pyimport 
seaborn but that didn't work either...


[julia-users] Re: PyCall Seaborn error

2016-02-04 Thread St Elmo Wilken
The website indicates that numpy, scipy, matplotlib, pandas and optionally 
statsmodels are required. I tried to @pyimport all of them and then 
@pyimport seaborn but the same error popped up...


On Thursday, February 4, 2016 at 6:21:20 PM UTC-8, Tony Kelman wrote:
>
> Does Seaborn use some unusual set of libraries over and above what, say 
> matplotlib does?
>
>
> On Wednesday, February 3, 2016 at 9:34:50 PM UTC-8, St Elmo Wilken wrote:
>>
>> Hi all,
>>
>> I'm trying to load the Python package Seaborn using Julia. I''m 
>> attempting:
>>
>> using PyCall
>> @pyimport seaborn as sb
>>
>> This generates the following warning in a new window:
>>
>> "Runtime Error!
>>
>> Program: C:\Users\St. Elmo\AppData\Local\Julia-0.4.2\bin\julia.exe
>>
>> R6034
>> An application has made an attempt to load the C runtime library 
>> incorrectly. 
>> Please contact the application's support team for more information."
>>
>> It also outputs the following in the Julia terminal:
>>
>> ERROR: PyError (:PyImport_ImportModule) 
>> WindowsError(1114, 'A dynamic link library (DLL) initialization routine 
>> failed')
>>   File "C:\Users\St. 
>> Elmo\Anaconda2\lib\site-packages\seaborn\__init__.py", line 11, in 
>> from .widgets import *
>>   File "C:\Users\St. 
>> Elmo\Anaconda2\lib\site-packages\seaborn\widgets.py", line 8, in 
>> from ipywidgets import interact, FloatSlider, IntSlider
>>   File "C:\Users\St. 
>> Elmo\Anaconda2\lib\site-packages\ipywidgets\__init__.py", line 5, in 
>> 
>> from .widgets import *
>>   File "C:\Users\St. 
>> Elmo\Anaconda2\lib\site-packages\ipywidgets\widgets\__init__.py", line 1, 
>> in 
>> from .widget import Widget, DOMWidget, CallbackDispatcher, register, 
>> widget_serialization
>>   File "C:\Users\St. 
>> Elmo\Anaconda2\lib\site-packages\ipywidgets\widgets\widget.py", line 13, in 
>> 
>> from ipykernel.comm import Comm
>>   File "C:\Users\St. 
>> Elmo\Anaconda2\lib\site-packages\ipykernel\__init__.py", line 2, in 
>> from .connect import *
>>   File "C:\Users\St. 
>> Elmo\Anaconda2\lib\site-packages\ipykernel\connect.py", line 17, in 
>> import jupyter_client
>>   File "C:\Users\St. 
>> Elmo\Anaconda2\lib\site-packages\jupyter_client\__init__.py", line 4, in 
>> 
>> from .connect import *
>>   File "C:\Users\St. 
>> Elmo\Anaconda2\lib\site-packages\jupyter_client\connect.py", line 21, in 
>> 
>> import zmq
>>   File "C:\Users\St. Elmo\Anaconda2\lib\site-packages\zmq\__init__.py", 
>> line 42, in 
>> _libsodium = ctypes.cdll.LoadLibrary(bundled_sodium[0])
>>   File "C:\Users\St. Elmo\Anaconda2\lib\ctypes\__init__.py", line 443, in 
>> LoadLibrary
>> return self._dlltype(name)
>>   File "C:\Users\St. Elmo\Anaconda2\lib\ctypes\__init__.py", line 365, in 
>> __init__
>> self._handle = _dlopen(self._name, mode)
>>
>>  [inlined code] from C:\Users\St. 
>> Elmo\.julia\v0.4\PyCall\src\exception.jl:81
>>  in pyimport at C:\Users\St. Elmo\.julia\v0.4\PyCall\src\PyCall.jl:302
>>
>> Has anyone run into issues like this before? Does anyone know how to fix 
>> this? I have successfully imported other Python packages which makes me 
>> think that it is seaborn specific... 
>>
>> Thanks!
>>
>

[julia-users] Re: citing Julia

2016-02-04 Thread kleinsplash
How about citing a specific package? 

On Wednesday, 17 July 2013 03:13:24 UTC+2, georgiana wrote:
>
> Is there a suggested way to cite Julia if used for a publication?
>  
> Georgiana
>


Re: [julia-users] load a Julia dataframe from Microsoft SQL Server table

2016-02-04 Thread Jacob Quinn
That's a big part of the "remodel" I've been working on to always call the
"W" version of the functions and use UTF8 consistently (see here:
https://github.com/JuliaDB/ODBC.jl/blob/jq/remodel/src/API.jl). I would
certainly welcome those willing to test various configurations/setups.

-Jacob

On Thu, Feb 4, 2016 at 2:28 PM, Stefan Karpinski 
wrote:

> On Thu, Feb 4, 2016 at 1:50 PM, Scott Jones 
> wrote:
>
>>
>> This still doesn't explain why some drivers are accepting UCS-2/UTF-16
>>> when called with the non-Unicode API.
>>>
>>
>> When you do so, are you actually calling the functions with the A, or
>> just the macro without either A or W?
>> The macro will compile to either the A or the W form, depending on how
>> your application is built.
>>
>> This is a better page in MSDN:
>> https://msdn.microsoft.com/en-us/library/ms712612(v=vs.85).aspx describing
>> what is going on.
>>
>
> The ODBC package calls the functions without A or W. What it's calling
> can't be a macro since macros aren't callable via ccall. But changing ODBC
> to call the W version of everything may be the fix here.
>


[julia-users] Re: Simultaneous audio playback / recording.

2016-02-04 Thread CrocoDuck O'Ducks
Wow! Seems it could do the job. I think I will test it soon. Thanks!

On Wednesday, 3 February 2016 18:54:49 UTC, Sebastian Kraft wrote:
>
>
> Hi,
>
> in the last weeks I started a PortAudio.jl package (based on parts of the 
> AudioIO.jl package). It is still under development and far from perfect, 
> but should already work well for basic audio IO.
>
> https://github.com/seebk/PortAudio.jl
>
> Sebastian
>


Re: [julia-users] load a Julia dataframe from Microsoft SQL Server table

2016-02-04 Thread Scott Jones


On Thursday, February 4, 2016 at 4:29:46 PM UTC-5, Stefan Karpinski wrote:
>
> On Thu, Feb 4, 2016 at 1:50 PM, Scott Jones  > wrote:
>
>>
>> This still doesn't explain why some drivers are accepting UCS-2/UTF-16 
>>> when called with the non-Unicode API.
>>>
>>
>> When you do so, are you actually calling the functions with the A, or 
>> just the macro without either A or W?
>> The macro will compile to either the A or the W form, depending on how 
>> your application is built.
>>
>> This is a better page in MSDN: 
>> https://msdn.microsoft.com/en-us/library/ms712612(v=vs.85).aspx describing 
>> what is going on.
>>
>
> The ODBC package calls the functions without A or W. What it's calling 
> can't be a macro since macros aren't callable via ccall. But changing ODBC 
> to call the W version of everything may be the fix here.
>

That very well may be the solution: looking for example at libiodbc on the 
Mac, it has 3 different versions of all those functions, and I'm not sure 
just what behavior you get when using the form without the A or W.  I've 
always used ODBC with the C headers, unlike the direct linking that Julia 
is doing, so that it always gets the W version since I compile as a Unicode 
build. 


[julia-users] equivalent of python's string.title() in julia

2016-02-04 Thread julialangfanster
in python, "abc def ghi jkl".title() capitalizes each "word" in the string, 
giving 'Abc Def Ghi Jkl' as the result

i have not been able to find a similar string function in julia, so i'm 
currently doing this:

julia> join(map(ucfirst, split("abc def ghi jkl")), " ")
"Abc Def Ghi Jkl"

is there a better / more straightforward julia-based solution?

thanks for any suggestion!


Re: [julia-users] Re: how to undefine variable in composite types

2016-02-04 Thread Stefan Karpinski
This problem is equivalent to schema migration
 – which is kind of a
nightmare – but without being able to insist that people think carefully
about it and plan it out in advance. The notion that this is going to "just
work" somehow strikes me as profoundly unlikely.

On Thu, Feb 4, 2016 at 11:28 PM, Stefan Karpinski 
wrote:

> How do you transform an instance of the old type to the new type?
>
> On Thu, Feb 4, 2016 at 9:27 PM, Cedric St-Jean 
> wrote:
>
>> One could do a deepcopy-like traversal of everything starting from the GC
>> roots and replace all instances of the old type with the new type...
>> Obviously a very costly operation, but it might be cool to offer that in a
>> package.
>>
>> On Thursday, February 4, 2016 at 6:34:00 PM UTC-5, Stefan Karpinski wrote:
>>>
>>> That would mean that redefining a type of which there are any
>>> (reachable) instances would invalidate the entire system. That seems
>>> significantly worse than simply not allowing types to be redefined without
>>> restarting. One could potentially make references to "invalidated" objects
>>> #undef, but that seems likely to leave the object graph in a completely
>>> unusable state.
>>>
>>> On Thu, Feb 4, 2016 at 6:11 PM, Michael Landis 
>>> wrote:
>>>
 They would be invalid too.  I know... no garbage collector, so it would
 be necessary to find the inbound references.  Smart pointers maybe?  Yet
 another performance hit.

 On Thursday, February 4, 2016 at 1:54:24 PM UTC-8, Stefan Karpinski
 wrote:
>
> How does one "release" an object? What happens to other objects that
> retain references to those objects?
>
> On Thu, Feb 4, 2016 at 4:35 PM, Michael Landis 
> wrote:
>
>> if you added a field, the existing objects could still be valid.  If
>> you killed an attribute, they are invalid and can be released.
>>
>> On Thursday, February 4, 2016 at 10:55:25 AM UTC-8, Stefan Karpinski
>> wrote:
>>>
>>> What happens to existing objects of a type when you redefine the
>>> type?
>>>
>>> On Thu, Feb 4, 2016 at 1:46 PM, Michael Landis >> > wrote:
>>>
 I think it would be nice to be able to undefine a type, so
 restarting the environment is not required when adding or deleting an
 attribute from a type description.  Not being able to update a type
 definition without restarting the environment is a royal pain in the 
 ass.


 On Saturday, March 8, 2014 at 9:55:37 AM UTC-8, Freddy Chua wrote:
>
> Suppose I have a Type
>
> type Foo
>   a
>   b
> end
>
> f = Foo(1,2)
> f.a = 1
> f.b = 2
>
> how do I test whether f.a is defined
> I do this isdefined(f, 1) but isdefined(f, 'a') does not work
>
> another question
> how do i undefine f.a such that isdefined(f,1) now returns false
>

>>>
>
>>>
>


Re: [julia-users] Re: how to undefine variable in composite types

2016-02-04 Thread Stefan Karpinski
How do you transform an instance of the old type to the new type?

On Thu, Feb 4, 2016 at 9:27 PM, Cedric St-Jean 
wrote:

> One could do a deepcopy-like traversal of everything starting from the GC
> roots and replace all instances of the old type with the new type...
> Obviously a very costly operation, but it might be cool to offer that in a
> package.
>
> On Thursday, February 4, 2016 at 6:34:00 PM UTC-5, Stefan Karpinski wrote:
>>
>> That would mean that redefining a type of which there are any (reachable)
>> instances would invalidate the entire system. That seems significantly
>> worse than simply not allowing types to be redefined without restarting.
>> One could potentially make references to "invalidated" objects #undef, but
>> that seems likely to leave the object graph in a completely unusable state.
>>
>> On Thu, Feb 4, 2016 at 6:11 PM, Michael Landis 
>> wrote:
>>
>>> They would be invalid too.  I know... no garbage collector, so it would
>>> be necessary to find the inbound references.  Smart pointers maybe?  Yet
>>> another performance hit.
>>>
>>> On Thursday, February 4, 2016 at 1:54:24 PM UTC-8, Stefan Karpinski
>>> wrote:

 How does one "release" an object? What happens to other objects that
 retain references to those objects?

 On Thu, Feb 4, 2016 at 4:35 PM, Michael Landis 
 wrote:

> if you added a field, the existing objects could still be valid.  If
> you killed an attribute, they are invalid and can be released.
>
> On Thursday, February 4, 2016 at 10:55:25 AM UTC-8, Stefan Karpinski
> wrote:
>>
>> What happens to existing objects of a type when you redefine the type?
>>
>> On Thu, Feb 4, 2016 at 1:46 PM, Michael Landis 
>> wrote:
>>
>>> I think it would be nice to be able to undefine a type, so
>>> restarting the environment is not required when adding or deleting an
>>> attribute from a type description.  Not being able to update a type
>>> definition without restarting the environment is a royal pain in the 
>>> ass.
>>>
>>>
>>> On Saturday, March 8, 2014 at 9:55:37 AM UTC-8, Freddy Chua wrote:

 Suppose I have a Type

 type Foo
   a
   b
 end

 f = Foo(1,2)
 f.a = 1
 f.b = 2

 how do I test whether f.a is defined
 I do this isdefined(f, 1) but isdefined(f, 'a') does not work

 another question
 how do i undefine f.a such that isdefined(f,1) now returns false

>>>
>>

>>


Re: [julia-users] Re: how to undefine variable in composite types

2016-02-04 Thread elextr


On Friday, February 5, 2016 at 1:47:51 PM UTC+10, Tony Fong wrote:
>
> If you design a software that requires runtime redefinition of a type, you 
> should seriously reconsider that decision.


True, but it could be useful for experimentation on the REPL, but as Stefan 
says the implementation implications (say that fast 10 times :) are 
significant. 


[julia-users] Re: Solve ode with initial conditions

2016-02-04 Thread j verzani
It can be a bit cleaner to just get the constant if you substitute as the 
following:

eqn = diff(u(x),x) - 2u(x)   # for example
out = dsolve(eqn)
solve(out(u(x) => y0, x=> x0))

On Thursday, February 4, 2016 at 2:25:04 PM UTC-5, jmarcell...@ufpi.edu.br 
wrote:
>
> Hi j
> in fact, the solution is not easy. I got your tip and made this way:
>
> C1 = Sym("C1")
>
> # eq1 na forma: substituir x por 0 na parte direita da sol_simb
> # e subtrair a expressao pelo valor de y0
>
> eq1 = subs(rhs(sol_simb),x=>0) - 1
>
> SymPy.solve(eq1,C1)
>
>
>
>
> Em quinta-feira, 4 de fevereiro de 2016 11:23:15 UTC-2, j verzani escreveu:
>>
>> Then this should work where `u` is the Symbolic Function and eqn is just 
>> `diff(u(x),x) - 2u(x)`: `dsolve(eqn, ics=Dict(u(x0)=>y0))`, but it doesn't 
>> for me :( I think the problem is that initial conditions seem to only work 
>> with the power series method. For this problem this call will work with an 
>> initial condition: `dsolve(eqn, ics=Dict(u(x0)=>y0), 
>> hint="1st_power_series")`. Which isn't too satisfying, as there is an exact 
>> answer.
>>
>> --J
>>
>> On Thursday, February 4, 2016 at 7:47:14 AM UTC-5, 
>> jmarcell...@ufpi.edu.br wrote:
>>>
>>> Hi j verzani
>>>
>>>
>>>  SymPy documentation has the "ics", but does not show example: dsolve(
>>> *eq*, *func=None*, *hint='default'*, *simplify=True*, *ics=None*, 
>>> *xi=None*, *eta=None*, *x0=0*, *n=6*, ***kwargs*)
>>> any tips?
>>>
>>> Em quinta-feira, 4 de fevereiro de 2016 02:01:20 UTC-2, j verzani 
>>> escreveu:

 There may be a better way, but here is one that works:

 * extract the RHS of the output: eqn = rhs(out)
 * find the symbol for C1 from the output of free_symbols(eqn)
 * if (x0,y0) are your initial conditions, then: solve(eqn(x=>x0) - y0, 
 C1)



 On Wednesday, February 3, 2016 at 10:43:30 PM UTC-5, 
 jmarcell...@ufpi.edu.br wrote:
>
> I want to solve an ode with initial conditions. For example
> using SymPy
> f   = SymFunction("f")
> x,y = Sym("x,y")
>
> edo1 = SymPy.diff(f(x),x) + x 
>
> SymPy.dsolve(edo1)
>
> f(x) == C1 - x^2/2
>
>
>
>
> How to solve C1?
>


Re: [julia-users] Re: how to undefine variable in composite types

2016-02-04 Thread Tony Fong
If you design a software that requires runtime redefinition of a type, you 
should seriously reconsider that decision. 

[julia-users] Memory allocation free array slices ?

2016-02-04 Thread Nitin Arora
Hello,

I realize that the current best way to do array slices is to either use 
ArrayViews or SubArrays. 

But will it ever be possible (in future) to have slice of contiguous arrays 
without memory allocation ? How do other compiled languages like Fortran or 
C deal with this issue ?

For example, given: 
M1 = rand(7,3)
M = view(M1,1:6,1:3) # some memory allocation occurs here
a= rand(3)
c1 = zeros(6)
c =view(c1) # some memory allocation occurs here

would it be possible to do this step without array allocation in future ?
c = M*a # 2 memory allocations

I don't have enough of a background to know the limits of the array 
indexing/slicing algorithms. I am designing an optimization software in 
Julia and I am happy using ArrayViews for now but just wanted to know what 
can be expected in the future.

thanks,
Nitin


Re: [julia-users] Re: how to undefine variable in composite types

2016-02-04 Thread Cedric St-Jean
One could do a deepcopy-like traversal of everything starting from the GC 
roots and replace all instances of the old type with the new type... 
Obviously a very costly operation, but it might be cool to offer that in a 
package.

On Thursday, February 4, 2016 at 6:34:00 PM UTC-5, Stefan Karpinski wrote:
>
> That would mean that redefining a type of which there are any (reachable) 
> instances would invalidate the entire system. That seems significantly 
> worse than simply not allowing types to be redefined without restarting. 
> One could potentially make references to "invalidated" objects #undef, but 
> that seems likely to leave the object graph in a completely unusable state.
>
> On Thu, Feb 4, 2016 at 6:11 PM, Michael Landis  > wrote:
>
>> They would be invalid too.  I know... no garbage collector, so it would 
>> be necessary to find the inbound references.  Smart pointers maybe?  Yet 
>> another performance hit.
>>
>> On Thursday, February 4, 2016 at 1:54:24 PM UTC-8, Stefan Karpinski wrote:
>>>
>>> How does one "release" an object? What happens to other objects that 
>>> retain references to those objects?
>>>
>>> On Thu, Feb 4, 2016 at 4:35 PM, Michael Landis  
>>> wrote:
>>>
 if you added a field, the existing objects could still be valid.  If 
 you killed an attribute, they are invalid and can be released.

 On Thursday, February 4, 2016 at 10:55:25 AM UTC-8, Stefan Karpinski 
 wrote:
>
> What happens to existing objects of a type when you redefine the type?
>
> On Thu, Feb 4, 2016 at 1:46 PM, Michael Landis  
> wrote:
>
>> I think it would be nice to be able to undefine a type, so restarting 
>> the environment is not required when adding or deleting an attribute 
>> from a 
>> type description.  Not being able to update a type definition without 
>> restarting the environment is a royal pain in the ass.
>>
>>
>> On Saturday, March 8, 2014 at 9:55:37 AM UTC-8, Freddy Chua wrote:
>>>
>>> Suppose I have a Type
>>>
>>> type Foo
>>>   a
>>>   b
>>> end
>>>
>>> f = Foo(1,2)
>>> f.a = 1
>>> f.b = 2
>>>
>>> how do I test whether f.a is defined
>>> I do this isdefined(f, 1) but isdefined(f, 'a') does not work
>>>
>>> another question
>>> how do i undefine f.a such that isdefined(f,1) now returns false
>>>
>>
>
>>>
>

[julia-users] Re: PyCall Seaborn error

2016-02-04 Thread Tony Kelman
Does Seaborn use some unusual set of libraries over and above what, say 
matplotlib does?


On Wednesday, February 3, 2016 at 9:34:50 PM UTC-8, St Elmo Wilken wrote:
>
> Hi all,
>
> I'm trying to load the Python package Seaborn using Julia. I''m attempting:
>
> using PyCall
> @pyimport seaborn as sb
>
> This generates the following warning in a new window:
>
> "Runtime Error!
>
> Program: C:\Users\St. Elmo\AppData\Local\Julia-0.4.2\bin\julia.exe
>
> R6034
> An application has made an attempt to load the C runtime library 
> incorrectly. 
> Please contact the application's support team for more information."
>
> It also outputs the following in the Julia terminal:
>
> ERROR: PyError (:PyImport_ImportModule) 
> WindowsError(1114, 'A dynamic link library (DLL) initialization routine 
> failed')
>   File "C:\Users\St. 
> Elmo\Anaconda2\lib\site-packages\seaborn\__init__.py", line 11, in 
> from .widgets import *
>   File "C:\Users\St. Elmo\Anaconda2\lib\site-packages\seaborn\widgets.py", 
> line 8, in 
> from ipywidgets import interact, FloatSlider, IntSlider
>   File "C:\Users\St. 
> Elmo\Anaconda2\lib\site-packages\ipywidgets\__init__.py", line 5, in 
> 
> from .widgets import *
>   File "C:\Users\St. 
> Elmo\Anaconda2\lib\site-packages\ipywidgets\widgets\__init__.py", line 1, 
> in 
> from .widget import Widget, DOMWidget, CallbackDispatcher, register, 
> widget_serialization
>   File "C:\Users\St. 
> Elmo\Anaconda2\lib\site-packages\ipywidgets\widgets\widget.py", line 13, in 
> 
> from ipykernel.comm import Comm
>   File "C:\Users\St. 
> Elmo\Anaconda2\lib\site-packages\ipykernel\__init__.py", line 2, in 
> from .connect import *
>   File "C:\Users\St. 
> Elmo\Anaconda2\lib\site-packages\ipykernel\connect.py", line 17, in 
> import jupyter_client
>   File "C:\Users\St. 
> Elmo\Anaconda2\lib\site-packages\jupyter_client\__init__.py", line 4, in 
> 
> from .connect import *
>   File "C:\Users\St. 
> Elmo\Anaconda2\lib\site-packages\jupyter_client\connect.py", line 21, in 
> 
> import zmq
>   File "C:\Users\St. Elmo\Anaconda2\lib\site-packages\zmq\__init__.py", 
> line 42, in 
> _libsodium = ctypes.cdll.LoadLibrary(bundled_sodium[0])
>   File "C:\Users\St. Elmo\Anaconda2\lib\ctypes\__init__.py", line 443, in 
> LoadLibrary
> return self._dlltype(name)
>   File "C:\Users\St. Elmo\Anaconda2\lib\ctypes\__init__.py", line 365, in 
> __init__
> self._handle = _dlopen(self._name, mode)
>
>  [inlined code] from C:\Users\St. 
> Elmo\.julia\v0.4\PyCall\src\exception.jl:81
>  in pyimport at C:\Users\St. Elmo\.julia\v0.4\PyCall\src\PyCall.jl:302
>
> Has anyone run into issues like this before? Does anyone know how to fix 
> this? I have successfully imported other Python packages which makes me 
> think that it is seaborn specific... 
>
> Thanks!
>


[julia-users] Pre-compiling images for different CPUs on GCloud

2016-02-04 Thread Pavel
I am deploying a CPU-intensive application on Google Cloud Compute with 
Julia code running inside a Docker container. GCloud instances have a few 
different CPU architectures depending on the zone. Ideally, I would like to 
pre-compile Julia images (i.e. different docker container images) for all 
of those architectures.

Currently the following runs on container launch:

include(joinpath(JULIA_HOME, Base.DATAROOTDIR, "julia", 
"build_sysimg.jl"))
build_sysimg(joinpath(dirname(Libdl.dlpath("libjulia")),"sys"), 
"native", "/home/juser/jimg.jl", force=true)

so that the "native" setting pre-compiles for the CPU that these commands 
are running on. That takes time and having that done at the container image 
build time would save cloud runtime.

Would it be possible to pre-compile for different CPUs on my development 
machine or do I need to run the pre-compilation on those exact CPUs? If the 
former is possible, what build_sysimg arguments would help? GCloud virtual 
machine architectures of interest include Sandy Bridge, Ivy Bridge, and 
Haswell CPU types.

Thanks for reading,
Pavel




Re: [julia-users] Parametric Types with Incomplete Initialization

2016-02-04 Thread Kevin Squire
Whoops... yes, I should have read through more carefully.  Yes, if `T` is
abstract, you will lose performance.  Sorry for the misdirection.

Kevin

On Thu, Feb 4, 2016 at 11:56 AM, Josh Langsfeld  wrote:

> I may be mistaken, but I think setting the type parameter to be abstract
> is indeed the same as setting the field itself to be abstract. This snippet
> is my evidence:
>
> julia> abstract ABC
>
> julia> immutable A <: ABC
>  a::Float32
>end
>
> julia> type B{T<:ABC}
>  a::T
>end
>
> julia> bA, bABC = B{A}(A(1)), B{ABC}(A(2))
> (B{A}(A(1.0f0)),B{ABC}(A(2.0f0)))
>
> julia> sizeof(bA), sizeof(bABC)
> (4,8)
>
> Even though both 'B' objects contain an 'A' immutable, bABC keeps it as a
> pointer (size 8) whereas bA can directly unpack it into the definition.
>
>
> On Thursday, February 4, 2016 at 1:59:17 PM UTC-5, Christopher Alexander
> wrote:
>>
>> Oh cool!  I was worried, since my call method was passing in the abstract
>> type if none was specified (ie I wasn't setting a value for the param "a"),
>> that it would just be the same as if I hadn't used a parametric type at all
>> and just set the type of "a" to the abstract type.
>>
>> Thanks!
>>
>> Chris
>>
>> On Thursday, February 4, 2016 at 11:50:07 AM UTC-5, Kevin Squire wrote:
>>>
>>> No, `a` is the (concrete) type `T`, which is a subtype of `ABC` (and a
>>> new type `B{T}` is created for each `T`).  So you shouldn't lose
>>> performance because of this.
>>>
>>> Cheers,
>>>Kevin
>>>
>>> On Thu, Feb 4, 2016 at 8:10 AM, Christopher Alexander >> > wrote:
>>>
 Let's say I have the following types:

 abstract ABC

 type A <: ABC
 a::Float64
 end

 type B{T <: ABC}
 a::T
 end

 In some cases, I need for type "B" to be incompletely initialized so
 that I can define its parameter "a" later.  I've found out that you can do
 something like this:

 type B{T <: ABC}
 a::T

 call(::Type{B}) = new{ABC}()
 end

 which then allows this:

 julia> myB = B()
 B{ABC}(#undef)

 My question is, I'm assuming you lose any of the performance gain by
 using the parametric type in this case because you are still using the
 abstract type "ABC" for the parameter "a" (even if you define it later with
 a concrete "A").   Is there a better way to do this?

 Thanks!

 Chris

>>>
>>>


[julia-users] Re: PyPlot

2016-02-04 Thread Steven G. Johnson


On Thursday, February 4, 2016 at 4:03:26 PM UTC-5, digxx wrote:
>
> When plotting with PyPlot and subsequently using
> title("hello") or legend(loc="upper right",fancybox="true")
> I get the error:
>

 Works fine for me with Julia 0.4 and Anaconda Python, e.g.

using PyPlot
plot(rand(10))
title("random plot")


works fine.


Re: [julia-users] Queue{ByteString} acting strangely

2016-02-04 Thread Michael Landis
Thanks for the clarifications...  Good to know which code is scheduled for 
an update later too.

On Thursday, February 4, 2016 at 3:22:00 PM UTC-8, Stefan Karpinski wrote:
>
> The Queue constructors seem to be lagging the newer convention in Julia. 
> In older versions of Julia it was not possible to do Queue{ByteString}() or 
> Vector{ByteString}().
>
> On Thu, Feb 4, 2016 at 5:56 PM, Michael Landis  > wrote:
>
>> ah, Queue's don't need to be typed, the type is a parameter to the 
>> constructor.  Parens, not braces.  So, why are Vectors defined as 
>> Vector{ByteString}(vecLength)?  Where is the syntactical consistency?
>>
>> On Thursday, February 4, 2016 at 2:47:52 PM UTC-8, Yichao Yu wrote:
>>>
>>> On Thu, Feb 4, 2016 at 5:43 PM, Michael Landis  
>>> wrote: 
>>> > so ... what's the syntax for creating an empty Queue{ByteString}? 
>>> > 
>>> > qbs = Queue{ByteString}([])# also produces convert errors 
>>>
>>> I think the document tells you exactly that. 
>>> https://github.com/JuliaLang/DataStructures.jl#stack-and-queue 
>>>
>>> Queue(ByteString) seems to work. 
>>>
>>> > 
>>> > 
>>> >> 
>>> > 
>>>
>>
>

Re: [julia-users] SIMD long inner expression

2016-02-04 Thread Erik Schnetter
Chris

To get good performance, you need to put your code into a function.
You seem to be evaluating it directly at the REPL -- this will be
slow. See the "Performance Tips" in the manual.

The LLVM code you see is not your kernel code. Instead, it contains a
"call" statement, presumably to a function that contains all the code
in the @parallel region. You can try creating a function for your
actual kernel, which goes from "tmp = 0" to "tmp" near the bottom, and
running "@code_llvm" on it.

-erik


On Thu, Feb 4, 2016 at 4:29 PM, Chris Rackauckas  wrote:
> Hi, I am trying to optimize a code which just adds a bunch of things. My
> first instinct was to unravel the loops and run it as SIMD, like so:
>
> dx = 1/400
> addprocs(3)
> imin = -6
> jmin = -2
>
> #Some SIMD
> @time res = @sync @parallel (+) for i = imin:dx:0
>   tmp = 0
>   for j=jmin:dx:0
> ans = 0
> @simd for k=1:24
>   @inbounds ans += coefs[k]*(i^(powz[k]))*(j^(poww[k]))
> end
> tmp += abs(ans)<1
>   end
>   tmp
> end
> res = res*(12/(length(imin:dx:0)*length(jmin:dx:0)))
> println(res)#Mathematica gives 2.98
>
> (Coefficients arrays posted at the bottom for completeness). On a 4 core i7
> this runs in ~4.68 seconds. I was able to beat this by optimizing the power
> calculations like so:
>
> ## Full unravel
> @time res = @sync @parallel (+) for i = imin:dx:0
>   tmp = 0
>   isq2 = i*i; isq3 = i*isq2; isq4 = isq2*isq2; isq5 = i*isq4
>   isq6 = isq4*isq2; isq7 = i*isq6; isq8 = isq4*isq4
>   for j=jmin:dx:0
> jsq2 = j*j; jsq4 = jsq2*jsq2; jsq6 = jsq2*jsq4; jsq8 = jsq4*jsq4
> @inbounds tmp += abs(coefs[1]*(jsq2) + coefs[2]*(jsq4) + coefs[3]*(jsq6)
> + coefs[4]*(jsq8) + coefs[5]*(i) + coefs[6]*(i)*(jsq2) + coefs[7]*(i)*(jsq4)
> + coefs[8]*(i)*(jsq6) +
> coefs[9]*(isq2) + coefs[10]*(isq2)*(jsq2) + coefs[11]*(isq2)*(jsq4) +
> coefs[12]*(isq2)*(jsq6) + coefs[13]*(isq3) + coefs[14]*(isq3)*(jsq2) +
> coefs[15]*(isq3)*(jsq4) +
> coefs[16]*(isq4) + coefs[17]*(isq4)*(jsq2) + coefs[18]*(isq4)*(jsq4) +
> coefs[19]*(isq5) + coefs[20]*(isq5)*(jsq2) + coefs[21]*(isq6) +
> coefs[22]*(isq6)*(jsq2) +
> coefs[23]*(isq7) + coefs[24]*(isq8))<1
>   end
>   tmp
> end
> res = res*(12/(length(imin:dx:0)*length(jmin:dx:0)))
> println(res)#Mathematica gives 2.98
>
> This is the best version and gets ~1.83 seconds (FYI it bets a version where
> I distributed out by isq). However, when I put this into a function and call
> it with @code_llvm, I get:
>
> define %jl_value_t* @julia_simdCheck_3161() {
> top:
>   %0 = alloca [8 x %jl_value_t*], align 8
>   %.sub = getelementptr inbounds [8 x %jl_value_t*]* %0, i64 0, i64 0
>   %1 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 2
>   %2 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 3
>   store %jl_value_t* inttoptr (i64 12 to %jl_value_t*), %jl_value_t** %.sub,
> align 8
>   %3 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 1
>   %4 = load %jl_value_t*** @jl_pgcstack, align 8
>   %.c = bitcast %jl_value_t** %4 to %jl_value_t*
>   store %jl_value_t* %.c, %jl_value_t** %3, align 8
>   store %jl_value_t** %.sub, %jl_value_t*** @jl_pgcstack, align 8
>   store %jl_value_t* null, %jl_value_t** %1, align 8
>   store %jl_value_t* null, %jl_value_t** %2, align 8
>   %5 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 4
>   store %jl_value_t* null, %jl_value_t** %5, align 8
>   %6 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 5
>   store %jl_value_t* null, %jl_value_t** %6, align 8
>   %7 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 6
>   store %jl_value_t* null, %jl_value_t** %7, align 8
>   %8 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 7
>   store %jl_value_t* null, %jl_value_t** %8, align 8
>   %9 = call %jl_value_t* @julia_sync_begin_535()
>   store %jl_value_t* inttoptr (i64 2274649264 to %jl_value_t*),
> %jl_value_t** %2, align 8
>   %10 = load %jl_value_t* (%jl_value_t*, %jl_value_t**, i32)** inttoptr (i64
> 2274649264 to %jl_value_t* (%jl_value_t*, %jl_value_t**, i32)**), align 16
>   %11 = load %jl_value_t** inttoptr (i64 2212282536 to %jl_value_t**), align
> 8
>   store %jl_value_t* %11, %jl_value_t** %5, align 8
>   %12 = load %jl_value_t** inttoptr (i64 2197909240 to %jl_value_t**), align
> 8
>   store %jl_value_t* %12, %jl_value_t** %6, align 8
>   %13 = load %jl_value_t** inttoptr (i64 2197909288 to %jl_value_t**), align
> 8
>   store %jl_value_t* %13, %jl_value_t** %7, align 8
>   %14 = load %jl_value_t** inttoptr (i64 2212418552 to %jl_value_t**), align
> 8
>   store %jl_value_t* %14, %jl_value_t** %8, align 8
>   %15 = call %jl_value_t* %10(%jl_value_t* inttoptr (i64 2274649264 to
> %jl_value_t*), %jl_value_t** %5, i32 4)
>   store %jl_value_t* %15, %jl_value_t** %1, align 8
>   call void @julia_sync_end_541()
>   %16 = load %jl_value_t** %3, align 8
>   %17 = getelementptr inbounds %jl_value_t* %16, i64 0, i32 0
>   store %jl_value_t** %17, %jl_value_t*** @jl_pgcstack, align 8
>   ret %jl_value_t* %15
> }
>
> This shows me that the llvm is not auto-vec

Re: [julia-users] Re: how to undefine variable in composite types

2016-02-04 Thread Stefan Karpinski
That would mean that redefining a type of which there are any (reachable)
instances would invalidate the entire system. That seems significantly
worse than simply not allowing types to be redefined without restarting.
One could potentially make references to "invalidated" objects #undef, but
that seems likely to leave the object graph in a completely unusable state.

On Thu, Feb 4, 2016 at 6:11 PM, Michael Landis 
wrote:

> They would be invalid too.  I know... no garbage collector, so it would be
> necessary to find the inbound references.  Smart pointers maybe?  Yet
> another performance hit.
>
> On Thursday, February 4, 2016 at 1:54:24 PM UTC-8, Stefan Karpinski wrote:
>>
>> How does one "release" an object? What happens to other objects that
>> retain references to those objects?
>>
>> On Thu, Feb 4, 2016 at 4:35 PM, Michael Landis 
>> wrote:
>>
>>> if you added a field, the existing objects could still be valid.  If you
>>> killed an attribute, they are invalid and can be released.
>>>
>>> On Thursday, February 4, 2016 at 10:55:25 AM UTC-8, Stefan Karpinski
>>> wrote:

 What happens to existing objects of a type when you redefine the type?

 On Thu, Feb 4, 2016 at 1:46 PM, Michael Landis 
 wrote:

> I think it would be nice to be able to undefine a type, so restarting
> the environment is not required when adding or deleting an attribute from 
> a
> type description.  Not being able to update a type definition without
> restarting the environment is a royal pain in the ass.
>
>
> On Saturday, March 8, 2014 at 9:55:37 AM UTC-8, Freddy Chua wrote:
>>
>> Suppose I have a Type
>>
>> type Foo
>>   a
>>   b
>> end
>>
>> f = Foo(1,2)
>> f.a = 1
>> f.b = 2
>>
>> how do I test whether f.a is defined
>> I do this isdefined(f, 1) but isdefined(f, 'a') does not work
>>
>> another question
>> how do i undefine f.a such that isdefined(f,1) now returns false
>>
>

>>


Re: [julia-users] Queue{ByteString} acting strangely

2016-02-04 Thread Stefan Karpinski
The Queue constructors seem to be lagging the newer convention in Julia. In
older versions of Julia it was not possible to do Queue{ByteString}() or
Vector{ByteString}().

On Thu, Feb 4, 2016 at 5:56 PM, Michael Landis 
wrote:

> ah, Queue's don't need to be typed, the type is a parameter to the
> constructor.  Parens, not braces.  So, why are Vectors defined as
> Vector{ByteString}(vecLength)?  Where is the syntactical consistency?
>
> On Thursday, February 4, 2016 at 2:47:52 PM UTC-8, Yichao Yu wrote:
>>
>> On Thu, Feb 4, 2016 at 5:43 PM, Michael Landis 
>> wrote:
>> > so ... what's the syntax for creating an empty Queue{ByteString}?
>> >
>> > qbs = Queue{ByteString}([])# also produces convert errors
>>
>> I think the document tells you exactly that.
>> https://github.com/JuliaLang/DataStructures.jl#stack-and-queue
>>
>> Queue(ByteString) seems to work.
>>
>> >
>> >
>> >>
>> >
>>
>


Re: [julia-users] Re: how to undefine variable in composite types

2016-02-04 Thread Michael Landis
They would be invalid too.  I know... no garbage collector, so it would be 
necessary to find the inbound references.  Smart pointers maybe?  Yet 
another performance hit.

On Thursday, February 4, 2016 at 1:54:24 PM UTC-8, Stefan Karpinski wrote:
>
> How does one "release" an object? What happens to other objects that 
> retain references to those objects?
>
> On Thu, Feb 4, 2016 at 4:35 PM, Michael Landis  > wrote:
>
>> if you added a field, the existing objects could still be valid.  If you 
>> killed an attribute, they are invalid and can be released.
>>
>> On Thursday, February 4, 2016 at 10:55:25 AM UTC-8, Stefan Karpinski 
>> wrote:
>>>
>>> What happens to existing objects of a type when you redefine the type?
>>>
>>> On Thu, Feb 4, 2016 at 1:46 PM, Michael Landis  
>>> wrote:
>>>
 I think it would be nice to be able to undefine a type, so restarting 
 the environment is not required when adding or deleting an attribute from 
 a 
 type description.  Not being able to update a type definition without 
 restarting the environment is a royal pain in the ass.


 On Saturday, March 8, 2014 at 9:55:37 AM UTC-8, Freddy Chua wrote:
>
> Suppose I have a Type
>
> type Foo
>   a
>   b
> end
>
> f = Foo(1,2)
> f.a = 1
> f.b = 2
>
> how do I test whether f.a is defined
> I do this isdefined(f, 1) but isdefined(f, 'a') does not work
>
> another question
> how do i undefine f.a such that isdefined(f,1) now returns false
>

>>>
>

[julia-users] Re: Announcing "Persist": Evaluating Julia expressions in the background

2016-02-04 Thread Nitin Arora
Thank you ! This will help my workflow a lot.

On Friday, November 27, 2015 at 7:14:40 AM UTC-8, Erik Schnetter wrote:
>
> I'd like to kindly draw your attention to a new package "Persist": <
> https://github.com/eschnett/Persist.jl>.
>
> This package mainly provides one macro `@persist` that evaluates a Julia 
> expression in the background, in a separate Julia process, independent of 
> the current Julia shell. The main point is that this evaluation will not be 
> interrupted or aborted if the current Julia shell exits. This is a 
> convenient shortcut to writing a small Julia script and executing it in the 
> background; think of it as an `@spawn` that persists even when the Julia 
> shell exits. The readme on Github has details and examples.
>
> Persist can also use Slurm to submit a job. There are several obvious 
> ideas (integration with ClusterManager, better integration with MPI, etc.) 
> that I'd like to explore in the feature; your feedback is welcome.
>
>
>
> Some philosophical points:
>
> Current HPC queuing managers conflate two ideas: resource management 
> (getting access to compute nodes that are usually oversubscribed) and 
> persistent execution (ensuring that a calculation is not aborted if the 
> shell is closed or the network connection to the HPC system drops). 
> However, from a user's point of view these two should ideally be separate:
> (1) When I'm developing or debugging or visualizing, I'd like interactive 
> access to compute nodes
> (2) When I'm using the Julia shell or Jupyter, I'd like to be able to 
> easily start certain long-running calculations in the background.
>
> The package "ClusterManagers" offers feature (1); I hope that HPC queueing 
> systems will become more flexible over time to simplify such interactive 
> access.
>
> This package "Persist" offers feature (2).
>
> -erik
>
> -- 
> Erik Schnetter > 
> http://www.perimeterinstitute.ca/personal/eschnetter/
>


[julia-users] Re: SIMD long inner expression

2016-02-04 Thread alan souza
Hi. I think that the number of variables in the inner loop  is too high and 
the compiler can't vectorize the code because of a insufficient number of 
available registers (see wik i- Register_allocation 
 )
and even if the compiler could vectorize this loop the speedup will be at 
best of two times for SSE code (Could you use float32). I believe that can 
be easier to the compiler if split your computation
(calculate the arrays with powers, pointwise multiplication and finally a 
reduction).
On Thursday, February 4, 2016 at 7:29:53 PM UTC-2, Chris Rackauckas wrote:
>
> Hi, I am trying to optimize a code which just adds a bunch of things. My 
> first instinct was to unravel the loops and run it as SIMD, like so:
>
> dx = 1/400
> addprocs(3)
> imin = -6
> jmin = -2
>
> #Some SIMD
> @time res = @sync @parallel (+) for i = imin:dx:0
>   tmp = 0
>   for j=jmin:dx:0
> ans = 0
> @simd for k=1:24
>   @inbounds ans += coefs[k]*(i^(powz[k]))*(j^(poww[k]))
> end
> tmp += abs(ans)<1
>   end
>   tmp
> end
> res = res*(12/(length(imin:dx:0)*length(jmin:dx:0)))
> println(res)#Mathematica gives 2.98
>
> (Coefficients arrays posted at the bottom for completeness). On a 4 core 
> i7 this runs in ~4.68 seconds. I was able to beat this by optimizing the 
> power calculations like so:
>
> ## Full unravel
> @time res = @sync @parallel (+) for i = imin:dx:0
>   tmp = 0
>   isq2 = i*i; isq3 = i*isq2; isq4 = isq2*isq2; isq5 = i*isq4
>   isq6 = isq4*isq2; isq7 = i*isq6; isq8 = isq4*isq4
>   for j=jmin:dx:0
> jsq2 = j*j; jsq4 = jsq2*jsq2; jsq6 = jsq2*jsq4; jsq8 = jsq4*jsq4
> @inbounds tmp += abs(coefs[1]*(jsq2) + coefs[2]*(jsq4) + coefs[3]*(
> jsq6) + coefs[4]*(jsq8) + coefs[5]*(i) + coefs[6]*(i)*(jsq2) + coefs[7]*(i
> )*(jsq4) + coefs[8]*(i)*(jsq6) +
> coefs[9]*(isq2) + coefs[10]*(isq2)*(jsq2) + coefs[11]*(isq2)*(jsq4) + 
> coefs[12]*(isq2)*(jsq6) + coefs[13]*(isq3) + coefs[14]*(isq3)*(jsq2) + 
> coefs[15]*(isq3)*(jsq4) +
> coefs[16]*(isq4) + coefs[17]*(isq4)*(jsq2) + coefs[18]*(isq4)*(jsq4) + 
> coefs[19]*(isq5) + coefs[20]*(isq5)*(jsq2) + coefs[21]*(isq6) + coefs[22
> ]*(isq6)*(jsq2) +
> coefs[23]*(isq7) + coefs[24]*(isq8))<1
>   end
>   tmp
> end
> res = res*(12/(length(imin:dx:0)*length(jmin:dx:0)))
> println(res)#Mathematica gives 2.98
>
> This is the best version and gets ~1.83 seconds (FYI it bets a version 
> where I distributed out by isq). However, when I put this into a function 
> and call it with @code_llvm, I get:
>
> define %jl_value_t* @julia_simdCheck_3161() {
> top:
>   %0 = alloca [8 x %jl_value_t*], align 8
>   %.sub = getelementptr inbounds [8 x %jl_value_t*]* %0, i64 0, i64 0
>   %1 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 2
>   %2 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 3
>   store %jl_value_t* inttoptr (i64 12 to %jl_value_t*), %jl_value_t** %.
> sub, align 8
>   %3 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 1
>   %4 = load %jl_value_t*** @jl_pgcstack, align 8
>   %.c = bitcast %jl_value_t** %4 to %jl_value_t*
>   store %jl_value_t* %.c, %jl_value_t** %3, align 8
>   store %jl_value_t** %.sub, %jl_value_t*** @jl_pgcstack, align 8
>   store %jl_value_t* null, %jl_value_t** %1, align 8
>   store %jl_value_t* null, %jl_value_t** %2, align 8
>   %5 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 4
>   store %jl_value_t* null, %jl_value_t** %5, align 8
>   %6 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 5
>   store %jl_value_t* null, %jl_value_t** %6, align 8
>   %7 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 6
>   store %jl_value_t* null, %jl_value_t** %7, align 8
>   %8 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 7
>   store %jl_value_t* null, %jl_value_t** %8, align 8
>   %9 = call %jl_value_t* @julia_sync_begin_535()
>   store %jl_value_t* inttoptr (i64 2274649264 to %jl_value_t*), %
> jl_value_t** %2, align 8
>   %10 = load %jl_value_t* (%jl_value_t*, %jl_value_t**, i32)** inttoptr (i64 
> 2274649264 to %jl_value_t* (%jl_value_t*, %jl_value_t**, i32)**), align 16
>   %11 = load %jl_value_t** inttoptr (i64 2212282536 to %jl_value_t**), 
> align 8
>   store %jl_value_t* %11, %jl_value_t** %5, align 8
>   %12 = load %jl_value_t** inttoptr (i64 2197909240 to %jl_value_t**), 
> align 8
>   store %jl_value_t* %12, %jl_value_t** %6, align 8
>   %13 = load %jl_value_t** inttoptr (i64 2197909288 to %jl_value_t**), 
> align 8
>   store %jl_value_t* %13, %jl_value_t** %7, align 8
>   %14 = load %jl_value_t** inttoptr (i64 2212418552 to %jl_value_t**), 
> align 8
>   store %jl_value_t* %14, %jl_value_t** %8, align 8
>   %15 = call %jl_value_t* %10(%jl_value_t* inttoptr (i64 2274649264 to %
> jl_value_t*), %jl_value_t** %5, i32 4)
>   store %jl_value_t* %15, %jl_value_t** %1, align 8
>   call void @julia_sync_end_541()
>   %16 = load %jl_value_t** %3, align 8
>   %17 = getelementptr inbounds %jl_value_t* %16, i64 0, i32 0
>   store %jl_value_t** %17, %jl_value_t*** @jl_pgcstack, 

[julia-users] Re: PyPlot

2016-02-04 Thread digxx
Hm Thx...Apart from the Browser Plotting solved it :-(


Re: [julia-users] Queue{ByteString} acting strangely

2016-02-04 Thread Michael Landis
ah, Queue's don't need to be typed, the type is a parameter to the 
constructor.  Parens, not braces.  So, why are Vectors defined as 
Vector{ByteString}(vecLength)?  Where is the syntactical consistency?

On Thursday, February 4, 2016 at 2:47:52 PM UTC-8, Yichao Yu wrote:
>
> On Thu, Feb 4, 2016 at 5:43 PM, Michael Landis  > wrote: 
> > so ... what's the syntax for creating an empty Queue{ByteString}? 
> > 
> > qbs = Queue{ByteString}([])# also produces convert errors 
>
> I think the document tells you exactly that. 
> https://github.com/JuliaLang/DataStructures.jl#stack-and-queue 
>
> Queue(ByteString) seems to work. 
>
> > 
> > 
> >> 
> > 
>


Re: [julia-users] Queue{ByteString} acting strangely

2016-02-04 Thread Michael Landis
assuming that you know more than I do (a likely circumstance), how do you 
explain...

qbs = Queue{ByteString}("1234")   # ok
typeof(qbs)  # --> 
DataStructures.Queue{ByteString}
length(qbs)  # --> 4, presumably the 
result of enqueuing "1", "2", "3", "4" as you suggest
# then, why does 
the following...
dequque!(qbs) # fails with MethodError: 
`shift!` has no method matching shift!(::ASCIIString)
# why not just produce "1" (or "4")?

On Thursday, February 4, 2016 at 1:52:51 PM UTC-8, Stefan Karpinski wrote:
>
> The Queue constructor (like all collection constructors) takes a 
> collection which it iterates over and converts each value it gets to the 
> expected element type – in this case ByteString. If you iterate over "1234" 
> you get '1' then '2' then '3' then '4' – each of which is converted to a 
> string and then inserted into your queue.
>
>

[julia-users] Re: Strangely formatted HTTP response (Pkg.publish())

2016-02-04 Thread Josh Day
Yes, I just saw it and searched about it to find this post.


Re: [julia-users] Queue{ByteString} acting strangely

2016-02-04 Thread Yichao Yu
On Thu, Feb 4, 2016 at 5:43 PM, Michael Landis  wrote:
> so ... what's the syntax for creating an empty Queue{ByteString}?
>
> qbs = Queue{ByteString}([])# also produces convert errors

I think the document tells you exactly that.
https://github.com/JuliaLang/DataStructures.jl#stack-and-queue

Queue(ByteString) seems to work.

>
>
>>
>


Re: [julia-users] Queue{ByteString} acting strangely

2016-02-04 Thread Michael Landis
so ... what's the syntax for creating an empty Queue{ByteString}?

qbs = Queue{ByteString}([])# also produces convert errors



>

Re: [julia-users] Re: how to undefine variable in composite types

2016-02-04 Thread Stefan Karpinski
How does one "release" an object? What happens to other objects that retain
references to those objects?

On Thu, Feb 4, 2016 at 4:35 PM, Michael Landis 
wrote:

> if you added a field, the existing objects could still be valid.  If you
> killed an attribute, they are invalid and can be released.
>
> On Thursday, February 4, 2016 at 10:55:25 AM UTC-8, Stefan Karpinski wrote:
>>
>> What happens to existing objects of a type when you redefine the type?
>>
>> On Thu, Feb 4, 2016 at 1:46 PM, Michael Landis 
>> wrote:
>>
>>> I think it would be nice to be able to undefine a type, so restarting
>>> the environment is not required when adding or deleting an attribute from a
>>> type description.  Not being able to update a type definition without
>>> restarting the environment is a royal pain in the ass.
>>>
>>>
>>> On Saturday, March 8, 2014 at 9:55:37 AM UTC-8, Freddy Chua wrote:

 Suppose I have a Type

 type Foo
   a
   b
 end

 f = Foo(1,2)
 f.a = 1
 f.b = 2

 how do I test whether f.a is defined
 I do this isdefined(f, 1) but isdefined(f, 'a') does not work

 another question
 how do i undefine f.a such that isdefined(f,1) now returns false

>>>
>>


Re: [julia-users] Queue{ByteString} acting strangely

2016-02-04 Thread Stefan Karpinski
The Queue constructor (like all collection constructors) takes a collection
which it iterates over and converts each value it gets to the expected
element type – in this case ByteString. If you iterate over "1234" you get
'1' then '2' then '3' then '4' – each of which is converted to a string and
then inserted into your queue.

On Thu, Feb 4, 2016 at 4:29 PM, Michael Landis 
wrote:

> DataStructures.Queue is doing strange things for me.
>
> Can someone please post proper syntax for forward declarations of an empty
> Queue{ByteString} and maybe an in-line instantiation (if different) so I
> can be sure that I am getting the declarations right?
>
> When I do:
> using DataStructures;
> qbs = Queue{ByteString}()  # --> convert errors
> qbs = Queue{ByteString}(0)# --> convert errors
> qbs = Queue{ByteString}("")   # --> no errors, so ok?
> typeof(qbs)  # -->
> DataStructures.Queue{ByteString}  (so far, so good)
> length(qbs)  # --> 0 (hmmm)
> # which seems ok, but ...
> qbs = Queue{ByteString}("1234")   # ok
> typeof(qbs)  # -->
> DataStructures.Queue{ByteString}
> length(qbs)  # --> 4 ??? why not 1?
> enqueue!(qbs, "xyz")   # --> MethodError: `push!` has
> no method matching push!(::ASCIIString, ::ASCIIString ) in queue.jl:17
> x = dequeue!( qbs ) # --> MethodError: `shift!`
> has no method matching shift!(::ASCIIString) in ... dequeue! at queue.jl:21
>
> so... I am growing increasingly mystified.  How can the type be right when
> you ask for it, but wrong when you use it?  Maybe I'm declaring it wrong?
> Any insight or suggestions would be appreciated.
>


[julia-users] Re: Conda

2016-02-04 Thread J Luis
Small? Mine (that I didn't ask for) has 320 Mb.

quinta-feira, 4 de Fevereiro de 2016 às 19:44:54 UTC, digxx escreveu:
>
> When I do not have Conda installed but install PyCall in Julia does 
> Pkg.add("PyCall") still installs its own small PYthon distribution?
>


Re: [julia-users] Re: how to undefine variable in composite types

2016-02-04 Thread Michael Landis
if you added a field, the existing objects could still be valid.  If you 
killed an attribute, they are invalid and can be released.

On Thursday, February 4, 2016 at 10:55:25 AM UTC-8, Stefan Karpinski wrote:
>
> What happens to existing objects of a type when you redefine the type?
>
> On Thu, Feb 4, 2016 at 1:46 PM, Michael Landis  > wrote:
>
>> I think it would be nice to be able to undefine a type, so restarting the 
>> environment is not required when adding or deleting an attribute from a 
>> type description.  Not being able to update a type definition without 
>> restarting the environment is a royal pain in the ass.
>>
>>
>> On Saturday, March 8, 2014 at 9:55:37 AM UTC-8, Freddy Chua wrote:
>>>
>>> Suppose I have a Type
>>>
>>> type Foo
>>>   a
>>>   b
>>> end
>>>
>>> f = Foo(1,2)
>>> f.a = 1
>>> f.b = 2
>>>
>>> how do I test whether f.a is defined
>>> I do this isdefined(f, 1) but isdefined(f, 'a') does not work
>>>
>>> another question
>>> how do i undefine f.a such that isdefined(f,1) now returns false
>>>
>>
>

[julia-users] SIMD long inner expression

2016-02-04 Thread Chris Rackauckas
Hi, I am trying to optimize a code which just adds a bunch of things. My 
first instinct was to unravel the loops and run it as SIMD, like so:

dx = 1/400
addprocs(3)
imin = -6
jmin = -2

#Some SIMD
@time res = @sync @parallel (+) for i = imin:dx:0
  tmp = 0
  for j=jmin:dx:0
ans = 0
@simd for k=1:24
  @inbounds ans += coefs[k]*(i^(powz[k]))*(j^(poww[k]))
end
tmp += abs(ans)<1
  end
  tmp
end
res = res*(12/(length(imin:dx:0)*length(jmin:dx:0)))
println(res)#Mathematica gives 2.98

(Coefficients arrays posted at the bottom for completeness). On a 4 core i7 
this runs in ~4.68 seconds. I was able to beat this by optimizing the power 
calculations like so:

## Full unravel
@time res = @sync @parallel (+) for i = imin:dx:0
  tmp = 0
  isq2 = i*i; isq3 = i*isq2; isq4 = isq2*isq2; isq5 = i*isq4
  isq6 = isq4*isq2; isq7 = i*isq6; isq8 = isq4*isq4
  for j=jmin:dx:0
jsq2 = j*j; jsq4 = jsq2*jsq2; jsq6 = jsq2*jsq4; jsq8 = jsq4*jsq4
@inbounds tmp += abs(coefs[1]*(jsq2) + coefs[2]*(jsq4) + coefs[3]*(jsq6) 
+ coefs[4]*(jsq8) + coefs[5]*(i) + coefs[6]*(i)*(jsq2) + coefs[7]*(i)*(jsq4) 
+ coefs[8]*(i)*(jsq6) +
coefs[9]*(isq2) + coefs[10]*(isq2)*(jsq2) + coefs[11]*(isq2)*(jsq4) + 
coefs[12]*(isq2)*(jsq6) + coefs[13]*(isq3) + coefs[14]*(isq3)*(jsq2) + coefs
[15]*(isq3)*(jsq4) +
coefs[16]*(isq4) + coefs[17]*(isq4)*(jsq2) + coefs[18]*(isq4)*(jsq4) + 
coefs[19]*(isq5) + coefs[20]*(isq5)*(jsq2) + coefs[21]*(isq6) + coefs[22]*(
isq6)*(jsq2) +
coefs[23]*(isq7) + coefs[24]*(isq8))<1
  end
  tmp
end
res = res*(12/(length(imin:dx:0)*length(jmin:dx:0)))
println(res)#Mathematica gives 2.98

This is the best version and gets ~1.83 seconds (FYI it bets a version 
where I distributed out by isq). However, when I put this into a function 
and call it with @code_llvm, I get:

define %jl_value_t* @julia_simdCheck_3161() {
top:
  %0 = alloca [8 x %jl_value_t*], align 8
  %.sub = getelementptr inbounds [8 x %jl_value_t*]* %0, i64 0, i64 0
  %1 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 2
  %2 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 3
  store %jl_value_t* inttoptr (i64 12 to %jl_value_t*), %jl_value_t** %.sub, 
align 8
  %3 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 1
  %4 = load %jl_value_t*** @jl_pgcstack, align 8
  %.c = bitcast %jl_value_t** %4 to %jl_value_t*
  store %jl_value_t* %.c, %jl_value_t** %3, align 8
  store %jl_value_t** %.sub, %jl_value_t*** @jl_pgcstack, align 8
  store %jl_value_t* null, %jl_value_t** %1, align 8
  store %jl_value_t* null, %jl_value_t** %2, align 8
  %5 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 4
  store %jl_value_t* null, %jl_value_t** %5, align 8
  %6 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 5
  store %jl_value_t* null, %jl_value_t** %6, align 8
  %7 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 6
  store %jl_value_t* null, %jl_value_t** %7, align 8
  %8 = getelementptr [8 x %jl_value_t*]* %0, i64 0, i64 7
  store %jl_value_t* null, %jl_value_t** %8, align 8
  %9 = call %jl_value_t* @julia_sync_begin_535()
  store %jl_value_t* inttoptr (i64 2274649264 to %jl_value_t*), %jl_value_t
** %2, align 8
  %10 = load %jl_value_t* (%jl_value_t*, %jl_value_t**, i32)** inttoptr (i64 
2274649264 to %jl_value_t* (%jl_value_t*, %jl_value_t**, i32)**), align 16
  %11 = load %jl_value_t** inttoptr (i64 2212282536 to %jl_value_t**), 
align 8
  store %jl_value_t* %11, %jl_value_t** %5, align 8
  %12 = load %jl_value_t** inttoptr (i64 2197909240 to %jl_value_t**), 
align 8
  store %jl_value_t* %12, %jl_value_t** %6, align 8
  %13 = load %jl_value_t** inttoptr (i64 2197909288 to %jl_value_t**), 
align 8
  store %jl_value_t* %13, %jl_value_t** %7, align 8
  %14 = load %jl_value_t** inttoptr (i64 2212418552 to %jl_value_t**), 
align 8
  store %jl_value_t* %14, %jl_value_t** %8, align 8
  %15 = call %jl_value_t* %10(%jl_value_t* inttoptr (i64 2274649264 to %
jl_value_t*), %jl_value_t** %5, i32 4)
  store %jl_value_t* %15, %jl_value_t** %1, align 8
  call void @julia_sync_end_541()
  %16 = load %jl_value_t** %3, align 8
  %17 = getelementptr inbounds %jl_value_t* %16, i64 0, i32 0
  store %jl_value_t** %17, %jl_value_t*** @jl_pgcstack, align 8
  ret %jl_value_t* %15
}

This shows me that the llvm is not auto-vectorizing the inner part. *Is 
there a way to tell the llvm to SIMD vectorize the big summation in this 
more optimized form?*

For completeness, here are the coefficient arrays (note: coefs should be 
treated as variable. In principle those zeros could change so there's no 
manual optimizing to be done there):

coefs 
Vector Float64, 24
1.3328
0.16669
0.0
0.0
2.0
2.335
0.06251
0.0
2.0
1.1659
0.0190972224
0.0
1.0
3.469446951953614e-18
0.0
0.25
0.010416
0.0
0.0
0.0
0.0
0.0
0.0
0.0

powz
Vector Float64, 24
0.0
0.0
0.0
0.0
1.0
1.0
1.0
1.0
2.0
2.0
2.0
2.0
3.0
3.0
3.0
4.0
4.0
4.0
5.0
5.0
6.0
6.0
7.0
8.0

poww

Vector Float64, 24

2.0
4.0
6.0
8.0
0.0
2.0
4.0
6.0
0

Re: [julia-users] load a Julia dataframe from Microsoft SQL Server table

2016-02-04 Thread Stefan Karpinski
On Thu, Feb 4, 2016 at 1:50 PM, Scott Jones 
wrote:

>
> This still doesn't explain why some drivers are accepting UCS-2/UTF-16
>> when called with the non-Unicode API.
>>
>
> When you do so, are you actually calling the functions with the A, or just
> the macro without either A or W?
> The macro will compile to either the A or the W form, depending on how
> your application is built.
>
> This is a better page in MSDN:
> https://msdn.microsoft.com/en-us/library/ms712612(v=vs.85).aspx describing
> what is going on.
>

The ODBC package calls the functions without A or W. What it's calling
can't be a macro since macros aren't callable via ccall. But changing ODBC
to call the W version of everything may be the fix here.


[julia-users] Queue{ByteString} acting strangely

2016-02-04 Thread Michael Landis
DataStructures.Queue is doing strange things for me.

Can someone please post proper syntax for forward declarations of an empty 
Queue{ByteString} and maybe an in-line instantiation (if different) so I 
can be sure that I am getting the declarations right?

When I do:
using DataStructures;
qbs = Queue{ByteString}()  # --> convert errors
qbs = Queue{ByteString}(0)# --> convert errors
qbs = Queue{ByteString}("")   # --> no errors, so ok?
typeof(qbs)  # --> 
DataStructures.Queue{ByteString}  (so far, so good)
length(qbs)  # --> 0 (hmmm)
# which seems ok, but ...
qbs = Queue{ByteString}("1234")   # ok
typeof(qbs)  # --> 
DataStructures.Queue{ByteString}
length(qbs)  # --> 4 ??? why not 1?
enqueue!(qbs, "xyz")   # --> MethodError: `push!` has 
no method matching push!(::ASCIIString, ::ASCIIString ) in queue.jl:17
x = dequeue!( qbs ) # --> MethodError: `shift!` has 
no method matching shift!(::ASCIIString) in ... dequeue! at queue.jl:21

so... I am growing increasingly mystified.  How can the type be right when 
you ask for it, but wrong when you use it?  Maybe I'm declaring it wrong? 
 Any insight or suggestions would be appreciated.


Re: [julia-users] load a Julia dataframe from Microsoft SQL Server table

2016-02-04 Thread Scott Jones


On Thursday, February 4, 2016 at 1:33:33 PM UTC-5, Stefan Karpinski wrote:
>
> Not a model of clarity (ANSI and Unicode are not encodings), but this page 
> seems to be the best resource on this:
>
> https://msdn.microsoft.com/en-us/library/ms709439(v=vs.85).aspx
>
> It seems that there's a parallel "Unicode" API for ODBC drivers that 
> support it. Moreover:
>
> Currently, the only Unicode encoding that ODBC supports is UCS-2, which 
>> uses a 16-bit integer (fixed length) to represent a character. Unicode 
>> allows applications to work in different languages.
>
>
> So using Klingon is off the table. Although the design of UTF-16 is such 
> that sending UTF-16 to an application that expects UCS-2 will probably work 
> reasonably well, as long as it treats it as "just data".
>

That comment is probably years (decades?) out of date.  There is no limit 
of just UCS-2.
 

> This still doesn't explain why some drivers are accepting UCS-2/UTF-16 
> when called with the non-Unicode API.
>

When you do so, are you actually calling the functions with the A, or just 
the macro without either A or W?
The macro will compile to either the A or the W form, depending on how your 
application is built.

This is a better page in MSDN: 
https://msdn.microsoft.com/en-us/library/ms712612(v=vs.85).aspx describing 
what is going on.

>
>

Re: [julia-users] load a Julia dataframe from Microsoft SQL Server table

2016-02-04 Thread Scott Jones
My reply wasn't meant to be condescending at all, just trying to explain 
the issue.
UTF-16LE & UTF-16BE *are* encodings of the 16-bit UTF-16 encoding of 
Unicode onto 8-bit code units.
If the server is sending UTF-16 or UTF-32, you should simply use the *W 
API, period, because in some places the 8-bit API can have
problems with the embedded 0x00 bytes.

On Thursday, February 4, 2016 at 1:13:12 PM UTC-5, Stefan Karpinski wrote:
>
> The real issue is this:
>
> SQLCHAR is for encodings with 8-bit code units.
>
>
> Condescending lecture on encodings notwithstanding, UTF-16 is not such an 
> encoding, yet UTF-16 is what the ODBC package is currently sending 
> to SQLExecDirect for an argument of type SQLCHAR * – and somehow it seems 
> to be working for many drivers, which still makes no sense to me. I can 
> only conclude that some ODBC drivers are treating this as a void * argument 
> and they expect pointers to data in whatever encoding they prefer, not 
> specifically in encodings with 8-bit code units.
>
> Querying the database about what encoding it expects is a good idea, but 
> how does one do that? The SQLGetInfo 
>  
> function seems like a good candidate but this page doesn't include 
> "encoding" or "utf" anywhere.
>
> On Thu, Feb 4, 2016 at 7:53 AM, Milan Bouchet-Valat  > wrote:
>
>> Le mercredi 03 février 2016 à 11:44 -0800, Terry Seaward a écrit :
>> > From R, it seems like the encoding is based on the connection (as
>> > opposed to being hard coded). See `enc <- attr(channel, "encoding")`
>> > below:
>> >
>> > ```
>> > [...]
>> >
>> > Digging down `odbcConnect` is just a wrapper for `odbcDriverConnect`
>> > which has the following parameter `DBMSencoding = ""`. This calls the
>> > `C` function `C_RODBCDriverConnect` (available here:RODBC_1.3-
>> > 12.tar.gz), which has no reference to encodings. So `attr(channel,
>> > "encoding")` is simply `DBMSencoding`, i.e. `""`.
>> >
>> > It seems to come down to `iconv(..., to = "")` which, from the R
>> > source code, uses `win_iconv.c` attached. I can't seem to find how
>> > `""` is handled, i.e. is there some default value based on the
>> > system?
>> "" refers to the encoding of the current system locale. This is a
>> reasonable guess, but it will probably be wrong in many cases (else, R
>> wouldn't have provided this option at all).
>>
>>
>> Regards
>>
>
>

[julia-users] Re: PyPlot

2016-02-04 Thread digxx
MAybe some related question:
When plotting with PyPlot and subsequently using
title("hello") or legend(loc="upper right",fancybox="true")
I get the error:
Is it because im missing some matplotlib stuff or what is the issue here?

ERROR: MethodError: `call` has no method matching call(::ASCIIString)
Closest candidates are:
  BoundsError()
  BoundsError(, ::Any...)
  DivideError()
  ...


Re: [julia-users] Re: Elapsed CPU time in Julia?

2016-02-04 Thread Stefan Karpinski
Works ok here. Are you using an old version or something? Or maybe you have
a file called benchmarks.jl that's getting loaded instead of the package?

On Thu, Feb 4, 2016 at 3:49 PM, Lytu  wrote:

> When i do :
> using Benchmarks
> @benchmark sin(2.0)
>
> I have an error like :
>
> Has anyone been able to successfully use Benchmarks.jl ?
>
>
> On Wednesday, 3 February 2016 22:58:09 UTC+1, Stefan Karpinski wrote:
>>
>> You may want to check out Benchmarks.jl
>> , which goes to
>> significant lengths to do benchmarking correctly.
>>
>> On Wed, Feb 3, 2016 at 4:05 PM, Milan Bouchet-Valat 
>> wrote:
>>
>>> Le mercredi 03 février 2016 à 12:55 -0800, Christopher Alexander a
>>> écrit :
>>> > Try doing something like:
>>> >
>>> > tic()
>>> > # my code
>>> > toc()
>>> Be careful with tic() and toc() in Julia. In most cases, when
>>> benchmarking, you should wrap your code in a function to make sure it
>>> gets specialized on the argument types, instead of running it from the
>>> REPL. So in general it's better to do:
>>> @time myfun(arg1, arg2, ...)
>>>
>>> See http://docs.julialang.org/en/latest/manual/performance-tips/#measur
>>> e-performance-with-time-and-pay-attention-to-memory-allocation
>>> 
>>>
>>>
>>> Regards
>>>
>>> > On Wednesday, February 3, 2016 at 3:28:28 PM UTC-5, Lytu wrote:
>>> > > Hello Julia users,
>>> > >
>>> > > Can someone tell me what's the equivalent of matlab elapsed cputime
>>> > > in Julia
>>> > >
>>> > > For example i Matlab, we can do this:
>>> > >t = cputime;
>>> > >x=4;
>>> > >iter = 1;
>>> > >z = ones(1,4);
>>> > >y=x*2*z;
>>> > >e = cputime-t
>>> > >
>>> > > But in Julia i don't seem to find how to do this. I thought i can
>>> > > use
>>> > >t=time()
>>> > >x=4;
>>> > >iter = 1;
>>> > >z = ones(1,4);
>>> > >y=x*2*z;
>>> > >e=time()-t
>>> > >
>>> > > But time() in Julia is not the elapsed CPU time, it's a wall clock
>>> > > time.
>>> > >
>>> > > Can someone help me?
>>> > >
>>> > > Thank you
>>> > >
>>>
>>
>>


Re: [julia-users] Re: Elapsed CPU time in Julia?

2016-02-04 Thread Lytu
When i do :
using Benchmarks
@benchmark sin(2.0)

I have an error like : ERROR: @benchmark not defined

Has anyone been able to successfully use Benchmarks.jl ?

On Wednesday, 3 February 2016 22:58:09 UTC+1, Stefan Karpinski wrote:
>
> You may want to check out Benchmarks.jl 
> , which goes to 
> significant lengths to do benchmarking correctly.
>
> On Wed, Feb 3, 2016 at 4:05 PM, Milan Bouchet-Valat  > wrote:
>
>> Le mercredi 03 février 2016 à 12:55 -0800, Christopher Alexander a
>> écrit :
>> > Try doing something like:
>> >
>> > tic()
>> > # my code
>> > toc()
>> Be careful with tic() and toc() in Julia. In most cases, when
>> benchmarking, you should wrap your code in a function to make sure it
>> gets specialized on the argument types, instead of running it from the
>> REPL. So in general it's better to do:
>> @time myfun(arg1, arg2, ...)
>>
>> See http://docs.julialang.org/en/latest/manual/performance-tips/#measur
>> e-performance-with-time-and-pay-attention-to-memory-allocation 
>> 
>>
>>
>> Regards
>>
>> > On Wednesday, February 3, 2016 at 3:28:28 PM UTC-5, Lytu wrote:
>> > > Hello Julia users,
>> > >
>> > > Can someone tell me what's the equivalent of matlab elapsed cputime
>> > > in Julia
>> > >
>> > > For example i Matlab, we can do this:
>> > >t = cputime;
>> > >x=4;
>> > >iter = 1; 
>> > >z = ones(1,4);
>> > >y=x*2*z;
>> > >e = cputime-t
>> > >
>> > > But in Julia i don't seem to find how to do this. I thought i can
>> > > use 
>> > >t=time()
>> > >x=4;
>> > >iter = 1; 
>> > >z = ones(1,4);
>> > >y=x*2*z;
>> > >e=time()-t
>> > >
>> > > But time() in Julia is not the elapsed CPU time, it's a wall clock
>> > > time.
>> > >
>> > > Can someone help me?
>> > >
>> > > Thank you
>> > >
>>
>
>

Re: [julia-users] Re: Elapsed CPU time in Julia?

2016-02-04 Thread Lytu
When i do :
using Benchmarks
@benchmark sin(2.0)

I have an error like : 

Has anyone been able to successfully use Benchmarks.jl ?


On Wednesday, 3 February 2016 22:58:09 UTC+1, Stefan Karpinski wrote:
>
> You may want to check out Benchmarks.jl 
> , which goes to 
> significant lengths to do benchmarking correctly.
>
> On Wed, Feb 3, 2016 at 4:05 PM, Milan Bouchet-Valat  > wrote:
>
>> Le mercredi 03 février 2016 à 12:55 -0800, Christopher Alexander a
>> écrit :
>> > Try doing something like:
>> >
>> > tic()
>> > # my code
>> > toc()
>> Be careful with tic() and toc() in Julia. In most cases, when
>> benchmarking, you should wrap your code in a function to make sure it
>> gets specialized on the argument types, instead of running it from the
>> REPL. So in general it's better to do:
>> @time myfun(arg1, arg2, ...)
>>
>> See http://docs.julialang.org/en/latest/manual/performance-tips/#measur
>> e-performance-with-time-and-pay-attention-to-memory-allocation 
>> 
>>
>>
>> Regards
>>
>> > On Wednesday, February 3, 2016 at 3:28:28 PM UTC-5, Lytu wrote:
>> > > Hello Julia users,
>> > >
>> > > Can someone tell me what's the equivalent of matlab elapsed cputime
>> > > in Julia
>> > >
>> > > For example i Matlab, we can do this:
>> > >t = cputime;
>> > >x=4;
>> > >iter = 1; 
>> > >z = ones(1,4);
>> > >y=x*2*z;
>> > >e = cputime-t
>> > >
>> > > But in Julia i don't seem to find how to do this. I thought i can
>> > > use 
>> > >t=time()
>> > >x=4;
>> > >iter = 1; 
>> > >z = ones(1,4);
>> > >y=x*2*z;
>> > >e=time()-t
>> > >
>> > > But time() in Julia is not the elapsed CPU time, it's a wall clock
>> > > time.
>> > >
>> > > Can someone help me?
>> > >
>> > > Thank you
>> > >
>>
>
>

Re: [julia-users] Parametric Types with Incomplete Initialization

2016-02-04 Thread Josh Langsfeld
No surprise there since a Float64 is 8 bytes.

On Thursday, February 4, 2016 at 3:22:44 PM UTC-5, Christopher Alexander 
wrote:
>
> That's interesting, I can reproduce that exactly.  However, when I set the 
> "a" attribute for A as being Float64, they are both size 8:
>
> abstract ABC
>
> immutable A2 <: ABC
> a::Float64
> end
>
> julia> bA2, bABC2 = B{A2}(A2(1)), B{ABC}(A2(2))
> (B{A2}(A2(1.0)),B{ABC}(A2(2.0)))
>
> julia> sizeof(bA2), sizeof(bABC2)
> (8,8)
>
>
>
>
>
> On Thursday, February 4, 2016 at 2:56:46 PM UTC-5, Josh Langsfeld wrote:
>>
>> I may be mistaken, but I think setting the type parameter to be abstract 
>> is indeed the same as setting the field itself to be abstract. This snippet 
>> is my evidence:
>>
>> julia> abstract ABC
>>
>> julia> immutable A <: ABC
>>  a::Float32
>>end
>>
>> julia> type B{T<:ABC}
>>  a::T
>>end
>>
>> julia> bA, bABC = B{A}(A(1)), B{ABC}(A(2))
>> (B{A}(A(1.0f0)),B{ABC}(A(2.0f0)))
>>
>> julia> sizeof(bA), sizeof(bABC)
>> (4,8)
>>
>> Even though both 'B' objects contain an 'A' immutable, bABC keeps it as a 
>> pointer (size 8) whereas bA can directly unpack it into the definition.
>>
>>
>> On Thursday, February 4, 2016 at 1:59:17 PM UTC-5, Christopher Alexander 
>> wrote:
>>>
>>> Oh cool!  I was worried, since my call method was passing in the 
>>> abstract type if none was specified (ie I wasn't setting a value for the 
>>> param "a"), that it would just be the same as if I hadn't used a parametric 
>>> type at all and just set the type of "a" to the abstract type.
>>>
>>> Thanks!
>>>
>>> Chris
>>>
>>> On Thursday, February 4, 2016 at 11:50:07 AM UTC-5, Kevin Squire wrote:

 No, `a` is the (concrete) type `T`, which is a subtype of `ABC` (and a 
 new type `B{T}` is created for each `T`).  So you shouldn't lose 
 performance because of this.

 Cheers,
Kevin

 On Thu, Feb 4, 2016 at 8:10 AM, Christopher Alexander <
 uvap...@gmail.com> wrote:

> Let's say I have the following types:
>
> abstract ABC
>
> type A <: ABC
> a::Float64
> end
>
> type B{T <: ABC}
> a::T
> end
>
> In some cases, I need for type "B" to be incompletely initialized so 
> that I can define its parameter "a" later.  I've found out that you can 
> do 
> something like this:
>
> type B{T <: ABC}
> a::T
> 
> call(::Type{B}) = new{ABC}()
> end
>
> which then allows this:
>
> julia> myB = B()
> B{ABC}(#undef)
>
> My question is, I'm assuming you lose any of the performance gain by 
> using the parametric type in this case because you are still using the 
> abstract type "ABC" for the parameter "a" (even if you define it later 
> with 
> a concrete "A").   Is there a better way to do this?
>
> Thanks!
>
> Chris
>



Re: [julia-users] Parametric Types with Incomplete Initialization

2016-02-04 Thread Christopher Alexander
That's interesting, I can reproduce that exactly.  However, when I set the 
"a" attribute for A as being Float64, they are both size 8:

abstract ABC

immutable A2 <: ABC
a::Float64
end

julia> bA2, bABC2 = B{A2}(A2(1)), B{ABC}(A2(2))
(B{A2}(A2(1.0)),B{ABC}(A2(2.0)))

julia> sizeof(bA2), sizeof(bABC2)
(8,8)





On Thursday, February 4, 2016 at 2:56:46 PM UTC-5, Josh Langsfeld wrote:
>
> I may be mistaken, but I think setting the type parameter to be abstract 
> is indeed the same as setting the field itself to be abstract. This snippet 
> is my evidence:
>
> julia> abstract ABC
>
> julia> immutable A <: ABC
>  a::Float32
>end
>
> julia> type B{T<:ABC}
>  a::T
>end
>
> julia> bA, bABC = B{A}(A(1)), B{ABC}(A(2))
> (B{A}(A(1.0f0)),B{ABC}(A(2.0f0)))
>
> julia> sizeof(bA), sizeof(bABC)
> (4,8)
>
> Even though both 'B' objects contain an 'A' immutable, bABC keeps it as a 
> pointer (size 8) whereas bA can directly unpack it into the definition.
>
>
> On Thursday, February 4, 2016 at 1:59:17 PM UTC-5, Christopher Alexander 
> wrote:
>>
>> Oh cool!  I was worried, since my call method was passing in the abstract 
>> type if none was specified (ie I wasn't setting a value for the param "a"), 
>> that it would just be the same as if I hadn't used a parametric type at all 
>> and just set the type of "a" to the abstract type.
>>
>> Thanks!
>>
>> Chris
>>
>> On Thursday, February 4, 2016 at 11:50:07 AM UTC-5, Kevin Squire wrote:
>>>
>>> No, `a` is the (concrete) type `T`, which is a subtype of `ABC` (and a 
>>> new type `B{T}` is created for each `T`).  So you shouldn't lose 
>>> performance because of this.
>>>
>>> Cheers,
>>>Kevin
>>>
>>> On Thu, Feb 4, 2016 at 8:10 AM, Christopher Alexander >> > wrote:
>>>
 Let's say I have the following types:

 abstract ABC

 type A <: ABC
 a::Float64
 end

 type B{T <: ABC}
 a::T
 end

 In some cases, I need for type "B" to be incompletely initialized so 
 that I can define its parameter "a" later.  I've found out that you can do 
 something like this:

 type B{T <: ABC}
 a::T
 
 call(::Type{B}) = new{ABC}()
 end

 which then allows this:

 julia> myB = B()
 B{ABC}(#undef)

 My question is, I'm assuming you lose any of the performance gain by 
 using the parametric type in this case because you are still using the 
 abstract type "ABC" for the parameter "a" (even if you define it later 
 with 
 a concrete "A").   Is there a better way to do this?

 Thanks!

 Chris

>>>
>>>

[julia-users] Re: PyPlot

2016-02-04 Thread digxx
Sorry I meant:
http://matplotlib.org/users/installing.html#windows


[julia-users] Re: UInt8 in hist()

2016-02-04 Thread Diego Javier Zea
Hi! 
I can't understand your question/problem... 
Are you looking for something like this:

julia> using Gadfly

julia> A = rand(UInt8, 1000);

julia> B = rand(UInt8, 1000);

julia> plot(layer(x=A, Geom.histogram, Theme(default_color=colorant"orange"
)), 
   layer(x=B, Geom.histogram, Theme(default_color=colorant"brown")))

?

Best!


El martes, 2 de febrero de 2016, 2:25:19 (UTC-3), marusu escribió:
>
> Hi, I'm newbie.
>
> I'm trying to make histogram for graphics.
> BMP data is made with UInt8, so I threw UInt8 array to hist().
> It does not work properly.
> I suppose comparing A and B may be confused in hist().
> So what shall I do?
>
>
> There is a sample code. rand(UInt8, 1000) * 1.0 may work fine.
>
> # create data
> data1d= rand(UInt8, 1000)
> (edges, counts)= hist(data1d, -1:255)
> # draw Histogram
> using Winston
> h= Histogram(edges, counts)
> p= FramedPlot()
> add(p, h)
>


[julia-users] PyPlot

2016-02-04 Thread digxx
Installing PyPLot creates a folder .matplotlib which only contains a cache 
file
fontList.cache
and a tex.cache folder...Do I need to install matplotlib manually from 
http://matplotlib.org/api/pyplot_api.html#module-matplotlib.pyplot ???
Because here: https://github.com/stevengj/PyPlot.jl
it said it would be installed automatically when the private python version 
is installed, but I'm not sure if these 2 files are it. That I can't 
believe so what do I have to do to continue since using:
plot(x,y) for some arrays x,y I just get the output
julia> plot(x,y)
1-element Array{Any,1}:
 PyObject 
Can I use the browser for plotting like in Gadfly?!?


Re: [julia-users] Parametric Types with Incomplete Initialization

2016-02-04 Thread Josh Langsfeld
I may be mistaken, but I think setting the type parameter to be abstract is 
indeed the same as setting the field itself to be abstract. This snippet is 
my evidence:

julia> abstract ABC

julia> immutable A <: ABC
 a::Float32
   end

julia> type B{T<:ABC}
 a::T
   end

julia> bA, bABC = B{A}(A(1)), B{ABC}(A(2))
(B{A}(A(1.0f0)),B{ABC}(A(2.0f0)))

julia> sizeof(bA), sizeof(bABC)
(4,8)

Even though both 'B' objects contain an 'A' immutable, bABC keeps it as a 
pointer (size 8) whereas bA can directly unpack it into the definition.


On Thursday, February 4, 2016 at 1:59:17 PM UTC-5, Christopher Alexander 
wrote:
>
> Oh cool!  I was worried, since my call method was passing in the abstract 
> type if none was specified (ie I wasn't setting a value for the param "a"), 
> that it would just be the same as if I hadn't used a parametric type at all 
> and just set the type of "a" to the abstract type.
>
> Thanks!
>
> Chris
>
> On Thursday, February 4, 2016 at 11:50:07 AM UTC-5, Kevin Squire wrote:
>>
>> No, `a` is the (concrete) type `T`, which is a subtype of `ABC` (and a 
>> new type `B{T}` is created for each `T`).  So you shouldn't lose 
>> performance because of this.
>>
>> Cheers,
>>Kevin
>>
>> On Thu, Feb 4, 2016 at 8:10 AM, Christopher Alexander  
>> wrote:
>>
>>> Let's say I have the following types:
>>>
>>> abstract ABC
>>>
>>> type A <: ABC
>>> a::Float64
>>> end
>>>
>>> type B{T <: ABC}
>>> a::T
>>> end
>>>
>>> In some cases, I need for type "B" to be incompletely initialized so 
>>> that I can define its parameter "a" later.  I've found out that you can do 
>>> something like this:
>>>
>>> type B{T <: ABC}
>>> a::T
>>> 
>>> call(::Type{B}) = new{ABC}()
>>> end
>>>
>>> which then allows this:
>>>
>>> julia> myB = B()
>>> B{ABC}(#undef)
>>>
>>> My question is, I'm assuming you lose any of the performance gain by 
>>> using the parametric type in this case because you are still using the 
>>> abstract type "ABC" for the parameter "a" (even if you define it later with 
>>> a concrete "A").   Is there a better way to do this?
>>>
>>> Thanks!
>>>
>>> Chris
>>>
>>
>>

Re: [julia-users] readall() from osascript process (MacOS X)?

2016-02-04 Thread cormullion
Yay, it all works, thanks again. BTW, it's for this hacky script that I use 
when editing text files — it pads out the second part of each line starting at 
a particular character so that all the lines are vertically aligned on that 
character (probably much easier in other editors...).

 function readwrite()
 userinput = readall(`osascript -e "display dialog \"Align on\" default 
answer \"#\""`)
 chr = chomp(last(split(userinput, ':')))
 widest = 1
 # read all input into array
 buffer = []
 while !eof(STDIN)
 line = chomp(readline(STDIN))
 chrpos = contains(line, chr)
 if chrpos
 if searchindex(line, chr) > widest
 widest = searchindex(line, chr)
 end
 end
 push!(buffer, line)
 end

 for line in buffer
 chrpos = contains(line, chr)
 if chrpos && (line != "")
 # chop line in two
 chrpos = searchindex(line, chr)
 firsthalf = line[1:chrpos-1]
 secondhalf = line[chrpos:end]
 newline = rpad(firsthalf, widest, " ") * secondhalf
 println(newline)
 else
 # don't bother
 println(line)
 end
 end
 end



[julia-users] Conda

2016-02-04 Thread digxx
When I do not have Conda installed but install PyCall in Julia does 
Pkg.add("PyCall") still installs its own small PYthon distribution?


[julia-users] Re: Solve ode with initial conditions

2016-02-04 Thread jmarcellopereira
Hi j
in fact, the solution is not easy. I got your tip and made this way:

C1 = Sym("C1")

# eq1 na forma: substituir x por 0 na parte direita da sol_simb
# e subtrair a expressao pelo valor de y0

eq1 = subs(rhs(sol_simb),x=>0) - 1

SymPy.solve(eq1,C1)




Em quinta-feira, 4 de fevereiro de 2016 11:23:15 UTC-2, j verzani escreveu:
>
> Then this should work where `u` is the Symbolic Function and eqn is just 
> `diff(u(x),x) - 2u(x)`: `dsolve(eqn, ics=Dict(u(x0)=>y0))`, but it doesn't 
> for me :( I think the problem is that initial conditions seem to only work 
> with the power series method. For this problem this call will work with an 
> initial condition: `dsolve(eqn, ics=Dict(u(x0)=>y0), 
> hint="1st_power_series")`. Which isn't too satisfying, as there is an exact 
> answer.
>
> --J
>
> On Thursday, February 4, 2016 at 7:47:14 AM UTC-5, jmarcell...@ufpi.edu.br 
> wrote:
>>
>> Hi j verzani
>>
>>
>>  SymPy documentation has the "ics", but does not show example: dsolve(
>> *eq*, *func=None*, *hint='default'*, *simplify=True*, *ics=None*, 
>> *xi=None*, *eta=None*, *x0=0*, *n=6*, ***kwargs*)
>> any tips?
>>
>> Em quinta-feira, 4 de fevereiro de 2016 02:01:20 UTC-2, j verzani 
>> escreveu:
>>>
>>> There may be a better way, but here is one that works:
>>>
>>> * extract the RHS of the output: eqn = rhs(out)
>>> * find the symbol for C1 from the output of free_symbols(eqn)
>>> * if (x0,y0) are your initial conditions, then: solve(eqn(x=>x0) - y0, 
>>> C1)
>>>
>>>
>>>
>>> On Wednesday, February 3, 2016 at 10:43:30 PM UTC-5, 
>>> jmarcell...@ufpi.edu.br wrote:

 I want to solve an ode with initial conditions. For example
 using SymPy
 f   = SymFunction("f")
 x,y = Sym("x,y")

 edo1 = SymPy.diff(f(x),x) + x 

 SymPy.dsolve(edo1)

 f(x) == C1 - x^2/2




 How to solve C1?

>>>

Re: [julia-users] Parametric Types with Incomplete Initialization

2016-02-04 Thread Christopher Alexander
Oh cool!  I was worried, since my call method was passing in the abstract 
type if none was specified (ie I wasn't setting a value for the param "a"), 
that it would just be the same as if I hadn't used a parametric type at all 
and just set the type of "a" to the abstract type.

Thanks!

Chris

On Thursday, February 4, 2016 at 11:50:07 AM UTC-5, Kevin Squire wrote:
>
> No, `a` is the (concrete) type `T`, which is a subtype of `ABC` (and a new 
> type `B{T}` is created for each `T`).  So you shouldn't lose performance 
> because of this.
>
> Cheers,
>Kevin
>
> On Thu, Feb 4, 2016 at 8:10 AM, Christopher Alexander  > wrote:
>
>> Let's say I have the following types:
>>
>> abstract ABC
>>
>> type A <: ABC
>> a::Float64
>> end
>>
>> type B{T <: ABC}
>> a::T
>> end
>>
>> In some cases, I need for type "B" to be incompletely initialized so that 
>> I can define its parameter "a" later.  I've found out that you can do 
>> something like this:
>>
>> type B{T <: ABC}
>> a::T
>> 
>> call(::Type{B}) = new{ABC}()
>> end
>>
>> which then allows this:
>>
>> julia> myB = B()
>> B{ABC}(#undef)
>>
>> My question is, I'm assuming you lose any of the performance gain by 
>> using the parametric type in this case because you are still using the 
>> abstract type "ABC" for the parameter "a" (even if you define it later with 
>> a concrete "A").   Is there a better way to do this?
>>
>> Thanks!
>>
>> Chris
>>
>
>

Re: [julia-users] Re: how to undefine variable in composite types

2016-02-04 Thread Stefan Karpinski
What happens to existing objects of a type when you redefine the type?

On Thu, Feb 4, 2016 at 1:46 PM, Michael Landis 
wrote:

> I think it would be nice to be able to undefine a type, so restarting the
> environment is not required when adding or deleting an attribute from a
> type description.  Not being able to update a type definition without
> restarting the environment is a royal pain in the ass.
>
>
> On Saturday, March 8, 2014 at 9:55:37 AM UTC-8, Freddy Chua wrote:
>>
>> Suppose I have a Type
>>
>> type Foo
>>   a
>>   b
>> end
>>
>> f = Foo(1,2)
>> f.a = 1
>> f.b = 2
>>
>> how do I test whether f.a is defined
>> I do this isdefined(f, 1) but isdefined(f, 'a') does not work
>>
>> another question
>> how do i undefine f.a such that isdefined(f,1) now returns false
>>
>


[julia-users] Re: how to undefine variable in composite types

2016-02-04 Thread Michael Landis
I think it would be nice to be able to undefine a type, so restarting the 
environment is not required when adding or deleting an attribute from a 
type description.  Not being able to update a type definition without 
restarting the environment is a royal pain in the ass.

On Saturday, March 8, 2014 at 9:55:37 AM UTC-8, Freddy Chua wrote:
>
> Suppose I have a Type
>
> type Foo
>   a
>   b
> end
>
> f = Foo(1,2)
> f.a = 1
> f.b = 2
>
> how do I test whether f.a is defined
> I do this isdefined(f, 1) but isdefined(f, 'a') does not work
>
> another question
> how do i undefine f.a such that isdefined(f,1) now returns false
>


Re: [julia-users] load a Julia dataframe from Microsoft SQL Server table

2016-02-04 Thread Stefan Karpinski
Not a model of clarity (ANSI and Unicode are not encodings), but this page
seems to be the best resource on this:

https://msdn.microsoft.com/en-us/library/ms709439(v=vs.85).aspx

It seems that there's a parallel "Unicode" API for ODBC drivers that
support it. Moreover:

Currently, the only Unicode encoding that ODBC supports is UCS-2, which
> uses a 16-bit integer (fixed length) to represent a character. Unicode
> allows applications to work in different languages.


So using Klingon is off the table. Although the design of UTF-16 is such
that sending UTF-16 to an application that expects UCS-2 will probably work
reasonably well, as long as it treats it as "just data".

This still doesn't explain why some drivers are accepting UCS-2/UTF-16 when
called with the non-Unicode API.

On Thu, Feb 4, 2016 at 1:12 PM, Stefan Karpinski 
wrote:

> The real issue is this:
>
> SQLCHAR is for encodings with 8-bit code units.
>
>
> Condescending lecture on encodings notwithstanding, UTF-16 is not such an
> encoding, yet UTF-16 is what the ODBC package is currently sending
> to SQLExecDirect for an argument of type SQLCHAR * – and somehow it seems
> to be working for many drivers, which still makes no sense to me. I can
> only conclude that some ODBC drivers are treating this as a void * argument
> and they expect pointers to data in whatever encoding they prefer, not
> specifically in encodings with 8-bit code units.
>
> Querying the database about what encoding it expects is a good idea, but
> how does one do that? The SQLGetInfo
> 
> function seems like a good candidate but this page doesn't include
> "encoding" or "utf" anywhere.
>
> On Thu, Feb 4, 2016 at 7:53 AM, Milan Bouchet-Valat 
> wrote:
>
>> Le mercredi 03 février 2016 à 11:44 -0800, Terry Seaward a écrit :
>> > From R, it seems like the encoding is based on the connection (as
>> > opposed to being hard coded). See `enc <- attr(channel, "encoding")`
>> > below:
>> >
>> > ```
>> > [...]
>> >
>> > Digging down `odbcConnect` is just a wrapper for `odbcDriverConnect`
>> > which has the following parameter `DBMSencoding = ""`. This calls the
>> > `C` function `C_RODBCDriverConnect` (available here:RODBC_1.3-
>> > 12.tar.gz), which has no reference to encodings. So `attr(channel,
>> > "encoding")` is simply `DBMSencoding`, i.e. `""`.
>> >
>> > It seems to come down to `iconv(..., to = "")` which, from the R
>> > source code, uses `win_iconv.c` attached. I can't seem to find how
>> > `""` is handled, i.e. is there some default value based on the
>> > system?
>> "" refers to the encoding of the current system locale. This is a
>> reasonable guess, but it will probably be wrong in many cases (else, R
>> wouldn't have provided this option at all).
>>
>>
>> Regards
>>
>
>


Re: [julia-users] load a Julia dataframe from Microsoft SQL Server table

2016-02-04 Thread Stefan Karpinski
The real issue is this:

SQLCHAR is for encodings with 8-bit code units.


Condescending lecture on encodings notwithstanding, UTF-16 is not such an
encoding, yet UTF-16 is what the ODBC package is currently sending
to SQLExecDirect for an argument of type SQLCHAR * – and somehow it seems
to be working for many drivers, which still makes no sense to me. I can
only conclude that some ODBC drivers are treating this as a void * argument
and they expect pointers to data in whatever encoding they prefer, not
specifically in encodings with 8-bit code units.

Querying the database about what encoding it expects is a good idea, but
how does one do that? The SQLGetInfo
 function
seems like a good candidate but this page doesn't include "encoding" or
"utf" anywhere.

On Thu, Feb 4, 2016 at 7:53 AM, Milan Bouchet-Valat 
wrote:

> Le mercredi 03 février 2016 à 11:44 -0800, Terry Seaward a écrit :
> > From R, it seems like the encoding is based on the connection (as
> > opposed to being hard coded). See `enc <- attr(channel, "encoding")`
> > below:
> >
> > ```
> > [...]
> >
> > Digging down `odbcConnect` is just a wrapper for `odbcDriverConnect`
> > which has the following parameter `DBMSencoding = ""`. This calls the
> > `C` function `C_RODBCDriverConnect` (available here:RODBC_1.3-
> > 12.tar.gz), which has no reference to encodings. So `attr(channel,
> > "encoding")` is simply `DBMSencoding`, i.e. `""`.
> >
> > It seems to come down to `iconv(..., to = "")` which, from the R
> > source code, uses `win_iconv.c` attached. I can't seem to find how
> > `""` is handled, i.e. is there some default value based on the
> > system?
> "" refers to the encoding of the current system locale. This is a
> reasonable guess, but it will probably be wrong in many cases (else, R
> wouldn't have provided this option at all).
>
>
> Regards
>


[julia-users] Re: Executing a Julia script from python

2016-02-04 Thread Nils Gudat
If you have a few minutes watch this video, in which Stefan explains how to 
use Julia from within Python: https://www.youtube.com/watch?v=PsjANO10KgM 
(you'll be especially interested in the bit starting around minute 25)


[julia-users] Re: Elapsed CPU time in Julia?

2016-02-04 Thread Ritchie Lee
You may want to take a look at the CPUTime package.
https://github.com/schmrlng/CPUTime.jl

On Wednesday, February 3, 2016 at 12:28:28 PM UTC-8, Lytu wrote:
>
> Hello Julia users,
>
> Can someone tell me what's the equivalent of matlab elapsed cputime in 
> Julia
>
> For example i Matlab, we can do this:
>
>t = cputime;
>x=4;
>
>iter = 1; 
>
>z = ones(1,4);
>
>y=x*2*z;
>
> e = cputime-t
>
>
> But in Julia i don't seem to find how to do this. I thought i can use 
>
>t=time()
>
>x=4;
>
>iter = 1; 
>
>z = ones(1,4);
>
>y=x*2*z;
>
>e=time()-t
>
>
> But time() in Julia is not the elapsed CPU time, it's a wall clock time.
>
>
> Can someone help me?
>
>
> Thank you
>
>

[julia-users] Re: Announcing "Persist": Evaluating Julia expressions in the background

2016-02-04 Thread cdm

any thoughts on how this relates to threading / multi-threading and 
parallelisation ... ?


Re: [julia-users] Parametric Types with Incomplete Initialization

2016-02-04 Thread Kevin Squire
No, `a` is the (concrete) type `T`, which is a subtype of `ABC` (and a new
type `B{T}` is created for each `T`).  So you shouldn't lose performance
because of this.

Cheers,
   Kevin

On Thu, Feb 4, 2016 at 8:10 AM, Christopher Alexander 
wrote:

> Let's say I have the following types:
>
> abstract ABC
>
> type A <: ABC
> a::Float64
> end
>
> type B{T <: ABC}
> a::T
> end
>
> In some cases, I need for type "B" to be incompletely initialized so that
> I can define its parameter "a" later.  I've found out that you can do
> something like this:
>
> type B{T <: ABC}
> a::T
>
> call(::Type{B}) = new{ABC}()
> end
>
> which then allows this:
>
> julia> myB = B()
> B{ABC}(#undef)
>
> My question is, I'm assuming you lose any of the performance gain by using
> the parametric type in this case because you are still using the abstract
> type "ABC" for the parameter "a" (even if you define it later with a
> concrete "A").   Is there a better way to do this?
>
> Thanks!
>
> Chris
>


[julia-users] Executing a Julia script from python

2016-02-04 Thread parth patel
If I have a Julia script, how do I execute the entire julia script from a 
python program. As in i want to call the Julia script from my python code 
and have the result returned to python.


[julia-users] Parametric Types with Incomplete Initialization

2016-02-04 Thread Christopher Alexander
Let's say I have the following types:

abstract ABC

type A <: ABC
a::Float64
end

type B{T <: ABC}
a::T
end

In some cases, I need for type "B" to be incompletely initialized so that I 
can define its parameter "a" later.  I've found out that you can do 
something like this:

type B{T <: ABC}
a::T

call(::Type{B}) = new{ABC}()
end

which then allows this:

julia> myB = B()
B{ABC}(#undef)

My question is, I'm assuming you lose any of the performance gain by using 
the parametric type in this case because you are still using the abstract 
type "ABC" for the parameter "a" (even if you define it later with a 
concrete "A").   Is there a better way to do this?

Thanks!

Chris


[julia-users] Re: PyPlot and art3D

2016-02-04 Thread Alex Dowling
Thanks!

On Wednesday, February 3, 2016 at 2:41:03 PM UTC-6, Steven G. Johnson wrote:
>
>
>
> On Tuesday, February 2, 2016 at 5:49:48 PM UTC-5, Alex Dowling wrote:
>>
>> Hello,
>>
>> I'm having trouble finding examples for using art3D through the PyPlot 
>> module in Julia. Ultimately I'd like to reproduce this example: 
>> http://stackoverflow.com/questions/4622057/plotting-3d-polygons-in-python-matplotlib
>>  
>> (Python, code below)
>>
>
> This works for me (in Julia 0.4):
>
> using PyPlot
> const Poly3DCollection = PyPlot.mplot3d[:art3d][:Poly3DCollection]
> fig = figure()
> ax = Axes3D(fig)
> x = [0,1,1,0]
> y = [0,0,1,1]
> z = [0,1,0,1]
> verts = (collect(zip(x,y,z)),)
> ax[:add_collection3d](Poly3DCollection(verts)) 
>
>

[julia-users] Re: Solve ode with initial conditions

2016-02-04 Thread j verzani
Then this should work where `u` is the Symbolic Function and eqn is just 
`diff(u(x),x) - 2u(x)`: `dsolve(eqn, ics=Dict(u(x0)=>y0))`, but it doesn't 
for me :( I think the problem is that initial conditions seem to only work 
with the power series method. For this problem this call will work with an 
initial condition: `dsolve(eqn, ics=Dict(u(x0)=>y0), 
hint="1st_power_series")`. Which isn't too satisfying, as there is an exact 
answer.

--J

On Thursday, February 4, 2016 at 7:47:14 AM UTC-5, jmarcell...@ufpi.edu.br 
wrote:
>
> Hi j verzani
>
>
>  SymPy documentation has the "ics", but does not show example: dsolve(*eq*, 
> *func=None*, *hint='default'*, *simplify=True*, *ics=None*, *xi=None*, 
> *eta=None*, *x0=0*, *n=6*, ***kwargs*)
> any tips?
>
> Em quinta-feira, 4 de fevereiro de 2016 02:01:20 UTC-2, j verzani escreveu:
>>
>> There may be a better way, but here is one that works:
>>
>> * extract the RHS of the output: eqn = rhs(out)
>> * find the symbol for C1 from the output of free_symbols(eqn)
>> * if (x0,y0) are your initial conditions, then: solve(eqn(x=>x0) - y0, C1)
>>
>>
>>
>> On Wednesday, February 3, 2016 at 10:43:30 PM UTC-5, 
>> jmarcell...@ufpi.edu.br wrote:
>>>
>>> I want to solve an ode with initial conditions. For example
>>> using SymPy
>>> f   = SymFunction("f")
>>> x,y = Sym("x,y")
>>>
>>> edo1 = SymPy.diff(f(x),x) + x 
>>>
>>> SymPy.dsolve(edo1)
>>>
>>> f(x) == C1 - x^2/2
>>>
>>>
>>>
>>>
>>> How to solve C1?
>>>
>>

Re: [julia-users] Plotting with Plot

2016-02-04 Thread digxx
2 axes on the left is also not supported?


Re: [julia-users] Plotting with Plot

2016-02-04 Thread digxx
-.- Yeah sure..I just thought maybe there is a method still possible not 
that direct like axis=... which I still makes it work for Gadfly because as 
far as I thought Gadfly was the most comprehensive Plotting package for 
Julia, am I wrong?


Re: [julia-users] load a Julia dataframe from Microsoft SQL Server table

2016-02-04 Thread Milan Bouchet-Valat
Le mercredi 03 février 2016 à 11:44 -0800, Terry Seaward a écrit :
> From R, it seems like the encoding is based on the connection (as
> opposed to being hard coded). See `enc <- attr(channel, "encoding")`
> below:
> 
> ```
> [...]
> 
> Digging down `odbcConnect` is just a wrapper for `odbcDriverConnect`
> which has the following parameter `DBMSencoding = ""`. This calls the
> `C` function `C_RODBCDriverConnect` (available here:RODBC_1.3-
> 12.tar.gz), which has no reference to encodings. So `attr(channel,
> "encoding")` is simply `DBMSencoding`, i.e. `""`.
> 
> It seems to come down to `iconv(..., to = "")` which, from the R
> source code, uses `win_iconv.c` attached. I can't seem to find how
> `""` is handled, i.e. is there some default value based on the
> system?
"" refers to the encoding of the current system locale. This is a
reasonable guess, but it will probably be wrong in many cases (else, R
wouldn't have provided this option at all).


Regards


Re: [julia-users] rref in 0.4.3

2016-02-04 Thread Kevin Squire
Hi Linus,

There are suggestions in that pull request for alternatives to rref.

Alternatively, you can simply copy the function yourself from that pull
request and, e.g., include it in your .juliarc.jl file.

Cheers,
   Kevin

On Thu, Feb 4, 2016 at 4:47 AM, Linus Härenstam-Nielsen  wrote:

> So it seems like the rref function has been taken out from Base (
> https://github.com/JuliaLang/julia/pull/9804). Is there a package
> floating around that contains the same function? I really liked having it
> for checking my work and for a quick way of find spanning vectors for
> kernel spaces etc..
>
>
>


Re: [julia-users] load a Julia dataframe from Microsoft SQL Server table

2016-02-04 Thread Scott Jones
I just have have been clearer - it is just a superset of the printable 
characters, but, as it reuses assigned (even though pretty much never used) 
control character positions, it is not truly a superset.  ASCII is a 7-bit 
subset of ANSI Latin-1, which is an 8-bit subset of UCS-2, which is a 
16-bit subset that can represent only the BMP, which is a subset of the 
Unicode code points (which need 21 bits).

On Thursday, February 4, 2016 at 4:52:33 AM UTC-5, Páll Haraldsson wrote:
>
> On Thursday, February 4, 2016 at 5:33:35 AM UTC, Scott Jones wrote:
>>
>> SQLCHAR is for encodings with 8-bit code units.  It doesn't imply ASCII 
>> or UTF-8 (probably one of the more common character sets used with that is 
>> actually Microsoft's CP1252, which is often mistakenly described as ANSI 
>> Latin-1 - of which it is a superset).
>>
>
> When I read that, I thought, that must not be true.. You can't have s 
> superset (add letters) without dropping others (implying a superset of a 
> subset), so I looked up:
>
> https://en.wikipedia.org/wiki/Windows-1252
> "differs from the IANA's ISO-8859-1 by using displayable characters rather 
> than control characters in the 80 to 9F (hex) range. Notable additional 
> characters are curly quotation marks, the Euro sign, and all the printable 
> characters that are in ISO 8859-15.
> [..]
> This is now standard behavior in the HTML 5 
>  specification, which requires that 
> documents advertised as ISO-8859-1 actually be parsed with the Windows-1252 
> encoding.[1]  In 
> January 2016 1.0% of all web sites use Windows-1252."
>
> Still, despite this 1.0% I think we should support this encoding (in a 
> way, if not its own 8-bit-only type (I'm not sure we need to support any 
> other 8-bit one); it's no longer just some Microsoft thing as I assumed..), 
> as it is ideal for most of Europe (and even the US/world because of "curly 
> quotation"). I've been thinking of doing a sting-type, that does the same 
> as Python, encodes in 8-bit when possible, possibly 7-bit (then it can 
> still say it's UTF-8 and fast indexing is known, note the strings are 
> immutable).
>
> It wouldn't surprise me that "UTF-8" would sometimes, incorrectly, include 
> this as the "Latin-1" subset..
>
> I wander if this screws up sorting.. It's not like the exact position of 
> the Euro sign is to important in alphabetical sorting. I could argue it be 
> sorted with E e but I assume just after A-Z a-z if ok for most..
>
> I had never heard of "control characters in the 80 to 9F (hex) range", 
> assuming then it's a very obscure/ancient thing that can be assumed to be 
> never used anymore..
>
>
> Even when something says it is UTF-8, it frequently is not *really* valid 
>> UTF-8, for example, there are two common variations of UTF-8, CESU-8, used 
>> by MySQL and others, which encodes any non-BMP code point using the two 
>> UTF-16 surrogate pairs, i.e. to 6 bytes instead of the correct 4-byte UTF-8 
>> sequence, and Java's Modified UTF-8, which is the same as CESU-8, plus 
>> embedded \0s are encoded in a "long" form (0xc0 0x80)
>>
>
> Not only those..
>
> I thought the WTF variant (important for us, because of 
> Windows-filenames?) of UTF-8 was a joke/vandalism at Wikipedia until I read 
> more closely on this I just saw:
>
> https://en.wikipedia.org/wiki/UTF-8#WTF-8
>

I ever hadn't run across that in my work, but my work was in databases, 
usually Unix (AIX, Solaris, etc) or Linux, not so much on Windows any 
longer, and I added Unicode support before surrogates even existed (they 
were added in Unicode 2.0, but not actually used until Unicode 3.0).
I'm not sure what you'd want to do to convert that for use in Julia? (btw, 
I think the initials of the "format" says it all!)



[julia-users] rref in 0.4.3

2016-02-04 Thread Linus Härenstam-Nielsen
So it seems like the rref function has been taken out from Base 
(https://github.com/JuliaLang/julia/pull/9804). Is there a package floating 
around that contains the same function? I really liked having it for 
checking my work and for a quick way of find spanning vectors for kernel 
spaces etc.. 




[julia-users] Re: Solve ode with initial conditions

2016-02-04 Thread jmarcellopereira
Hi j verzani


 SymPy documentation has the "ics", but does not show example: dsolve(*eq*, 
*func=None*, *hint='default'*, *simplify=True*, *ics=None*, *xi=None*, 
*eta=None*, *x0=0*, *n=6*, ***kwargs*)
any tips?

Em quinta-feira, 4 de fevereiro de 2016 02:01:20 UTC-2, j verzani escreveu:
>
> There may be a better way, but here is one that works:
>
> * extract the RHS of the output: eqn = rhs(out)
> * find the symbol for C1 from the output of free_symbols(eqn)
> * if (x0,y0) are your initial conditions, then: solve(eqn(x=>x0) - y0, C1)
>
>
>
> On Wednesday, February 3, 2016 at 10:43:30 PM UTC-5, 
> jmarcell...@ufpi.edu.br wrote:
>>
>> I want to solve an ode with initial conditions. For example
>> using SymPy
>> f   = SymFunction("f")
>> x,y = Sym("x,y")
>>
>> edo1 = SymPy.diff(f(x),x) + x 
>>
>> SymPy.dsolve(edo1)
>>
>> f(x) == C1 - x^2/2
>>
>>
>>
>>
>> How to solve C1?
>>
>

Re: [julia-users] Elapsed CPU time in Julia?

2016-02-04 Thread Patrick Kofod Mogensen
That is because it is not registered, you have to use 
Pkg.clone("https://github.com/johnmyleswhite/Benchmarks.jl";)

On Thursday, February 4, 2016 at 11:56:32 AM UTC+1, Lytu wrote:
>
> The problem is that it is not possible for me to add Benchmarks.jl package 
> when i do Pkg,add("Benchmarks"), i have something like "unknown package 
> Benchmarks".
>
> On Thursday, 4 February 2016 01:52:22 UTC+1, Kevin Squire wrote:
>>
>> Benchmarks is great!  JMW, any chance you can register it as an official 
>> package (and deprecate Benchmark.jl).
>>
>> (I guess I could file an issue.)
>>
>> Cheers,
>>Kevin 
>>
>> On Wednesday, February 3, 2016, Stefan Karpinski  
>> wrote:
>>
>>> You may want to check out Benchmarks.jl 
>>> , which goes to 
>>> significant lengths to do benchmarking correctly.
>>>
>>> On Wed, Feb 3, 2016 at 4:05 PM, Milan Bouchet-Valat  
>>> wrote:
>>>
 Le mercredi 03 février 2016 à 12:55 -0800, Christopher Alexander a
 écrit :
 > Try doing something like:
 >
 > tic()
 > # my code
 > toc()
 Be careful with tic() and toc() in Julia. In most cases, when
 benchmarking, you should wrap your code in a function to make sure it
 gets specialized on the argument types, instead of running it from the
 REPL. So in general it's better to do:
 @time myfun(arg1, arg2, ...)

 See http://docs.julialang.org/en/latest/manual/performance-tips/#measur
 e-performance-with-time-and-pay-attention-to-memory-allocation 
 


 Regards

 > On Wednesday, February 3, 2016 at 3:28:28 PM UTC-5, Lytu wrote:
 > > Hello Julia users,
 > >
 > > Can someone tell me what's the equivalent of matlab elapsed cputime
 > > in Julia
 > >
 > > For example i Matlab, we can do this:
 > >t = cputime;
 > >x=4;
 > >iter = 1; 
 > >z = ones(1,4);
 > >y=x*2*z;
 > >e = cputime-t
 > >
 > > But in Julia i don't seem to find how to do this. I thought i can
 > > use 
 > >t=time()
 > >x=4;
 > >iter = 1; 
 > >z = ones(1,4);
 > >y=x*2*z;
 > >e=time()-t
 > >
 > > But time() in Julia is not the elapsed CPU time, it's a wall clock
 > > time.
 > >
 > > Can someone help me?
 > >
 > > Thank you
 > >

>>>
>>>

Re: [julia-users] Elapsed CPU time in Julia?

2016-02-04 Thread Lytu
The problem is that it is not possible for me to add Benchmarks.jl package 
when i do Pkg,add("Benchmarks"), i have something like "unknown package 
Benchmarks".

On Thursday, 4 February 2016 01:52:22 UTC+1, Kevin Squire wrote:
>
> Benchmarks is great!  JMW, any chance you can register it as an official 
> package (and deprecate Benchmark.jl).
>
> (I guess I could file an issue.)
>
> Cheers,
>Kevin 
>
> On Wednesday, February 3, 2016, Stefan Karpinski  > wrote:
>
>> You may want to check out Benchmarks.jl 
>> , which goes to 
>> significant lengths to do benchmarking correctly.
>>
>> On Wed, Feb 3, 2016 at 4:05 PM, Milan Bouchet-Valat  
>> wrote:
>>
>>> Le mercredi 03 février 2016 à 12:55 -0800, Christopher Alexander a
>>> écrit :
>>> > Try doing something like:
>>> >
>>> > tic()
>>> > # my code
>>> > toc()
>>> Be careful with tic() and toc() in Julia. In most cases, when
>>> benchmarking, you should wrap your code in a function to make sure it
>>> gets specialized on the argument types, instead of running it from the
>>> REPL. So in general it's better to do:
>>> @time myfun(arg1, arg2, ...)
>>>
>>> See http://docs.julialang.org/en/latest/manual/performance-tips/#measur
>>> e-performance-with-time-and-pay-attention-to-memory-allocation 
>>> 
>>>
>>>
>>> Regards
>>>
>>> > On Wednesday, February 3, 2016 at 3:28:28 PM UTC-5, Lytu wrote:
>>> > > Hello Julia users,
>>> > >
>>> > > Can someone tell me what's the equivalent of matlab elapsed cputime
>>> > > in Julia
>>> > >
>>> > > For example i Matlab, we can do this:
>>> > >t = cputime;
>>> > >x=4;
>>> > >iter = 1; 
>>> > >z = ones(1,4);
>>> > >y=x*2*z;
>>> > >e = cputime-t
>>> > >
>>> > > But in Julia i don't seem to find how to do this. I thought i can
>>> > > use 
>>> > >t=time()
>>> > >x=4;
>>> > >iter = 1; 
>>> > >z = ones(1,4);
>>> > >y=x*2*z;
>>> > >e=time()-t
>>> > >
>>> > > But time() in Julia is not the elapsed CPU time, it's a wall clock
>>> > > time.
>>> > >
>>> > > Can someone help me?
>>> > >
>>> > > Thank you
>>> > >
>>>
>>
>>

[julia-users] OSV a possibility with Julia?

2016-02-04 Thread Páll Haraldsson

https://github.com/cloudius-systems/osv
"OSv is a new open-source operating system for virtual-machines. OSv was 
designed from the ground up to execute a single application on top of a 
hypervisor, resulting in superior performance and effortless management 
when compared to traditional operating systems which were designed for a 
vast range of physical machines. [..] and in particular can run an 
unmodified JVM" [they also list Ruby and more.]

This seems interesting for Julia [users] (more than using say Docker?). 
Some supercomputing Linux have the Linux kernel out of the way. This seems 
more radical:


https://github.com/cloudius-systems/osv/wiki/OSv-Linux-ABI-Compatibility
"OSv *mostly* implements Linux's ABI. This means that *most* unmodified 
executable code compiled for Linux can be run in OSv.

[seems ok, except for (only?) this:]

OSv supports only a single process. Therefore, fork(), vfork() and clone() 
are not supported (their use in an executable will cause a crash because of 
a missing symbol).

Moreover, in OSv there is no isolation between the single process and the 
kernel - we do not track which memory, and which resources (threads, 
mutexes, etc.) belong to the process and which to the kernel."


Would this be much of a problem (with say libuv)? Say for parallelism/green 
threading, doesn't Julia bypass the OS anyway?


Looking for my own post (that didn't get any response at the time):
https://groups.google.com/forum/#!searchin/julia-users/unikernel/julia-users/ocalcIrZWsc/wy6J_mPiaZwJ


I found this on "Running Rust on the Rumprun unikernel":
https://groups.google.com/forum/#!searchin/julia-users/unikernel/julia-users/0lay41CDcPk/S-vR8owUCAAJ

-- 
Palli.



Re: [julia-users] load a Julia dataframe from Microsoft SQL Server table

2016-02-04 Thread Páll Haraldsson
On Thursday, February 4, 2016 at 5:33:35 AM UTC, Scott Jones wrote:
>
> SQLCHAR is for encodings with 8-bit code units.  It doesn't imply ASCII or 
> UTF-8 (probably one of the more common character sets used with that is 
> actually Microsoft's CP1252, which is often mistakenly described as ANSI 
> Latin-1 - of which it is a superset).
>

When I read that, I thought, that must not be true.. You can't have s 
superset (add letters) without dropping others (implying a superset of a 
subset), so I looked up:

https://en.wikipedia.org/wiki/Windows-1252
"differs from the IANA's ISO-8859-1 by using displayable characters rather 
than control characters in the 80 to 9F (hex) range. Notable additional 
characters are curly quotation marks, the Euro sign, and all the printable 
characters that are in ISO 8859-15.
[..]
This is now standard behavior in the HTML 5 
 specification, which requires that 
documents advertised as ISO-8859-1 actually be parsed with the Windows-1252 
encoding.[1]  In 
January 2016 1.0% of all web sites use Windows-1252."

Still, despite this 1.0% I think we should support this encoding (in a way, 
if not its own 8-bit-only type (I'm not sure we need to support any other 
8-bit one); it's no longer just some Microsoft thing as I assumed..), as it 
is ideal for most of Europe (and even the US/world because of "curly 
quotation"). I've been thinking of doing a sting-type, that does the same 
as Python, encodes in 8-bit when possible, possibly 7-bit (then it can 
still say it's UTF-8 and fast indexing is known, note the strings are 
immutable).

It wouldn't surprise me that "UTF-8" would sometimes, incorrectly, include 
this as the "Latin-1" subset..

I wander if this screws up sorting.. It's not like the exact position of 
the Euro sign is to important in alphabetical sorting. I could argue it be 
sorted with E e but I assume just after A-Z a-z if ok for most..

I had never heard of "control characters in the 80 to 9F (hex) range", 
assuming then it's a very obscure/ancient thing that can be assumed to be 
never used anymore..


Even when something says it is UTF-8, it frequently is not *really* valid 
> UTF-8, for example, there are two common variations of UTF-8, CESU-8, used 
> by MySQL and others, which encodes any non-BMP code point using the two 
> UTF-16 surrogate pairs, i.e. to 6 bytes instead of the correct 4-byte UTF-8 
> sequence, and Java's Modified UTF-8, which is the same as CESU-8, plus 
> embedded \0s are encoded in a "long" form (0xc0 0x80)
>

Not only those..

I thought the WTF variant (important for us, because of Windows-filenames?) 
of UTF-8 was a joke/vandalism at Wikipedia until I read more closely on 
this I just saw:

https://en.wikipedia.org/wiki/UTF-8#WTF-8

-- 
Palli.



Re: [julia-users] readall() from osascript process (MacOS X)?

2016-02-04 Thread cormullion
Thanks!

Re: [julia-users] AVL Trees - SortedSet?

2016-02-04 Thread Ben Ward
Hi Kevin,

Thanks! That's one less thing for me to implement - no point in re-doing 
stuff already in .jl packages :)

On Thursday, February 4, 2016 at 12:48:50 AM UTC, Kevin Squire wrote:
>
> Not in a place where I can look at that link, but yes, SortedSet and 
> SortedDict are base on AVL trees. 
>
> Cheers,
>Kevin
>
> On Wednesday, February 3, 2016, Ben Ward  > wrote:
>
>> Hi,
>>
>> I'm looking to implement a C library in Julia which makes use of another 
>> library which contains a sorted dictionary called a AVL table. I don't know 
>> much about the technical internals of ALV table, and the C looks 
>> complicated to get into, if Julia already has something that does the job. 
>> Does the data structure SortedSet in DataStructures.jl perform the same 
>> functionality in a similar way? The ALV table C implementation is here: 
>> https://github.com/benedictpaten/sonLib/blob/master/C/inc/avl.h
>>
>> Thanks,
>> Ben.
>>
>

[julia-users] Re: Mutual reference between scripts

2016-02-04 Thread Robert DJ
You can take a look at a package to get inspiration: One master file 
includes all the other files with code and load any 3rd party dependencies. 
You then include the master file in Julia to have all of your functions 
available.

On Thursday, February 4, 2016 at 6:33:35 AM UTC+1, Cristian Garcia wrote:
>
> Hi, I a new Julia user. I am having trouble understanding how to create a 
> structured project. I'd like to split my code into separate files (as you'd 
> expect). I am using "include" to create references between scripts but I 
> run into a "stackoverflow" because of mutual references. I have two files 
> and both include one another. 
>
> What am I doing wrong? How do you structure a project in Julia? I've read 
> the "module" documentation and have searched Google, but it seems that I am 
> missing something fundamental.
>