• 11-09-2006
rosicky2005
Here is a part of the persudo code I read:

Code:

```for k = 1 to N - 1  A(k+1:N, k+1:N) = A(k+1:N, k+1:N) - A(k+1:N, k)*A(k, k+1:N) endfor```
My question is, what's mean by the notation k+1:N ?
Also, can anyway please translate the persudo code above into real C++ code ?
• 11-09-2006
robatino
From a google search on part of the formula, I think that A is a matrix, and A(m_1:m_2, n_1:n_2) is the submatrix with first coordinate running from m_1 to m_2 and second coordinate running from n_1 to n_2. This is consistent with the fact that when you multiply two matrices B*C, the number of columns of B must equal the number of rows of C, and the number of rows and columns of the product is equal to the number of rows of B and the number of columns of C, resp. So both sides of your equation are square matrices with N-(k+1)+1 rows and columns.
• 11-12-2006
rosicky2005
You are right. This is really a part of matrix calculation.

Then can I read the code as follows:

Code:

```for k = 1 to N - 1  A(k+1, k+1) = A(k+1, k+1) - A(k+1, k)*A(k, k+1) endfor```
• 11-13-2006
robatino
No, you can't drop the N like that. The formula in the loop depends on N. Also I should have mentioned that in the formula, k by itself is equivalent to k:k (they're just abbreviating), so the full version of the formula is

A(k+1:N, k+1:N) = A(k+1:N, k+1:N) - A(k+1:N, k:k)*A(k:k, k+1:N)
• 11-14-2006
rosicky2005
Anyway, does anyone know how to translate this piece of persudo code into real code that can run in C++.

Thx
• 11-14-2006
vart