Package jline.lib.butools.mam
Class FluidTools
java.lang.Object
jline.lib.butools.mam.FluidTools
Small matrix helpers shared by the fluid-queue ports (diagonal extraction,
index-based submatrices, block assembly). Kept package-local to mirror the
self-contained BUTools thirdparty style.
-
Method Summary
Modifier and TypeMethodDescriptionstatic MatrixBlock-diagonal [[A 0];[0 B]].static Matrix2x2 block matrix [[A B];[C D]].static int[]concat(int[] a, int[] b) Concatenate two index arrays.static double[]Diagonal of M as a double array.static MatrixdiagFrom(double[] v) Diagonal matrix from a double array.static MatrixDiagonal matrix from a row/column vector.static Matrix[]expIntMoments(Matrix M, double L) {J0, J1} with J0=int_0^L expm(M u)du, J1=int_0^L u expm(M u)du via nilpotent augmentation.static Matrix[A B] side by side (handles zero-dimension blocks).static Matrixint_0^L expm(KA u) du, robust when KA has a zero eigenvalue (deflation).static Matrix[]{int_0^L expm(KA u)du, int_0^L expm(KB u)du}, applying deflation to the near-singular one.static MatrixSolves A*X = B via partial-pivot LU (LAPACK-equivalent accuracy).static doubleMinimum modulus of the eigenvalues of M.static MatrixLeft null vector of KA via the CRPSolve algorithm (column, no generator check).static Object[]orderedSchur(Matrix A, double tol) Real Schur decomposition of A reordered so that the eigenvalues appear grouped as [zero real-part, negative real-part, positive real-part], the ordering used by MATLAB's ordschur in the multi-regime fluid solver.static Matrix[]Real Schur decomposition of A reordered so that eigenvalues with positive real part appear in the leading block, matching MATLAB's ordschur(U,T,'rhp').static int[]range(int n) 0..n-1.static MatrixRow vector of row-sums (each row summed across columns).static voidAssigns src (rows x |cols|) into the given columns of dst (all rows).static voidAssigns src into dst at rows ri, cols ci.static int[]shiftRange(int start, int n) start..start+n-1.static MatrixSubmatrix M(ri, ci) with index arrays (0-based).static MatrixtriSylvester(Matrix A, Matrix B, Matrix C) Solves the Sylvester equation A*X - X*B = C where A (n x n) and B (m x m) are quasi-upper-triangular (real Schur form), via column-wise back-substitution (Bartels-Stewart), handling 1x1 and 2x2 diagonal blocks of B.static MatrixColumn-major reshape of M into a single column vector.static Matrix[A; B] stacked (handles zero-dimension blocks).
-
Method Details
-
diagArray
Diagonal of M as a double array. -
diagFrom
Diagonal matrix from a double array. -
diagFrom
Diagonal matrix from a row/column vector. -
sub
Submatrix M(ri, ci) with index arrays (0-based). -
setSub
Assigns src into dst at rows ri, cols ci. -
setCols
Assigns src (rows x |cols|) into the given columns of dst (all rows). -
hstack
[A B] side by side (handles zero-dimension blocks). -
vstack
[A; B] stacked (handles zero-dimension blocks). -
block
2x2 block matrix [[A B];[C D]]. -
blkdiag
Block-diagonal [[A 0];[0 B]]. -
concat
public static int[] concat(int[] a, int[] b) Concatenate two index arrays. -
range
public static int[] range(int n) 0..n-1. -
vec
Column-major reshape of M into a single column vector. -
rowSums
Row vector of row-sums (each row summed across columns). -
nullvec
Left null vector of KA via the CRPSolve algorithm (column, no generator check). -
minAbsEig
Minimum modulus of the eigenvalues of M. -
integExp
int_0^L expm(KA u) du, robust when KA has a zero eigenvalue (deflation). -
integExp2
{int_0^L expm(KA u)du, int_0^L expm(KB u)du}, applying deflation to the near-singular one. -
expIntMoments
{J0, J1} with J0=int_0^L expm(M u)du, J1=int_0^L u expm(M u)du via nilpotent augmentation. -
shiftRange
public static int[] shiftRange(int start, int n) start..start+n-1. -
orderedSchur
Real Schur decomposition of A reordered so that the eigenvalues appear grouped as [zero real-part, negative real-part, positive real-part], the ordering used by MATLAB's ordschur in the multi-regime fluid solver. Returns {Z, T, int[]{zeroeig, negeig, poseig}} with Z orthogonal, T quasi-upper-triangular and Z'*A*Z = T. -
orderedSchurRhp
Real Schur decomposition of A reordered so that eigenvalues with positive real part appear in the leading block, matching MATLAB's ordschur(U,T,'rhp'). Returns {Z, T} with Z orthogonal, T quasi-upper-triangular and Z'*A*Z = T. -
linsolve
Solves A*X = B via partial-pivot LU (LAPACK-equivalent accuracy). -
triSylvester
Solves the Sylvester equation A*X - X*B = C where A (n x n) and B (m x m) are quasi-upper-triangular (real Schur form), via column-wise back-substitution (Bartels-Stewart), handling 1x1 and 2x2 diagonal blocks of B. Accurate even when A/B are large.
-