Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sparse3 #1845

Open
wants to merge 64 commits into
base: main
Choose a base branch
from
Open

Sparse3 #1845

Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
57912d7
API for sparse vectors
Feb 6, 2024
52d7fbe
adding gr_sparse_vec dir
Feb 6, 2024
75d157b
adding fit, set, update
Feb 7, 2024
5dd99b0
working on sparse vec
Feb 7, 2024
45f4d45
adding macros
Feb 7, 2024
da2e5d4
gr sparse vec template stuff
Feb 8, 2024
d928055
working on gr_sparse vec templates
aldenwalker Feb 8, 2024
c14897c
working on several sparse vec functions
Feb 9, 2024
701127c
added some other creation and tests
Feb 9, 2024
efe5d72
starting to try to compile
Feb 9, 2024
511ab5c
compiles
Feb 9, 2024
9cc6a03
added into dense functions
Feb 9, 2024
3d6ea81
working on documentation
Feb 10, 2024
b6617f7
more documentation
Feb 10, 2024
3b42d5d
cmake and compiling
Feb 13, 2024
c39f222
working on tests and get/set individual entries
Feb 14, 2024
e1ce9e5
find/set entry
Feb 15, 2024
bfc4bca
debugging sparse vec creation test failure
Feb 16, 2024
edca4ac
unsorted creation test passing
aldenwalker Feb 21, 2024
fd2fad5
added conversion test
aldenwalker Feb 21, 2024
94aa615
Added shallow transpose macro
Mar 17, 2024
49b1a8e
Merge remote-tracking branch 'overcrimp2/sparse3_akwalke' into sparse3
Mar 17, 2024
1427ffa
Some nomenclature changes
Mar 17, 2024
3f53d01
Beginning of gr sparse matrix
Mar 17, 2024
72d3b91
Bug fix
Mar 17, 2024
ae7f8af
Forgot to save
Mar 17, 2024
9a75954
Fixed setting functions
Mar 17, 2024
a687079
A few more functions
Mar 18, 2024
967ee80
Added negation
Mar 18, 2024
2aa7bb5
Added scaling ops
Mar 18, 2024
cb8c911
Sparse vector and matrix multiplication
Mar 18, 2024
1d22885
Merge branch 'main' into sparse3
Mar 18, 2024
26cd947
Fixed documentation
Mar 18, 2024
98ecdf7
Bug fixes
Mar 18, 2024
5da9446
Changed more col to ind, ind to nzidx
Mar 18, 2024
4eb5ca1
Updated sparse vector docs
Mar 18, 2024
34908ed
Finished basic API analogous to sparse vector
Mar 18, 2024
fd083fd
Merge branch 'main' into sparse3
Mar 18, 2024
6108953
Fixed test
Mar 18, 2024
d9cebe6
Various nomenclature changes, added randtest, testing more rings
Mar 19, 2024
e931f8d
More doc fixes
Mar 19, 2024
6b3ed70
More doc fixes
Mar 19, 2024
9436272
Fixed equality and tested scaling
Mar 20, 2024
1565c9b
Fixed bug in riffling
Mar 20, 2024
6eb88f7
Fixed other testing
Mar 20, 2024
1a49b2d
Weakened test because of ring compatibility issues, decent coverage now
Mar 20, 2024
9bce9ee
Added missed tests
Mar 20, 2024
0b4ac8b
Moved inline arithmetic functions to files
Mar 20, 2024
a3be3d5
Moved column permutations to file
Mar 20, 2024
ca8e38e
Added newline
Mar 20, 2024
ecf1f65
Fixed a few bugs, test for generation and conversion
Mar 20, 2024
1152d15
More conversion tests
Mar 21, 2024
971f11a
A little more coverage
Mar 21, 2024
0b5eee6
Basic stuff mostly tested, have most of the functionality for solving
Mar 21, 2024
71eb7d2
Added solvers, compiles but will not work yet
Mar 22, 2024
a3cdc82
Fixed tests
Mar 22, 2024
fe248bd
Everything but block lanczos works
Mar 22, 2024
61fc72c
Merged upstream
Mar 22, 2024
f9f9e51
Forgot a file
Mar 22, 2024
ad3dfe5
Updated documentation, added functions to update a dense matrix with …
Mar 22, 2024
7b5ec2b
fix sparse_vec arithmetic for length zero
fredrik-johansson Apr 27, 2024
4ec61b0
Added LU and rref
Apr 29, 2024
83ebaaa
Forgot to add files
Apr 29, 2024
4996074
Merge branch 'main' into sparse3
Apr 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ set(_BUILD_DIRS
acb_theta dirichlet bernoulli hypgeom

gr gr_generic gr_vec gr_mat
gr_poly gr_mpoly gr_special
gr_poly gr_mpoly gr_sparse_vec gr_sparse_mat gr_special

calcium
fmpz_mpoly_q
Expand Down
3 changes: 2 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ HEADER_DIRS := \
acb_theta dirichlet bernoulli hypgeom \
\
gr gr_generic gr_vec gr_mat \
gr_poly gr_mpoly gr_special \
gr_poly gr_mpoly gr_sparse_vec gr_sparse_mat \
gr_special \
\
calcium \
fmpz_mpoly_q \
Expand Down
10 changes: 8 additions & 2 deletions doc/source/gr_mat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,20 +199,26 @@ Basic row, column and entry operations
``c`` is the number of columns of ``mat``. If ``perm`` is non-``NULL``, the
permutation of the columns will also be applied to ``perm``.

.. function:: truth_t gr_mat_is_empty(const gr_mat_t mat, gr_ctx_t ctx)
.. macro:: gr_mat_is_empty(mat, ctx)

Returns whether *mat* is an empty matrix, having either zero
rows or zero column. This predicate is always decidable (even if
the underlying ring is not computable), returning
``T_TRUE`` or ``T_FALSE``.

.. function:: truth_t gr_mat_is_square(const gr_mat_t mat, gr_ctx_t ctx)
.. macro:: gr_mat_is_square(mat, ctx)

Returns whether *mat* is a square matrix, having the same number
of rows as columns (not the same thing as being a perfect square!).
This predicate is always decidable (even if the underlying ring
is not computable), returning ``T_TRUE`` or ``T_FALSE``.

.. macro:: gr_mat_is_compatible(mat1, mat2, ctx)

Returns whether *mat1* and *mat2* have the same dimensions.
This predicate is always decidable (even if the underlying ring
is not computable), returning ``T_TRUE`` or ``T_FALSE``.


Arithmetic
-------------------------------------------------------------------------------
Expand Down
550 changes: 550 additions & 0 deletions doc/source/gr_sparse_mat.rst

Large diffs are not rendered by default.

321 changes: 321 additions & 0 deletions doc/source/gr_sparse_vec.rst

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Generic rings
gr_generic.rst
gr_special.rst
gr_vec.rst
gr_sparse_vec.rst
gr_mat.rst
gr_poly.rst
gr_mpoly.rst
Expand Down
2 changes: 1 addition & 1 deletion src/fmpz_mod_mat/det.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ void fmpz_mod_mat_det(fmpz_t res, const fmpz_mod_mat_t mat, const fmpz_mod_ctx_t
GR_MUST_SUCCEED(gr_mat_det_berkowitz(res, (const gr_mat_struct *) mat, gr_ctx));
}
}
}
}
58 changes: 57 additions & 1 deletion src/gr_mat.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ WARN_UNUSED_RESULT int gr_mat_randops(gr_mat_t mat, flint_rand_t state, slong co
WARN_UNUSED_RESULT int gr_mat_randpermdiag(int * parity, gr_mat_t mat, flint_rand_t state, gr_ptr diag, slong n, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_randrank(gr_mat_t mat, flint_rand_t state, slong rank, gr_ctx_t ctx);

#define gr_mat_is_compatible(mat1, mat2, ctx) (((mat1)->r == (mat2)->r && (mat1)->c == (mat2)->c) ? T_TRUE : T_FALSE)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should remain as functions; someone might want to call them externally.


GR_MAT_INLINE truth_t
gr_mat_is_empty(const gr_mat_t mat, gr_ctx_t FLINT_UNUSED(ctx))
{
Expand Down Expand Up @@ -135,17 +137,50 @@ WARN_UNUSED_RESULT int gr_mat_sub(gr_mat_t res, const gr_mat_t mat1, const gr_ma

/* todo: test, wrap; div; more conversions */
WARN_UNUSED_RESULT int gr_mat_add_scalar(gr_mat_t res, const gr_mat_t mat, gr_srcptr x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_add_scalar_si(gr_mat_t res, const gr_mat_t mat, slong x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_add_scalar_ui(gr_mat_t res, const gr_mat_t mat, ulong x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_add_scalar_fmpz(gr_mat_t res, const gr_mat_t mat, fmpz_t x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_add_scalar_fmpq(gr_mat_t res, const gr_mat_t mat, fmpq_t x, gr_ctx_t ctx);

WARN_UNUSED_RESULT int gr_mat_sub_scalar(gr_mat_t res, const gr_mat_t mat, gr_srcptr x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_sub_scalar_si(gr_mat_t res, const gr_mat_t mat, slong x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_sub_scalar_ui(gr_mat_t res, const gr_mat_t mat, ulong x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_sub_scalar_fmpz(gr_mat_t res, const gr_mat_t mat, fmpz_t x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_sub_scalar_fmpq(gr_mat_t res, const gr_mat_t mat, fmpq_t x, gr_ctx_t ctx);

WARN_UNUSED_RESULT int gr_mat_mul_scalar(gr_mat_t res, const gr_mat_t mat, gr_srcptr x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_mul_scalar_si(gr_mat_t res, const gr_mat_t mat, slong x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_mul_scalar_ui(gr_mat_t res, const gr_mat_t mat, ulong x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_mul_scalar_fmpz(gr_mat_t res, const gr_mat_t mat, fmpz_t x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_mul_scalar_fmpq(gr_mat_t res, const gr_mat_t mat, fmpq_t x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_mul_scalar_2exp_si(gr_mat_t res, const gr_mat_t mat, slong e, gr_ctx_t ctx);

WARN_UNUSED_RESULT int gr_mat_div_scalar(gr_mat_t res, const gr_mat_t mat, gr_srcptr x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_div_scalar_si(gr_mat_t res, const gr_mat_t mat, slong x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_div_scalar_ui(gr_mat_t res, const gr_mat_t mat, ulong x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_div_scalar_fmpz(gr_mat_t res, const gr_mat_t mat, fmpz_t x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_div_scalar_fmpq(gr_mat_t res, const gr_mat_t mat, fmpq_t x, gr_ctx_t ctx);

WARN_UNUSED_RESULT int gr_mat_divexact_scalar(gr_mat_t res, const gr_mat_t mat, gr_srcptr x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_divexact_scalar_si(gr_mat_t res, const gr_mat_t mat, slong x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_divexact_scalar_ui(gr_mat_t res, const gr_mat_t mat, ulong x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_divexact_scalar_fmpz(gr_mat_t res, const gr_mat_t mat, fmpz_t x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_divexact_scalar_fmpq(gr_mat_t res, const gr_mat_t mat, fmpq_t x, gr_ctx_t ctx);

WARN_UNUSED_RESULT int gr_mat_addmul_scalar(gr_mat_t res, const gr_mat_t mat, gr_srcptr x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_submul_scalar(gr_mat_t res, const gr_mat_t mat, gr_srcptr x, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_div_scalar(gr_mat_t res, const gr_mat_t mat, gr_srcptr x, gr_ctx_t ctx);

WARN_UNUSED_RESULT int gr_mat_mul_vec(gr_ptr v, const gr_mat_t A, gr_srcptr u, gr_ctx_t ctx);

WARN_UNUSED_RESULT int gr_mat_mul_classical(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_mul_strassen(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_mul_generic(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_mul(gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx);

WARN_UNUSED_RESULT int gr_mat_addmul_classical(gr_mat_t D, const gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_addmul_generic(gr_mat_t D, const gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_addmul(gr_mat_t D, const gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx);

/* todo */
GR_MAT_INLINE WARN_UNUSED_RESULT int
gr_mat_sqr(gr_mat_t res, const gr_mat_t mat, gr_ctx_t ctx)
Expand Down Expand Up @@ -214,6 +249,27 @@ WARN_UNUSED_RESULT int gr_mat_hilbert(gr_mat_t mat, gr_ctx_t ctx);
WARN_UNUSED_RESULT int gr_mat_hadamard(gr_mat_t mat, gr_ctx_t ctx);
/* todo: dft, dct */

#define _GR_MAT_SHALLOW_TRANSPOSE(AT, A, sz) { \
for (j = 0; j < A->c; j++) \
{ \
for (i = 0; i < A->r; i++) \
{ \
set_shallow(GR_MAT_ENTRY(AT, j, i, sz), GR_MAT_ENTRY(A, i, j, sz), ctx); \
} \
} \
}

#define _GR_MAT_INIT_SHALLOW_TRANSPOSE(AT, A, sz) { \
AT->r = A->c; \
AT->c = A->r; \
AT->rows = flint_malloc(AT->r * sizeof(gr_ptr)); \
AT->entries = TMP_ALLOC(sz * A->c * A->r); \
for (j = 0; j < A->c; j++) \
AT->rows[j] = GR_ENTRY(AT->entries, j * A->r, sz); \
_GR_MAT_SHALLOW_TRANSPOSE(AT, A, sz) \
}


WARN_UNUSED_RESULT int gr_mat_transpose(gr_mat_t B, const gr_mat_t A, gr_ctx_t ctx);

WARN_UNUSED_RESULT int gr_mat_nonsingular_solve_tril_classical(gr_mat_t X, const gr_mat_t L, const gr_mat_t B, int unit, gr_ctx_t ctx);
Expand Down
85 changes: 53 additions & 32 deletions src/gr_mat/add_scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,56 @@

#include "gr_mat.h"

int
gr_mat_add_scalar(gr_mat_t res, const gr_mat_t mat, gr_srcptr x, gr_ctx_t ctx)
{
slong i, j, r, c;
slong sz = ctx->sizeof_elem;
int status = GR_SUCCESS;

r = gr_mat_nrows(res, ctx);
c = gr_mat_ncols(res, ctx);

if (res == mat)
{
for (i = 0; i < FLINT_MIN(r, c); i++)
status |= gr_add(GR_MAT_ENTRY(res, i, i, sz), GR_MAT_ENTRY(res, i, i, sz), x, ctx);
}
else
{
for (i = 0; i < r; i++)
{
for (j = 0; j < c; j++)
{
/* todo: vectorize */
if (i == j)
status |= gr_add(GR_MAT_ENTRY(res, i, j, sz), GR_MAT_ENTRY(mat, i, j, sz), x, ctx);
else
status |= gr_set(GR_MAT_ENTRY(res, i, j, sz), GR_MAT_ENTRY(mat, i, j, sz), ctx);
}
}
}

return status;
}
#define GR_MAT_ADD_SCALAR(FUNC, res, mat, x, ctx) \
slong i, j, r, c, sz = (ctx)->sizeof_elem; \
int status = GR_SUCCESS; \
r = gr_mat_nrows(res, ctx); \
c = gr_mat_ncols(res, ctx); \
if (res == mat) \
{ \
for (i = 0; i < FLINT_MIN(r, c); i++) \
status |= (FUNC)( \
GR_MAT_ENTRY(res, i, i, sz), \
GR_MAT_ENTRY(res, i, i, sz), \
x, ctx \
); \
} \
else \
{ \
for (i = 0; i < r; i++) \
{ \
for (j = 0; j < c; j++) \
{ \
/* todo: vectorize */ \
if (i == j) \
status |= (FUNC)( \
GR_MAT_ENTRY(res, i, j, sz), \
GR_MAT_ENTRY(mat, i, j, sz), \
x, ctx \
); \
else \
status |= gr_set( \
GR_MAT_ENTRY(res, i, j, sz), \
GR_MAT_ENTRY(mat, i, j, sz), \
ctx \
); \
} \
} \
} \
return status; \


int gr_mat_add_scalar(gr_mat_t res, const gr_mat_t mat, gr_srcptr x, gr_ctx_t ctx)
{ GR_MAT_ADD_SCALAR(gr_add, res, mat, x, ctx) }

int gr_mat_add_scalar_si(gr_mat_t res, const gr_mat_t mat, slong x, gr_ctx_t ctx)
{ GR_MAT_ADD_SCALAR(gr_add_si, res, mat, x, ctx) }

int gr_mat_add_scalar_ui(gr_mat_t res, const gr_mat_t mat, ulong x, gr_ctx_t ctx)
{ GR_MAT_ADD_SCALAR(gr_add_ui, res, mat, x, ctx) }

int gr_mat_add_scalar_fmpz(gr_mat_t res, const gr_mat_t mat, fmpz_t x, gr_ctx_t ctx)
{ GR_MAT_ADD_SCALAR(gr_add_fmpz, res, mat, x, ctx) }

int gr_mat_add_scalar_fmpq(gr_mat_t res, const gr_mat_t mat, fmpq_t x, gr_ctx_t ctx)
{ GR_MAT_ADD_SCALAR(gr_add_fmpq, res, mat, x, ctx) }
24 changes: 24 additions & 0 deletions src/gr_mat/addmul.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
Copyright (C) 2022 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_mat.h"

int
gr_mat_addmul_generic(gr_mat_t D, const gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx)
{
return gr_mat_mul_classical(C, A, B, ctx);
}

int
gr_mat_addmul(gr_mat_t D, const gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx)
{
return gr_mat_addmul_generic(D, C, A, B, ctx);
}
117 changes: 117 additions & 0 deletions src/gr_mat/addmul_classical.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
Copyright (C) 2022 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 <stdint.h>
#include "gr_vec.h"
#include "gr_mat.h"

int
gr_mat_addmul_classical(gr_mat_t D, const gr_mat_t C, const gr_mat_t A, const gr_mat_t B, gr_ctx_t ctx)
{
slong ar, ac, br, bc, i, j, sz;
int status;

ar = gr_mat_nrows(A, ctx);
ac = gr_mat_ncols(A, ctx);
br = gr_mat_nrows(B, ctx);
bc = gr_mat_ncols(B, ctx);

if (gr_mat_is_compatible(C, D, ctx) == T_FALSE || ac != br || ar != gr_mat_nrows(C, ctx) || bc != gr_mat_ncols(C, ctx))
return GR_DOMAIN;

if (br == 0)
{
return GR_SUCCESS;
}

status = GR_SUCCESS;

if (A == D || B == D)
{
gr_mat_t T;
gr_mat_init(T, ar, bc, ctx);
status |= gr_mat_addmul_classical(T, C, A, B, ctx);
status |= gr_mat_swap_entrywise(T, D, ctx);
gr_mat_clear(T, ctx);
return status;
}

sz = ctx->sizeof_elem;

if (br == 1)
{
for (i = 0; i < ar; i++)
{
for (j = 0; j < bc; j++)
{
if (C != D)
status |= gr_set(GR_MAT_ENTRY(D, i, j, sz), GR_MAT_ENTRY(C, i, j, sz), ctx);
status |= gr_addmul(GR_MAT_ENTRY(D, i, j, sz),
GR_MAT_ENTRY(A, i, 0, sz),
GR_MAT_ENTRY(B, 0, j, sz), ctx);
}
}
}
else
{
gr_ptr tmp;
gr_method_void_unary_op set_shallow = GR_VOID_UNARY_OP(ctx, SET_SHALLOW);
TMP_INIT;

TMP_START;
tmp = TMP_ALLOC(sz * br * bc);

/* Make a shallow transpose so that we can use dot products.
Inline common sizes. (Caution: are we sure about the alignment?
Some asserts would be nice here.)
Todo: we may want inlining in nonsingular_solve etc. as well. */
for (i = 0; i < br; i++)
{
for (j = 0; j < bc; j++)
{
switch (sz)
{
#if 0
case 1:
((int8_t *) GR_ENTRY(tmp, j * br + i, 1))[0] = ((int8_t *) GR_MAT_ENTRY(B, i, j, 1))[0];
break;
case 2:
((int16_t *) GR_ENTRY(tmp, j * br + i, 2))[0] = ((int16_t *) GR_MAT_ENTRY(B, i, j, 2))[0];
break;
case 4:
((int32_t *) GR_ENTRY(tmp, j * br + i, 4))[0] = ((int32_t *) GR_MAT_ENTRY(B, i, j, 4))[0];
break;
#if FLINT_BITS == 64
case 8:
((int64_t *) GR_ENTRY(tmp, j * br + i, 8))[0] = ((int64_t *) GR_MAT_ENTRY(B, i, j, 8))[0];
break;
#endif
#endif
default:
set_shallow(GR_ENTRY(tmp, j * br + i, sz), GR_MAT_ENTRY(B, i, j, sz), ctx);
}
}
}

for (i = 0; i < ar; i++)
{
for (j = 0; j < bc; j++)
{
status |= _gr_vec_dot(GR_MAT_ENTRY(D, i, j, sz), GR_MAT_ENTRY(C, i, j, sz), 0,
GR_MAT_ENTRY(A, i, 0, sz), GR_ENTRY(tmp, j * br, sz), br, ctx);
}
}

TMP_END;
}

return status;
}
Loading
Loading