Skip to content

Commit

Permalink
cmpabs & linear algebra tuning for nfloat, nfloat_complex
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrik-johansson committed Jul 20, 2024
1 parent 8645932 commit 373c6ec
Show file tree
Hide file tree
Showing 6 changed files with 315 additions and 8 deletions.
7 changes: 7 additions & 0 deletions doc/source/nfloat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ Matrix functions

Different implementations of matrix multiplication.

.. function:: int nfloat_mat_nonsingular_solve_tril(gr_mat_t X, const gr_mat_t L, const gr_mat_t B, int unit, gr_ctx_t ctx)
int nfloat_mat_nonsingular_solve_triu(gr_mat_t X, const gr_mat_t L, const gr_mat_t B, int unit, gr_ctx_t ctx)
int nfloat_mat_lu(slong * rank, slong * P, gr_mat_t LU, const gr_mat_t A, int rank_check, gr_ctx_t ctx)

Internal functions
-------------------------------------------------------------------------------

Expand Down Expand Up @@ -417,3 +421,6 @@ real pairs.
int nfloat_complex_mat_mul_block(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, slong min_block_size, gr_ctx_t ctx)
int nfloat_complex_mat_mul_reorder(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx)
int nfloat_complex_mat_mul(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx)
int nfloat_complex_mat_nonsingular_solve_tril(gr_mat_t X, const gr_mat_t L, const gr_mat_t B, int unit, gr_ctx_t ctx)
int nfloat_complex_mat_nonsingular_solve_triu(gr_mat_t X, const gr_mat_t L, const gr_mat_t B, int unit, gr_ctx_t ctx)
int nfloat_complex_mat_lu(slong * rank, slong * P, gr_mat_t LU, const gr_mat_t A, int rank_check, gr_ctx_t ctx)
7 changes: 3 additions & 4 deletions src/gr/test_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -2904,7 +2904,7 @@ gr_test_ordered_ring_cmpabs(gr_ctx_t R, flint_rand_t state, int test_flags)
status = GR_TEST_FAIL;
}

if (status & GR_DOMAIN && !(status & GR_UNABLE))
if (gr_ctx_is_ordered_ring(R) == T_TRUE && (status & GR_DOMAIN && !(status & GR_UNABLE)))
{
status = GR_TEST_FAIL;
}
Expand Down Expand Up @@ -4315,10 +4315,9 @@ gr_test_ring(gr_ctx_t R, slong iters, int test_flags)
gr_test_iter(R, state, "pow: ui/si/fmpz/fmpq", gr_test_pow_type_variants, iters, test_flags & (~GR_TEST_ALWAYS_ABLE));

if (gr_ctx_is_ordered_ring(R) == T_TRUE)
{
gr_test_iter(R, state, "ordered_ring_cmp", gr_test_ordered_ring_cmp, iters, test_flags);
gr_test_iter(R, state, "ordered_ring_cmpabs", gr_test_ordered_ring_cmpabs, iters, test_flags);
}

gr_test_iter(R, state, "ordered_ring_cmpabs", gr_test_ordered_ring_cmpabs, iters, test_flags);

