\(\(\(SetAttributes[Swap23, HoldAll]\)\(
\)
    \)\)
Swap23[L_] := 
      Module[{temp}, 
        temp = L[[2]]; 
L[[2]] = 
          L[[3]]; 
L[[3]] = 
          temp; 
L]

SetAttributes[InitializeMatrix, HoldFirst]
InitializeMatrix[M_, n_] := M = 
          Table[If[i == j, Infinity, -Infinity], {i, 1, n}, {j, 1, 
              n}];
SetAttributes[SetToLambda, HoldFirst];
SetToLambda[M_, i_, j_] :=  
        If[i > j, SetToLambda[M, j, i], 
          M[[i, j]]  =  M[[j, 
                  i]]  =  (Subscript[λ, i,j])];
SetAttributes[RecoverFromRowSum, 
        HoldFirst];
RecoverFromRowSum[M_, i_, j_]  :=  (M[[i, j]]  =  0;  
          M[[i, j]]  =  M[[j, i]]  =  -Total[
                  M[[i]]]);

    
SetAttributes[SolveDet, HoldFirst];
\(\(\(SolveDet[M_, i_, j_, rows_, cols_, \ 
        sieveFunction_: \((True &)\)]\  := \ 
      Module[{submat, x, soln, 
          eqn}, \ 
M[\([i, j]\)] = \(M[\([j, i]\)] = 
            x\); \  (*\ 
          Double\ assignment\ important\ for\ the\ square - 
            root\ trick\ *) 
submat = M[\([rows]\)]; \ 
        submat = 
          Transpose[\ \((Transpose[
                  submat])\)[\([cols]\)]]; 
 (*\ 
          Maxe\ soln\ the\ list\ of\ solutions*) 
eqn = \((Det[submat] == 0)\); 
soln\  = \ 
          x /. Solve[eqn, x]; 
soln = 
          Select[soln, \ sieveFunction]; 
If[
          Length[soln] ≠ 1, \ Print[eqn]; 
          Message[recover::TooManySolutions, \ "Multiple or no solutions found where there should only be one"]]; 
 (*Curious\ \(thing : \ without\ this\ Simplify[]\), \ 
          the\ program\ is\ vastly\ \((100\ times)\)\ less\ efficient\ *) 
M[\([j, i]\)]\  = \ \(M[\([i, j]\)] = 
            Simplify[
              First[soln]]\);

]\)\(
\)
    \)\)
SetAttributes[SqrtTrick, HoldFirst];
SqrtTrick[M_, i_, 
          j_]  :=   
M[[i, 
              j]] = M[[j, i]]  =  -Sqrt[
                M[[i, i]]*
                  M[[j, j]]];
SetAttributes[ParametrizeIndex, 
        HoldFirst];
ParametrizeIndex[M_, i_, 
          j_] := M[[i, j]]  =  M[[j, i]]  =  
            Unique[];

<< LinearAlgebra`MatrixManipulation`

      
KtoL[K_, n_]  :=  
      Block[{A, B, C},  
        If[Length[K] == n, 
          K, 
A = 
            TakeMatrix[K, {1, 1}, {n, n}]; 
B = 
            TakeMatrix[
              K, {1, n + 1}, {n, Length[K]}]; 
C  =  
            TakeMatrix[
              K,  {n + 1, n + 1},  {Length[K], 
                Length[K]}]; 
A - 
            B . Inverse[C] . 
              Transpose[B]
]]
LtoConditions[L_] := 
      Flatten[Table[(Subscript[λ, i, j]) = 
            0; (Subscript[λ, i, j]) =. ; (Subscript[λ, i, j]) -> 
            L[[i, j]], {j, 1, Length[L]}, {i, 1, 
            j}]]

K = 
        G /. {-Infinity -> 1,  
            Infinity -> 0};
K[[6, 9]]  =  K[[9, 6]]  =  
          2;
Map[Function[x, K[[x, x]]  =  -Total[K[[x]]]], 
        Range[Length[K]]];
K  // MatrixForm

KtoL[K, 6]

LtoConditions[%]

Unique[]

M = {{-2, 1, 1}, {1, -2, 1},  {1, 
            1, -2}};
M // MatrixForm
LtoConditions[KtoL[M,  3]]

With[Evaluate[%], (Subscript[λ, 1, 1])]

%

(Subscript[λ, 1, 1])

With[{n = 1, K = M}, 
        A = TakeMatrix[K, {1, 1}, {n, n}]; 
B = 
          TakeMatrix[
            K, {1, n + 1}, {n, Length[K]}]; 
CC  =  
          TakeMatrix[
            K,  {n + 1, Length[K]},  {n + 1, Length[K]}]];

Length[M]

TakeMatrix[M, {2, 3}, {2, 3}]

MatrixForm  /@  {A, B, CC}

TakeMatrix[M, {1, n + 1}, {n, Length}]  /.  n -> 2

?? Solve

Assuming[x > 0, 
      Solve[{x^2 == 1 , x/Abs[x] == -1}, x]]

Reduce

x /. Solve[x^2 == 1, x]

SolveDet[A, 2, 3, {2, 3, 5}, {3, 4, 5}]

B = A = Table[Random[], {5}, {5}];
A // MatrixForm
SolveDet[A, 2, 3, {2, 3, 5}, {3, 4, 5}];
A  // MatrixForm
A - B

InitializeMatrix[A, 5]

