code: function compareMatricesAndArrays (x, y) {
      if (isSparseMatrix(x) && isSparseMatrix(y)) {
        return compareArrays(x.toJSON().values, y.toJSON().values)
      }
      if (isSparseMatrix(x)) {
        // note: convert to array is expensive
        return compareMatricesAndArrays(x.toArray(), y)
      }
      if (isSparseMatrix(y)) {
        // note: convert to array is expensive
        return compareMatricesAndArrays(x, y.toArray())
      }
  
      // convert DenseArray into Array
      if (isDenseMatrix(x)) {
        return compareMatricesAndArrays(x.toJSON().data, y)
      }
      if (isDenseMatrix(y)) {
        return compareMatricesAndArrays(x, y.toJSON().data)
      }
  
      // convert scalars to array
      if (!Array.isArray(x)) {
        return compareMatricesAndArrays([x], y)
      }
      if (!Array.isArray(y)) {
        return compareMatricesAndArrays(x, [y])
      }
  
      return compareArrays(x, y)
    }
docs: Compare mixed matrix/array types, by converting to same-shaped array.
  This comparator is non-deterministic regarding input types.
  @param {Array | SparseMatrix | DenseMatrix | *} x
  @param {Array | SparseMatrix | DenseMatrix | *} y
  @returns {number} Returns the comparison result: -1, 0, or 1