gr_test_iter(R, state, "numerator_denominator", gr_test_numerator_denominator, iters, test_flags);
gr_test_iter(R, state, "complex_parts", gr_test_complex_parts, iters, test_flags);
Expand Down
9 changes: 9 additions & 0 deletions src/nfloat.h
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,11 @@ int nfloat_mat_mul_waksman(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ct
int nfloat_mat_mul_block(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, slong min_block_size, gr_ctx_t ctx);
int nfloat_mat_mul(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx);

int nfloat_mat_nonsingular_solve_tril(gr_mat_t X, const gr_mat_t L, const gr_mat_t B, int unit, gr_ctx_t ctx);
int nfloat_mat_nonsingular_solve_triu(gr_mat_t X, const gr_mat_t L, const gr_mat_t B, int unit, gr_ctx_t ctx);
int nfloat_mat_lu(slong * rank, slong * P, gr_mat_t LU, const gr_mat_t A, int rank_check, gr_ctx_t ctx);


/* Complex numbers */
/* Note: we use the same context data for real and complex rings
(only which_ring and sizeof_elem differ). This allows us to call
Expand Down Expand Up @@ -569,6 +574,10 @@ int nfloat_complex_mat_mul_block(gr_mat_t C, const gr_mat_t A, const gr_mat_t B,
int nfloat_complex_mat_mul_reorder(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx);
int nfloat_complex_mat_mul(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx);

int nfloat_complex_mat_nonsingular_solve_tril(gr_mat_t X, const gr_mat_t L, const gr_mat_t B, int unit, gr_ctx_t ctx);
int nfloat_complex_mat_nonsingular_solve_triu(gr_mat_t X, const gr_mat_t L, const gr_mat_t B, int unit, gr_ctx_t ctx);
int nfloat_complex_mat_lu(slong * rank, slong * P, gr_mat_t LU, const gr_mat_t A, int rank_check, gr_ctx_t ctx);

#ifdef __cplusplus
}
#endif
Expand Down
141 changes: 137 additions & 4 deletions src/nfloat/complex.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "gr_generic.h"
#include "acf.h"
#include "acb.h"
#include "mag.h"
#include "nfloat.h"

static int
Expand Down Expand Up @@ -1542,17 +1543,146 @@ nfloat_complex_cmp(int * res, nfloat_complex_srcptr x, nfloat_complex_srcptr y,
return nfloat_cmp(res, NFLOAT_COMPLEX_RE(x, ctx), NFLOAT_COMPLEX_RE(y, ctx), ctx);
}

#include "double_extras.h"

int
nfloat_complex_cmpabs(int * res, nfloat_complex_srcptr x, nfloat_complex_srcptr y, gr_ctx_t ctx)
{
nfloat_srcptr a, b, c, d;
slong aexp, bexp, cexp, dexp, xexp, yexp, exp;
slong xn = NFLOAT_CTX_NLIMBS(ctx);

if (NFLOAT_CTX_HAS_INF_NAN(ctx))
return GR_UNABLE;

if (!NFLOAT_IS_ZERO(NFLOAT_COMPLEX_IM(x, ctx)) ||
!NFLOAT_IS_ZERO(NFLOAT_COMPLEX_IM(y, ctx)))
return GR_UNABLE;
a = NFLOAT_COMPLEX_RE(x, ctx);
b = NFLOAT_COMPLEX_IM(x, ctx);
c = NFLOAT_COMPLEX_RE(y, ctx);
d = NFLOAT_COMPLEX_IM(y, ctx);

if (NFLOAT_IS_ZERO(b))
{
if (NFLOAT_IS_ZERO(d))
return nfloat_cmpabs(res, a, c, ctx);
if (NFLOAT_IS_ZERO(c))
return nfloat_cmpabs(res, a, d, ctx);
}

if (NFLOAT_IS_ZERO(a))
{
if (NFLOAT_IS_ZERO(d))
return nfloat_cmpabs(res, b, c, ctx);
if (NFLOAT_IS_ZERO(c))
return nfloat_cmpabs(res, b, d, ctx);
}

if (NFLOAT_IS_ZERO(c))
{
if (NFLOAT_IS_ZERO(a))
return nfloat_cmpabs(res, b, d, ctx);

Check warning on line 1582 in src/nfloat/complex.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/complex.c#L1582

Added line #L1582 was not covered by tests
if (NFLOAT_IS_ZERO(b))
return nfloat_cmpabs(res, a, d, ctx);

Check warning on line 1584 in src/nfloat/complex.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/complex.c#L1584

Added line #L1584 was not covered by tests
}

if (NFLOAT_IS_ZERO(d))
{
if (NFLOAT_IS_ZERO(a))
return nfloat_cmpabs(res, b, c, ctx);

Check warning on line 1590 in src/nfloat/complex.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/complex.c#L1590

Added line #L1590 was not covered by tests
if (NFLOAT_IS_ZERO(b))
return nfloat_cmpabs(res, a, c, ctx);

Check warning on line 1592 in src/nfloat/complex.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/complex.c#L1592

Added line #L1592 was not covered by tests
}

aexp = NFLOAT_EXP(a);
bexp = NFLOAT_EXP(b);
cexp = NFLOAT_EXP(c);
dexp = NFLOAT_EXP(d);

/* 0.5 * 2^xexp <= |x| < sqrt(2) * 2^xexp */
xexp = FLINT_MAX(aexp, bexp);
/* 0.5 * 2^yexp <= |y| < sqrt(2) * 2^yexp */
yexp = FLINT_MAX(cexp, dexp);

if (xexp + 2 < yexp)
{
*res = -1;
return GR_SUCCESS;
}

if (xexp > yexp + 2)
{
*res = 1;
return GR_SUCCESS;
}

exp = FLINT_MAX(xexp, yexp);

double tt, xx = 0.0, yy = 0.0;

if (aexp >= exp - 53)
{
tt = d_mul_2exp_inrange(NFLOAT_D(a)[xn - 1], aexp - exp - FLINT_BITS);
xx += tt * tt;
}

return nfloat_cmpabs(res, NFLOAT_COMPLEX_RE(x, ctx), NFLOAT_COMPLEX_RE(y, ctx), ctx);
if (bexp >= exp - 53)
{
tt = d_mul_2exp_inrange(NFLOAT_D(b)[xn - 1], bexp - exp - FLINT_BITS);
xx += tt * tt;
}

if (cexp >= exp - 53)
{
tt = d_mul_2exp_inrange(NFLOAT_D(c)[xn - 1], cexp - exp - FLINT_BITS);
yy += tt * tt;
}

if (dexp >= exp - 53)
{
tt = d_mul_2exp_inrange(NFLOAT_D(d)[xn - 1], dexp - exp - FLINT_BITS);
yy += tt * tt;
}

if (xx < yy * 0.999999)
{
*res = -1;
return GR_SUCCESS;
}

if (xx * 0.999999 > yy)
{
*res = 1;
return GR_SUCCESS;
}

arf_struct s[5];

arf_init(s + 0);
arf_init(s + 1);
arf_init(s + 2);
arf_init(s + 3);
arf_init(s + 4);

nfloat_get_arf(s + 0, a, ctx);
nfloat_get_arf(s + 1, b, ctx);
nfloat_get_arf(s + 2, c, ctx);
nfloat_get_arf(s + 3, d, ctx);

arf_mul(s + 0, s + 0, s + 0, ARF_PREC_EXACT, ARF_RND_DOWN);
arf_mul(s + 1, s + 1, s + 1, ARF_PREC_EXACT, ARF_RND_DOWN);
arf_mul(s + 2, s + 2, s + 2, ARF_PREC_EXACT, ARF_RND_DOWN);
arf_mul(s + 3, s + 3, s + 3, ARF_PREC_EXACT, ARF_RND_DOWN);
arf_neg(s + 2, s + 2);
arf_neg(s + 3, s + 3);
arf_sum(s + 4, s, 4, 30, ARF_RND_DOWN);
*res = arf_sgn(s + 4);

arf_clear(s + 0);
arf_clear(s + 1);
arf_clear(s + 2);
arf_clear(s + 3);
arf_clear(s + 4);

return GR_SUCCESS;
}

