xnn.krnn.common.sgdml_iterative.PairFactors#

class xnn.krnn.common.sgdml_iterative.PairFactors(model, x, u, energy_constraint=False)[source]#

Bases: object

K v from the kernel factors of every training pair, formed once.

The geometry does not change during the solve, so g, t (and k with energy rows) of every pair of a training geometry and a permuted training term are kept (from exact distances); a product then needs three matrix products over the (M, M Q) pairs: the dot products D . w as x_i . w - x_j . w and the gradient terms likewise. Those differences cancel to about 1e-12 relative, far below the solver’s tolerance.

Parameters:
  • model (SGDML) – Supplies the kernel and the permutations.

  • x (Tensor) – (M, D) training descriptors and (M, D, 3) their pair gradients.

  • u (Tensor) – (M, D) training descriptors and (M, D, 3) their pair gradients.

  • energy_constraint (bool, optional) – Whether the system has energy rows.

static nbytes(m, q, energy_constraint)[source]#

Bytes of the factors and of the temporaries of a product.

Parameters:
Return type:

float