[julia-users] Re: Pivoting when inverting a sparse matrix

2016-06-12 Thread Gabriel Goh
Thanks!

You are right, my matrix is symmetric but indefinite, Is there a 
foolproofway to construct an LDLt factorization to take advantage of the 
structure without falling back to LU? This seems like an unnecessary 
limitation

Gabe

On Sunday, June 12, 2016 at 6:50:43 AM UTC-7, Andreas Noack wrote:
>
> To start with the conclusion, the easiest solution here is to use the 
> lufact, i.e. lufact(sparse(A))\ones(3). The explanation is that when a 
> sparse matrix is symmetric, we first try to use a sparse Cholesky 
> factorization and when that fails we try a sparse LDLt factorization. Both 
> use Cholmod, as Tony mentions, and they only pivot during the symbolic 
> factorization to reduce the fill in and no pivoting takes place during the 
> numerical factorization which is the reason for the error. In contrast, our 
> lufact is based on UMFPACK which is pivoting in both the symbolic and 
> numerical factorization and therefore does not fail on this problem.
>
> On Saturday, June 11, 2016 at 4:45:40 PM UTC-4, Tony Kelman wrote:
>>
>> That matrix is indefinite. Cholmod only implements diagonal pivoting 
>> (modified Cholesky, will work for semidefinite or some special cases of 
>> indefinite like quasidefinite), not the general symmetric indefinite 
>> Bunch-Kaufman factorization with 2-by-2 pivots. Assuming you actually care 
>> about sparse matrices that are large enough to make implementing this 
>> difficult, you will need to use a library other than Cholmod - Pardiso, 
>> Mumps, or HSL MA57 are all decent choices.
>>
>>
>> On Friday, June 10, 2016 at 2:37:08 PM UTC-7, Gabriel Goh wrote:
>>>
>>> The following code doesn't make a lot of sense, is there a reason why 
>>> the backslash doesnt pivot for sparse matrices?
>>>
>>>
>>> *julia> *A =[1.0 0.0 1.0
>>>
>>>0.0 0.0 1.0
>>>
>>>1.0 1.0 0.0]
>>>
>>> 3x3 Array{Float64,2}:
>>>
>>>  1.0  0.0  1.0
>>>
>>>  0.0  0.0  1.0
>>>
>>>  1.0  1.0  0.0
>>>
>>>
>>> *julia>* inv(A)
>>>
>>> 3x3 Array{Float64,2}:
>>>
>>>   1.0  -1.0  -0.0
>>>
>>>  -1.0   1.0   1.0
>>>
>>>   0.0   1.0   0.0
>>>
>>>
>>> *julia>* A\ones(3)
>>>
>>> 3-element Array{Float64,1}:
>>>
>>>  0.0
>>>
>>>  1.0
>>>
>>>  1.0
>>>
>>>
>>> *julia>* sparse(A)\ones(3)
>>>
>>> ERROR: ArgumentError: matrix has one or more zero pivots
>>>
>>>  in ldltfact at sparse/cholmod.jl:1246
>>>
>>>  in ldltfact at sparse/cholmod.jl:1253
>>>
>>>  in factorize at sparse/linalg.jl:849
>>>
>>>  in \ at linalg/generic.jl:326
>>>
>>>

[julia-users] Re: ANN: DC.jl - automagical linked plots in your IJulia Notebook

2016-06-12 Thread Eric Forgy
What about DCJS.jl to be consistent with PlotlyJS.jl and ThreeJS.jl?

The JS library is DC.js and is known as such so I would think DCJS.jl would be 
alright.

[julia-users] Re: Problem with Homebrew after Pkg.update()

2016-06-12 Thread Fabrice Collard
Sorry, was away. Running the Pkg.status() I get

21 required packages:

 - Clp   0.2.1

 - DSP   0.0.11

 - DataFrames0.7.3

 - Distributions 0.9.0

 - FastGaussQuadrature   0.0.3

 - Formatting0.1.5

 - FredData  0.1.2

 - GLM   0.5.2

 - Gadfly0.4.2

 - Homebrew  0.2.0+ master (dirty)

 - IJulia1.1.10

 - Interact  0.3.1

 - Interpolations0.3.5

 - Ipopt 0.2.2

 - JuMP  0.13.2

 - MAT   0.2.14

 - NLsolve   0.7.1

 - ODE   0.2.1

 - Optim 0.4.5

 - PyPlot2.1.1+ master

 - TimeSeries0.8.1


Thanks

On Tuesday, June 7, 2016 at 12:19:24 AM UTC-4, Tony Kelman wrote:
>
> Please answer the original question. What does Pkg.status() say?



Re: [julia-users] Plotting lots of data

2016-06-12 Thread Tim Holy
If you can use OpenGL, consider GLVisualize.jl.

--Tim

On Sunday, June 12, 2016 1:31:06 PM CDT CrocoDuck O'Ducks wrote:
> Hi there!
> 
> I have been experimenting a little with many plotting packages recently.
> Being used to Matlab PyPlot seemed to work well for me... until this bug
>  I did not figure out how
> to workaround. I often need to plot a lot of data. The fact is that I often
> work with sampled data, like audio. For example, I could have to plot 10
> seconds of 192 kHz sampled audio. Even when PyPlot was working it was hard
> to plot so many data: PyPlot was used to give up after few errors. I tried
> also other packages (Gadfly and few others) but seems like they really
> struggle to plot so much stuff: they often kinda freeze. I am not sure
> wether I am missing something or using the packages improperly or the
> packages are somewhat limited at this stage. I have resorted to export the
> data to .mat files and plot with matlab...
> 
> My question is:  how do you guys plot large data sets? Do you suggest a
> plot package in particular?




