PaStiX Handbook 6.4.0
Loading...
Searching...
No Matches
c_refine_functions.c
Go to the documentation of this file.
1/**
2 *
3 * @file c_refine_functions.c
4 *
5 * PaStiX refinement functions implementations.
6 *
7 * @copyright 2015-2024 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
8 * Univ. Bordeaux. All rights reserved.
9 *
10 * @version 6.4.0
11 * @author Mathieu Faverge
12 * @author Pierre Ramet
13 * @author Theophile Terraz
14 * @author Xavier Lacoste
15 * @author Gregoire Pichon
16 * @author Tony Delarue
17 * @author Vincent Bridonneau
18 * @date 2024-07-05
19 * @generated from /builds/j2uR5rszh/0/solverstack/pastix/refinement/z_refine_functions.c, normal z -> c, Fri Jul 25 09:31:20 2025
20 *
21 **/
22#include "common.h"
23#include "cblas.h"
24#include "bcsc/bcsc.h"
25#include "bcsc/bvec.h"
26#include "bcsc/bcsc_c.h"
27#include "sopalin/sopalin_data.h"
29
30/**
31 *******************************************************************************
32 *
33 * @ingroup pastix_dev_refine
34 *
35 * @brief Print statistics about one iteration
36 *
37 *******************************************************************************
38 *
39 * @param[in] t0
40 * The clock value at the beginning of the iteration
41 *
42 * @param[in] tf
43 * The clock value at the end of the iteration
44 *
45 * @param[in] err
46 * The backward error after the iteration
47 *
48 * @param[in] nb_iters
49 * Current number of refinement iterations
50 *
51 *******************************************************************************/
53{
55
56 stt = tf - t0;
57 fprintf(stdout, OUT_ITERREFINE_ITER, (int)nb_iters);
58 fprintf(stdout, OUT_ITERREFINE_TTT, stt);
59 fprintf(stdout, OUT_ITERREFINE_ERR, err);
60}
61
62/**
63 *******************************************************************************
64 *
65 * @ingroup pastix_dev_refine
66 *
67 * @brief Final output
68 *
69 *******************************************************************************
70 *
71 * @param[in] pastix_data
72 * The PaStiX data structure that describes the solver instance.
73 *
74 * @param[in] err
75 * The final backward error
76 *
77 * @param[in] nb_iters
78 * The final number of iterations
79 *
80 * @param[in] tf
81 * The final clock value
82 *
83 * @param[inout] x
84 * The vector that is to be overwritten by gmresx
85 *
86 * @param[in] gmresx
87 * The final solution
88 *
89 *******************************************************************************/
92 pastix_int_t nb_iters,
94 void *x,
95 pastix_complex32_t *gmresx )
96{
97 (void)pastix_data;
98 (void)err;
99 (void)nb_iters;
100 (void)tf;
101 (void)x;
102 (void)gmresx;
103}
104
105/**
106 *******************************************************************************
107 *
108 * @ingroup pastix_dev_refine
109 *
110 * @brief Initiate functions pointers to define basic operations
111 *
112 *******************************************************************************
113 *
114 * @param[out] solver
115 * The structure to be filled
116 *
117 * @param[in] pastix_data
118 * TODO
119 *
120 *******************************************************************************/
121void c_refine_init( struct c_solver *solver,
122 pastix_data_t *pastix_data )
123{
124 pastix_scheduler_t sched = pastix_data->iparm[IPARM_SCHEDULER];
125
126 /* Allocations */
127 solver->malloc = &bvec_malloc;
128 solver->free = &bvec_free;
129
130 /* Output */
131 solver->output_oneiter = &c_refine_output_oneiter;
132 solver->output_final = &c_refine_output_final;
133
134 /* Basic operations */
135 solver->spsv = &bcsc_cspsv;
136 if ( sched == PastixSchedSequential )
137 {
138 solver->spmv = &bcsc_cspmv;
139 solver->copy = &bvec_ccopy_seq;
140 solver->dot = &bvec_cdotc_seq;
141 solver->axpy = &bvec_caxpy_seq;
142 solver->scal = &bvec_cscal_seq;
143 solver->norm = &bvec_cnrm2_seq;
144 solver->gemv = &bvec_cgemv_seq;
145 } else {
146 solver->spmv = &bcsc_cspmv;
147 solver->copy = &bvec_ccopy_smp;
148 solver->dot = &bvec_cdotc_smp;
149 solver->axpy = &bvec_caxpy_smp;
150 solver->scal = &bvec_cscal_smp;
151 solver->norm = &bvec_cnrm2_smp;
152 solver->gemv = &bvec_cgemv_smp;
153 }
154}
BEGIN_C_DECLS typedef int pastix_int_t
Definition datatypes.h:51
float _Complex pastix_complex32_t
Definition datatypes.h:76
double pastix_fixdbl_t
Definition datatypes.h:65
void bvec_cgemv_smp(pastix_data_t *pastix_data, pastix_int_t m, pastix_int_t n, pastix_complex32_t alpha, const pastix_complex32_t *A, pastix_int_t lda, const pastix_complex32_t *x, pastix_complex32_t beta, pastix_complex32_t *y)
Compute.
float bvec_cnrm2_seq(pastix_data_t *pastix_data, pastix_int_t n, const pastix_complex32_t *x)
Compute the norm 2 of a vector. (Sequential version)
void bvec_free(void *x)
Free a vector.
Definition bvec.c:62
void bvec_cscal_seq(pastix_data_t *pastix_data, pastix_int_t n, pastix_complex32_t alpha, pastix_complex32_t *x)
Scale a vector by the scalar alpha. (Sequential version)
void bvec_ccopy_smp(pastix_data_t *pastix_data, pastix_int_t n, const pastix_complex32_t *x, pastix_complex32_t *y)
Copy a vector y = x (parallel version)
void * bvec_malloc(size_t size)
Allocate a vector.
Definition bvec.c:42
void bvec_ccopy_seq(pastix_data_t *pastix_data, pastix_int_t n, const pastix_complex32_t *x, pastix_complex32_t *y)
Copy a vector y = x (Sequential version)
void bvec_caxpy_seq(pastix_data_t *pastix_data, pastix_int_t n, pastix_complex32_t alpha, const pastix_complex32_t *x, pastix_complex32_t *y)
Compute y <- alpha * x + y. (Sequential version)
void bcsc_cspsv(pastix_data_t *pastix_data, pastix_complex32_t *b, pastix_complex32_t *work)
Solve A x = b with A the sparse matrix.
void bcsc_cspmv(const pastix_data_t *pastix_data, pastix_trans_t trans, pastix_complex32_t alpha, const pastix_complex32_t *x, pastix_complex32_t beta, pastix_complex32_t *y)
Compute the matrix-vector product y = alpha * op(A) * x + beta * y.
Definition bcsc_cspmv.c:629
void bvec_cgemv_seq(pastix_data_t *pastix_data, pastix_int_t m, pastix_int_t n, pastix_complex32_t alpha, const pastix_complex32_t *A, pastix_int_t lda, const pastix_complex32_t *x, pastix_complex32_t beta, pastix_complex32_t *y)
Compute.
float bvec_cnrm2_smp(pastix_data_t *pastix_data, pastix_int_t n, const pastix_complex32_t *x)
Compute the norm 2 of a vector. (Parallel version)
void bvec_caxpy_smp(pastix_data_t *pastix_data, pastix_int_t n, pastix_complex32_t alpha, const pastix_complex32_t *x, pastix_complex32_t *y)
Perform y = alpha * x + y (Parallel version)
void bvec_cscal_smp(pastix_data_t *pastix_data, pastix_int_t n, pastix_complex32_t alpha, pastix_complex32_t *x)
Scale a vector (Parallel version)
enum pastix_scheduler_e pastix_scheduler_t
Scheduler.
@ IPARM_SCHEDULER
Definition api.h:117
@ PastixSchedSequential
Definition api.h:334
void c_refine_init(struct c_solver *, pastix_data_t *)
Initiate functions pointers to define basic operations.
void c_refine_output_oneiter(pastix_fixdbl_t t0, pastix_fixdbl_t tf, float err, pastix_int_t nb_iters)
Print statistics about one iteration.
void c_refine_output_final(pastix_data_t *pastix_data, pastix_complex32_t err, pastix_int_t nb_iters, pastix_fixdbl_t tf, void *x, pastix_complex32_t *gmresx)
Final output.
pastix_int_t * iparm
Definition pastixdata.h:70
Main PaStiX data structure.
Definition pastixdata.h:68