| 18 | #define GB_FREE_ALL GB_phybix_free (C) ; |
| 19 | |
| 20 | GrB_Info GB_AxB_rowscale // C = D*B, row scale with diagonal D |
| 21 | ( |
| 22 | GrB_Matrix C, // output matrix, static header |
| 23 | const GrB_Matrix D, // diagonal input matrix |
| 24 | const GrB_Matrix B, // input matrix |
| 25 | const GrB_Semiring semiring, // semiring that defines C=D*B |
| 26 | const bool flipxy, // if true, do z=fmult(b,a) vs fmult(a,b) |
| 27 | GB_Context Context |
| 28 | ) |
| 29 | { |
| 30 | |
| 31 | //-------------------------------------------------------------------------- |
| 32 | // check inputs |
| 33 | //-------------------------------------------------------------------------- |
| 34 | |
| 35 | GrB_Info info ; |
| 36 | ASSERT (C != NULL && (C->static_header || GBNSTATIC)) ; |
| 37 | ASSERT_MATRIX_OK (D, "D for rowscale D*B", GB0) ; |
| 38 | ASSERT_MATRIX_OK (B, "B for rowscale D*B", GB0) ; |
| 39 | ASSERT (!GB_ZOMBIES (D)) ; |
| 40 | ASSERT (!GB_JUMBLED (D)) ; |
| 41 | ASSERT (!GB_PENDING (D)) ; |
| 42 | ASSERT (!GB_ZOMBIES (B)) ; |
| 43 | ASSERT (GB_JUMBLED_OK (B)) ; |
| 44 | ASSERT (!GB_PENDING (B)) ; |
| 45 | ASSERT_SEMIRING_OK (semiring, "semiring for numeric D*B", GB0) ; |
| 46 | ASSERT (D->vdim == B->vlen) ; |
| 47 | ASSERT (GB_is_diagonal (D, Context)) ; |
| 48 | |
| 49 | ASSERT (!GB_IS_BITMAP (D)) ; // bitmap or full: not needed |
| 50 | ASSERT (!GB_IS_BITMAP (B)) ; |
| 51 | ASSERT (!GB_IS_FULL (D)) ; |
| 52 | |
| 53 | GBURBLE ("(%s=%s*%s) ", |
| 54 | GB_sparsity_char_matrix (B), // C has the sparsity structure of B |
| 55 | GB_sparsity_char_matrix (D), |
| 56 | GB_sparsity_char_matrix (B)) ; |
| 57 | |
| 58 | //-------------------------------------------------------------------------- |
| 59 | // get the semiring operators |
| 60 | //-------------------------------------------------------------------------- |
| 61 | |
| 62 | GrB_BinaryOp mult = semiring->multiply ; |
| 63 | GrB_Type ztype = mult->ztype ; |
| 64 | ASSERT (ztype == semiring->add->op->ztype) ; |
| 65 | GB_Opcode opcode = mult->opcode ; |
| 66 | // GB_reduce_to_vector does not use GB_AxB_rowscale: |
| 67 | ASSERT (!(mult->binop_function == NULL && |
| 68 | (opcode == GB_FIRST_binop_code || opcode == GB_SECOND_binop_code))) ; |
| 69 | |
| 70 | //-------------------------------------------------------------------------- |
| 71 | // determine if C is iso (ignore the monoid since it isn't used) |
| 72 | //-------------------------------------------------------------------------- |
| 73 | |
| 74 | size_t zsize = ztype->size ; |
| 75 | GB_void cscalar [GB_VLA(zsize)] ; |
| 76 | bool C_iso = GB_iso_AxB (cscalar, D, B, D->vdim, semiring, flipxy, true) ; |
| 77 |
no test coverage detected