From 4739c595fe88b74f15185681744aaf9d216894a2 Mon Sep 17 00:00:00 2001 From: Luke Shingles Date: Sun, 1 Sep 2024 22:49:54 +0100 Subject: [PATCH] Update vectors.h --- vectors.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vectors.h b/vectors.h index d0d29fea6..744f71696 100644 --- a/vectors.h +++ b/vectors.h @@ -33,7 +33,7 @@ template // vector dot product template -[[nodiscard]] constexpr auto dot(const std::array x, const std::array y) -> double { +[[nodiscard]] constexpr auto dot(const std::array &x, const std::array &y) -> double { // if len(x) < len(y), the extra elements of y are ignored return std::inner_product(x.begin(), x.end(), y.begin(), 0.); } @@ -57,8 +57,8 @@ template // dir1: direction unit vector in frame1 // vel: velocity of frame2 relative to frame1 // dir2: direction vector in frame2 -[[nodiscard]] constexpr auto angle_ab(const std::array dir1, - const std::array vel) -> std::array { +[[nodiscard]] constexpr auto angle_ab(const std::array &dir1, + const std::array &vel) -> std::array { const double vsqr = dot(vel, vel) / CLIGHTSQUARED; const double gamma_rel = 1. / std::sqrt(1 - vsqr); @@ -77,8 +77,8 @@ template // dir_rf: the rest frame direction (unit vector) of light propagation // vel_rf: velocity of the comoving frame relative to the rest frame // returns: the ratio f = nu_cmf / nu_rf -[[nodiscard]] constexpr auto doppler_nucmf_on_nurf(const std::array dir_rf, - const std::array vel_rf) -> double { +[[nodiscard]] constexpr auto doppler_nucmf_on_nurf(const std::array &dir_rf, + const std::array &vel_rf) -> double { assert_testmodeonly(dot(vel_rf, vel_rf) / CLIGHTSQUARED >= 0.); assert_testmodeonly(dot(vel_rf, vel_rf) / CLIGHTSQUARED < 1.);