Object Kpctoolbox
-
- All Implemented Interfaces:
public class KpctoolboxFacade object providing static-style access to KPC-Toolbox functions.
This object bridges the gap between JPype (which needs a class with static methods) and Kotlin top-level functions. JPype accesses methods via: jline.lib.kpctoolbox.Kpctoolbox.INSTANCE.methodName(...) or equivalently via @JvmStatic: jline.lib.kpctoolbox.Kpctoolbox.methodName(...)
Functions that accept DoubleArray in the Kotlin implementations are wrapped to accept Matrix objects (from jline.util.matrix.Matrix), since the Python wrapper passes Matrix objects via JPype using jlineMatrixFromArray().
-
-
Field Summary
Fields Modifier and Type Field Description public final static KpctoolboxINSTANCE
-
Method Summary
Modifier and Type Method Description final static Doubletrace_mean(Matrix S)Computes the mean of a trace. final static Doubletrace_var(Matrix S)Computes the variance of a trace. final static Doubletrace_scv(Matrix S)Computes the squared coefficient of variation (SCV) of a trace. final static Matrixtrace_acf(Matrix S, Integer maxLag)Computes the autocorrelation function at specified lags. final static Doubletrace_skew(Matrix S)Computes the skewness of a trace. final static Doubletrace_joint(Matrix S, Matrix lags, Matrix orders)Computes the joint moment of a trace. final static Matrixtrace_bicov(Matrix S1, Matrix S2, Integer maxLag)Computes the bicovariance of a trace. final static Matrixtrace_bicov(Matrix S, IntArray grid)Computes the bicovariance using a grid array. final static Doubletrace_idi(Matrix S, Integer numIntervals)Computes the index of dispersion for intervals (IDI). final static Doubletrace_idc(Matrix S, Double timeWindow)Computes the index of dispersion for counts (IDC). final static Matrixtrace_gamma(Matrix S, Integer limit)Estimates the autocorrelation decay rate of a trace. final static Matrixtrace_shuffle(Matrix S)Shuffles a trace randomly. final static Matrixtrace_iat2counts(Matrix S, Integer numBins)Computes the counting process from inter-arrival times. final static Matrixtrace_iat2bins(Matrix S, Integer numBins)Computes binned counts from inter-arrival times. final static Matrixtrace_pmf(Matrix S)Computes the PMF of discrete values in a trace. final static TraceSummarytrace_summary(Matrix S)Computes summary statistics for a trace. final static Matrixautocov(Matrix S)Computes the autocovariance of a trace. final static Doublemtrace_mean(List<Matrix> traces)Computes the mean of multiple traces. final static Doublemtrace_var(List<Matrix> traces)Computes the variance across multiple traces. final static Matrixeye(Integer n)Creates an identity matrix. final static Matrixones(Integer m, Integer n)Creates a matrix of ones. final static Matrixzeros(Integer m, Integer n)Creates a matrix of zeros. final static Integermaxpos(Matrix data)Finds the position of the maximum value. final static Integerminpos(Matrix data)Finds the position of the minimum value. final static Doublemvph_mean_x(Matrix alpha, Matrix A, Matrix B)Computes EX = mean of first variable in bivariate PH. final static Doublemvph_mean_y(Matrix alpha, Matrix A, Matrix C)Computes EY = mean of second variable in bivariate PH. final static Doublemvph_cov(Matrix alpha, Matrix A, Matrix B, Matrix C)Computes covariance of bivariate PH. final static Doublemvph_corr(Matrix alpha, Matrix A, Matrix B, Matrix C)Computes correlation of bivariate PH. final static Doublemvph_joint(Matrix alpha, Matrix A, Matrix B, Matrix C, Matrix x, Matrix y)Computes the joint moment of bivariate PH. -
-
Method Detail
-
trace_mean
final static Double trace_mean(Matrix S)
Computes the mean of a trace.
- Parameters:
S- Input trace as Matrix (column or row vector)- Returns:
Mean value
-
trace_var
final static Double trace_var(Matrix S)
Computes the variance of a trace.
- Parameters:
S- Input trace as Matrix- Returns:
Variance
-
trace_scv
final static Double trace_scv(Matrix S)
Computes the squared coefficient of variation (SCV) of a trace.
- Parameters:
S- Input trace as Matrix- Returns:
SCV = variance / mean^2
-
trace_acf
final static Matrix trace_acf(Matrix S, Integer maxLag)
Computes the autocorrelation function at specified lags. The wrapper calls this with (Matrix, int) where int is max_lag. Returns a Matrix of ACF values for lags 1..maxLag.
- Parameters:
S- Input trace as MatrixmaxLag- Maximum lag to compute- Returns:
Matrix containing ACF values
-
trace_skew
final static Double trace_skew(Matrix S)
Computes the skewness of a trace.
- Parameters:
S- Input trace as Matrix- Returns:
Skewness value
-
trace_joint
final static Double trace_joint(Matrix S, Matrix lags, Matrix orders)
Computes the joint moment of a trace.
- Parameters:
S- Input trace as Matrixlags- Lag values as Matrixorders- Moment orders as Matrix- Returns:
Joint moment value
-
trace_bicov
final static Matrix trace_bicov(Matrix S1, Matrix S2, Integer maxLag)
Computes the bicovariance of a trace. The wrapper calls this with (Matrix, Matrix, int) where:
first Matrix is trace1, second is trace2, int is maxLag. Returns a Matrix of bicovariance values.
- Parameters:
S1- First trace as MatrixS2- Second trace as Matrix (used as lag grid)maxLag- Maximum lag- Returns:
Matrix of bicovariance values
-
trace_bicov
final static Matrix trace_bicov(Matrix S, IntArray grid)
Computes the bicovariance using a grid array.
- Parameters:
S- Input trace as Matrixgrid- Grid of lag values as IntArray- Returns:
Matrix of bicovariance values
-
trace_idi
final static Double trace_idi(Matrix S, Integer numIntervals)
Computes the index of dispersion for intervals (IDI). The wrapper calls this with (Matrix, int) where int is num_intervals.
- Parameters:
S- Input trace as MatrixnumIntervals- Number of intervals- Returns:
IDI value
-
trace_idc
final static Double trace_idc(Matrix S, Double timeWindow)
Computes the index of dispersion for counts (IDC). The wrapper calls this with (Matrix, double) where double is time_window. Since IDC is asymptotically equal to IDI, we use trace_idi with appropriate k.
- Parameters:
S- Input trace as MatrixtimeWindow- Time window for analysis- Returns:
IDC value
-
trace_gamma
final static Matrix trace_gamma(Matrix S, Integer limit)
Estimates the autocorrelation decay rate of a trace. The wrapper calls this with (Matrix, int) where int is max_lag limit.
- Parameters:
S- Input trace as Matrixlimit- Maximum lag considered- Returns:
Matrix containing gamma value
-
trace_shuffle
final static Matrix trace_shuffle(Matrix S)
Shuffles a trace randomly.
- Parameters:
S- Input trace as Matrix- Returns:
Shuffled trace as Matrix
-
trace_iat2counts
final static Matrix trace_iat2counts(Matrix S, Integer numBins)
Computes the counting process from inter-arrival times. The wrapper calls this with (Matrix, int) where int is num_bins.
- Parameters:
S- Inter-arrival times as MatrixnumBins- Number of bins (used as scale)- Returns:
Counts as Matrix
-
trace_iat2bins
final static Matrix trace_iat2bins(Matrix S, Integer numBins)
Computes binned counts from inter-arrival times. The wrapper calls this with (Matrix, int) where int is num_bins.
- Parameters:
S- Inter-arrival times as MatrixnumBins- Number of bins- Returns:
Matrix of binned counts
-
trace_pmf
final static Matrix trace_pmf(Matrix S)
Computes the PMF of discrete values in a trace.
- Parameters:
S- Input trace as Matrix- Returns:
Matrix where column 0 = PMF values, column 1 = unique values
-
trace_summary
final static TraceSummary trace_summary(Matrix S)
Computes summary statistics for a trace.
- Parameters:
S- Input trace as Matrix- Returns:
TraceSummary object
-
autocov
final static Matrix autocov(Matrix S)
Computes the autocovariance of a trace.
- Parameters:
S- Input trace as Matrix- Returns:
Matrix of autocovariance values
-
mtrace_mean
final static Double mtrace_mean(List<Matrix> traces)
Computes the mean of multiple traces. The wrapper passes a Python list of Matrix objects.
- Parameters:
traces- List of trace Matrix objects- Returns:
Mean value (double) representing overall mean
-
mtrace_var
final static Double mtrace_var(List<Matrix> traces)
Computes the variance across multiple traces. The wrapper expects this to return a single double.
- Parameters:
traces- List of trace Matrix objects- Returns:
Variance value
-
eye
final static Matrix eye(Integer n)
Creates an identity matrix.
- Parameters:
n- Size of the matrix- Returns:
Identity matrix
-
ones
final static Matrix ones(Integer m, Integer n)
Creates a matrix of ones.
- Parameters:
m- Number of rowsn- Number of columns- Returns:
Matrix of ones
-
zeros
final static Matrix zeros(Integer m, Integer n)
Creates a matrix of zeros.
- Parameters:
m- Number of rowsn- Number of columns- Returns:
Zero matrix
-
maxpos
final static Integer maxpos(Matrix data)
Finds the position of the maximum value.
- Parameters:
data- Input data as Matrix- Returns:
Index (0-based) of maximum value
-
minpos
final static Integer minpos(Matrix data)
Finds the position of the minimum value.
- Parameters:
data- Input data as Matrix- Returns:
Index (0-based) of minimum value
-
mvph_mean_x
final static Double mvph_mean_x(Matrix alpha, Matrix A, Matrix B)
Computes EX = mean of first variable in bivariate PH. Wrapper calls: mvph_mean_x(alpha, A, B) with 3 Matrix args. Maps to: mvph_mean_x(alpha, S=A, T=B, D=eye) -- T and D are unused when n2=0.
- Parameters:
alpha- Initial probability vector as MatrixA- Generator matrix SB- Matrix (unused for mean_x since n2=0)- Returns:
EX
-
mvph_mean_y
final static Double mvph_mean_y(Matrix alpha, Matrix A, Matrix C)
Computes EY = mean of second variable in bivariate PH. Wrapper calls: mvph_mean_y(alpha, A, C) with 3 Matrix args. Maps to: mvph_mean_y(alpha, S=A, T=C, D=eye) -- S is unused when n1=0.
- Parameters:
alpha- Initial probability vector as MatrixA- Generator matrix S (unused for mean_y since n1=0)C- Generator matrix T for Y- Returns:
EY
-
mvph_cov
final static Double mvph_cov(Matrix alpha, Matrix A, Matrix B, Matrix C)
Computes covariance of bivariate PH. Wrapper calls: mvph_cov(alpha, A, B, C) with 4 Matrix args. Maps to: mvph_cov(alpha, S=A, T=B, D=C).
- Parameters:
alpha- Initial probability vector as MatrixA- Generator matrix S for XB- Generator matrix T for YC- Transition matrix D from X to Y- Returns:
Cov(X, Y)
-
mvph_corr
final static Double mvph_corr(Matrix alpha, Matrix A, Matrix B, Matrix C)
Computes correlation of bivariate PH. Wrapper calls: mvph_corr(alpha, A, B, C) with 4 Matrix args. Maps to: mvph_corr(alpha, S=A, T=B, D=C).
- Parameters:
alpha- Initial probability vector as MatrixA- Generator matrix S for XB- Generator matrix T for YC- Transition matrix D from X to Y- Returns:
Corr(X, Y)
-
mvph_joint
final static Double mvph_joint(Matrix alpha, Matrix A, Matrix B, Matrix C, Matrix x, Matrix y)
Computes the joint moment of bivariate PH. Wrapper calls: mvph_joint(alpha, A, B, C, x, y) with 6 Matrix args. Maps to: mvph_joint(alpha, S=A, T=B, D=C, n1=x(0,0), n2=y(0,0)).
- Parameters:
alpha- Initial probability vector as MatrixA- Generator matrix S for XB- Generator matrix T for YC- Transition matrix D from X to Yx- Matrix containing moment order n1 in position (0,0)y- Matrix containing moment order n2 in position (0,0)- Returns:
Joint moment EX^n1 * Y^n2
-
-
-
-