25static inline double real_int_pow(
double base,
unsigned int exp) {
35 return base * base * base;
41 return b2 * b2 * base;
47 return b2 * b2 * b2 * base;
75static inline double complex inverse_imaginary_int_pow(
unsigned int exp) {
76 static const double complex powers[4] = {1.0, -I, -1.0, I};
77 return powers[exp & 3];
86static inline double negative_one_pow(
unsigned int exp) {
100unsigned int mult_abs(
unsigned int dim,
const unsigned int *alpha);
108unsigned long long binom(
unsigned long long n,
unsigned long long k);
116static inline void kahan_add_c(
double complex *restrict sum,
117 double complex *restrict epsilon,
double complex x) {
118 double complex y = x - *epsilon;
119 double complex t = *sum + y;
120 *epsilon = (t - *sum) - y;
130static inline void kahan_add_r(
double *restrict sum,
double *restrict epsilon,
132 double y = x - *epsilon;
134 *epsilon = (t - *sum) - y;
145static inline double dot(
unsigned int dim,
const double *v1,
const double *v2) {
147 for (
int i = 0; i < dim; i++) {
161static inline void matrix_intVector(
unsigned int dim,
const double *m,
const int *v,
162 double *res,
bool diag) {
164 for (
int i = 0; i < dim; i++) {
165 res[i] = m[(i * dim) + i] * v[i];
168 for (
int i = 0; i < dim; i++) {
170 for (
int j = 0; j < dim; j++) {
171 res[i] += m[(i * dim) + j] * v[j];
182void transpose(
unsigned int dim,
double *m);
191bool equals(
unsigned int dim,
const double *v1,
const double *v2);
200void invert(
unsigned int dim,
double *m,
int *p,
double *r);
207double inf_norm(
unsigned int dim,
const double *m);
218double *
vectorProj(
unsigned int dim,
const double *m,
const double *m_invt,