tempnet.parallel_expm ===================== .. py:module:: tempnet.parallel_expm .. autoapi-nested-parse:: # # flow stability # # Copyright (C) 2021 Alexandre Bovet # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 3 of the License, or (at your option) any # later version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . Attributes ---------- .. autoapisummary:: tempnet.parallel_expm.var_dict Functions --------- .. autoapisummary:: tempnet.parallel_expm.compute_parallel_expm tempnet.parallel_expm.compute_subspace_expm_parallel Module Contents --------------- .. py:function:: compute_parallel_expm(A, nproc=1, thresh_ratio=None, normalize_rows=True, verbose=True) Computes the exponential matrix of A by computing each column separately exploiting the fact that the column i of expm(A) is expm_multiply(A,delta_i) where delta i is the vector with zeros everywhere except on i. This only works if A is equal to (minus) a Laplacian matrix :param A: Square csc sparse matrix representing (+ or -) a Laplacian. If A is not csc, it will be converted to csc format. :type A: scipy csc sparse matrix :param nproc: number of parallel processes. The default is 1. :type nproc: int, optional :param thresh_ratio: Threshold ratio used to trim negligible values in the resulting matrix. For each columns `c`, values smaller than `max(c)/thresh_ratio` are set to zero. Default is None. :type thresh_ratio: float, optional. :param normalize_rows: Whether rows of the resulting matrix are normalized to sum to 1. :type normalize_rows: bool, optional. :returns: scipy csr sparse matrix :rtype: expm(A). .. py:function:: compute_subspace_expm_parallel(A, n_comp=None, comp_labels=None, verbose=False, nproc=1, thresh_ratio=None, normalize_rows=True) Compute the exponential matrix of `A` by applying expm on each connected subgraphs defined by A and recomposing it to return expm(A). Small subgraphs are computed in parallel, each using scipy expm, and large subgraphs are computed with compute_parallel_expm. :param A: :type A: scipy.sparse.csc_matrix nproc : int, optional number of parallel processes. The default is 1. thresh_ratio: float, optional. Threshold ratio used to trim negligible values in the resulting matrix. Values smaller than `max(expm(A))/thresh_ratio` are set to zero. Default is None. normalize_rows: bool, optional. Whether rows of the resulting matrix are normalized to sum to 1. :returns: * **expm(A)** (*scipy.sparse.csr_matrix*) * *matrix exponential of A* .. py:data:: var_dict