Compute Schur matrix¶

This examples show how to compute and plot the Schur matrix.

The Schur matrix is equivalent to the diagonal matrix of eigenvalues for diagonalizable matrices. For the real Schur decomposition, it is a real, quasi-upper triangular matrix with 1x1 and 2x2 blocks on the diagonal. For a rectangular, real matrix $$T$$, it holds: $$T = Q R Q^T$$, where $$R$$ is the real Schur matrix and $$Q$$ is an orthogonal matrix containing the real Schur vectors as columns. 1x1 blocks on the diagonal of $$R$$ correspond to real eigenvalues of $$T$$ whereas 2x2 blocks on the diagonal of $$R$$ correspond to pairs of complex conjugate eigenvalues of $$T$$.

import cellrank as cr



Out:

AnnData object with n_obs × n_vars = 2531 × 2000
obs: 'day', 'proliferation', 'G2M_score', 'S_score', 'phase', 'clusters_coarse', 'clusters', 'clusters_fine', 'louvain_Alpha', 'louvain_Beta', 'initial_size_unspliced', 'initial_size_spliced', 'initial_size', 'n_counts', 'velocity_self_transition', 'dpt_pseudotime'
var: 'highly_variable_genes', 'gene_count_corr', 'means', 'dispersions', 'dispersions_norm', 'fit_r2', 'fit_alpha', 'fit_beta', 'fit_gamma', 'fit_t_', 'fit_scaling', 'fit_std_u', 'fit_std_s', 'fit_likelihood', 'fit_u0', 'fit_s0', 'fit_pval_steady', 'fit_steady_u', 'fit_steady_s', 'fit_variance', 'fit_alignment_scaling', 'velocity_genes'
uns: 'clusters_colors', 'clusters_fine_colors', 'diffmap_evals', 'iroot', 'louvain_Alpha_colors', 'louvain_Beta_colors', 'neighbors', 'pca', 'recover_dynamics', 'velocity_graph', 'velocity_graph_neg', 'velocity_params'
obsm: 'X_diffmap', 'X_pca', 'X_umap', 'velocity_umap'
varm: 'PCs', 'loss'
layers: 'Ms', 'Mu', 'fit_t', 'fit_tau', 'fit_tau_', 'spliced', 'unspliced', 'velocity', 'velocity_u'
obsp: 'connectivities', 'distances'


First, we prepare the kernel using the high-level pipeline and the cellrank.tl.estimators.GPCCA estimator.

k = cr.tl.transition_matrix(
)
g = cr.tl.estimators.GPCCA(k)


To compute the Schur vectors, run the code below. Parameter n_components controls how many vectors to compute.

g.compute_schur(n_components=6)


Finally, we are ready to plot the Schur matrix. The real Schur matrix is quasi-upper triangular, which means there may be 1x1 or 2x2 blocks on the diagonal.

g.plot_schur_matrix()