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 <http://www.gnu.org/licenses/>.
11 */
12 
13 #ifndef MPF_VEC_H
14 #define MPF_VEC_H
15 
16 #ifdef MPF_VEC_INLINES_C
17 #define MPF_VEC_INLINE FLINT_DLL
18 #else
19 #define MPF_VEC_INLINE static __inline__
20 #endif
21 
22 #include "flint.h"
23 
24 typedef __mpf_struct mpf;
25 
26 #ifdef __cplusplus
27  extern "C" {
28 #endif
29 
30 /*  Memory management  *******************************************************/
31 
32 FLINT_DLL mpf * _mpf_vec_init(slong len, flint_bitcnt_t prec);
33 
34 FLINT_DLL void _mpf_vec_clear(mpf * vec, slong len);
35 
36 /*  Randomisation  ***********************************************************/
37 
38 FLINT_DLL void _mpf_vec_randtest(mpf * f, flint_rand_t state,
39                         slong len, flint_bitcnt_t bits);
40 
41 /*  Assignment and basic manipulation  ***************************************/
42 
43 FLINT_DLL void _mpf_vec_zero(mpf * vec, slong len);
44 
45 FLINT_DLL void _mpf_vec_set(mpf * vec1, const mpf * vec2, slong len2);
46 
47 /*  Comparison  **************************************************************/
48 
49 FLINT_DLL int _mpf_vec_equal(const mpf * vec1, const mpf * vec2, slong len);
50 
51 FLINT_DLL int _mpf_vec_approx_equal(const mpf * vec1, const mpf * vec2, slong len, flint_bitcnt_t bits);
52 
53 FLINT_DLL int _mpf_vec_is_zero(const mpf * vec, slong len);
54 
55 /*  Addition  ****************************************************************/
56 
57 FLINT_DLL void _mpf_vec_add(mpf * res, const mpf * vec1, const mpf * vec2, slong len2);
58 
59 FLINT_DLL void _mpf_vec_sub(mpf * res, const mpf * vec1, const mpf * vec2, slong len2);
60 
61 /*  Scalar multiplication  **************************************/
62 
63 FLINT_DLL void _mpf_vec_scalar_mul_2exp(mpf * res, const mpf * vec, slong len, flint_bitcnt_t exp);
64 
65 FLINT_DLL void _mpf_vec_scalar_mul_mpf(mpf * res, const mpf * vec, slong len, mpf_t c);
66 
67 /*  Dot product and norm  **************************************/
68 
69 FLINT_DLL void _mpf_vec_dot(mpf_t res, const mpf * vec1, const mpf * vec2, slong len2);
70 
71 FLINT_DLL void _mpf_vec_norm(mpf_t res, const mpf * vec, slong len);
72 
73 FLINT_DLL int _mpf_vec_dot2(mpf_t res, const mpf * vec1, const mpf * vec2, slong len2, flint_bitcnt_t prec);
74 
75 FLINT_DLL void _mpf_vec_norm2(mpf_t res, const mpf * vec, slong len, flint_bitcnt_t prec);
76 
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif
82 
83