Re: [julia-users] Re: build-in function to find inverse of a matrix

2014-07-21 Thread Cameron McBride
in the REPL, would it be reasonable to have ?? be able to do an
apropos() search?

Cameron


On Fri, Jul 18, 2014 at 4:40 PM, Viral Shah vi...@mayin.org wrote:

 I think that most new users are unlikely to know about apropos. Perhaps we
 should put it in the julia banner.

 We can say something like:
 Type help() for function usage or apropos() to search the
 documentation.

 apropos() could then just print a message about how to use it, just like
 help() does.

 -viral


 On Wednesday, July 16, 2014 7:35:44 PM UTC+5:30, Hans W Borchers wrote:

 But  apropos  does find it:

 julia apropos(matrix inverse)
 INFO: Loading help data...
 Base.inv(M)


 On Wednesday, July 16, 2014 2:59:05 PM UTC+2, Tomas Lycken wrote:

 `inv` will do that for you. http://docs.julialang.
 org/en/latest/stdlib/linalg/#Base.inv

 It's a little unfortunate that the help text is Matrix inverse, yet
 searching for that exact phrase yields no results at all. Is it possible to
 make documentation search be full-text for help text as well?

 // T

 On Wednesday, July 16, 2014 2:39:53 PM UTC+2, Alan Chan wrote:

 sorry if it's a stupid question. But I cannot find one in the online
 doc.

 Thanks




Re: [julia-users] Re: build-in function to find inverse of a matrix

2014-07-21 Thread Ethan Anderes
+1. For some reason my fingers always get tied up when typing apropos


Re: [julia-users] Re: build-in function to find inverse of a matrix

2014-07-21 Thread John Myles White
There's one complication here, which is that a single ? already changes the 
mode of the REPL into help mode. So this would have to be a mode only 
triggerable from inside of help mode.

 -- John

On Jul 21, 2014, at 6:47 PM, Ethan Anderes ethanande...@gmail.com wrote:

 +1. For some reason my fingers always get tied up when typing apropos



Re: [julia-users] Re: build-in function to find inverse of a matrix

2014-07-21 Thread Stefan Karpinski
Would it be crazy to make ? just do apropos? Interestingly, I was just
thinking of making ;; trigger sticky shell mode where you have to actively
escape to get back to julia mode.


On Mon, Jul 21, 2014 at 6:48 PM, John Myles White johnmyleswh...@gmail.com
wrote:

 There's one complication here, which is that a single ? already changes
 the mode of the REPL into help mode. So this would have to be a mode only
 triggerable from inside of help mode.

  -- John

 On Jul 21, 2014, at 6:47 PM, Ethan Anderes ethanande...@gmail.com wrote:

  +1. For some reason my fingers always get tied up when typing apropos




Re: [julia-users] Re: build-in function to find inverse of a matrix

2014-07-17 Thread Tobias Knopp
Indeed it is one of the first things one learns in numerical lectures that 
one has to avoid explicitely calculating an inverse matrix.
Still, I think that there various small problems in geometry where I don't 
see an issue of invering a 2x2 or 3x3 matrix. It depends, as so often, a 
lot on the context. When considering not so well posed problems it is quite 
essential to take regularization into account. A simple x = A\b would not 
produce satisfying results in those cases.

Am Donnerstag, 17. Juli 2014 06:25:27 UTC+2 schrieb Stefan Karpinski:

 It's a bit of numerical computing lore that inv is bad – both for 
 performance and for numerical accuracy. It turns out it may not be so bad 
 http://arxiv.org/pdf/1201.6035v1.pdf after all, but everyone is still 
 kind of wary of it and there are often better ways to solve problems where 
 inv would be the naive way to do it.

 On Wed, Jul 16, 2014 at 3:59 PM, Alan Chan szelo...@gmail.com 
 javascript: wrote:

 any reason of avoiding inv?




Re: [julia-users] Re: build-in function to find inverse of a matrix

2014-07-17 Thread Andreas Lobinger
Hello colleague,

