Message Boards Message Boards

0
|
1677 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

Understanding the computations applied to a square matrix

Posted 1 year ago

We have a square matrix A. I am not able to understand how matrix A is used to create matrix SC by looking at the code.

Can you please advise?

not[idx_] := Complement[Range[NN], idx]
SC[A_, idx_] := A[[idx, idx]] - A[[idx, not@idx]] . Inverse[A[[not@idx, not@idx]]] . A[[not@idx, idx]]

I am a beginner in Mathematica and trying to understand..

POSTED BY: Baymax Hamada

As far as I understand, these lines work like this:

  1. NN is an integer variable defined somewhere above;
  2. idx is expected to be a list of integers not exceding NN so that Complement[Range[NN], idx] returns a non-empty list of indices that are in Range[NN] but not in idx;
  3. Matrix A must be NN * NN square matrix;
  4. By calling function SC first you take A's rows and columns specified by the idx list and then subtract from it a dot-product of three matrices: a matrix formed by A's rows from idx and A's columns from the complement of idx, the inverse of a matrix formed by A's rows and columns from the idx's complement and finally a matrix formed by A's rows from the idx's complement and A's columns from idx.

The last sentence is rather sophisticated but I hope it clarifies these lines of code a bit. Good luck!

POSTED BY: Nikolay Shilov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract