Skip to content

Commit 7c45967

Browse files
author
SPancratz
committed
Fixing the return type for _mpfr_vec_scalar_product
1 parent e2ad544 commit 7c45967

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

mpfr_vec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void _mpfr_vec_scalar_mul_2exp(mpfr * res, mpfr * vec, long length, mp_bitcnt_t
4343

4444
void _mpfr_vec_scalar_mul_mpfr(mpfr * res, mpfr * vec, long length, mpfr_t c);
4545

46-
void * _mpfr_vec_scalar_product(mpfr_t res, __mpfr_struct * vec1,
46+
void _mpfr_vec_scalar_product(mpfr_t res, __mpfr_struct * vec1,
4747
__mpfr_struct * vec2, long length);
4848

4949
#endif

mpfr_vec/scalar_product.c

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*============================================================================
1+
/*=============================================================================
22
33
This file is part of FLINT.
44
@@ -16,32 +16,31 @@
1616
along with FLINT; if not, write to the Free Software
1717
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1818
19-
===============================================================================*/
20-
/****************************************************************************
19+
=============================================================================*/
20+
/******************************************************************************
2121
22-
Copyright (C) 2010 William Hart
23-
24-
*****************************************************************************/
22+
Copyright (C) 2010 William Hart
23+
24+
******************************************************************************/
2525

2626
#include <stdlib.h>
2727
#include <mpir.h>
2828
#include <mpfr.h>
2929
#include "flint.h"
3030
#include "mpfr_vec.h"
3131

32-
void * _mpfr_vec_scalar_product(mpfr_t res, __mpfr_struct * vec1, __mpfr_struct * vec2, long length)
32+
void _mpfr_vec_scalar_product(mpfr_t res, __mpfr_struct * vec1, __mpfr_struct * vec2, long length)
3333
{
34-
long i;
35-
36-
mpfr_t tmp;
37-
mpfr_init(tmp);
38-
39-
mpfr_mul(res, vec1, vec2, GMP_RNDN);
40-
for (i = 1; i < length; i++)
41-
{
42-
mpfr_mul(tmp, vec1 + i, vec2 + i, GMP_RNDN);
43-
mpfr_add(res, res, tmp, GMP_RNDN);
44-
}
34+
long i;
35+
mpfr_t tmp;
36+
mpfr_init(tmp);
37+
38+
mpfr_mul(res, vec1, vec2, GMP_RNDN);
39+
for (i = 1; i < length; i++)
40+
{
41+
mpfr_mul(tmp, vec1 + i, vec2 + i, GMP_RNDN);
42+
mpfr_add(res, res, tmp, GMP_RNDN);
43+
}
4544

4645
mpfr_clear(tmp);
4746
}

0 commit comments

Comments
 (0)