int
Expand Down Expand Up @@ -1794,6 +1924,9 @@ gr_method_tab_input _nfloat_complex_methods_input[] =
{GR_METHOD_POLY_ROOTS_OTHER,(gr_funcptr) nfloat_complex_poly_roots_other},
*/
{GR_METHOD_MAT_MUL, (gr_funcptr) nfloat_complex_mat_mul},
{GR_METHOD_MAT_NONSINGULAR_SOLVE_TRIL, (gr_funcptr) nfloat_complex_mat_nonsingular_solve_tril},
{GR_METHOD_MAT_NONSINGULAR_SOLVE_TRIU, (gr_funcptr) nfloat_complex_mat_nonsingular_solve_triu},
{GR_METHOD_MAT_LU, (gr_funcptr) nfloat_complex_mat_lu},
{GR_METHOD_MAT_DET, (gr_funcptr) gr_mat_det_generic_field},
{GR_METHOD_MAT_FIND_NONZERO_PIVOT, (gr_funcptr) gr_mat_find_nonzero_pivot_large_abs},

Expand Down
3 changes: 3 additions & 0 deletions src/nfloat/ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ gr_method_tab_input _nfloat_methods_input[] =
{GR_METHOD_POLY_ROOTS_OTHER,(gr_funcptr) nfloat_poly_roots_other},
*/
{GR_METHOD_MAT_MUL, (gr_funcptr) nfloat_mat_mul},
{GR_METHOD_MAT_NONSINGULAR_SOLVE_TRIL, (gr_funcptr) nfloat_mat_nonsingular_solve_tril},
{GR_METHOD_MAT_NONSINGULAR_SOLVE_TRIU, (gr_funcptr) nfloat_mat_nonsingular_solve_triu},
{GR_METHOD_MAT_LU, (gr_funcptr) nfloat_mat_lu},
{GR_METHOD_MAT_DET, (gr_funcptr) gr_mat_det_generic_field},
{GR_METHOD_MAT_FIND_NONZERO_PIVOT, (gr_funcptr) gr_mat_find_nonzero_pivot_large_abs},

