Class BasicUtilsKt
-
- All Implemented Interfaces:
public final class BasicUtilsKt
-
-
Method Summary
Modifier and Type Method Description final static Integerminpos(DoubleArray v)Finds the position of the minimum value in a vector. final static IntArrayminpos(DoubleArray v, Integer n)Finds the positions of the n smallest values in a vector. final static Integermaxpos(DoubleArray v)Finds the position of the maximum value in a vector. final static IntArraymaxpos(DoubleArray v, Integer n)Finds the positions of the n largest values in a vector. final static IntArraylogspacei(Double a, Double b, Integer points)Generates logarithmically spaced integers in a, b. final static SpectralDecompositionspectd(Matrix A)Computes the spectral decomposition of a matrix. final static Matrixones(Integer n)Creates a column vector of ones. final static Matrixe(Integer n)Creates a vector e(n) = 1, 1, ... final static Matrixeye(Integer n)Creates an identity matrix. final static Matrixzeros(Integer m, Integer n)Creates a zero matrix. -
-
Method Detail
-
minpos
final static Integer minpos(DoubleArray v)
Finds the position of the minimum value in a vector.
- Parameters:
v- The input vector- Returns:
The index (0-based) of the minimum value
-
minpos
final static IntArray minpos(DoubleArray v, Integer n)
Finds the positions of the n smallest values in a vector.
- Parameters:
v- The input vectorn- The number of smallest elements to find- Returns:
Array of indices (0-based) of the n smallest values, sorted by value
-
maxpos
final static Integer maxpos(DoubleArray v)
Finds the position of the maximum value in a vector.
- Parameters:
v- The input vector- Returns:
The index (0-based) of the maximum value
-
maxpos
final static IntArray maxpos(DoubleArray v, Integer n)
Finds the positions of the n largest values in a vector.
- Parameters:
v- The input vectorn- The number of largest elements to find- Returns:
Array of indices (0-based) of the n largest values, sorted by value descending
-
logspacei
final static IntArray logspacei(Double a, Double b, Integer points)
Generates logarithmically spaced integers in a, b.
- Parameters:
a- Lower boundb- Upper boundpoints- Number of points- Returns:
Array of logarithmically spaced integers
-
spectd
final static SpectralDecomposition spectd(Matrix A)
Computes the spectral decomposition of a matrix. Returns eigenvalues, eigenvectors, and projectors.
- Parameters:
A- The input matrix- Returns:
SpectralDecomposition containing spectrum, projectors, eigenvectors, and eigenvalue matrix
-
ones
final static Matrix ones(Integer n)
Creates a column vector of ones.
- Parameters:
n- Size of the vector- Returns:
Column vector of ones
-
e
final static Matrix e(Integer n)
Creates a vector e(n) = 1, 1, ..., 1^T used in matrix operations.
- Parameters:
n- Size of the vector- Returns:
Column vector of ones
-
eye
final static Matrix eye(Integer n)
Creates an identity matrix.
- Parameters:
n- Size of the matrix- Returns:
Identity matrix of size n x n
-
-
-
-