Macaulay2 Engine
Loading...
Searching...
No Matches

◆ mult() [1/2]

void M2::ARingCCC::mult ( ElementType & res,
const ElementType & a,
const ElementType & b ) const
inline

Definition at line 348 of file aring-CCC.hpp.

349 {
350 mpfr_t tmp;
351 Element result(*this);
352 mpfr_init2(tmp, get_precision());
353
354 // &result.re = &a.re*&b.re - &a.im*&b.im;
355 mpfr_mul(tmp, &a.re, &b.re, MPFR_RNDN);
356 mpfr_set(&result.value().re, tmp, MPFR_RNDN);
357 mpfr_mul(tmp, &a.im, &b.im, MPFR_RNDN);
358 mpfr_sub(&result.value().re, &result.value().re, tmp, MPFR_RNDN);
359
360 // &result.im = &a.re*&b.im + &a.im*&b.re;
361 mpfr_mul(tmp, &a.re, &b.im, MPFR_RNDN);
362 mpfr_set(&result.value().im, tmp, MPFR_RNDN);
363 mpfr_mul(tmp, &a.im, &b.re, MPFR_RNDN);
364 mpfr_add(&result.value().im, &result.value().im, tmp, MPFR_RNDN);
365
366 set(res, result);
367 mpfr_clear(tmp);
368 }
unsigned long get_precision() const
Definition aring-CCC.hpp:88
void set(ElementType &result, const ElementType &a) const
VALGRIND_MAKE_MEM_DEFINED & result(result)

References get_precision(), cc_struct::im, cc_struct::re, result(), and set().