From 6f4ebe31cfe564b7185cf1598946571f1cd025b6 Mon Sep 17 00:00:00 2001
From: jacob Computes the Hessenburg decomposition of a complex dense Hermitian matrix. That is, for a square, Hermitian matrix
+ * {@code A}, computes the decomposition {@code A=QHQ}H where {@code Q} is an unitary matrix and
+ * {@code H} is a Hermitian matrix in tri-diagonal form (special case of Hessenburg form) which is similar to {@code A}
+ * (i.e. has the same eigenvalues). A matrix {@code H} is in tri-diagonal form if it is nearly diagonal except for possibly the first sub/super-diagonal.
+ * Specifically, if {@code H} has all zeros below the first sub-diagonal and above the first super-diagonal. For example, the following matrix is in Hermitian tri-diagonal form where each {@code x} may hold a different value (provided
+ * the matrix is Hermitian):
+ *
+ * [[ x x 0 0 0 ]
+ * [ x x x 0 0 ]
+ * [ 0 x x x 0 ]
+ * [ 0 0 x x x ]
+ * [ 0 0 0 x x ]]
+ *
Note: no check is made to + * explicitly check that the {@code src} matrix is actually Hermitian.
+ * + * @param src Matrix to apply the Householder reflector to. Assumed to be square and Hermitian. Upper triangular portion + * overwritten with the result. + * @param householderVector Householder vector {@code v} from the definition of a Householder reflector matrix. + * @param alpha The scalar &alpha value in Householder reflector matrix definition. + * @param startCol Starting column of sub-matrix in {@code src} to apply reflector to. + * @param workArray Array for storing temporary values during the computation. Contents will be overwritten. + */ + public static void hermLeftRightMultReflector(CMatrix src, + CNumber[] householderVector, + CNumber alpha, + int startCol, + CNumber[] workArray) { + int numRows = src.numRows; + + // Computes w = -alpha*A*v (taking conjugate for lower triangular part) + for (int i = startCol; i < numRows; i++) { + CNumber total = new CNumber(0, 0); + int rowOffset = i * numRows; + + for (int j = startCol; j < i; j++) { + total = total.add(src.entries[j * numRows + i].conj().mult(householderVector[j])); + } + for (int j = i; j < src.numRows; j++) { + total = total.add(src.entries[rowOffset + j].mult(householderVector[j])); + } + + workArray[i] = alpha.mult(total).addInv(); + } + + // Computes -0.5*alpha*v^T*w (with conjugation in the scalar product) + CNumber innerProd = new CNumber(0, 0); + for (int i = startCol; i < numRows; i++) { + innerProd = innerProd.add(householderVector[i].conj().mult(workArray[i])); + } + innerProd = innerProd.mult(alpha).mult(new CNumber(-0.5, 0)); + + // Computes w + innerProd*v + for (int i = startCol; i < numRows; i++) { + workArray[i] = workArray[i].add(innerProd.mult(householderVector[i])); + } + + // Computes A + w*v^T + v*w^T (ensuring Hermitian property is maintained) + for (int i = startCol; i < numRows; i++) { + CNumber prod = workArray[i]; + CNumber h = householderVector[i]; + int rowOffset = i * numRows; + + for (int j = i; j < src.numRows; j++) { + src.entries[rowOffset + j] = src.entries[rowOffset + j] + .add(prod.mult(householderVector[j])) + .add(workArray[j].mult(h.conj())); + } + } + } } diff --git a/target/flag4j-v0.1.0-beta.jar b/target/flag4j-v0.1.0-beta.jar index af96840b894bd2001835709fc33e92d96ba65db8..37658b10c1c992ca6d7bddff8f366bc4c6d77bb8 100644 GIT binary patch delta 27609 zcmZ6yWmFtpv@HrWjk`O+-QC^YHMqMwX(SNb-Q6{~y9Wzy!GgO54=?b&_wG4&j2b=X zUe>Fs>&NQ3s{(&g4lGk5D9ZsL;lRLPz`*dr;t?ny{(Z8&K;VWYvVgO{gC#h}JLG_K zy~7eX+dCjY(En#7PBq+vK>8m=aKaK@A-Lb2)eyArumZvO4o2{ViA<1KiTnV#_hl4- zEzuW%{2vv4hZ%tIf53+7?85Yay21^E)k&Oy!GF(AH8O^UN{oj5D3J~+@}3|9^HDgJ z*$fuufAsOsLk47h56}W~zC$dK{~acQQva>!Q2xq5gM8))EOpd=>PpqM(_gfMMPkz-<{}* zO0XZ-OlPH|4UL;ft)HDpb9
z7>E_#&!Z 7HrI}V03Qp`6&d>v8JhSAJb5Qnf>vaY(#OOJS?Bt&!
zJ*{DBR%O~I08z>G&jZ!K2i!?II7Y`{!}kp0gdU^n_mregQCMIo=S$AaRx};)1!I
zI~>c$796;keN8L4G}B~Rjd
pYul62coP5zm%TO
zM77o@-}^nzI+#+BulmXMpSTS*mj5}AQ0Y)U^|g=YhfwE+y*Uf4@0sc~+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