LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
ljd_delinearize.m
1function nvec = ljd_delinearize(idx, cutoffs)
2% NVEC = LJD_DELINEARIZE(IDX, CUTOFFS)
3%
4% Convert linearized index back to per-class population vector
5%
6% idx: 1-based linearized index
7% cutoffs: [N1, N2, ..., NK] - per-class cutoffs
8%
9% Returns: [n1, n2, ..., nK] - per-class populations
10
11% Copyright (c) 2012-2026, Imperial College London
12% All rights reserved.
13
14K = length(cutoffs);
15nvec = zeros(1, K);
16idx = idx - 1; % convert to 0-based for computation
17
18for k = 1:K
19 base = cutoffs(k) + 1;
20 nvec(k) = mod(idx, base);
21 idx = floor(idx / base);
22end
23end