Re: [julia-users] How can I define an anonymous function with keyword arguments

2016-06-12 Thread Yichao Yu
On Sun, Jun 12, 2016 at 4:06 PM, Xiaoqing Rong-Mullins
 wrote:
> I want to define a series of anonymous functions, where each will be a value
> in a Dict and/or a field value in a composite type. I need to be able to use
> them for multiple times with different choices of arguments, including
> keyword arguments. How many of them are defined at runtime depends on the
> input and is unknown before hand, therefore I thought it'll be convenient to
> for them to be anonymous.
>
> The methods I've tried do not allow me to define an anonymous function with
> keyword arguments:

Not on 0.4. It's supported on 0.5.

>
> julia> VERSION
> v"0.4.5"
>
> julia> function (a1,a2;a3=1) a1+a2+a3*2 end
> ERROR: syntax: unexpected semicolon in tuple
>
> julia> (a1,a2;a3=1) -> a1+a2+a3*2
> ERROR: syntax: unexpected semicolon in tuple
>
> julia> (a1,a2;a3=1) = a1+a2+a3*2
> ERROR: syntax: unexpected semicolon in tuple
>
>
> I can define named functions, but I want it to work on anonymous functions.
>
> julia> function g1(a1,a2;a3=1) a1+a2+a3*2 end
> g1 (generic function with 1 method)
>
> julia> g2(a1,a2;a3=1) = a1+a2+a3*2
> g2 (generic function with 1 method)
>


[julia-users] How can I define an anonymous function with keyword arguments

2016-06-12 Thread Xiaoqing Rong-Mullins
I want to define a series of anonymous functions, where each will be a 
value in a Dict and/or a field value in a composite type. I need to be able 
to use them for multiple times with different choices of arguments, 
including keyword arguments. How many of them are defined at runtime 
depends on the input and is unknown before hand, therefore I thought it'll 
be convenient to for them to be anonymous.

The methods I've tried do not allow me to define an anonymous function with 
keyword arguments:

julia> VERSION
v"0.4.5"

julia> function (a1,a2;a3=1) a1+a2+a3*2 end
ERROR: syntax: unexpected semicolon in tuple

julia> (a1,a2;a3=1) -> a1+a2+a3*2
ERROR: syntax: unexpected semicolon in tuple

julia> (a1,a2;a3=1) = a1+a2+a3*2
ERROR: syntax: unexpected semicolon in tuple


I can define named functions, but I want it to work on anonymous functions.

julia> function g1(a1,a2;a3=1) a1+a2+a3*2 end
g1 (generic function with 1 method)

julia> g2(a1,a2;a3=1) = a1+a2+a3*2
g2 (generic function with 1 method)



[julia-users] Packages Distances problem with Distances.Jaccard : very slow

2016-06-12 Thread jean-pierre both


I encountered in my application with Distances.Jaccard compared with 
Distances.Euclidean
It was very slow.

For example with 2 vecteurs Float64 of size 11520

I get the following 
julia> D=Euclidean()
Distances.Euclidean()
julia> @time for i in 1:500
   evaluate(D,v1,v2)
   end
  0.002553 seconds (500 allocations: 7.813 KB)

and with Jaccard

julia> D=Jaccard()
Distances.Jaccard()
@time for i in 1:500
  evaluate(D,v1,v2)
  end
  1.995046 seconds (40.32 M allocations: 703.156 MB, 9.68% gc time)

With a simple loop for computing jaccard :


function myjaccard2(a::Array{Float64,1}, b::Array{Float64,1})
   num = 0
   den = 0
   for i in 1:length(a)
   num = num + min(a[i],b[i])
   den = den + max(a[i],b[i])  
   end
   1. - num/den
   end
myjaccard2 (generic function with 1 method)

julia> @time for i in 1:500
  myjaccard2(v1,v2)
  end
  0.451582 seconds (23.04 M allocations: 351.592 MB, 20.04% gc time)

I do not see the problem in jaccard distance implementation in the 
Distances packages


[julia-users] Jaccard Distance very slow in Packages Distances

2016-06-12 Thread jean-pierre both


using Distances

v1=rand(1)
v2=rand(1)
function testDistances(v1::Array{Float64,1}, v2::Array{Float64,1}, 
D::SemiMetric)
for i in 1:5000
evaluate(D,v1,v2)
end
end

 @time testDistances(v1,v2,Jaccard())
 18.351446 seconds (350.02 M allocations: 5.961 GB, 8.04% gc time)

julia> @time testDistances(v1,v2,CosineDist())
  0.219039 seconds (4 allocations: 160 bytes)

julia> @time testDistances(v1,v2,Cityblock())
  0.01 seconds (4 allocations: 160 bytes)

julia> @time testDistances(v1,v2,Euclidean())
  0.031838 seconds (4 allocations: 160 bytes)

Any fix possible ?


[julia-users] MethodError closest candidate is same as "no matching method" method

2016-06-12 Thread michael
I am using a fork of Nemo  I modified 
to support a fork of FLINT so I could use the function snf_with_transform 
. The 
Julia script I'm using works great in some cases. I'm scheduling it with 
Slurm and using ClusterManagers and addprocs_slurm. The scripts work when I 
request one node and 24 tasks and use addprocs, but not addprocs_slurm. I 
am trying to use more than one node and addprocs_slurm works when I request 
two nodes and two tasks. I'm not sure at how many tasks it stops working, 
but seemingly somewhere between 2 and 24 I get a strange method error that 
doesn't make any sense.

MethodError: `snf_with_transform` has no method matching snf_with_transform
(::Nemo.fmpz_mat)
Closest candidates are:
 snf_with_transform(::Nemo.fmpz_mat)

Does anyone know why I would get this or seen anything like this before?


[julia-users] Re: Pesky type instability