Expand Down
156 changes: 156 additions & 0 deletions src/nfloat/mat.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
/*
Copyright (C) 2024 Fredrik Johansson
This file is part of FLINT.
FLINT is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License (LGPL) as published
by the Free Software Foundation; either version 3 of the License, or
(at your option) any later version. See <https://www.gnu.org/licenses/>.
*/

#include "gr.h"
#include "nfloat.h"
#include "gr_mat.h"

int
nfloat_mat_nonsingular_solve_tril(gr_mat_t X, const gr_mat_t L,

Check warning on line 17 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L17

Added line #L17 was not covered by tests
const gr_mat_t B, int unit, gr_ctx_t ctx)
{
slong cutoff, prec = NFLOAT_CTX_PREC(ctx);

Check warning on line 20 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L20

Added line #L20 was not covered by tests

if (prec <= 256)
cutoff = 96;
else if (prec <= 512)

Check warning on line 24 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L24

Added line #L24 was not covered by tests
cutoff = 16;
else if (prec <= 576)

Check warning on line 26 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L26

Added line #L26 was not covered by tests
cutoff = 32;
else if (prec <= 1536)

Check warning on line 28 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L28

Added line #L28 was not covered by tests
cutoff = 8;
else if (prec <= 2176)

Check warning on line 30 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L30

Added line #L30 was not covered by tests
cutoff = 7;
else
cutoff = 6;

Check warning on line 33 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L33

Added line #L33 was not covered by tests

if (B->r < cutoff || B->c < cutoff)
return gr_mat_nonsingular_solve_tril_classical(X, L, B, unit, ctx);

Check warning on line 36 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L36

Added line #L36 was not covered by tests
else
return gr_mat_nonsingular_solve_tril_recursive(X, L, B, unit, ctx);

Check warning on line 38 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L38

Added line #L38 was not covered by tests
}

int
nfloat_mat_nonsingular_solve_triu(gr_mat_t X, const gr_mat_t L,

Check warning on line 42 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L42

Added line #L42 was not covered by tests
const gr_mat_t B, int unit, gr_ctx_t ctx)
{
slong cutoff, prec = NFLOAT_CTX_PREC(ctx);

Check warning on line 45 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L45

Added line #L45 was not covered by tests

if (prec <= 256)
cutoff = 96;
else if (prec <= 512)

Check warning on line 49 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L49

Added line #L49 was not covered by tests
cutoff = 16;
else if (prec <= 576)

Check warning on line 51 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L51

Added line #L51 was not covered by tests
cutoff = 32;
else if (prec <= 1536)

Check warning on line 53 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L53

Added line #L53 was not covered by tests
cutoff = 8;
else if (prec <= 2176)

Check warning on line 55 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L55

Added line #L55 was not covered by tests
cutoff = 7;
else
cutoff = 6;

Check warning on line 58 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L58

Added line #L58 was not covered by tests

if (B->r < cutoff || B->c < cutoff)
return gr_mat_nonsingular_solve_triu_classical(X, L, B, unit, ctx);

Check warning on line 61 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L61

Added line #L61 was not covered by tests
else
return gr_mat_nonsingular_solve_triu_recursive(X, L, B, unit, ctx);

Check warning on line 63 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L63

Added line #L63 was not covered by tests
}

int
nfloat_complex_mat_nonsingular_solve_tril(gr_mat_t X, const gr_mat_t L,

Check warning on line 67 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L67

Added line #L67 was not covered by tests
const gr_mat_t B, int unit, gr_ctx_t ctx)
{
slong cutoff, prec = NFLOAT_CTX_PREC(ctx);

Check warning on line 70 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L70

Added line #L70 was not covered by tests

if (prec <= 192)
cutoff = 64;
else if (prec <= 256)

Check warning on line 74 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L74

Added line #L74 was not covered by tests
cutoff = 16;
else if (prec <= 384)

Check warning on line 76 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L76

Added line #L76 was not covered by tests
cutoff = 7;
else if (prec == 576)

Check warning on line 78 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L78

Added line #L78 was not covered by tests
cutoff = 16;
else
cutoff = 6;

Check warning on line 81 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L81

Added line #L81 was not covered by tests

if (B->r < cutoff || B->c < cutoff)
return gr_mat_nonsingular_solve_tril_classical(X, L, B, unit, ctx);

Check warning on line 84 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L84

Added line #L84 was not covered by tests
else
return gr_mat_nonsingular_solve_tril_recursive(X, L, B, unit, ctx);

Check warning on line 86 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L86

Added line #L86 was not covered by tests
}

