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..
As far as I understand, these lines work like this:
NN is an integer variable defined somewhere above;
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;
- Matrix
A must be NN * NN square matrix;
- 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!