2016-06-12 Thread Matt Bauman
Constructing expressions with strings for a generated function is 
definitely much more complicated and harder to read.  And it'll almost 
certainly take more resources and time during compilation.

You'll probably also be very interested in Base.Cartesian.  See the 
developer documentation 
here: http://docs.julialang.org/en/latest/devdocs/cartesian/

For example, I think this:

inner_prod_numerator = "f["
for i = 1:N
if i == N
inner_prod_numerator = string("poly[",i,"][s",i,",i",i,"]*",
inner_prod_numerator,"s",i)
else
inner_prod_numerator = string("poly[",i,"][s",i,",i",i,"]*",
inner_prod_numerator,"s",i,",")
end
end
inner_prod_numerator = string(inner_prod_numerator,"]")
numerator_term = parse(inner_prod_numerator)


can be simplified to:
:(@ncall(3, *, d->poly[d][s_d,i_d]))

Note that you have to name your variables with underscores to make use of 
Base.Cartesian, so s3 becomes s_3, but I think you'll find it much simpler 
to lean on the existing functionality.  Check out `macroexpand` to see what 
these macros do.

julia> macroexpand(:(@ncall(3, *, d->poly[d][s_d,i_d])))
:((poly[1])[s_1,i_1] * (poly[2])[s_2,i_2] * (poly[3])[s_3,i_3])

Matt

On Sunday, June 12, 2016 at 7:07:17 PM UTC-5, Kristoffer Carlsson wrote:
>
> Yes the splatting is the problem. But since you are using a generated 
> function you can just generate code to avoid splatting.
>
> Evaling a string should on 0.4 not affect the performance of the generated 
> function but on 0.5 I think you can't even call eval in generated functions 
> (for technical reasons).
>


[julia-users] Re: Pesky type instability

2016-06-12 Thread Kristoffer Carlsson
Yes the splatting is the problem. But since you are using a generated function 
you can just generate code to avoid splatting.

Evaling a string should on 0.4 not affect the performance of the generated 
function but on 0.5 I think you can't even call eval in generated functions 
(for technical reasons).

[julia-users] Re: ANN: DC.jl - automagical linked plots in your IJulia Notebook

2016-06-12 Thread Tim Wheeler
Now renamed to CrossfilterCharts.jl 
 to make it 
METADATA-friendly.

On Wednesday, June 1, 2016 at 9:28:07 PM UTC-7, Tim Wheeler wrote:
>
> Hello Julia Users,
>
> We are happy to announce DC.jl  - a 
> package which gives you the power of DC.js 
>  in your IJulia notebook. The premise is 
> simple: put in a DataFrame and you get out a nice set of charts that you 
> can interactively filter. Whenever you do so they automatically crossfilter.
>
>
> 
>
>
>
> The package is up and running. We (three students) put it together for our 
> data visualization course. We hope you like it and welcome comments / 
> suggestions.
>
>
>
>

[julia-users] Re: The simple @parallel example from the docs not working

2016-06-12 Thread Marius Millea
Ah, I missed in the docs that if you don't give a reduction operator it 
executes asynchronously and you need to prepend with @sync to make sure 
there workers have actually finished running the loop. 




