distribution queries [
Can20
], and constraint based queries [
ES20
] in property testing, inner product queries
in compressed sensing [EK12], and quantum queries [LSZ21, CHL21].
Most prior works on query based models assume black-box access to matrix-vector queries. While this is
a natural model which allows for the design non-trivial algorithms and lower bounds, it is not always clear
how such queries can be initialized. In contrast, the focus of our work is not on obtaining query complexity
bounds, but rather complementing prior works by creating an efficient matrix-vector query for a natural class
of matrices.
Subquadratic Algorithms for Distance Matrices.
Most work on subquadratic algorithms for distance
matrices have focused on the problem of computing a low-rank approximation. [
BW18
,
IVWW19
] both
obtain an additive error low-rank approximation applicable for all distance matrices. These works only
assume access to the entries of the distance matrix whereas we assume we also have access to the underlying
dataset. [
BCW20
] study the problem of computing the low-rank approximation of PSD matrices with also
sample access to the entries of the matrix. Their results extend to low-rank approximation for the
`1
and
`2
2
distance matrices in addition to other more specialized metrics such as spherical metrics. Table 2 lists the
runtime comparisons between their results and ours.
Practically, the algorithm of [
IVWW19
] is the easiest to implement and has outstanding empirical
performance. We note that we can easily simulate their algorithm with no overall asymptotic runtime
overhead using
O
(
log n
) vector queries. Indeed, their algorithm proceeds by sampling rows of the matrix
according to their
`2
2
value and then post-processing these rows. The sampling probabilities only need to
be accurate up to a factor of two. We can acquire these sampling probabilities by performing
O
(
log n
)
matrix-vector queries which sketches the rows onto dimension
O
(
log n
) and preserves all row-norms up to
a factor of two with high probability due to the Johnson-Lindenstrauss lemma [
JL84
]. This procedure only
incurs an additional runtime of O(Tlog n) where Tis the time required to perform a matrix-vector query.
The paper [
ILLP04
] shows that the exact
L1
distance matrix can be created in time
O
(
n(w+3)/2
)
≈n2.69
in the case of
d
=
n
, which is asymptotically faster than the naive bound of
O
(
n2d
) =
O
(
n3
). In contrast,
we focus on creating an (entry-wise) approximate distance matrices for all values of d.
We also compare to the paper of [
ACSS20
]. In summary, their main upper bounds are approximation
algorithms while we mainly focus on exact algorithms. Concretely, they study matrix vector products for
matrices of the form
Ai,j
=
f
(
kxi−xjk2
2
) for some function
f
:
R→R
. They present results on approximating
the matrix vector product of Awhere the approximation error is additive. They also consider a wide range
of
f
, including polynomials and other kernels, but the input to is always the
`2
distance squared. In contrast,
we also present exact algorithms, i.e., with no approximation errors. For example one of our main upper
bounds is an exact algorithm when
Ai,j
=
kxi−xjk1
(see Table 1 for the full list). Since it is possible to
approximately embed the
`1
distance into
`2
2
, their methods could be used to derive approximate algorithms
for
`1
, but not the exact ones. Furthermore, we also study a wide variety of other distance functions such as
`∞
and
`p
p
(and others listed in Table 1) which are not studied in Alman et al. In terms of technique, the main
upper bound technique of Alman et al. is to expand
f
(
kxi−xjk2
2
) and approximate the resulting quantity
via a polynomial. This is related to our upper bound results for
`p
p
for even
p
where we also use polynomials.
However, our results are exact, while theirs are approximate. Our
`1
upper bound technique is orthogonal to
the polynomial approximation techniques used in Alman et al. We also employ polynomial techniques to give
upper bounds for the approximate
`∞
distance function which is not studied in Alman et al. Lastly, Alman
et al. also focus on the Laplacian matrix of the weighted graph represented by the distance matrix, such
as spectral sparsification and Laplacian system solving. In contrast, we study different problems including
low-rank approximations, eigenvalue estimation, and the task of initializing an approximate distance matrix.
We do not consider the distance matrix as a graph or consider the associated Laplacian matrix.
It is also easy to verify the “folklore” fact that for a gram matrix
AAT
, we can compute
AATv
in time
O
(
nd
) if
A∈Rn×d
by computing
ATv
first and then
A
(
ATv
). Our upper bound for the
`2
2
function can
be reduced to this folklore fact by noting that
kx−yk2
2
=
kxk2
2
+
kyk2
2−
2
hx, yi
. Thus the
`2
2
matrix can
be decomposed into two rank one components due to the terms
kxk2
2
and
kyk2
2
, and a gram matrix due to
the term
hx, yi
. This decomposition of the
`2
2
matrix is well-known (see Section 2 in [
DPRV15
]). Hence, a
5