On Thursday, July 17, 2014 6:25:27 AM UTC+2, Stefan Karpinski wrote:

 It's a bit of numerical computing lore that inv is bad – both for 
 performance and for numerical accuracy. It turns out it may not be so bad 
 http://arxiv.org/pdf/1201.6035v1.pdf after all, but everyone is still 
 kind of wary of it and there are often better ways to solve problems where 
 inv would be the naive way to do it.


i scanned the paper and follows the fashion that people proof numerical 
assumptions by running matlab experiments ... so i cannot take this 
seriously.

The paper has a point, that if you have random matrix input the method to 
get Ax = b is -using recent FP implementation- not so influential, by 
missing the point, that in random input you are not really interested in 
the output...

For real world problems in evaluating ODEs or PDEs where you are especially 
interested in the result and in ill-conditioned systems, because the impact 
to the real world would have a price tag (at least, or fatal consequences), 
i still prefer the conservative solution (of factorisation) which btw (cite 
from paper): 
Computing the inverse requires more arithmetic operations than computing an 
LU factorization.




Re: [julia-users] Re: build-in function to find inverse of a matrix

2014-07-17 Thread Tomas Lycken


If the inverse of a matrix is your final result, rather than some 
intermediate calculation, it might still be possible to use \ (and, at 
least in some cases, advantageous): 

julia A = rand(10,10)
julia @time inv(A)
elapsed time: 0.002185216 seconds (21336 bytes allocated)
julia @time inv(A)
elapsed time: 0.000202789 seconds (7536 bytes allocated)
julia @time A\eye(10)
elapsed time: 0.000117989 seconds (3280 bytes allocated)

julia @time A\eye(10)
elapsed time: 0.000117989 seconds (3280 bytes allocated)

I show the timings twice to illustrate the kind of weird behavior that the 
second time inv(A) is called, it’s 10x faster and allocates only a third of 
the memory (which is from the third time on consistent). These measurements 
are after precompilation (using different matrices of the same size, i.e. 
inv(rand(10,10)) and rand(10,10)\eye(10) to eliminate any caching or other 
magic), so it’s not JIT-ting. Anyone got any ideas here?

Also, the results aren’t exactly equal: inv(A) == A\eye(10) returns false. 
However, that’s just floating point inaccuracies - all(map(isapprox, 
inv(A), A\eye(10)) returns true. I can’t vouch for which result is closer 
to the mathematically exact correct matrix inverse - it probably depends on 
the input.

// T

On Thursday, July 17, 2014 10:11:10 AM UTC+2, Tobias Knopp wrote:

Indeed it is one of the first things one learns in numerical lectures that 
 one has to avoid explicitely calculating an inverse matrix.
 Still, I think that there various small problems in geometry where I don't 
 see an issue of invering a 2x2 or 3x3 matrix. It depends, as so often, a 
 lot on the context. When considering not so well posed problems it is quite 
 essential to take regularization into account. A simple x = A\b would not 
 produce satisfying results in those cases.

 Am Donnerstag, 17. Juli 2014 06:25:27 UTC+2 schrieb Stefan Karpinski:

 It's a bit of numerical computing lore that inv is bad – both for 
 performance and for numerical accuracy. It turns out it may not be so bad 
 http://arxiv.org/pdf/1201.6035v1.pdf after all, but everyone is still 
 kind of wary of it and there are often better ways to solve problems where 
 inv would be the naive way to do it.

 On Wed, Jul 16, 2014 at 3:59 PM, Alan Chan szelo...@gmail.com wrote:

 any reason of avoiding inv?


  ​


Re: [julia-users] Re: build-in function to find inverse of a matrix

2014-07-16 Thread gael . mcdon
I agree. What I meant is that since inv is avoided, it's not used nor well 
referenced in search engines or on this list. :)


Re: [julia-users] Re: build-in function to find inverse of a matrix

2014-07-16 Thread Stefan Karpinski
It's a bit of numerical computing lore that inv is bad – both for
performance and for numerical accuracy. It turns out it may not be so bad
http://arxiv.org/pdf/1201.6035v1.pdf after all, but everyone is still
kind of wary of it and there are often better ways to solve problems where
inv would be the naive way to do it.

On Wed, Jul 16, 2014 at 3:59 PM, Alan Chan szelok.c...@gmail.com wrote:

 any reason of avoiding inv?