|
From: | Cris |
Subject: | Re: Socis 16 - Problem with pcg |
Date: | Sun, 3 Jul 2016 17:08:47 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 |
On 03/07/2016 15:26, Nicholas Jankowski
wrote:
Dear Nicholas, thanks for your reply. When I saw for the first time that Octave can compare two complex numbers I was surprised, since the Complex Numbers are not an ordered field. But as you observed, if we think complex numbers as vectors (i.e. mathematically x + i*y is isomorphic to [x,y]) can be a reasonable idea to compare their modules. But this is not the comparison that Octave makes for vectors of arbitrary length. Indeed for example: a = rand(3,1) a = 0.46585 0.23369 0.89662 b = rand(3,1) b = 0.499048 0.484491 0.060499 a < b ans = 1 1 0 We can see that Octave compares element by element. So it is strange that for complex numbers it uses an approach and another approach to other type of vector. In my code is fundamental to check if alpha is positive or not. We know from the theory that pcg works only if the matrix input A is symmetric (if it is real) / hermitian (if it is complex) and positive definite. The definition of a positive definite matrix is simple, (indeed a A is positive definite if it is symmetric/hermitian and for every vector x we have that <x, A*x> is greater or equal than 0). But it is not simple to determine if a general matrix A is positive definite. A way to determine it is to compute the eigenvalues of A (indeed an equivalent condition is to have all the eigenvalues real and positive), but it is not practicable if the matrix is very big. Also in the Octave/Matlab pcg code, A can be passed as a function handle and we can not compute the eigenvalues of a function handle. Then, the only hint to understand if A is positive definite is alpha, that is the only situation where we use (in its denominator) the definition <x, A*x> in the implementation. Then the value of alpha becomes determinant to understand if the code is running in the rigth way or not. Moreover my mentors told me that, since it is difficult to determine if A is positive definite or not, the simplest way to check it is to run pcg or the Cholesky factorization (another function that works with positive definite matrices). If pcg / Cholesky doesn't converge then we are sure that A is not positive definite. This gives to the pcg an additionally importance and it is important that it works well. Sorry for the long reply. Best regards, Cristiano Dorigo |
[Prev in Thread] | Current Thread | [Next in Thread] |