79 lines
2.8 KiB
Plaintext
79 lines
2.8 KiB
Plaintext
/*=============================================================================
|
|
|
|
This file is part of FLINT.
|
|
|
|
FLINT is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
FLINT is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with FLINT; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
=============================================================================*/
|
|
/******************************************************************************
|
|
|
|
Copyright (C) 2010 William Hart
|
|
Copyright (C) 2010 Andy Novocin
|
|
|
|
******************************************************************************/
|
|
|
|
*******************************************************************************
|
|
|
|
Memory management
|
|
|
|
*******************************************************************************
|
|
|
|
mpfr * _mpfr_vec_init(slong len, mp_bitcnt_t prec)
|
|
|
|
Returns a vector of the given length of initialised \code{mpfr}'s
|
|
with the given exact precision.
|
|
|
|
void _mpfr_vec_clear(mpfr * vec, slong len)
|
|
|
|
Clears the given vector.
|
|
|
|
*******************************************************************************
|
|
|
|
Arithmetic
|
|
|
|
*******************************************************************************
|
|
|
|
void _mpfr_vec_zero(mpfr * vec, slong len)
|
|
|
|
Zeros the vector \code{(vec, len)}.
|
|
|
|
void _mpfr_vec_set(mpfr * vec1, const mpfr * vec2, slong len)
|
|
|
|
Copies the vector \code{vec2} of the given length into \code{vec1}.
|
|
No check is made to ensure \code{vec1} and \code{vec2} are different.
|
|
|
|
void _mpfr_vec_add(mpfr * res, const mpfr * vec1, const mpfr * vec2, slong len)
|
|
|
|
Adds the given vectors of the given length together and stores the
|
|
result in \code{res}.
|
|
|
|
void _mpfr_vec_scalar_mul_mpfr(mpfr * res, const mpfr * vec,
|
|
slong len, mpfr_t c)
|
|
|
|
Multiplies the vector with given length by the scalar $c$ and
|
|
sets \code{res} to the result.
|
|
|
|
void _mpfr_vec_scalar_mul_2exp(mpfr * res,
|
|
const mpfr * vec, slong len, mp_bitcnt_t exp)
|
|
|
|
Multiplies the given vector of the given length by \code{2^exp}.
|
|
|
|
void _mpfr_vec_scalar_product(mpfr_t res, const mpfr * vec1,
|
|
const mpfr * vec2, slong len)
|
|
|
|
Sets \code{res} to the scalar product of \code{(vec1, len)} with
|
|
\code{(vec2, len)}. Assumes \code{len > 0}.
|
|
|