22 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_SNS 56 if (
m->m_matrix ==
NULL)
59 for (
i = 0;
i < h; ++
i) {
61 if (
m->m_matrix[
i] ==
NULL) {
74 for (
i = 0;
i <
m->m_height; ++
i)
77 m->m_height =
m->m_width = 0;
90 return &
m->m_matrix[y][
x];
100 for (y = 0; y < mat->
m_height; ++y) {
115 for (
x = 0;
x <
vec->mv_size; ++
x)
124 M0_PRE(r0 < m->m_height && r1 < m->m_height);
126 temp =
m->m_matrix[r0];
127 m->m_matrix[r0] =
m->m_matrix[r1];
128 m->m_matrix[r1] = temp;
149 for (
x = 0;
x <
m->m_width; ++
x) {
176 for (
x = 0;
x <
m->m_width; ++
x) {
179 *e0 =
f(f0(*e0, c0), f1(*e1, c1));
192 for (
x = 0;
x <
m->m_width; ++
x) {
195 *e0 =
f(f0(*e0, c0), *e1);
208 for (
x = 0;
x <
m->m_width; ++
x) {
211 *e0 =
f(*e0, f1(*e1, c1));
227 for (y = 0; y <
m->m_height; ++y) {
230 *e0 =
f(f0(*e0, c0), f1(*e1, c1));
241 for (y = 0; y <
m->m_height; ++y) {
262 *e0 =
f(f0(*e0, c0), f1(*e1, c1));
278 *e0 =
f(*e0, f1(*e1, c1));
294 *e0 =
f(f0(*e0, c0), *e1);
310 for (y = 0; y <
m->m_height; ++y) {
314 for (
x = 0;
x <
m->m_width; ++
x) {
319 *er =
add(*er, mul(ev, em));
326 uint32_t x_off, uint32_t y_off)
334 for (y = 0; y < submat->
m_height; ++y) {
360 for (
i = 0;
i <
ma->m_height; ++
i) {
361 for (j = 0; j <
ma->m_width; ++j) {
362 for (k = 0; k <
mb->m_height; ++k) {
381 for (j = 0; j < identity_mat->
m_height; ++j) {
402 uint32_t des_row, uint32_t src_row)
419 #undef M0_TRACE_SUBSYSTEM M0_INTERNAL void m0_matvec_rows_operate(struct m0_matvec *v, uint32_t row0, uint32_t row1, m0_matvec_matrix_binary_operator_t f0, m0_parity_elem_t c0, m0_matvec_matrix_binary_operator_t f1, m0_parity_elem_t c1, m0_matvec_matrix_binary_operator_t f)
M0_INTERNAL void m0_matvec_print(const struct m0_matvec *vec)
static m0_parity_elem_t m0_parity_add(m0_parity_elem_t x, m0_parity_elem_t y)
M0_INTERNAL bool m0_matrix_is_null(const struct m0_matrix *mat)
#define M0_ALLOC_ARR(arr, nr)
static struct m0_addb2_mach * m
M0_INTERNAL void m0_matrix_row_copy(struct m0_matrix *des, const struct m0_matrix *src, uint32_t des_row, uint32_t src_row)
#define M0_LOG(level,...)
M0_INTERNAL bool m0_matrix_is_square(const struct m0_matrix *mat)
M0_INTERNAL void m0_matrix_cols_operate(struct m0_matrix *m, uint32_t col0, uint32_t col1, m0_matvec_matrix_binary_operator_t f0, m0_parity_elem_t c0, m0_matvec_matrix_binary_operator_t f1, m0_parity_elem_t c1, m0_matvec_matrix_binary_operator_t f)
M0_INTERNAL bool m0_matrix_is_init(const struct m0_matrix *mat)
M0_INTERNAL void m0_matrix_row_operate(struct m0_matrix *m, uint32_t row, m0_parity_elem_t c, m0_matvec_matrix_binary_operator_t f)
M0_INTERNAL void m0_matvec_row_operate(struct m0_matvec *v, uint32_t row, m0_parity_elem_t c, m0_matvec_matrix_binary_operator_t f)
return M0_ERR(-EOPNOTSUPP)
m0_parity_elem_t * mv_vector
M0_INTERNAL void m0_matrix_col_operate(struct m0_matrix *m, uint32_t col, m0_parity_elem_t c, m0_matvec_matrix_binary_operator_t f)
M0_INTERNAL void m0_matvec_rows_operate1(struct m0_matvec *v, uint32_t row0, uint32_t row1, m0_matvec_matrix_binary_operator_t f1, m0_parity_elem_t c1, m0_matvec_matrix_binary_operator_t f)
M0_INTERNAL void m0_matrix_rows_operate(struct m0_matrix *m, uint32_t row0, uint32_t row1, m0_matvec_matrix_binary_operator_t f0, m0_parity_elem_t c0, m0_matvec_matrix_binary_operator_t f1, m0_parity_elem_t c1, m0_matvec_matrix_binary_operator_t f)
static struct m0_addb2_callback c
M0_INTERNAL void m0_matvec_swap_row(struct m0_matvec *v, uint32_t r0, uint32_t r1)
M0_INTERNAL void m0_matrix_rows_operate1(struct m0_matrix *m, uint32_t row0, uint32_t row1, m0_matvec_matrix_binary_operator_t f1, m0_parity_elem_t c1, m0_matvec_matrix_binary_operator_t f)
M0_INTERNAL void m0_matrix_multiply(const struct m0_matrix *ma, const struct m0_matrix *mb, struct m0_matrix *mc)
M0_INTERNAL void m0_matvec_rows_operate2(struct m0_matvec *v, uint32_t row0, uint32_t row1, m0_matvec_matrix_binary_operator_t f0, m0_parity_elem_t c0, m0_matvec_matrix_binary_operator_t f)
m0_parity_elem_t * m0_matrix_elem_get(const struct m0_matrix *m, uint32_t x, uint32_t y)
m0_parity_elem_t * m0_matvec_elem_get(const struct m0_matvec *v, uint32_t x)
M0_INTERNAL void m0_matrix_submatrix_get(const struct m0_matrix *mat, struct m0_matrix *submat, uint32_t x_off, uint32_t y_off)
m0_parity_elem_t(* m0_matvec_matrix_binary_operator_t)(m0_parity_elem_t, m0_parity_elem_t)
#define m0_forall(var, nr,...)
M0_INTERNAL void m0_matrix_fini(struct m0_matrix *m)
M0_INTERNAL void m0_identity_matrix_fill(struct m0_matrix *identity_mat)
M0_INTERNAL int m0_matrix_init(struct m0_matrix *m, uint32_t w, uint32_t h)
M0_INTERNAL void m0_matrix_vec_multiply(const struct m0_matrix *m, const struct m0_matvec *v, struct m0_matvec *r, m0_matvec_matrix_binary_operator_t mul, m0_matvec_matrix_binary_operator_t add)
m0_parity_elem_t ** m_matrix
M0_INTERNAL void m0_matrix_rows_operate2(struct m0_matrix *m, uint32_t row0, uint32_t row1, m0_matvec_matrix_binary_operator_t f0, m0_parity_elem_t c0, m0_matvec_matrix_binary_operator_t f)
M0_INTERNAL int m0_matvec_init(struct m0_matvec *v, uint32_t sz)
static m0_parity_elem_t m0_parity_mul(m0_parity_elem_t x, m0_parity_elem_t y)
M0_INTERNAL void m0_matvec_fini(struct m0_matvec *v)
struct m0_pdclust_src_addr src
M0_INTERNAL void m0_matrix_print(const struct m0_matrix *mat)
static void add(struct m0_addb2_mach *mach, uint64_t id, int n, const uint64_t *value)
M0_INTERNAL void m0_matrix_swap_row(struct m0_matrix *m, uint32_t r0, uint32_t r1)