\(TryUsingRMatrixRelations[lo0_, hi0_, lo1_, hi1_, lo2_, hi2_, i_, 
        j_]\  := 
Module[{infinities, \ loToFind, \ 
          hiToFind, l, \ x, \ eqn, \ solutions, R1, \ R2, \ 
          R3}, 
x =. ; 
l = {{lo0, 
              hi0}, {lo1, hi1}, {lo2, hi2}}; 
l = 
          Sort[l]; \ 
 (*\ Hopefully, \ 
          the\ relations\ are\ now\ R\_\(\(L[\([1]\)]\)[\([1]\)]\)\%\(\(L[\([1]\)]\)[\([2]\)]\) + 
              R\_\(\(L[\([3]\)]\)[\([1]\)]\)\%\(\(L[\([3]\)]\)[\([2]\)]\)\  == \ R\_\(\(L[\([2]\)]\)[\([1]\)]\)\%\(\(L[\([2]\)]\)[\([2]\)]\) . \ 
                  Imagine\ this\ as\ R\_12\%14 + R\_15\%16\  == \ 
            R\_12\%16*) 
infinities = 0; loToFind = 0; 
        hiToFind = 0; 
Scan[
          Function[

If[\(\(R[#[\([1]\)], #[\([2]\)]]\)[\([i]\)]\)[\([j]\)] == Infinity, \ \((\(++infinities\); 
                loToFind\  = \ #[\([1]\)]; \ hiToFind\  = \ #[\([2]\)]; \ 
                Print[loToFind, " ", \ 
                  hiToFind])\)]
], \ 
          l]; 
Print[loToFind, \ " ", \ 
          hiToFind, \ " ", \ i, \ " ", \ j]; 
If[
          infinities\  == \ 
            1, 
\(\(R[loToFind, 
                  hiToFind]\)[\([i]\)]\)[\([j]\)]\ \  = 
            x; 
R1\  := \ 
            R[\(l[\([1]\)]\)[\([1]\)], \ \(l[\([1]\)]\)[\([2]\)]]; \ 
          R2 := R[\(l[\([3]\)]\)[\([1]\)], \ \(l[\([3]\)]\)[\([2]\)]]; \ 
          R3 := R[\(l[\([2]\)]\)[\([1]\)], \ \(l[\([2]\)]\)[\([2]\)]]; 
eqn\  = \ \((\ \(R1[\([i]\)]\)[\([j]\)]\  + \ \(R2[\([i]\)]\)[\([j]\)]\  == 
\(R3[\([i]\)]\)[\([j]\)])\); 
solutions\  = \ Solve[eqn, \ x]; 
If[
            Length[solutions] ≠ 1, \ 
            Message[recover::TooManySolutions, \ "Multiple or no solutions found where there should only be one"]]; 
 (*\ 
            Substitute\ the\ solution\ in . \ 
                The\ weird\ syntax\ comes\ from\ the\ wierd\ output\ of\ Solve\ *) 
\(\(R[loToFind, 
                  hiToFind]\)[\([i]\)]\)[\([j]\)]\  = \ 
            x\  /. \ First[
                solutions];
]
]\)
True

R[1, 2]
R[1, 2] = {{Infinity,  1},  {2,  3}}
R[3, 
        5] = {{4,  Infinity},  {5,  Infinity}}
R[1, 5] = {{7, 8},  {Infinity,  Infinity}}

Attributes[Superscript]

R[1, 2][[1]]

Block[{i, j, l, h} ,  i = 1; j = 1; 
      Print ["|", R[1, 2][[i]][[j]]  =  
          5, "|"]; R[1, 2][[i]][[j]]   = x]

Trace[
        TryUsingRMatrixRelations[1, 2, 3, 5, 1, 5, 1, 
          1]][[3]]

MatrixForm[(Subscript[R, 1]^2)]
MatrixForm[(Subscript[R, 3]^5)]
MatrixForm[(Subscript[R, 1]^5)]

R = {}

R[[5]]  =  5;

R = SparseArray[{1 -> 0}]

R[[5]]

SparseArray[{}]

SparseArray[]

R$1$5 + 1

R$1$5 = 5

R$1$5

Aargh[1, 2]  =  {{5, 6}, {7, 8}}

Aargh[1, 2][[1]][[2]]

Remove[R]

L1 = L2 = Table[0, {9}, {9}]

With[
{i = 6, j = 9, 
        k = 23/13}, 
L1[[i, j]] = 1; 
      L2[[i, j]] = k]

L1 = {{0, 0, 0, 0, 0, 0, 1, 0, 1}, {0, 0, 0, 0, 0, 0, 1, 1, 0}, {0, 0, 
          0, 0, 0, 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 1, 0, 1}, {0, 0, 0, 0, 0, 
          0, 1, 1, 0}, {0, 0, 0, 0, 0, 0, 0, 1, 2}, {0, 0, 0, 0, 0, 0, 0, 0, 
          0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 
          0}}

L2 = {{0, 0, 0, 0, 0, 0, (19/21), 0, (23/21)}, {0, 0, 0, 0, 0, 0, (19/17), 
          (15/17), 0}, {0, 0, 0, 0, 0, 0, 0, (15/13), (23/26)}, {0, 0, 0, 0, 0, 
          0, (19/21), 0, (23/21)}, {0, 0, 0, 0, 0, 0, (19/17), (15/17), 0}, {0, 
          0, 0, 0, 0, 0, 0, (15/13), (23/13)}, {0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 
          0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0}}

L1 = L1 + Transpose[L1];
Function[i, L1[[i, i]]  =  -Total[L1[[i]]]]  /@  
        Range[9];
L1  // MatrixForm

L1

L2 = L2 + Transpose[L2];
Function[i, L2[[i, i]]  =  -Total[L2[[i]]]]  /@  
        Range[9];
L2  // MatrixForm

N[Eigensystem[L2]]

N[Eigensystem[L1]]