# Can cosine similarity be applied to multidimensional matrices?

I'm trying to find the similarity between two 4D matrices. Because cosine similarity takes the dot product of the input matrices, the result is inevitably a matrix. Is there a way to get a scalar value instead? Could inner product used instead of dot product? That is, is

cossim(A,B) = inner(A,B) / (norm(A) * norm(B))

valid? Or is there a better way to find the similarity between multidimensional matrices?

• Well, this depends very much on how the similarity is defined: there is no general definition thereof: what is the question you are trying to answer? When would you want two matrices to be "close" to each other? Jul 12 '18 at 17:10