int
nfloat_complex_mat_nonsingular_solve_triu(gr_mat_t X, const gr_mat_t L,

Check warning on line 90 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L90

Added line #L90 was not covered by tests
const gr_mat_t B, int unit, gr_ctx_t ctx)
{
slong cutoff, prec = NFLOAT_CTX_PREC(ctx);

Check warning on line 93 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L93

Added line #L93 was not covered by tests

if (prec <= 192)
cutoff = 64;
else if (prec <= 256)

Check warning on line 97 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L97

Added line #L97 was not covered by tests
cutoff = 16;
else if (prec <= 384)

Check warning on line 99 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L99

Added line #L99 was not covered by tests
cutoff = 7;
else if (prec == 576)

Check warning on line 101 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L101

Added line #L101 was not covered by tests
cutoff = 16;
else
cutoff = 6;

Check warning on line 104 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L104

Added line #L104 was not covered by tests

if (B->r < cutoff || B->c < cutoff)
return gr_mat_nonsingular_solve_triu_classical(X, L, B, unit, ctx);

Check warning on line 107 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L107

Added line #L107 was not covered by tests
else
return gr_mat_nonsingular_solve_triu_recursive(X, L, B, unit, ctx);

Check warning on line 109 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L109

Added line #L109 was not covered by tests
}

int
nfloat_mat_lu(slong * rank, slong * P, gr_mat_t LU, const gr_mat_t A, int rank_check, gr_ctx_t ctx)

Check warning on line 113 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L113

Added line #L113 was not covered by tests
{
slong cutoff, prec = NFLOAT_CTX_PREC(ctx);

Check warning on line 115 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L115

Added line #L115 was not covered by tests

if (prec <= 256)
cutoff = 32;
else if (prec <= 576)

Check warning on line 119 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L119

Added line #L119 was not covered by tests
cutoff = 28;
else if (prec <= 768)

Check warning on line 121 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L121

Added line #L121 was not covered by tests
cutoff = 16;
else if (prec <= 1536)

Check warning on line 123 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L123

Added line #L123 was not covered by tests
cutoff = 12;
else if (prec <= 2560)

Check warning on line 125 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L125

Added line #L125 was not covered by tests
cutoff = 8;
else
cutoff = 7;

Check warning on line 128 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L128

Added line #L128 was not covered by tests

if (A->r < cutoff || A->c < cutoff)
return gr_mat_lu_classical(rank, P, LU, A, rank_check, ctx);

Check warning on line 131 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L131

Added line #L131 was not covered by tests
else
return gr_mat_lu_recursive(rank, P, LU, A, rank_check, ctx);

Check warning on line 133 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L133

Added line #L133 was not covered by tests
}

int
nfloat_complex_mat_lu(slong * rank, slong * P, gr_mat_t LU, const gr_mat_t A, int rank_check, gr_ctx_t ctx)

Check warning on line 137 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L137

Added line #L137 was not covered by tests
{
slong cutoff, prec = NFLOAT_CTX_PREC(ctx);

Check warning on line 139 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L139

Added line #L139 was not covered by tests

if (prec <= 256)
cutoff = 12;
else if (prec <= 512)

Check warning on line 143 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L143

Added line #L143 was not covered by tests
cutoff = 8;
else if (prec <= 576)

Check warning on line 145 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L145

Added line #L145 was not covered by tests
cutoff = 16;
else if (prec <= 1024)

Check warning on line 147 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L147

Added line #L147 was not covered by tests
cutoff = 7;
else
cutoff = 6;

Check warning on line 150 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L150

Added line #L150 was not covered by tests

if (A->r < cutoff || A->c < cutoff)
return gr_mat_lu_classical(rank, P, LU, A, rank_check, ctx);

Check warning on line 153 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L153

Added line #L153 was not covered by tests
else
return gr_mat_lu_recursive(rank, P, LU, A, rank_check, ctx);

Check warning on line 155 in src/nfloat/mat.c

View check run for this annotation

Codecov / codecov/patch

src/nfloat/mat.c#L155

Added line #L155 was not covered by tests
}

0 comments on commit 373c6ec

Please sign in to comment.