update cosine.cpp