Source code for bw2calc.dense_lca
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, division
from eight import *
from .lca import LCA
from numpy.linalg import solve
[docs]
class DenseLCA(LCA):
[docs]
def solve_linear_system(self):
"""
Master solution function for linear system :math:`Ax=B`.
To most numerical analysts, matrix inversion is a sin.
-- Nicolas Higham, Accuracy and Stability of Numerical Algorithms, Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, 2002, p. 260.
We use `UMFpack <http://www.cise.ufl.edu/research/sparse/umfpack/>`_, which is a very fast solver for sparse matrices.
If the technosphere matrix has already been factorized, then the decomposed technosphere (``self.solver``) is reused. Otherwise the calculation is redone completely.
"""
return solve(self.technosphere_matrix.toarray(), self.demand_array)