On Saturday, June 11, 2016 at 4:02:31 PM UTC+2, Marius Millea wrote:
>
> Kinda new to Julia so not sure where to post this but I'll start here. The 
> simple example from the docs involving @parallel and SharedArray doesn't 
> seem to work. I would think I should end up with a=1:10, but instead it all 
> zeros. 
>
>_   _ _(_)_ |  A fresh approach to technical computing
>   (_) | (_) (_)|  Documentation: http://docs.julialang.org
>_ _   _| |_  __ _   |  Type "?help" for help.
>   | | | | | | |/ _` |  |
>   | | |_| | | | (_| |  |  Version 0.5.0-dev+4553 (2016-06-06 02:05 UTC)
>  _/ |\__'_|_|_|\__'_|  |  Commit f4cb80b (5 days old master)
> |__/   |  x86_64-unknown-linux-gnu
>
> julia> addprocs()
> 8-element Array{Int64,1}:
>  2
>  3
>  4
>  5
>  6
>  7
>  8
>  9
>
> julia> begin
>a = SharedArray(Float64,10)
>@parallel for i=1:10
>  a[i] = i
>end
>end
> 8-element Array{Any,1}:
>  Future(2,1,26,#NULL)
>  Future(3,1,27,#NULL)
>  Future(4,1,28,#NULL)
>  Future(5,1,29,#NULL)
>  Future(6,1,30,#NULL)
>  Future(7,1,31,#NULL)
>  Future(8,1,32,#NULL)
>  Future(9,1,33,#NULL)
>
> julia> a
> 10-element SharedArray{Float64,1}:
>  0.0
>  0.0
>  0.0
>  0.0
>  0.0
>  0.0
>  0.0
>  0.0
>  0.0
>  0.0
>
>
> This is using a nightly build of v0.5.0 which I figured I should since 
> this exact example is included in the 0.5.0 docs but not the 0.4.5 ones. In 
> any case, from what I can gather this *should* also work on 0.4.5, and I've 
> tried it and the results is identical as above. If I just put these 
> commands in a script it also doesn't work. One note, if I just execute each 
> command on its own line, rather than grouping them with the begin, then it 
> works. 
>
> Any ideas whats going on? 
>


[julia-users] Re: Pesky type instability

2016-06-12 Thread Richard Dennis
Hi Kristoffer,

yes, the return type is stable because I explicitly declared weights as 
Array{T,N}.  With order being a 1D array it needs to be "converted" to a 
tuple to initialize the weights array and I don't see too many ways of 
doing this.  The problem seems to be present is the following

function test{S}(order::Array{S,1})
  h = (order...)
end

@code_warntype test([1,2,3])

so perhaps the type instability to within the julia code that does the 
splatting to create the tuple.

Regarding my use of strings and parsing them, I realize that it is not so 
elegant, but does it impact performance?

Thanks,

Richard


[julia-users] Re: local package, howto?

2016-06-12 Thread Dan
Not sure, but I may have had a similar problem and doing (in the shell):

git config --global url."https://".insteadOf git://

solved it.

On Sunday, June 12, 2016 at 1:42:13 PM UTC-4, Andreas Lobinger wrote:
>
> Hello colleagues,
>
> like with similar problems, i don't know how i ended up there, but my 
> question is how to avoid
> Being asked for githup authentification for a package that exists only 
> locally (i.e. has no remote on github or similar)?
>
> julia v0.4.5 was not updated for long, but yesterday i ran a Pkg.update() 
> and today with a Pkg.update i'm asked for githup username and passwd?
>
> Any idea?
>
> Wishing a happy day,
>   Andreas
>


[julia-users] Re: Pesky type instability

2016-06-12 Thread Kristoffer Carlsson
I would discourage generating code by creating strings and parsing them. It 
is much better to use actual julia expressions.

Anyway, from what I see, you don't have a problem with the return type but 
with an intermediate value and that is from doing this:

julia> g{S}(order::Array{S}) = Array(Float64, (order+1)...)
g (generic function with 1 method)


julia> @code_warntype g([1,2,3])
Variables:
  order::Array{Int64,1}


Body:
  begin  # none, line 1:
  return (top(_apply))((top(getfield))(Main,:call)::F,Main.Array,(top(
tuple))(Main.Float64)::Tuple{DataType},order::Array{Int64,1} .+ 1::Array{
Int64,1})::Array{Float64,N}
  end::Array{Float64,N}




On Monday, June 13, 2016 at 12:04:41 AM UTC+2, Richard Dennis wrote:
>
> I wrote a generate function to compute Chebyshev weights using Chebyshev 
> regression. I'm sure that there are many ways the code could be improved, 
> but at the top of my list is eliminating what appears to be a type 
> instability whose source I'm having trouble locating using @code_warntype. 
>  Any suggestions on how to eliminate the type instability would be 
> appreciated.
>
> The code can be found at the following gist: 
> https://gist.github.com/RJDennis/a0ea1e4e49da97edaa464ba2a8d701ab
>
> Thanks,
>
> Richard  
>


Re: [julia-users] How to launch a Julia cluster under Torque scheduler

2016-06-12 Thread David Parks
Nice idea Erik, I appreciate it!
Though if I'm not wrong this locks me into only using MPI as the only 
transport mechanism and I want to use julias remotecall and other built in 
functionality rather than just MPI constructs.

I see that the latest documentation for julia shows a --bind-to option that 
looks like it allows you to launch remote processes and have them connect 
back to the master rather than the other way around. The documentation was 
a little unspecific, so I wasn't completely sure this is how it works, but 
that would be perfect if it did. 

If anyone has any information on this new functionality I'd love to hear 
more details about it.

David

 


Re: [julia-users] Re: function! vs. function

2016-06-12 Thread digxx

>
> Indeed embarassing -.-

But yeah I was just confused thx anyway. 


[julia-users] Pesky type instability

2016-06-12 Thread Richard Dennis
I wrote a generate function to compute Chebyshev weights using Chebyshev 
regression. I'm sure that there are many ways the code could be improved, 
but at the top of my list is eliminating what appears to be a type 
instability whose source I'm having trouble locating using @code_warntype. 
 Any suggestions on how to eliminate the type instability would be 
appreciated.

The code can be found at the following gist: 
https://gist.github.com/RJDennis/a0ea1e4e49da97edaa464ba2a8d701ab

Thanks,

Richard  


[julia-users] Re: Plotting lots of data

2016-06-12 Thread Robert Gates
PlotlyJS.jl is a great tool, we use it to plot the boundary meshes of 3D 
finite element models as well as result data. Seems to handle large 
datasets well. The API is well-documented and everything works as expected.

On Sunday, June 12, 2016 at 11:31:06 PM UTC+3, CrocoDuck O'Ducks wrote:
>
> Hi there!
>
> I have been experimenting a little with many plotting packages recently. 
> Being used to Matlab PyPlot seemed to work well for me... until this bug 
>  I did not figure out 
> how to workaround. I often need to plot a lot of data. The fact is that I 
> often work with sampled data, like audio. For example, I could have to plot 
> 10 seconds of 192 kHz sampled audio. Even when PyPlot was working it was 
> hard to plot so many data: PyPlot was used to give up after few errors. I 
> tried also other packages (Gadfly and few others) but seems like they 
> really struggle to plot so much stuff: they often kinda freeze. I am not 
> sure wether I am missing something or using the packages improperly or the 
> packages are somewhat limited at this stage. I have resorted to export the 
> data to .mat files and plot with matlab...
>
> My question is:  how do you guys plot large data sets? Do you suggest a 
> plot package in particular?
>


Re: [julia-users] Re: Compose.jl animation

2016-06-12 Thread Ford O.
So I have moved a little bit further but it seems I am stuck again.

I am using IJulia with Atom and Hydrogen (atom plugin).


   - Compose.set_default_graphic_size() can set the canvas size at most to 
   ~20inches x ~20inches.
   - When using the code from reactive tutorial (below) and running the 
   code, the canvas shows the ball at one position. I have to run the code 
   again to see where did that ball go...


using Reactive, Interact, Compose
function drawball(t)
  y = 1-abs(sin(t)) # The y coordinate.
  compose(context(), circle(0.5, y, 0.04))
end

ticks = fps(60)
timestamps = map(_ -> time(), ticks)
map(drawball, timestamps)



On Sunday, June 12, 2016 at 5:02:30 PM UTC+2, Shashi Gowda wrote:
>
> Yes, this is because the canvas is not square
>
> Run
> Compose.set_default_graphic_size(5inch, 5inch)
>
> Before drawing the picture...
>
> On 11-Jun-2016 8:08 PM, "Michael Borregaard"  > wrote:
> >
> > It is not a full answer, but you should check ctxpromise() for the size. 
> I think the distribution is because the canvas is not square and you use 
> relative positions to specify circle centers. You can set the size 
> parameters in the context call. Sorry I realise this is really useless in 
> terms of help but may point you in the right direction.
>


[julia-users] Plotting lots of data

2016-06-12 Thread CrocoDuck O'Ducks
Hi there!

I have been experimenting a little with many plotting packages recently. 
Being used to Matlab PyPlot seemed to work well for me... until this bug 
 I did not figure out how 
to workaround. I often need to plot a lot of data. The fact is that I often 
work with sampled data, like audio. For example, I could have to plot 10 
seconds of 192 kHz sampled audio. Even when PyPlot was working it was hard 
to plot so many data: PyPlot was used to give up after few errors. I tried 
also other packages (Gadfly and few others) but seems like they really 
struggle to plot so much stuff: they often kinda freeze. I am not sure 
wether I am missing something or using the packages improperly or the 
packages are somewhat limited at this stage. I have resorted to export the 
data to .mat files and plot with matlab...

My question is:  how do you guys plot large data sets? Do you suggest a 
plot package in particular?


[julia-users] Re: Status of FEM packages

2016-06-12 Thread CrocoDuck O'Ducks
Cool stuff! Many thanks for the info, plenty of stuff to look at. Glad to 
see that a lot is going on.


Re: [julia-users] ControKTH

2016-06-12 Thread Linus Härenstam-Nielsen
Here we go: https://github.com/Linusnie/ControlBasic

Note that at the time I used a 0.4.0 dev build so everything might not work 
properly. 


On Sunday, June 12, 2016 at 7:35:51 PM UTC+2, Linus Härenstam-Nielsen wrote:
>
> Hi author of (part of) ControlKTH here
>
> This was indeed a student project last summer, we based the development on 
> Control.jl . We decided not to 
> post the code publicly under the university name since I copied part of 
> MatLab's algorithm for drawing root locus diagrams, but since you ask I 
> could post it on my private repository. 
>
> I'll write here once I've done so. 
>
> On Sunday, June 12, 2016 at 5:47:34 AM UTC+2, Christian Peel wrote:
>>
>> Here are two pertinent links
>> * 
>> https://www.kth.se/polopoly_fs/1.627826!/harenstam-nielsen_lindemann.pdf
>> * https://www.kth.se/social/files/55f124f8f276547bba8a16f9/controldoc.pdf
>>
>> I guess they refer to a student project to implement basic control theory 
>> concepts in Julia. Even if it is not too fancy, it would be useful for the 
>> author (cc'd) to post the code publicly.  
>>
>> On Sat, Jun 11, 2016 at 4:48 PM, Stefan Karpinski  
>> wrote:
>>
>>> The top Google hit on "ControKTH" is this message thread. After that the 
>>> hits are all nonsense. It's also completely unclear what EL1000 is supposed 
>>> to be.
>>>
>>> On Sat, Jun 11, 2016 at 6:06 AM, Henri Girard  
>>> wrote:
>>>
 Hi,
 Does somebody knows where I can get the control toolbox ?

 EL1000 home page and download the ControlKTH.zip
 Is there other toolbox for julia ?
 Regards
 Henri




>>>
>>
>>
>> -- 
>> chris...@ieee.org
>>
>

Re: [julia-users] Re: function! vs. function

2016-06-12 Thread Yichao Yu
On Sun, Jun 12, 2016 at 2:27 PM, digxx  wrote:
> Thx evan.
> just to clarify: when calling:
> function f(a,farr)
> for i=1:n
> for j=1:n
> farr[j,i] = (a[j,:]*a[:,i] - A[j,:]*a[:,i])[1] - k2[j,i]
> end
> end
> end
>
> f(x) with my previously defined x I get an error
>
> while calling
>
> function f!(a,farr)
> for i=1:n
> for j=1:n
> farr[j,i] = (a[j,:]*a[:,i] - A[j,:]*a[:,i])[1] - k2[j,i]
> end
> end
> end
>
> f!(x) I get some result which is nonsense (in this case x^2)
> but it doesnt show up an error...

You probably have a f! defined somewhere else.

>
> I know the original purpose is to specify farr as second argument to fill
> it. That both works


[julia-users] Re: function! vs. function

2016-06-12 Thread Kristoffer Carlsson
You probably defined an f!(x) function earlier in your REPL session. 
Restart the REPL or run workspace()and try again.

On Sunday, June 12, 2016 at 8:27:32 PM UTC+2, digxx wrote:
>
> Thx evan.
> just to clarify: when calling:
> function f(a,farr)
> for i=1:n
> for j=1:n
> farr[j,i] = (a[j,:]*a[:,i] - A[j,:]*a[:,i])[1] - k2[j,i]
> end
> end
> end
>
> f(x) with my previously defined x I get an error
>
> while calling
>
> function f!(a,farr)
> for i=1:n
> for j=1:n
> farr[j,i] = (a[j,:]*a[:,i] - A[j,:]*a[:,i])[1] - k2[j,i]
> end
> end
> end
>
> f!(x) I get some result which is nonsense (in this case x^2)
> but it doesnt show up an error...
>
> I know the original purpose is to specify farr as second argument to fill 
> it. That both works
>


[julia-users] Re: function! vs. function

2016-06-12 Thread digxx
Thx evan.
just to clarify: when calling:
function f(a,farr)
for i=1:n
for j=1:n
farr[j,i] = (a[j,:]*a[:,i] - A[j,:]*a[:,i])[1] - k2[j,i]
end
end
end

f(x) with my previously defined x I get an error

while calling

function f!(a,farr)
for i=1:n
for j=1:n
farr[j,i] = (a[j,:]*a[:,i] - A[j,:]*a[:,i])[1] - k2[j,i]
end
end
end

f!(x) I get some result which is nonsense (in this case x^2)
but it doesnt show up an error...

I know the original purpose is to specify farr as second argument to fill 
it. That both works


[julia-users] Re: function! vs. function

2016-06-12 Thread Evan Fields
Apologies if this is obvious, but: appending ! to a function name doesn't 
do anything special. It is convention to "append ! to names of functions 
that modify their arguments" (from the manual, section style guide). But 
this is just a naming convention and doesn't affect how the function is 
actually computed.


Re: [julia-users] Re: function! vs. function

2016-06-12 Thread Milan Bouchet-Valat
Le dimanche 12 juin 2016 à 10:13 -0700, digxx a écrit :
> the function I defined above? Or what do you mean?
> function f!(a,farr)
> for i=1:n
>   for j=1:n
>   farr[j,i] = (a[j,:]*a[:,i] - A[j,:]*a[:,i])[1] - k2[j,i]
>   end
> end
> end
That method requires two arguments, you cannot call it with f!(x). So
what method did you call?


Regards


[julia-users] local package, howto?

2016-06-12 Thread Andreas Lobinger
Hello colleagues,

like with similar problems, i don't know how i ended up there, but my 
question is how to avoid
Being asked for githup authentification for a package that exists only 
locally (i.e. has no remote on github or similar)?

julia v0.4.5 was not updated for long, but yesterday i ran a Pkg.update() 
and today with a Pkg.update i'm asked for githup username and passwd?

Any idea?

Wishing a happy day,
  Andreas


Re: [julia-users] ControKTH

2016-06-12 Thread Linus Härenstam-Nielsen
Hi author of (part of) ControlKTH here

This was indeed a student project last summer, we based the development on 
Control.jl . We decided not to 
post the code publicly under the university name since I copied part of 
MatLab's algorithm for drawing root locus diagrams, but since you ask I 
could post it on my private repository. 

I'll write here once I've done so. 

On Sunday, June 12, 2016 at 5:47:34 AM UTC+2, Christian Peel wrote:
>
> Here are two pertinent links
> * https://www.kth.se/polopoly_fs/1.627826!/harenstam-nielsen_lindemann.pdf
> * https://www.kth.se/social/files/55f124f8f276547bba8a16f9/controldoc.pdf
>
> I guess they refer to a student project to implement basic control theory 
> concepts in Julia. Even if it is not too fancy, it would be useful for the 
> author (cc'd) to post the code publicly.  
>
> On Sat, Jun 11, 2016 at 4:48 PM, Stefan Karpinski  > wrote:
>
>> The top Google hit on "ControKTH" is this message thread. After that the 
>> hits are all nonsense. It's also completely unclear what EL1000 is supposed 
>> to be.
>>
>> On Sat, Jun 11, 2016 at 6:06 AM, Henri Girard > > wrote:
>>
>>> Hi,
>>> Does somebody knows where I can get the control toolbox ?
>>>
>>> EL1000 home page and download the ControlKTH.zip
>>> Is there other toolbox for julia ?
>>> Regards
>>> Henri
>>>
>>>
>>>
>>>
>>
>
>
> -- 
> chris...@ieee.org 
>


[julia-users] Re: function! vs. function

2016-06-12 Thread digxx
the function I defined above? Or what do you mean?
function f!(a,farr)
for i=1:n
for j=1:n
farr[j,i] = (a[j,:]*a[:,i] - A[j,:]*a[:,i])[1] - k2[j,i]
end
end
end


[julia-users] function! vs. function

2016-06-12 Thread Kristoffer Carlsson
What is f! (X)?

[julia-users] function! vs. function

2016-06-12 Thread digxx
So now I'm using this function

A=[[2,1.]';[1,4]']
k2=Diagonal([3.,11.])^2
x=[[1,2]';[3.,4]']
farr=zeros(2,2)

n=length(x[:,1])
kd(i,j)=Int64(i .== j)

function f!(a,farr)
for i=1:n
for j=1:n
#for k=1:n
farr[j,i] = (a[j,:]*a[:,i] - A[j,:]*a[:,i])[1] - k2[j,i]
#end
end
end
end

When I calculate f!(x,farr) I get the right result
Also when I define the function without the !

But when I just calculate f!(x) it works but it only calculates: x^2
I thought f! only calculates the result inplace so I do not have to specify 
farr, or what is the problem?


Re: [julia-users] Re: Compose.jl animation

2016-06-12 Thread Shashi Gowda
Yes, this is because the canvas is not square

Run
Compose.set_default_graphic_size(5inch, 5inch)

Before drawing the picture...

On 11-Jun-2016 8:08 PM, "Michael Borregaard"  wrote:
>
> It is not a full answer, but you should check ctxpromise() for the size.
I think the distribution is because the canvas is not square and you use
relative positions to specify circle centers. You can set the size
parameters in the context call. Sorry I realise this is really useless in
terms of help but may point you in the right direction.


Re: [julia-users] Re: testing positive definiteness via Cholesky?

2016-06-12 Thread Andreas Noack
We could consider not to throw in cholfact but only when the factorization 
is applied. This is what we do for LU and BunchKaufman.

On Saturday, June 11, 2016 at 5:02:55 PM UTC-4, Tony Kelman wrote:
>
> For now, you can just manually make the same cholmod calls that cholfact 
> does, then use the same check that cholfact is currently using for throwing 
> a PosDefException, to instead return false (or use the just-computed 
> factorization as desired, when it succeeds) - see 
> https://github.com/JuliaLang/julia/blob/9ab1519db4ab8c525f84fce542bfc463d9a2b071/base/sparse/cholmod.jl#L1270-L1285
>
> This would likely be faster than the current try-catch implementation of 
> isposdef, but involve a bit of repeated code.
>
>
> On Friday, June 10, 2016 at 9:26:55 PM UTC-7, Tim Holy wrote:
>>
>> Two other advantages of just biting the bullet and implementing this for 
>> PositiveFactorizations: 
>> - there is no iteration step; the first time you try to factor it, it 
>> works. 
>> - when you think about it, the classic approach of adding a diagonal 
>> factor is 
>> (in my humble opinion) wrong, wrong, wrong. See the discussion linked 
>> from the 
>> PositiveFactorization README. 
>>
>> Best, 
>> --Tim 
>>
>> On Friday, June 10, 2016 5:22:03 PM CDT vav...@uwaterloo.ca wrote: 
>> > Dear Viral and Tim, 
>> > 
>> > Thanks for your prompt responses to my query.  I should have stated 
>> more 
>> > precisely how I am using positive definiteness testing.  The 
>> application is 
>> > a classic trust-region method for optimization.  In a trust region 
>> method, 
>> > the main operation is as follows.  The input is a symmetric (typically 
>> > sparse) matrix A and a vector b.  The problem is to compute a certain 
>> real 
>> > parameter lambda.  One tests if A + lambda*speye(n) is positive 
>> definite; 
>> > if so, then one solves a linear system with this coefficient matrix, 
>> and if 
>> > not, one increases lambda and tries again. 
>> > 
>> > So the problem with using isposdef is that, in the case that A is 
>> actually 
>> > positive definite, isposdef discards the Cholesky factor, so then my 
>> > application would need to compute it again (redundantly) to solve the 
>> > system.  In the case of the PostiveFactorizations.jl package, it 
>> appears 
>> > that the package is aimed at dense rather than sparse matrices. 
>> > 
>> > So aside from rewriting cholfact, it seems that the only remaining 
>> solution 
>> > is Viral's suggestion to catch an exception from cholfact.  This raises 
>> > another question.  Most C++ textbooks advise against using exceptions 
>> for 
>> > ordinary control-flow on the grounds that throwing and catching an 
>> > exception is a time-consuming operation.  How about in Julia?  Is it 
>> > reasonable to use try/throw/catch for ordinary control flow in a 
>> scientific 
>> > code?  The Julia manual states that exceptions are much slower than if 
>> > statements.  But on the other hand, isposdef in cholmod.jl is written 
>> in 
>> > terms of exceptions! 
>> > 
>> > Thanks, 
>> > Steve 
>> > 
>> > On Thursday, June 9, 2016 at 10:16:29 PM UTC-4, vav...@uwaterloo.ca 
>> wrote: 
>> > > In Matlab to check if a symmetric sparse matrix is positive definite, 
>> I 
>> > > can say [R,p]=chol(A) and then if p>0 etc.  Is this functionality 
>> > > available 
>> > > in Julia?  The cholfact standard routine throws an exception if its 
>> > > argument is not positive definite rather than returning any helpful 
>> > > information. 
>> > > 
>> > > I looked at the code for cholfact in cholmod.jl in Base; it appears 
>> that I 
>> > > can write a modified version of cholfact that exposes this 
>> functionality. 
>> > > But it would be better if the functionality were available in the 
>> library 
>> > > so that my code is not sensitive to changes in undocumented low-level 
>> > > routines. 
>> > > 
>> > > Thanks, 
>> > > Steve Vavasis 
>>
>>
>>

[julia-users] Re: Pivoting when inverting a sparse matrix

2016-06-12 Thread Andreas Noack
To start with the conclusion, the easiest solution here is to use the 
lufact, i.e. lufact(sparse(A))\ones(3). The explanation is that when a 
sparse matrix is symmetric, we first try to use a sparse Cholesky 
factorization and when that fails we try a sparse LDLt factorization. Both 
use Cholmod, as Tony mentions, and they only pivot during the symbolic 
factorization to reduce the fill in and no pivoting takes place during the 
numerical factorization which is the reason for the error. In contrast, our 
lufact is based on UMFPACK which is pivoting in both the symbolic and 
numerical factorization and therefore does not fail on this problem.

On Saturday, June 11, 2016 at 4:45:40 PM UTC-4, Tony Kelman wrote:
>
> That matrix is indefinite. Cholmod only implements diagonal pivoting 
> (modified Cholesky, will work for semidefinite or some special cases of 
> indefinite like quasidefinite), not the general symmetric indefinite 
> Bunch-Kaufman factorization with 2-by-2 pivots. Assuming you actually care 
> about sparse matrices that are large enough to make implementing this 
> difficult, you will need to use a library other than Cholmod - Pardiso, 
> Mumps, or HSL MA57 are all decent choices.
>
>
> On Friday, June 10, 2016 at 2:37:08 PM UTC-7, Gabriel Goh wrote:
>>
>> The following code doesn't make a lot of sense, is there a reason why the 
>> backslash doesnt pivot for sparse matrices?
>>
>>
>> *julia> *A =[1.0 0.0 1.0
>>
>>0.0 0.0 1.0
>>
>>1.0 1.0 0.0]
>>
>> 3x3 Array{Float64,2}:
>>
>>  1.0  0.0  1.0
>>
>>  0.0  0.0  1.0
>>
>>  1.0  1.0  0.0
>>
>>
>> *julia>* inv(A)
>>
>> 3x3 Array{Float64,2}:
>>
>>   1.0  -1.0  -0.0
>>
>>  -1.0   1.0   1.0
>>
>>   0.0   1.0   0.0
>>
>>
>> *julia>* A\ones(3)
>>
>> 3-element Array{Float64,1}:
>>
>>  0.0
>>
>>  1.0
>>
>>  1.0
>>
>>
>> *julia>* sparse(A)\ones(3)
>>
>> ERROR: ArgumentError: matrix has one or more zero pivots
>>
>>  in ldltfact at sparse/cholmod.jl:1246
>>
>>  in ldltfact at sparse/cholmod.jl:1253
>>
>>  in factorize at sparse/linalg.jl:849
>>
>>  in \ at linalg/generic.jl:326
>>
>>

Re: [julia-users] I can enter the same keyword argument twice, and the second over-rules the first.

2016-06-12 Thread Tom Breloff
I just want to point out that this is a feature in my eyes, not a bug. It's
very useful as a keyword override when splatting keywords.

On Sunday, June 12, 2016, Milan Bouchet-Valat  wrote:

> Le samedi 11 juin 2016 à 19:46 -0700, colintbow...@gmail.com
>  a écrit :
> > I can enter the same keyword argument twice, and the second entry is
> > the one that gets used. A short example follows:
> >
> > f(x::Int ; kw::Int=0) = x * kw
> > f(2)
> > f(2, kw=3) #evaluates to 6
> > f(2, kw=3, kw=4) #evaluates to 8
> >
> > Is this desired behaviour or is it a bug? Based on a quick scan, I
> > can't quite tell if this is the same bug as issue 9535
> > (https://github.com/JuliaLang/julia/issues/9535), so thought I would
> > post here before filing anything. Also, I'm on v0.4, so I don't want
> > to file if this is already taken care of in v0.5.
> It also happens on 0.5. This sounds like a different (and simpler) bug
> than #9535, so filing a new issue would likely be useful. Even if it
> was done on purpose, the manual doesn't seem to mention it.
>
>
> Regards
>


Re: [julia-users] Re: why the numerical result is different (RK45 julia and matlab)?

2016-06-12 Thread Daniel Carrera
I don't know what you are trying to say, but did you try running the two
programs with the same relative and absolute tolerances? Do the results
look more similar now?

On 12 June 2016 at 02:01,  wrote:

> Hi daniel
> in fact, there is a relationship with the tolerance between the methods.
>
> Em sábado, 11 de junho de 2016 11:51:53 UTC-3, Daniel Carrera escreveu:
>>
>> Probably because the Julia module has different default values for the
>> absolute and relative tolerance.  For Julia, the defaults are reltol=1e-5
>> and abstol=1e-8 but in Matlab the defaults are RelTol=1e-3 and AbsTol=1e-6.
>>
>> https://github.com/JuliaLang/ODE.jl
>> http://se.mathworks.com/help/matlab/ref/odeset.html
>>
>> That would also explain why the Julia program took so much longer. Try
>> again with the same tolerance and see if the results are more similar. Oh,
>> and like Erik said, you probably meant to have parenthesis around "1/8". If
>> the results still look difference, look for more options that might have
>> different default values.
>>
>> Cheers,
>> Daniel.
>>
>>
>>
>> On Saturday, 11 June 2016 04:29:47 UTC+2, jmarcell...@ufpi.edu.br wrote:
>>>
>>> this is the test for equation differential using runge-kutta45: f(x,y)=
>>> (-5*x - y/5)^1/8 + 10
>>>
>>>
>>> 
>>>
>>> why the numerical result is different? I used :
>>>
>>> function Rk_JL()
>>>  f(x,y)= (-5*x - y/5)^1/8 + 10
>>>  tspan = 0:0.001:n
>>>  y0 = [0.0, 1.0]
>>>  return ODE.ode45(f, y0,tspan);end
>>>
>>>
>>> and
>>>
>>>
>>> function [X1,Y1] = RK_M()
>>>  f = @(x,y) (-5*x - y/5)^1/8 + 10;
>>>  tspan = 0:0.001:n;
>>>  y0 = 1
>>>  [X1,Y1]= ode45(f,tspan,1);end
>>>
>>>


Re: [julia-users] I can enter the same keyword argument twice, and the second over-rules the first.

2016-06-12 Thread Milan Bouchet-Valat
Le samedi 11 juin 2016 à 19:46 -0700, colintbow...@gmail.com a écrit :
> I can enter the same keyword argument twice, and the second entry is
> the one that gets used. A short example follows:
> 
> f(x::Int ; kw::Int=0) = x * kw
> f(2)
> f(2, kw=3) #evaluates to 6
> f(2, kw=3, kw=4) #evaluates to 8
> 
> Is this desired behaviour or is it a bug? Based on a quick scan, I
> can't quite tell if this is the same bug as issue 9535
> (https://github.com/JuliaLang/julia/issues/9535), so thought I would
> post here before filing anything. Also, I'm on v0.4, so I don't want
> to file if this is already taken care of in v0.5.
It also happens on 0.5. This sounds like a different (and simpler) bug
than #9535, so filing a new issue would likely be useful. Even if it
was done on purpose, the manual doesn't seem to mention it.


Regards


Re: [julia-users] Re: Double free or corruption (out)

2016-06-12 Thread Nils Gudat
So it looks like I'm having the same issue - have been running the code 
without parallelization (defining my SharedArrays as regular ones), and it 
has now been going for about 3 days without any segfaults. Is this a known 
issue? If so, do we know whether there's a Julia version one can revert to 
in which SharedArrays work?