1 /*
2 Copyright (C) 2010 William Hart
3 Copyright (C) 2014 Abhinav Baid
4
5 This file is part of FLINT.
6
7 FLINT is free software: you can redistribute it and/or modify it under
8 the terms of the GNU Lesser General Public License (LGPL) as published
9 by the Free Software Foundation; either version 2.1 of the License, or
10 (at your option) any later version. See <https://www.gnu.org/licenses/>.
11 */
12
13 #include "mpf_vec.h"
14
15 void
_mpf_vec_dot(mpf_t res,const mpf * vec1,const mpf * vec2,slong len2)16 _mpf_vec_dot(mpf_t res, const mpf * vec1, const mpf * vec2, slong len2)
17 {
18 slong i;
19 mpf_t tmp;
20 mpf_init(tmp);
21
22 flint_mpf_set_ui(res, 0);
23 for (i = 0; i < len2; i++)
24 {
25 mpf_mul(tmp, vec1 + i, vec2 + i);
26 mpf_add(res, res, tmp);
27 }
28
29 mpf_clear(tmp);
30 }
31