1 //------------------------------------------------------------------------------
2 // GxB_Col_subassign: C(Rows,col)<M> = accum (C(Rows,col),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_Col_assign, which uses M and C_replace differently
11 
12 #include "GB_subassign.h"
13 
GxB_Col_subassign(GrB_Matrix C,const GrB_Vector M,const GrB_BinaryOp accum,const GrB_Vector u,const GrB_Index * Rows,GrB_Index nRows,GrB_Index col,const GrB_Descriptor desc)14 GrB_Info GxB_Col_subassign          // C(Rows,col)<M> = accum (C(Rows,col),u)
15 (
16     GrB_Matrix C,                   // input/output matrix for results
17     const GrB_Vector M,             // mask for C(Rows,col), unused if NULL
18     const GrB_BinaryOp accum,       // optional accum for z=accum(C(Rows,col),t)
19     const GrB_Vector u,             // input vector
20     const GrB_Index *Rows,          // row indices
21     GrB_Index nRows,                // number of row indices
22     GrB_Index col,                  // column index
23     const GrB_Descriptor desc       // descriptor for C(Rows,col) and M
24 )
25 {
26 
27     //--------------------------------------------------------------------------
28     // check inputs
29     //--------------------------------------------------------------------------
30 
31     GB_WHERE (C, "GxB_Col_subassign (C, M, accum, u, Rows, nRows, col, 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 
37     ASSERT (M == NULL || GB_VECTOR_OK (M)) ;
38     ASSERT (GB_VECTOR_OK (u)) ;
39 
40     // get the descriptor
41     GB_GET_DESCRIPTOR (info, desc, C_replace, Mask_comp, Mask_struct,
42         xx1, xx2, xx3, xx7) ;
43 
44     //--------------------------------------------------------------------------
45     // C(Rows,col)<M> = accum (C(Rows,col), u) and variations
46     //--------------------------------------------------------------------------
47 
48     // construct the column index list Cols = [ col ] of length nCols = 1
49     GrB_Index Cols [1] ;
50     Cols [0] = col ;
51 
52     info = GB_subassign (
53         C,                  C_replace,      // C matrix and its descriptor
54         (GrB_Matrix) M, Mask_comp, Mask_struct, // mask and its descriptor
55         false,                              // do not transpose the mask
56         accum,                              // for accum (C(Rows,col),u)
57         (GrB_Matrix) u,     false,          // u as a matrix; never transposed
58         Rows, nRows,                        // row indices
59         Cols, 1,                            // a single column index
60         false, NULL, GB_ignore_code,        // no scalar expansion
61         Context) ;
62 
63     GB_BURBLE_END ;
64     return (info) ;
65 }
66 
67