Loading...
Searching...
No Matches
gpr::linalg::ExactProductAccumulator Struct Reference

#include <gpr/linalg/OzakiSchemeII.h>

Classes

struct  Wide

Public Member Functions

void add (const SchemeIIWide &coefficient, int exponent)
double value () const

Public Attributes

struct gpr::linalg::ExactProductAccumulator::Wide total

Static Public Attributes

static constexpr int kMinExponent = -2372

Detailed Description

Definition at line 119 of file OzakiSchemeII.h.

Member Function Documentation

◆ add()

void gpr::linalg::ExactProductAccumulator::add ( const SchemeIIWide & coefficient,
int exponent )
inline

Definition at line 348 of file OzakiSchemeII.inl.

350{
351 Wide shifted{};
352 shifted.negative = coefficient.negative;
353 const int shift = exponent - kMinExponent;
354 const int word = shift / 64;
355 const int bits = shift % 64;
356 for (int i = 0; i < SchemeIIWide::kLimbs; ++i) {
357 if (coefficient.limb[i] == 0) continue;
358 shifted.limb[word + i] |= coefficient.limb[i] << bits;
359 if (bits != 0)
360 shifted.limb[word + i + 1] |= coefficient.limb[i] >> (64 - bits);
361 }
362 if (total.negative == shifted.negative) {
363 total = wide_add(total, shifted);
364 } else if (wide_cmp(total, shifted) >= 0) {
365 total = wide_sub(total, shifted);
366 } else {
367 total = wide_sub(shifted, total);
368 }
369}
struct gpr::linalg::ExactProductAccumulator::Wide total
static constexpr int kLimbs

◆ value()

double gpr::linalg::ExactProductAccumulator::value ( ) const
inline

Definition at line 371 of file OzakiSchemeII.inl.

372{
373 return wide_unscale(total, kMinExponent);
374}

Member Data Documentation

◆ kMinExponent

int gpr::linalg::ExactProductAccumulator::kMinExponent = -2372
staticconstexpr

Definition at line 120 of file OzakiSchemeII.h.

◆ total

struct gpr::linalg::ExactProductAccumulator::Wide gpr::linalg::ExactProductAccumulator::total

The documentation for this struct was generated from the following files: