Given a 2D feature matrix X with shape (n, d) where each row is a sample vector, compute the pairwise cosine similarity matrix S of shape (n, n) where S[i, j] is the cosine similarity between row i and row j of X.
Cosine similarity between two vectors a and b is defined as:
If a row has zero L2 norm, define its similarity with any other vector as 0.0. The diagonal S[i, i] should be 1.0 for nonzero rows and 0.0 for zero rows.
Return the result as a nested Python list, with each value rounded to 4 decimal places.