Re: [julia-users] Generators vs Comprehensions, Type-stability?

2016-09-22 Thread Steven G. Johnson
I don't think the empty case should be the problem. If it can't infer the type, sum just throws an error. So test1(r) actually always returns the same type for r::Array{Float64} in any case where it returns a value at al. The real problem is that eltype(t^2 for t in rand(10)) returns Any.

Re: [julia-users] Generators vs Comprehensions, Type-stability?

2016-09-22 Thread Steven G. Johnson
On Thursday, September 22, 2016 at 6:10:29 PM UTC-4, Tsur Herman wrote: > > The real problem is that eltype(t^2 for t in rand(10)) returns Any. > > > that is not a problem (t^2 for t in rand(10)) is a generator its element > type is Any which means a pointer to something complex. > >> It is a pr

[julia-users] Re: Broadcast slices

2016-09-22 Thread Steven G. Johnson
At some point, it is simpler to just write loops than to try and express a complicated operation in terms of higher-order functions like broadcast.

Re: [julia-users] Generators vs Comprehensions, Type-stability?

2016-09-23 Thread Steven G. Johnson
On Friday, September 23, 2016 at 2:42:00 AM UTC-4, Michele Zaffalon wrote: > > On Fri, Sep 23, 2016 at 2:23 AM, Steven G. Johnson > wrote: >> >> >> We could use type inference on the function t -> t^2 (which is buried in >> the generator) to determine a mor

Re: [julia-users] Generators vs Comprehensions, Type-stability?

2016-09-23 Thread Steven G. Johnson
On Friday, September 23, 2016 at 4:13:53 AM UTC-4, Christoph Ortner wrote: > > The sum of an empty set or vector is undefined it is not zero. > >> you can rewrite it in a more explicit way >> >>> >>> > Actually a sum over an empty set is normally defined to be zero while a > product over an empt

[julia-users] Re: Problems with Memoize in Julia 0.5.0

2016-09-23 Thread Steven G. Johnson
On Friday, September 23, 2016 at 9:08:29 AM UTC-4, Ed Scheinerman wrote: > > Hello, > > I use memoization frequently and have run into two problems with the move > to Julia 0.5.0. > > The first is not too serious and I hope can be fixed readily. The first > time I memoize a function, a warnin

[julia-users] Re: How does promote_op work?

2016-09-24 Thread Steven G. Johnson
On Friday, September 23, 2016 at 6:15:25 PM UTC-4, Pablo Zubieta wrote: > > The problem is empty arrays, when the type cannot be inferred broadcast > uses the types of each element to build the array. When there are no > elements it doesn't know what type to choose. > (For the empty array bro

Re: [julia-users] Generators vs Comprehensions, Type-stability?

