Open peekxc opened 1 year ago
Thank you for getting in touch and bringing this issue to my attention. I have resolved the ValueError: Input matrix should be a square matrix
error associated with the square matrix requirement when the Gram matrix is enabled.
Regarding your inquiry concerning the interpretation of the Schatten norm, both the mentioned paper and the package are aligned in their definitions for non-negative definite matrices. However, there is one distinction: within the package, we incorporate a coefficient of $n^{-\frac{1}{p}}$. To adhere to the mentioned paper's definition precisely, you can simply divide the result by this coefficient. For a more comprehensive understanding, you may refer to equations 3 to 5 in this article or consult this section within the package documentation.
Regarding the SLQ method, it is designed with the prerequisite that the input matrix is symmetric. This requirement aligns well with many practical applications, particularly in machine learning, where calculations involving trace functions are often required. These matrices in ML applications, such as covariance matrices, are typically non-negative definite.
However, if your interest extends to working with symmetric matrices that may not strictly adhere to the non-negative definite condition, please feel free to inform me. Adapting the implementation to handle such symmetric but indefinite matrices is a straightforward process and involves introducing an absolute value operation to the eigenvalues, effectively replacing $A$ with $\vert A \vert = \sqrt{A^{\ast} A}$.
Please don't hesitate to share further details or pose additional questions if necessary.
Hey! Out of curiosity, what is the limitation that prevents
imate
from working with products of rectangular matrices?For any real-valued matrix $A \in \mathbb{R}^{n \times m}$ and positive semi-definite matrix $P \in \mathbb{R}^{n \times n}$ given by $P = A A^T$ (or $P = A^T A)$, I would like to estimate various Schatten norms of both $A$ and $P$, e.g.
I can get the Schatten-norms out of $P$ with
imate
:But I also want the norms for $A$. Initially I thought to use that fact that the singular values of $A$ are the square roots of the eigenvalues of $P$. This works well enough using
numpy
:But when I try this for
A
via the gramian approach I get an error:EDIT: Actually the Schatten-p norm of a general matrix expressed as a trace quantity is given by 3rd equation in section 2.3 of Ubaru's paper:
$$ \lVert X \rVertp = \left(\sum\limits{i=1}^r \sigmai^p \right)^{1/p} = \left(\sum\limits{i=1}^r \lambda_i^{p/2} \right)^{1/p}$$
This doesn't seem capturable by imate's definition of the Schatten norm. Am I missing something? Or is this particular matrix function just yet to be implemented in
imate
?