[julia-users] Re: Problems with A\b and BigFloat

2016-08-10 Thread Ralph Smith
; want to adjust the tolerances. > > On Wednesday, August 10, 2016 at 7:37:35 PM UTC-7, Ralph Smith wrote: >> >> Here is a textbook answer. Appropriate choice of n depends on condition >> of A. >> >> """ >> >> iteri

[julia-users] Re: Problems with A\b and BigFloat

2016-08-10 Thread Ralph Smith
Here is a textbook answer. Appropriate choice of n depends on condition of A. """ iterimprove(A,b,n=1,verbose=true) Solve `A x = b` for `x` using iterative improvement """ function iterimprove{T<:AbstractFloat}(A::SparseMatrixCSC{T}, >

Re: [julia-users] Re: eigs fails silently

2016-08-06 Thread Ralph Smith
The 0.5 behavior is the same as Fortran, and is technically correct. ARPACK cannot create more (orthogonal) Krylov vectors than the rank of the matrix A, so your example needs the additional keyword ncv=2. This doesn't seem to be adequately documented in arpack-ng either. The 0.4 behavior

Re: [julia-users] Re: eigs fails silently

2016-08-07 Thread Ralph Smith
which I guess is fine as long the αs and βs are zeroed > and you reorthogonalize. > > On Saturday, August 6, 2016 at 5:02:42 PM UTC-4, Ralph Smith wrote: >> >> The 0.5 behavior is the same as Fortran, and is technically correct. >> ARPACK cannot create more (ortho

[julia-users] Re: Save a REPL defined function to a file

2016-08-08 Thread Ralph Smith
Your definition is entered into your history file, probably when you end the session. On Linux, the file is ${HOME}/.julia_history - perhaps someone else can report on OSX or Windows. This does not appear to be mentioned in the main documentation. On Monday, August 8, 2016 at 6:56:30 PM

[julia-users] Re: where is libmpfr found?

2016-08-16 Thread Ralph Smith
For v0.5 joinpath(JULIA_HOME,Base.LIBDIR,"julia","libmpfr" * dll_extension_if_needed) should work for standard installations. For v0.4, replace Base.LIBDIR with "..", "lib". If using a system library, one would presumably need to query the system loader to get a reliable value. On

[julia-users] Re: ANN: Documenter.jl 0.3

2016-08-19 Thread Ralph Smith
The make.jl in Documenter/docs has the appropriate incantation. Try this: cd(joinpath(Pkg.dir(),"Documenter","docs")) include("make.jl") Then point your browser at XXX/Documenter/docs/build/html/index.html (where XXX designates your Pkg directory). The developers seem to have dumped

[julia-users] Re: Avoiding duplicate code when defining concrete subtypes of an abstract type

2016-08-25 Thread Ralph Smith
If you don't need the flexible interrelations provided by J. Sarnoff's approach, you might use metaprogramming like this: abstract Cash function _validate(p::Cash) p.b >= 100 && throw(ArgumentError("Too much...")) (p.b < 0 || p.a < 0) && throw(ArgumentError("Cannot have negative

[julia-users] @threads not providing as big speedup as expected

2016-08-29 Thread Ralph Smith
Dict can be slow. Try d_cl = Array{Array,1} for i=1:np d_cl[i] = copy(inv_cl) end I can't say if that leads to good threads since nthreads() gives me only 1 today.

[julia-users] Re: Workflow question - reloading modules

2016-09-11 Thread Ralph Smith
I have had good results with the following: put test code in its own module, say TestModule.jl, which uses/imports ModuleA. Then the REPL session looks like this: include("ModuleA.jl"); include("ModuleB.jl"); include("TestModule.jl") TestModule.run() repeated over and over. Done in this

[julia-users] PyPlot x(y)tick label fontsize

2016-09-09 Thread Ralph Smith
ax[:tick_params]("both",labelsize=24) See http://matplotlib.org/api/pyplot_api.html for related functions and arguments.

[julia-users] Re: Error in call to eigs--0 index in arpack wrapper

2016-09-11 Thread Ralph Smith
) >> >> >> and the call to eigs: >> >> (valup,vecup,nconv,niter,nmult) = eigs(HLinup, nev=Nup, >> which=:SR,ritzvec=true,ncv=50,maxiter=2,tol=etol,v0=voup) >> >> >> By the way, I was incorrectly assuming [ns]aupd wasn't modifying its >>

[julia-users] Re: Error in call to eigs--0 index in arpack wrapper

2016-09-10 Thread Ralph Smith
`ipntr` is modified by the call to `[ns]aupd`, normally to make a sane index set (the line you quote is there to initialize memory). I find that the example using `eigs()` at the bottom of the LinearMap README still works, and have not encountered trouble in other use of Arpack under Julia.

Re: [julia-users] Advice on (perhaps) chunking to HDF5

2016-09-13 Thread Ralph Smith
I have better luck with inds = fill(:,3) By the way, if anyone appropriate is watching, can we have a sticky post about how to format Julia code here? And is the comprehension form of a one-line "for" loop considered good style? I don't see it in the manual anywhere. On Tuesday, September

[julia-users] Re: Tracking down type instability

2016-09-15 Thread Ralph Smith
SSAValue(15) = (Base.getfield)(SSAValue(0),1) *::Union{Array{Float64,1},Array{Int64,1}}* indicates that the first element of SSAValue(0) is ambiguous. Earlier it shows that this means p from p, l = distance(Proportion{AnyMutation}, seqs) which we can't analyze from what you show here. On

[julia-users] Re: Warning since 0.5

2016-10-08 Thread Ralph Smith
The problem is that some Julia processing stores references to definitions in hidden locations which are not updated consistently, so you get inconsistency like this: julia> f(x)=x^2 f (generic function with 1 method) julia> map(f,[1,2,3]) 3-element Array{Int64,1}: 1 4 9 julia>

[julia-users] Re: Warning since 0.5

2016-10-08 Thread Ralph Smith
By "module file" I just meant a source code file where all definitions are enclosed in modules, so if you "include" it, it replaces the whole module. Thus module M function f(x) x^2 end end then references to M.f are more likely to be consistent than a bare function f defined at the top

[julia-users] Re: Warning since 0.5

2016-10-06 Thread Ralph Smith
TL;DR: put everything in modules. "WARNING: Method definition ... overwritten..." This warning was extended to more cases in v0.5. It has caused some confusion, and some available explanations are themselves confusing. Here is another try. Overwriting a method (or type) has always been a

[julia-users] Re: Tracking down type instability

2016-09-16 Thread Ralph Smith
:Array{Int64,1})::Int64 >>> >>> D::Array{Float64,1} = >>> (Core.ccall)(:jl_alloc_array_1d,(Core.apply_type)(Core.Array,Float64,1)::Type{Array{Float64,1}},(Core.svec)(Core.Any,Core.Int)::SimpleVector,Array{Float64,1},0,SSAValue(6),0)::Array{Float64,1} >>> &g

[julia-users] Re: Tracking down type instability

2016-09-16 Thread Ralph Smith
A correction: the native Haswell build does use packed conversions for 32-bit integers, and valiantly mixes unpacked conversions with packed division for 64-bit. I didn't see any of this from the pre-built binaries. On Friday, September 16, 2016 at 10:22:16 PM UTC-4, Ralph Smith wrote

[julia-users] Re: ANN: ParallelAccelerator v0.2 for Julia 0.5 released.

2016-10-26 Thread Ralph Smith
This is great stuff. Initial observations (under Linux/GCC) are that native threads are about 20% faster than OpenMP, so I surmise you are feeding LLVM some very tasty code. (I tested long loops with straightforward memory access.) On the other hand, some of the earlier posts make me think

Re: [julia-users] Getting parameter names from Method

2016-11-04 Thread Ralph Smith
julia> mt=methods(randjump) # 2 methods for generic function "randjump": randjump(r::MersenneTwister, jumps::Integer) at random.jl:145 randjump(mt::MersenneTwister, jumps::Integer, jumppoly::AbstractString) at random.jl:137 julia> mt.ms[2].lambda_template.slotnames 8-element Array{Any,1}:

[julia-users] Re: mktemp doesn't accept anonymous function?

2016-10-19 Thread Ralph Smith
mktemp returns a 2-tuple, so (at least in v0.5) julia> mktemp() do y,x println(y) end /tmp/tmpS63NPs julia> mktemp((y,x) -> println(y)) /tmp/tmpA2p0Y1 julia> On Wednesday, October 19, 2016 at 5:06:55 PM UTC-4, John Brock wrote: > > > > Am I doing something wrong or is this a

[julia-users] Re: BLAS.set_num_threads() and peakflops scaling

2016-10-19 Thread Ralph Smith
At least 2 things contribute to erratic results from peakflops(). With hyperthreading, the threads are not always put on separate cores. Secondly, the measured time includes the allocation of the result matrix, so garbage collection affects some of the results. Most available advice says to

[julia-users] Re: mktemp doesn't accept anonymous function?

2016-10-19 Thread Ralph Smith
sday, October 19, 2016 at 5:45:56 PM UTC-4, Ralph Smith wrote: > > mktemp returns a 2-tuple, so (at least in v0.5) > > julia> mktemp() do y,x >println(y) >end > /tmp/tmpS63NPs > > julia> mktemp((y,x) -> println(y)) > /tmp/tmpA2p0Y1 > > ju

[julia-users] Re: Parallel file access

2016-10-14 Thread Ralph Smith
ning > Task cannot be serialized. > > Sorry for the long post, but I'm really hoping that someone can help me > out. I have a feeling that I'm missing something pretty simple. > > ---Zachary > > > > > On Tuesday, October 11, 2016 at 10:15:06 AM UTC-4, Ralph Smith w

Re: [julia-users] Re: BLAS.set_num_threads() and peakflops scaling

2016-10-21 Thread Ralph Smith
detects idle virtual cores and schedules disruptive processes there. On Friday, October 21, 2016 at 12:09:07 AM UTC-4, Ralph Smith wrote: > > That's interesting, I see the code in OpenBLAS. However, on the Linux > systems I use, when I had hyperthreading enabled the allocations looked > r

Re: [julia-users] Re: BLAS.set_num_threads() and peakflops scaling

2016-10-20 Thread Ralph Smith
threads(4) will indeed be faster than >>> under BLAS.set_num_threads(2)? That hasn't been my experience and I >>> figured the peakflops() example would constitute an MWE. Is there another >>> workload you would suggest I try to figure out if this is ju

[julia-users] Re: Why construction of Dict via generator is not type-stable?

2016-11-14 Thread Ralph Smith
nk you. > However, my problem is that t(x) does not have to have type T. > And this is exactly the question - how to determine type of t(x) given > that we know that x has type T. > > On Monday, November 14, 2016 at 12:29:56 AM UTC+1, Ralph Smith wrote: >> >> Until the

[julia-users] Re: Why construction of Dict via generator is not type-stable?

2016-11-13 Thread Ralph Smith
Until the issue with generators is resolved, this may suffice: f2x{T}(t::Function,a::AbstractArray{T})::Dict{T,T} = Dict((x,t(x)) for x in a) I think that diverts all the ambiguities to checks by conversion methods. On Sunday, November 13, 2016 at 11:16:20 AM UTC-5, bogumil@gmail.com

[julia-users] Re: Project organization and variable scope question

2016-11-19 Thread Ralph Smith
Unlike Matlab, Julia doesn't give special treatment to script files. By "script" we usually mean a file containing a series of expressions (which can include type and function definitions) intended for evaluation in the Main module. The Main module is where expressions typed interactively at the

Re: [julia-users] Recursive data structures with Julia

2016-10-30 Thread Ralph Smith
Conversion is done by methods listed in base/nullable.jl I would like to know if there is any drawback to an alternative like abstract Bst immutable NullNode <: Bst end type BstNode <: Bst val::Int left::Bst right::Bst end isnull(t::Bst) = isa(t,NullNode) BstNode(key::Int) =

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

2016-11-02 Thread Ralph Smith
Eigs uses shift-and-invert for the :sm variant, so it tries to solve M x = b. Try adding a small sigma parameter.

[julia-users] Re: ANN: ParallelAccelerator v0.2 for Julia 0.5 released.

2016-10-30 Thread Ralph Smith
n't modify them > either. > > On Wednesday, October 26, 2016 at 7:51:33 PM UTC-7, Ralph Smith wrote: >> >> This is great stuff. Initial observations (under Linux/GCC) are that >> native threads are about 20% faster than OpenMP, so I surmise you are >> feeding

Re: [julia-users] Question: Forcing readtable to create string type on import

2016-11-03 Thread Ralph Smith
Unless I misunderstand, df1 = readtable(file1,eltypes=[String,String,String]) seems to be what you want. If you're new to Julia, the fact that a "vector of types" really means exactly that may be surprising. Let us hope that the new versions of DataFrames include a parser that doesn't

[julia-users] Re: Parallel file access

2016-10-11 Thread Ralph Smith
You can do it with 2 (e.g. integer) channels per worker (requests and replies) and a task for each pair in the main process. That's so ugly I'd be tempted to write an interface to named system semaphores. Or just use a separate file for each worker. On Monday, October 10, 2016 at 11:09:39 AM

Re: [julia-users] python-like generators?

2016-10-13 Thread Ralph Smith
According to the manual, Tasks are coroutines. The Wikipedia article relates them to generators. For any recovering C programmers in the audience, this related article might remind you why

[julia-users] Re: Warning since 0.5

2016-10-10 Thread Ralph Smith
This is indeed fairly confusing, partly because the terminological conventions of functional programming are somewhat arbitrary. Some of my discussion upthread uses these conventions, but some (e.g. my use of "attach" and "associate/dissociate") may not be conventional. In Julia, and as Steven

[julia-users] Re: Parallel file access

2016-10-15 Thread Ralph Smith
How are the processes supposed to interact with the database? Without extra synchronization logic, SQLite.jl gives (occasionally) ERROR: LoadError: On worker 2: SQLite.SQLiteException("database is locked") which on the face of it suggests that all workers are using the same connection, although