2016-09-24 Thread Steven G. Johnson
On Saturday, September 24, 2016 at 9:09:38 AM UTC-4, Michele Zaffalon wrote: > > Sorry for being slow: the input array rand(10) or the output array, the > square of each element of rand(10)? > > julia> (begin;println(t);t^2;end for t=1:10) > Base.Generator{UnitRange{Int64},##37#38}(#37,1:10) >

[julia-users] Re: if-elseif-else programmatically

2016-09-24 Thread Steven G. Johnson
On Saturday, September 24, 2016 at 6:09:14 PM UTC-4, David P. Sanders wrote: > > julia> if rand() < 0.5 > You can also do "if rand(Bool)"

[julia-users] Re: Broadcast slices

2016-09-25 Thread Steven G. Johnson
On Saturday, September 24, 2016 at 9:38:55 PM UTC-4, Brandon Taylor wrote: > > I guess, but I'm trying to write a generic program where I don't know the > size of the array? I'm trying to find Nash Equilibrium for an n dimensional > array, where the player strategies are along dimensions 1:n-1,

[julia-users] Re: eval in current scope

2016-09-27 Thread Steven G. Johnson
On Tuesday, September 27, 2016 at 5:28:40 AM UTC-4, Marius Millea wrote: > > Hi, is there a way to "eval" something in the current scope? > No. I think you are fundamentally misunderstanding what macros do. Macros are functions evaluated at parse-time. The runtime scope doesn't even exist w

Re: [julia-users] Re: eval in current scope

2016-09-27 Thread Steven G. Johnson
On Tuesday, September 27, 2016 at 10:27:59 AM UTC-4, Stefan Karpinski wrote: > > But note that if you want some piece of f to be "pasted" from the user and > have access to certain parts of the local state of f, it's probably a much > better design to let the user pass in a function which f calls

[julia-users] Re: norm() is slow when variables are arguments

2016-09-28 Thread Steven G. Johnson
On a separate note, norm([u; v]) for scalar u and v is going to be a lot slower than hypot(u, v) or sqrt(u*u + v*v) (although the latter does not check for overflow the way hypot does). Allocating little arrays and calling "vector" functions for everything, even small computations on a few sc

Re: [julia-users] ANN: RawArray.jl

2016-10-01 Thread Steven G. Johnson
On Monday, September 26, 2016 at 9:59:15 AM UTC-4, David Smith wrote: > > I also don't need it to read image formats. Part of the reason behind > RawArray is to avoid standard image formats because they are not optimized > for large complex-float arrays. I just want to save multi-GB data arrays

[julia-users] Re: Definition of true for validity

2016-10-01 Thread Steven G. Johnson
https://github.com/JuliaLang/julia/blob/c4ebf7c8bbdfaba034a08fa795b93a5732514c64/src/jltypes.c#L3724

[julia-users] Re: membership checking in heap

2016-10-02 Thread Steven G. Johnson
On Saturday, October 1, 2016 at 1:17:48 PM UTC-4, Athul George Appadan wrote: > > I am trying to find a way to check the membership of a user defined type > object in a heap. This is the code I have written: > > type HeapEntry > k::Int > dist::Float64 > end > > isless(e1::HeapEntry, e2:

[julia-users] Re: Using generators

2016-10-02 Thread Steven G. Johnson
On Sunday, October 2, 2016 at 6:02:13 AM UTC-4, harven wrote: > > I see that julia v0.5 has now generators. That looks promising but the > example given in the docs is not really interesting, > > sum(1/n^2 for n = 1:1000) > > since we have been able to write from start the shorter and

[julia-users] jl_cstr_to_string() variant for wchar_t*

2016-10-03 Thread Steven G. Johnson
See the transcode function to convert wchar strings to/from Julia (UTF8) strings. You only need the LegacyStrings package if you want to work with wchar strings without converting them.

[julia-users] Re: String(Vector{UInt8}) Question

2016-10-05 Thread Steven G. Johnson
On Wednesday, October 5, 2016 at 12:01:32 AM UTC-4, josh...@fastmail.com wrote: > > OK, I understand now: they're continuation bytes for UTF-8 and can't > appear in that context so they get stripped from the string representation. > They don't get stripped — invalid data is still stored in the

[julia-users] Re: read binary file with endianness

2016-10-06 Thread Steven G. Johnson
Yes, just read in the first byte, and then read in the rest of the data, calling ntoh or hton as needed on each datum.

Re: [julia-users] Re: linear algebra question

2016-10-06 Thread Steven G. Johnson
Sorry, I meant qrfact(V)[:Q]

Re: [julia-users] Re: linear algebra question

2016-10-06 Thread Steven G. Johnson
On Wednesday, October 5, 2016 at 3:36:06 PM UTC-4, John Gibson wrote: > > I would do this via QR decomposition. Produce an orthogonal basis for span > v1, ..., vn via QR, then see if v changes when you project onto the space > spanned by the basis. E.g. > > V = [v1 v2 ... vn] > (Q,R) = qr(V) >

[julia-users] Re: travis with dependency on scipy?

2016-10-07 Thread Steven G. Johnson
On Friday, October 7, 2016 at 9:10:44 AM UTC-4, David van Leeuwen wrote: > > Hello, > > For a tiny package that depends > on PyCall and python's scipy.spatial I am trying to engineer a > `.travis.yml`, > You can always do ENV["PYTHON"]="" to force PyCa

[julia-users] Re: Broken PyPlot... need to revert to a previous version asap.

2016-10-08 Thread Steven G. Johnson
There seems to be some breakage right now in Anaconda from their switch from Qt4 to Qt5. Updating to PyCall and PyPlot master, and forcing the Qt4Agg backend (e.g. with ENV["MPLBACKEND"]="Qt4Agg") should work.

[julia-users] Re: How to print an array with the correct shape in 0.5

2016-10-08 Thread Steven G. Johnson
On Friday, October 7, 2016 at 9:30:00 AM UTC-4, spaceLem wrote: > > In Julia 0.4.6 I could print or @show a 2d array, and it would give me a > nicely formatted 2d array > println(reshape(1:4,2,2)) > [1 3 > 2 4] > > However in Julia 0.5 I instead get: > println(reshape(1:4,2,2)) > [1 3; 2 4] > >

[julia-users] Re: Warning since 0.5

2016-10-09 Thread Steven G. Johnson
On Saturday, October 8, 2016 at 5:09:19 PM UTC-4, digxx wrote: > > is f(x)=x^2 not an anonymous function?!?! > No, it has a name "f". An anonymous function is an expression like "x -> x^2" that creates a function object without binding it to a constant name.

Re: [julia-users] Re: Julia 0.5 Highlights

2016-10-12 Thread Steven G. Johnson
On Wednesday, October 12, 2016 at 9:26:54 PM UTC-4, Stefan Karpinski wrote: > > That's a fair point. It seems like it could/should be handled by the same > (not-yet-implemented) mechanism that ensures that `convert(T,x)::T` is > true. Of course, we could choose to enforce this fact via lowering

Re: [julia-users] Re: canonical binary representation for Array

2016-10-13 Thread Steven G. Johnson
write on a numeric array will output the raw bytes, i.e. Column-major data in the native byte order. Matlab arrays are also column major, so reading a Matlab-produced binary format is probably straightforward, but you have to be careful of the byte order. Obviously, you'll have to read the doc

[julia-users] Dictionary type inference

2016-10-13 Thread Steven G. Johnson
Probably there is a missing promote_type rule Try promote_type(typeof(sin),typeof(cos)) ... if this gives Any, please file an issue. (I would try it myself, but am on my phone.)

[julia-users] Re: Performance of release 0.5.0 v 0.4.6.0

2016-10-13 Thread Steven G. Johnson
runtests() runs correctness tests, not performance tests. 0.5 added many more tests, hence they are slower.

[julia-users] Re: How to properly close IJulia Notebooks (so that finalizers are run)

2016-10-13 Thread Steven G. Johnson
If you just close the notebook window, the process is still running (and you can re-connect to it via the Jupyter dashboard). You need to choose "Close and Halt" from the Jupyter file menu.

[julia-users] Re: Dictionary type inference

2016-10-13 Thread Steven G. Johnson
No, promote_type is working. I think this is intended behavior: if you construct a Dict with keys and/or values of different types, then it will default to using Any. For example: julia> Dict(3=>4, 3.5=>4.5) Dict{Any,Any} with 2 entries: 3 => 4 3.5 => 4.5 This was true in Julia 0.4 a

[julia-users] Re: Dictionary type inference

2016-10-13 Thread Steven G. Johnson
I've filed an issue for further discussion: https://github.com/JuliaLang/julia/issues/18906

Re: [julia-users] Re: Julia 0.5 Highlights

2016-10-13 Thread Steven G. Johnson
On Wednesday, October 12, 2016 at 9:40:27 PM UTC-4, Steven G. Johnson wrote: > > > > On Wednesday, October 12, 2016 at 9:26:54 PM UTC-4, Stefan Karpinski wrote: >> >> That's a fair point. It seems like it could/should be handled by the same >> (not-yet-imple

Re: [julia-users] HDF5, how to save string data to file?

2016-10-13 Thread Steven G. Johnson
HDF5.jl supports writing strings. For some reason, datatype(String) doesn't work, but datatype("This is a string") works. So just pass the string data, and not the string type, to datatype. Even simpler, just do write(g, "/dane", "my string"), for example.

[julia-users] Re: return Bool [and casting to Bool]

2016-10-14 Thread Steven G. Johnson
https://github.com/JuliaLang/julia/issues/18367

[julia-users] Re: quadgk with 2 arguments

2016-10-16 Thread Steven G. Johnson
quadgk is fine for vector-valued functions (and in fact any integrand type supporting +, -, *real, and norm, and can also integrate over infinite intervals and contours in the complex plane. But for multidimensional integrals you should use Cuba.jl or Cubature.jl or GSL.jl or similar.

[julia-users] Re: Uniqueness check in PriorityQueue

2016-10-17 Thread Steven G. Johnson
Make a copy before you mutate it. In general, it is not safe to mutate the keys of a dictionary, which is what you are doing.

Re: [julia-users] matrix multiplications

2016-10-18 Thread Steven G. Johnson
On Tuesday, October 18, 2016 at 4:10:57 PM UTC-4, Stefan Karpinski wrote: > > Since it uses the in-place assignment operator .= it could be made to work > as desired, but there's some designing to do. > The problem is that it doesn't know that * is a matrix multiplication until compile-time.

[julia-users] Re: quadgk with 2 arguments

2016-10-18 Thread Steven G. Johnson
On Tuesday, October 18, 2016 at 4:27:22 PM UTC-4, digxx wrote: > > do u have an example for how to use a contour? > quadgk(cis,0,1+1*im)= > probably integrates over the straight line so how can I integrate over the > line gamma(t)=t+im*t^2 > By contour, I just meant straight-line segments. Fo

Re: [julia-users] Re: quadgk with 2 arguments

2016-10-18 Thread Steven G. Johnson
On Tuesday, October 18, 2016 at 4:34:38 PM UTC-4, Michele Zaffalon wrote: > > quadgk(t -> cis(gamma(t)), 0, 1) > No, this is wrong because you forgot the Jacobian factor.

[julia-users] Re: Importing Python data to Julia

2016-10-18 Thread Steven G. Johnson
On Tuesday, October 18, 2016 at 4:42:51 PM UTC-4, Corbin Foucart wrote: > > 2) Call Julia code directly from python (I don't want to perform some > trivial computation as in the examples I've found, I want to operate on the > lists of numpy arrays) > pyjulia can do this.

Re: [julia-users] Re: quadgk with 2 arguments

2016-10-18 Thread Steven G. Johnson
On Tuesday, October 18, 2016 at 7:05:17 PM UTC-4, Mosè Giordano wrote: > > Hi Steven, > > 2016-10-19 0:36 GMT+02:00 Steven G. Johnson >: > > For example: > > > > quadgk(z -> 1/z, 1, 1im, -1, -1im) > > > > integrates 1/z over a closed co

Re: [julia-users] Re: quadgk with 2 arguments

2016-10-18 Thread Steven G. Johnson
On Tuesday, October 18, 2016 at 7:05:17 PM UTC-4, Mosè Giordano wrote: > > In any case, I have to admit that quadgk is much more powerful than > what I expected, at least because purely implemented in Julia, so can > work with any Julia type. > quadgk also supports arbitrary-precision (BigFloat

[julia-users] Re: Python Callbacks using pyjulia

2016-10-19 Thread Steven G. Johnson
It looks like this is a problem in the DASSL.jl package. They made the common mistake of over-specifying the types of their arguments, and in particular they require you to pass a Julia ::Function argument for the equations to be solved, rather than any callable object (here, the Python functi

[julia-users] Re: product of Int64 and Float64 is Int64

2016-10-19 Thread Steven G. Johnson
On Wednesday, October 19, 2016 at 9:53:00 AM UTC-4, Krisztián Pintér wrote: > > > i know i shouldn't, but i'm kinda angry at this "1." notation. saving one > character really worth losing readability? also leading to errors like > this. personally, i would not even allow this syntax at all. >

[julia-users] Re: product of Int64 and Float64 is Int64

2016-10-19 Thread Steven G. Johnson
Also https://github.com/JuliaLang/julia/pull/11529

[julia-users] Re: Python Callbacks using pyjulia

2016-10-19 Thread Steven G. Johnson
A workaround from pyjulia might be to create a Julia function that can wrap a Julia Function around a Python function fwrap = j.eval('f -> (args...) -> f(args...)') and then do j.dasslSolve(fwrap(f), 1.0, [0.0, 10.0]) Not super elegant, but occasionally inter-language calling requires this

[julia-users] Re: bit operations in Julia

2016-10-20 Thread Steven G. Johnson
To find the last bit set, see the trailing_zeros function. See also this section of the manual: http://docs.julialang.org/en/latest/stdlib/numbers/#integers

[julia-users] Re: Eval without JIT

2016-10-20 Thread Steven G. Johnson
eval() already uses an interpreter without JIT for sufficiently simple expressions.

[julia-users] Re: Does new "dot" syntax fuse?

2016-10-20 Thread Steven G. Johnson
Putting things into a function to avoid benchmarking in global scope: foo!(x,y) = x .= cos.(sin.(y)) y = rand(1000); x = similar(y); @time foo!(x, y); gives (after running @time twice to eliminate the compilation time): 0.35 seconds (5 allocations: 176 bytes) i.e. it is not alloca

[julia-users] Testing uncommitted changes to a package

2016-10-21 Thread Steven G. Johnson
Just include your runtests.jl script.

[julia-users] Re: Importing Python data to Julia

2016-10-25 Thread Steven G. Johnson
Don't evaluate Julia code as strings. Just call Julia functions directly. j.inv(randMat) should work

[julia-users] stop reading input from script

2016-10-25 Thread Steven G. Johnson
Wrap the unwanted code in a comment via #= . . =#

Re: [julia-users] use macros like a preprocessor directive?

2016-10-25 Thread Steven G. Johnson
You can use @static to implement a parse-time conditional

Re: [julia-users] Re: Comprehension (generator) with statement IF and the number of true

2016-10-26 Thread Steven G. Johnson
If you want to spend your effort on making this code cleaner, the more Julian thing would be to focus on making it more type-generic, so that it can handle arguments of more types. For example (requires Julia 0.5): function mapeBase{T<:Number,S<:Number}(A::AbstractArray{T}, F::AbstractArray{S})

[julia-users] Re: Matlabs scatteredInterpolant for julia?

2016-10-26 Thread Steven G. Johnson
The https://github.com/kbarbary/Dierckx.jl package can interpolate from unstructured sets of points.

Re: [julia-users] Re: Comprehension (generator) with statement IF and the number of true

2016-10-27 Thread Steven G. Johnson
On Wednesday, October 26, 2016 at 3:29:39 PM UTC-4, DNF wrote: > > Actually, I see only a very marginal performance difference between your > mapeBase_v4 (the first v4, don't know about the second v4) and the loop > version, roughly 10%. Not sure why you're seeing a big difference. > >> Perhaps

Re: [julia-users] 0.5 how to convert to Int

2016-10-27 Thread Steven G. Johnson
On Thursday, October 27, 2016 at 4:21:39 AM UTC-4, Ángel de Vicente wrote: > > > > program...@gmail.com writes: > > > BIG THX, but what about Float array ? > round(Int, rand(5)) also works. (In 0.6 this will probably be deprecated in favor of round.(Int, rand(5)) ...)

Re: [julia-users] Re: Comprehension (generator) with statement IF and the number of true

2016-10-27 Thread Steven G. Johnson
On Thursday, October 27, 2016 at 1:23:47 PM UTC-4, DNF wrote: > > All higher-order functions? I thought it was mainly anonymous functions. > Either way, that's a seriously big slowdown. > All higher-order functions can benefit in Julia 0.5, not just anonymous functions. Because each function

[julia-users] Re: package reproducibility

2016-10-28 Thread Steven G. Johnson
Since all Julia packages are managed via git, it would be easy to write a tool that collects all of the commits of the current packages into a list so that you can install the same commits on another system. I don't think there is an existing tool that automates this, though?

[julia-users] Re: Unit Testing: should I use Base.Test instead of FactCheck?

2016-10-29 Thread Steven G. Johnson
On Friday, October 28, 2016 at 10:30:28 AM UTC-4, Florian Oswald wrote: > > There is 1 thing I sorely miss from Base.Test coming from FactCheck, and > that is the ability to say > > @fact false --> true "your test failed: false is not true" > @test false || error("your test failed: false is not

[julia-users] best way to reinstall packages after upgrading Julia?

2016-11-01 Thread Steven G. Johnson
When you upgrade from (say) Julia 0.4 to 0.5, you have to re-install all of the packages because the package directory changes. It seems like there should be an automated way to do this. Does something like this exist? Seems like it should be a built-in Pkg feature. (It would be straightfor

Re: [julia-users] best way to reinstall packages after upgrading Julia?

2016-11-01 Thread Steven G. Johnson
On Tuesday, November 1, 2016 at 4:47:58 PM UTC-4, Yichao Yu wrote: > > I believe the current recommend way is to copy REQUIRED and run Pkg.update > Is this documented somewhere? Would be nice to have an easy way to do it from the REPL prompt, without users having to know where these files are.

[julia-users] Re: Error calculating eigs of pentadiagonal matrix.

2016-11-02 Thread Steven G. Johnson
On Wednesday, November 2, 2016 at 6:43:48 AM UTC-4, Alejandro Castellanos wrote: > > I use this command: *l, v = eigs(M,nev=15,which = :SM ,ritzvec=true)* > How are you constructing the matrix M? Apparently eigs thinks that your matrix is symmetric positive-definite (SPD), because it is tryi

[julia-users] Re: Error calculating eigs of pentadiagonal matrix.

2016-11-02 Thread Steven G. Johnson
On Wednesday, November 2, 2016 at 9:48:38 AM UTC-4, Steven G. Johnson wrote: > > > > On Wednesday, November 2, 2016 at 6:43:48 AM UTC-4, Alejandro Castellanos > wrote: >> >> I use this command: *l, v = eigs(M,nev=15,which = :SM ,ritzvec=true)* >> > >

Re: [julia-users] Cannot PyPlot / Matplotlib broken (warnings about font cache?)

2016-11-02 Thread Steven G. Johnson
For the font-cache, see https://github.com/matplotlib/matplotlib/issues/5836 ...there is some ~/.cache/matplotlib directory that you can delete to get rid of this. To tell PyPlot to use the Conda Python, you need to set the PYTHON environment variable and re-build PyCall: ENV["PYTHON"]=

[julia-users] Re: Error calculating eigs of pentadiagonal matrix.

2016-11-02 Thread Steven G. Johnson
On Wednesday, November 2, 2016 at 1:40:17 PM UTC-4, Ralph Smith wrote: > > Eigs uses shift-and-invert for the :sm variant, so it tries to solve M x = > b. Try adding a small sigma parameter. > Yes, but it really should be able to handle matrices with a nontrivial nullspace ... the nullspace is

Re: [julia-users] Cannot PyPlot / Matplotlib broken (warnings about font cache?)

2016-11-02 Thread Steven G. Johnson
On Wednesday, November 2, 2016 at 10:39:58 AM UTC-4, Daniel Carrera wrote: > > On Wednesday, 2 November 2016 15:20:07 UTC+1, Isaiah wrote: > Thanks! I've realized that Conda.jl doesn't actually install Python. But I > could use Anaconda to install Python in /opt and point Julia to that > versio

Re: [julia-users] Cannot PyPlot / Matplotlib broken (warnings about font cache?)

2016-11-02 Thread Steven G. Johnson
On Wednesday, November 2, 2016 at 11:35:20 AM UTC-4, Daniel Carrera wrote: > > Here is an idea for the future: Is it possible to get PyCall to print the > rest of Python's error message so that dummies like me aren't led astray... > It's weird that most of the error was printed but the path to th

[julia-users] Re: Calling Julia code from Python

2016-11-02 Thread Steven G. Johnson
On Wednesday, November 2, 2016 at 2:43:27 PM UTC-4, Alexei Serdiuk wrote: > > I'm new to Julia and, unfortunately, I'm almost zero to Python. > An unfortunate combination — better to learn one programming language before you deal with inter-language calling. > I need to call Julia code from

[julia-users] Re: Equivalent to the Python's None value for the function's default parameter value

2016-11-04 Thread Steven G. Johnson
On Friday, November 4, 2016 at 2:37:38 PM UTC-4, Alex wrote: > > Hi all, > > I need to specify function parameter by default value None/Nothing > You can just use "z=nothing", which is the equivalent of the Python construct, and check "z===nothing". However, z will be type-unstable, so you mi

Re: [julia-users] Re: unicode

2016-11-04 Thread Steven G. Johnson
On Friday, November 4, 2016 at 12:50:55 PM UTC-4, Henri Girard wrote: > > I am using julia-6.0 (but any version do it )(what a wonderfull tool) I > can even define a new value to a symbol. > > What I wish it's only getting rid of quotes : '䷂' = ䷂ > Single quotes define a Char (character) '䷂', d

Re: [julia-users] Passing N-D Julia arrays to C functions

2016-11-04 Thread Steven G. Johnson
Note that using **double is not actually that great a way to do multidimensional arrays in C -- way harder to do the memory management, and also slower. Most high-performance code uses just double* and then accesses it in row-major or column-major order. See, for example, the discussion here

Re: [julia-users] using or import a specific package version

2016-11-05 Thread Steven G. Johnson
On Saturday, November 5, 2016 at 12:38:41 AM UTC-4, Tom Lee wrote: > > Project-local environments sounds like exactly what I am after. Great to > hear its being worked on. I guess we will need to wait until 0.6 for Pkg3? > No, you can do that now. insert!(LOAD_PATH, 1, mypath) insert!(Base.LOA

Re: [julia-users] BigInt And Expression

2016-11-05 Thread Steven G. Johnson
On Saturday, November 5, 2016 at 10:31:24 AM UTC-4, Tamas Papp wrote: > > myexpression{T <: Integer}(a::T) = myexpression(convert(Int128, a)) myexpression(a::Integer) = ... is more concise and is equivalent.

[julia-users] Re: ANN: new blog post on array indexing, iteration, and multidimensional algorithms

2016-11-07 Thread Steven G. Johnson
Would be nice to have a simple performance comparison to NumPy multi-indices for some simple operation like the boxcar filter.

[julia-users] Re: How to built an array with some keys of a dictionary ?

2016-11-07 Thread Steven G. Johnson
On Monday, November 7, 2016 at 9:02:44 AM UTC-5, Fred wrote: > > Hi, > > I have many problems to build arrays with the keys of a dictionary except > for the simple situation : > > a = [uppercase(key) for key in keys(dict)]# works fine > > If I try to select the keys with more complex criteri

Re: [julia-users] Re: How to built an array with some keys of a dictionary ?

2016-11-07 Thread Steven G. Johnson
On Monday, November 7, 2016 at 9:45:37 AM UTC-5, Mauro wrote: > > On Mon, 2016-11-07 at 15:27, Fred > > wrote: > > Hi Steven, > > > > > > I also tried a = Array{String}() unfortunately it produces errors as > well. > > Array{String}(0) > Whoops, sorry about the typo.

Re: [julia-users] Rewriting this function from python to julia

2016-11-07 Thread Steven G. Johnson
On Monday, November 7, 2016 at 3:17:54 PM UTC-5, Jacob Yates wrote: > > I know ^ is an exponent. The whole function is meant to xor strings the > strings end up being the variables s and t > By "xor the strings", I think you mean "xor the bytes"? Note that chr and ord in Python only work for

[julia-users] Re: Julia calling MKL functions from fortran shared library

2016-11-15 Thread Steven G. Johnson
On Tuesday, November 15, 2016 at 4:23:11 AM UTC-5, 博陈 wrote: > > I got > Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so. > Possibly you need to add the directory containing these files (/opt/intel/composer_xe_2015.0.090/mkl/lib or similar?) to your LD_LIBRARY_PATH e

Re: [julia-users] Re: Hide and disable REPL

2016-11-15 Thread Steven G. Johnson
On Friday, November 4, 2016 at 1:28:16 PM UTC-4, David Anthoff wrote: > > > The complete setup is slightly more complicated, but you can imagine just > the following: start a normal julia REPL. Then include a file that will > start a server listening on some socket. This server is all async, so

Re: [julia-users] readdir returns inconsistent types

2015-01-13 Thread Steven G. Johnson
On Tuesday, January 13, 2015 at 7:43:07 PM UTC-5, ele...@gmail.com wrote: > Which can present problems if the UTF8String is displayed or otherwise > used where valid UTF8 is required. > It will display as mojibake, but you will still be able to open the file. There doesn't seem to be much

[julia-users] Re: Shogun Toolbox integration

2015-01-13 Thread Steven G. Johnson
On Tuesday, January 13, 2015 at 6:52:02 AM UTC-5, Куракин Александр wrote: > Is there some way to use Shogun Toolbox (http://shogun-toolbox.org/) with > Julia? > Since it is a C++ library, you can't call it directly from Julia with ccall. (The next Julia release will make it much easier to c

Re: [julia-users] readdir returns inconsistent types

2015-01-14 Thread Steven G. Johnson
On Tuesday, January 13, 2015 at 10:38:23 PM UTC-5, ele...@gmail.com wrote: > > Probably right if the mutations for adding extensions etc are not > conveniently available with Vector{uint8}. > It would certainly be possible to define these operations, e.g. concatenation of a string with a bytev

Re: [julia-users] Strange Type Errors

2015-01-14 Thread Steven G. Johnson
On Wednesday, January 14, 2015 at 4:19:35 PM UTC-5, Milan Bouchet-Valat wrote: Yes, zeros() only accepts integers currently. Maybe this could be > changed to automatically do the conversion when possible. > See https://github.com/JuliaLang/julia/issues/1972

Re: [julia-users] Speed of Julia when a function is passed as an argument, and a different, but much faster coding.

2015-01-15 Thread Steven G. Johnson
See also: http://docs.julialang.org/en/latest/manual/methods/#call-overloading-and-function-like-objects On Thursday, January 15, 2015 at 4:29:57 AM UTC-5, Mauro wrote: > > > Is there an example of the use of this new syntax for 0.4? > > It's in the manual: > http://docs.julialang.org/en/la

[julia-users] Re: inv() return incorrect result

2015-01-15 Thread Steven G. Johnson
I can't reproduce your problem. With m = [2.69E-05-2.25E-051.25E-05-2.30E-05 -1.09E-059.02E-06-1.42E-05-4.29E-06 1.47E-052.11E-06-2.27E-061.61E-062.15E-05 1.42E-05-4.05E-05 -2.25E-05

[julia-users] Re: Julia allocates huge amounts of memory in for loops which should overwrite scalars

2015-01-15 Thread Steven G. Johnson
function foo(n) m = 0.0 for i=1:n r= rand()-.05 m=max(m,abs(r)) end return m end @time foo(100) elapsed time: 0.005688064 seconds (96 bytes allocated)

[julia-users] Re: Error: zeros(UTF8String, 5)

2015-01-16 Thread Steven G. Johnson
On Friday, January 16, 2015 at 6:59:19 AM UTC-5, K leo wrote: > > I want the array to be initialized with every element being "". Can't say > about 0.3.4, but it definitely worked under 0.3.3. Are there any other > easy ways for what I want? If anything, this should be ones(UTF8String, n).

[julia-users] Re: PetSc interface in Julia

2015-01-20 Thread Steven G. Johnson
I'm hoping to have some time to work on this over the next few days.

[julia-users] Re: Unexpected variability in quadgk performance

2015-01-21 Thread Steven G. Johnson
On Wednesday, January 21, 2015 at 3:03:29 PM UTC-5, Alex Ames wrote: > > quadgk integration of the sin and cos functions takes several seconds when > integrated between 0 and 2pi, versus fractional seconds when integrated > between 0 and pi. > The difference is whether the integral is exactly

[julia-users] Re: Unexpected variability in quadgk performance

2015-01-21 Thread Steven G. Johnson
On Wednesday, January 21, 2015 at 3:03:29 PM UTC-5, Alex Ames wrote: > > but that fails to explain why sin(x)*cos(x) (which integrates to zero > between both 0--pi and 0--2pi) runs fast for 0--pi and slow for 0--2pi. > (It's purely a question of roundoff errors; if you get lucky and it gets a

Re: [julia-users] Re: How to convert character to numeric

2015-01-23 Thread Steven G. Johnson
On Friday, January 23, 2015 at 10:39:42 AM UTC-5, J Luis wrote: > > Than the confusion is even bigger (not intentional for sure) > > julia> parsefloat(a[2]) > ERROR: `parsefloat` has no method matching parsefloat(::Char) > > julia> parseint(a[2]) > 2 > We could certainly add a parsefloat(c::Char

Re: [julia-users] Re: How to convert character to numeric

2015-01-23 Thread Steven G. Johnson
On Friday, January 23, 2015 at 1:18:36 PM UTC-5, J Luis wrote: > > You are right, other than 'just for consistency' there is no real > motivation for that, but remember that this derived from the fact that > Julia doesn't have atoi() and atof() functions (so needed when porting C > code). >

Re: [julia-users] Re: How to convert character to numeric

2015-01-23 Thread Steven G. Johnson
On Friday, January 23, 2015 at 12:07:02 PM UTC-5, Seth wrote: > > Perhaps convoluted, but what about "e" and "π"? I could see some > arithmetic string parser that would use something like this. > I don't think these would be a good idea to handle in parsefloat by default; those specialized cas

Re: [julia-users] Re: Question about list of list; equivalent to Python's key paramater?

2015-01-27 Thread Steven G. Johnson
On Monday, January 26, 2015 at 8:15:28 PM UTC-5, Wai Yip Tung wrote: > My question is does Julia support this in general? In Python the `key` > argument is supported in many methods that deal with sorting and ordering. > If you see a standard-library (or package) function that would benefit fr

[julia-users] Re: poly2mask in Julia?

2015-01-27 Thread Steven G. Johnson
On Sunday, January 25, 2015 at 11:03:30 AM UTC-5, Andrei Zh wrote: > > In Matlab, `poly2mask` transforms polygon (given by arrays of `x` and `y` > coordinates) into a binary mask, where all values inside polygon get value > 1 and all others get value 0. I found Octave implementation [1] that I

[julia-users] Re: Robust Inner Products

2015-02-02 Thread Steven G. Johnson
It might be nice to submit a patch to OpenBLAS to make their dot functions use pairwise summation; this is almost as accurate as KBN summation but with negligible performance penalty (for a large base case), so it should be possible to put together an attractive pull request. For Base, currentl

Re: [julia-users] Re: compute hermite polynomials

2015-02-02 Thread Steven G. Johnson
On Monday, February 2, 2015 at 11:17:36 AM UTC-5, Jiahao Chen wrote: > > The entire point of orthogonal polynomials is that they can be evaluated > very efficiently using their recurrence relations. I would make use of this > fact to the extent possible allowed by numerical roundoff. > (In a se

  1   2   3   4   5   6   7   8   9   10   >