# Factor a non-symmetric matrix into the product of a sparse symmetric matrix and a diagonal matrix plus a low rank correction

I have a non-symmetric matrix, where the non-symmetry only appears at a subset of points. This arises due to the particular manner on which boundary conditions are applied in a Cartesian grid method. I'm looking for a way to factor the matrix into the product of a symmetric sparse matrix and a diagonal matrix with a low rank correction so I can symmetrize the system as suggested here:

How far is a non-symmetric discretization of an elliptic operator from the continuous operator itself?

There is no way you really mean product since the product of a low rank matrix with anything is also low rank. Given non-symmetric $A$, perhaps you are looking for
$$S = \frac 1 2 (A + A^T)$$ $$N = \frac 1 2 (A - A^T).$$
If $A = S + N$ is symmetric in most of the domain, then the non-symmetric part $N$ will be low rank and sparse.
Of course a sum is much less useful than a product if you were interested in solving this system. In particular, if $N$ is nonzero at boundaries, the rank is not small enough for specialized tricks to apply. What was really intended in the question you reference is to reformulate your problem, not to brute-force decompose or symmetricze.