1 //------------------------------------------------------------------------------
2 // GxB_Row_subassign: C(row,Cols)<M'> = accum (C(row,Cols),u')
3 //------------------------------------------------------------------------------
4 
5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
6 // SPDX-License-Identifier: Apache-2.0
7 
8 //------------------------------------------------------------------------------
9 
10 // Compare with GrB_Row_assign, which uses the M and C_replace differently
11 
12 #include "GB_subassign.h"
13 
GxB_Row_subassign(GrB_Matrix C,const GrB_Vector M,const GrB_BinaryOp accum,const GrB_Vector u,GrB_Index row,const GrB_Index * Cols,GrB_Index nCols,const GrB_Descriptor desc)14 GrB_Info GxB_Row_subassign          // C(row,Cols)<M'> += u'
15 (
16     GrB_Matrix C,                   // input/output matrix for results
17     const GrB_Vector M,             // mask for C(row,Cols), unused if NULL
18     const GrB_BinaryOp accum,       // optional accum for z=accum(C(row,Cols),t)
19     const GrB_Vector u,             // input vector
20     GrB_Index row,                  // row index
21     const GrB_Index *Cols,          // column indices
22     GrB_Index nCols,                // number of column indices
23     const GrB_Descriptor desc       // descriptor for C(row,Cols) and M
24 )
25 {
26 
27     //--------------------------------------------------------------------------
28     // check inputs
29     //--------------------------------------------------------------------------
30 
31     GB_WHERE (C, "GxB_Row_subassign (C, M, accum, u, row, Cols, nCols, desc)") ;
32     GB_BURBLE_START ("GxB_subassign") ;
33     GB_RETURN_IF_NULL_OR_FAULTY (C) ;
34     GB_RETURN_IF_FAULTY (M) ;
35     GB_RETURN_IF_NULL_OR_FAULTY (u) ;
36     ASSERT (M == NULL || GB_VECTOR_OK (M)) ;
37     ASSERT (GB_VECTOR_OK (u)) ;
38 
39     // get the descriptor
40     GB_GET_DESCRIPTOR (info, desc, C_replace, Mask_comp, Mask_struct,
41         xx1, xx2, xx3, xx7) ;
42 
43     //--------------------------------------------------------------------------
44     // C(row,Cols)<M'> = accum (C(row,Cols), u')
45     //--------------------------------------------------------------------------
46 
47     // construct the row index list Rows = [ row ] of length nRows = 1
48     GrB_Index Rows [1] ;
49     Rows [0] = row ;
50 
51     info = GB_subassign (
52         C,                  C_replace,      // C matrix and its descriptor
53         (GrB_Matrix) M, Mask_comp, Mask_struct, // mask and its descriptor
54         true,                               // transpose the mask
55         accum,                              // for accum (C(Rows,col),u)
56         (GrB_Matrix) u,     true,           // u as a matrix; always transposed
57         Rows, 1,                            // a single row index
58         Cols, nCols,                        // column indices
59         false, NULL, GB_ignore_code,        // no scalar expansion
60         Context) ;
61 
62     GB_BURBLE_END ;
63     return (info) ;
64 }
65