langchain.js
    Preparing search index...
    • This function calculates the row-wise cosine similarity between two matrices with the same number of columns.

      Parameters

      • X: number[][]

        The first matrix.

      • Y: number[][]

        The second matrix.

      Returns number[][]

      A matrix where each row represents the cosine similarity values between the corresponding rows of X and Y.

      If the number of columns in X and Y are not the same.