spateo.alignment.methods.morpho_sparse_utils#

Module Contents#

Functions#

calc_distance(X_A, X_B[, metric, batch_capacity, ...])

calc_P_related(XnAHat, XnB, X_A, X_B, sigma2, ...[, ...])

get_optimal_R_sparse(coordsA, coordsB, P, R_init)

Get the optimal rotation matrix R

_init_guess_sigma2(XA, XB[, subsample])

_init_guess_beta2(nx, XA, XB[, dissimilarity, ...])

_construct_label_mask(labelA, labelB, label_transfer_prior)

_dense_to_sparse(mat[, sparse_method, threshold, ...])

_SparseTensor(nx, row, col, value, sparse_sizes)

_dist(→ Union[numpy.ndarray, torch.Tensor])

_sort(nx, arr[, axis, descending])

Attributes#

spateo.alignment.methods.morpho_sparse_utils.calc_distance(X_A: numpy.ndarray | torch.Tensor, X_B: numpy.ndarray | torch.Tensor, metric: str = 'euc', batch_capacity: int = 1, use_sparse: bool = False, sparse_method: str = 'topk', threshold: int | float = 100, return_mask: bool = False, save_to_cpu: bool = False, **kwargs)[source]#
spateo.alignment.methods.morpho_sparse_utils.get_optimal_R_sparse(coordsA: numpy.ndarray | torch.Tensor, coordsB: numpy.ndarray | torch.Tensor, P: numpy.ndarray | torch.Tensor | torch.sparse_coo_tensor, R_init: numpy.ndarray | torch.Tensor)[source]#

Get the optimal rotation matrix R

Parameters:
coordsA Union[np.ndarray, torch.Tensor]

The first input matrix with shape n x d

coordsB Union[np.ndarray, torch.Tensor]

The second input matrix with shape n x d

P Union[np.ndarray, torch.Tensor]

The optimal transport matrix with shape n x n

Returns:

The optimal rotation matrix R with shape d x d

Return type:

Union[np.ndarray, torch.Tensor]

spateo.alignment.methods.morpho_sparse_utils._init_guess_sigma2(XA, XB, subsample=2000)[source]#
spateo.alignment.methods.morpho_sparse_utils._init_guess_beta2(nx, XA, XB, dissimilarity='kl', partial_robust_level=1, beta2=None, beta2_end=None, subsample=2000)[source]#
spateo.alignment.methods.morpho_sparse_utils._construct_label_mask(labelA, labelB, label_transfer_prior)[source]#
spateo.alignment.methods.morpho_sparse_utils._dense_to_sparse(mat: numpy.ndarray | torch.Tensor, sparse_method: str = 'topk', threshold: int | float = 100, axis: int = 0, descending=False)[source]#
spateo.alignment.methods.morpho_sparse_utils._SparseTensor(nx, row, col, value, sparse_sizes)[source]#
spateo.alignment.methods.morpho_sparse_utils._dist(mat1: numpy.ndarray | torch.Tensor, mat2: numpy.ndarray | torch.Tensor, metric: str = 'euc') numpy.ndarray | torch.Tensor[source]#
spateo.alignment.methods.morpho_sparse_utils.nx_torch[source]#
spateo.alignment.methods.morpho_sparse_utils._cat[source]#
spateo.alignment.methods.morpho_sparse_utils._dot[source]#
spateo.alignment.methods.morpho_sparse_utils._split[source]#
spateo.alignment.methods.morpho_sparse_utils._where[source]#
spateo.alignment.methods.morpho_sparse_utils._repeat_interleave[source]#
spateo.alignment.methods.morpho_sparse_utils._sort(nx, arr, axis=-1, descending=False)[source]#