Optimize a Python function that performs batch processing on high-dimensional feature vectors.
Implement batch_cosine_similarity(vectors, query) to return one cosine similarity score for each vector. All vectors have the same dimension as query. A zero vector, or a zero query vector, must produce a score of 0.0. Optimize the implementation by avoiding repeated calculations that are shared across the batch.
Input: a list of numeric vectors and one numeric query vector.
Output: a list of floating-point similarity scores in input order.
vectors may be empty.query.vectors.0.0.def batch_cosine_similarity(vectors, query):