1 //------------------------------------------------------------------------------
2 // GrB_Row_assign: C<M'>(row,Cols) = 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 GxB_Row_subassign, which uses M and C_replace differently
11 
12 #include "GB_assign.h"
13 #include "GB_bitmap_assign.h"
14 
GrB_Row_assign(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)15 GrB_Info GrB_Row_assign             // C<M'>(row,Cols) += u'
16 (
17     GrB_Matrix C,                   // input/output matrix for results
18     const GrB_Vector M,             // M for C(row,:), unused if NULL
19     const GrB_BinaryOp accum,       // optional accum for z=accum(C(row,Cols),t)
20     const GrB_Vector u,             // input vector
21     GrB_Index row,                  // row index
22     const GrB_Index *Cols,          // column indices
23     GrB_Index nCols,                // number of column indices
24     const GrB_Descriptor desc       // descriptor for C(row,:) and M
25 )
26 {
27 
28     //--------------------------------------------------------------------------
29     // check inputs
30     //--------------------------------------------------------------------------
31 
32     GB_WHERE (C, "GrB_Row_assign (C, M, accum, u, row, Cols, nCols, desc)") ;
33     GB_BURBLE_START ("GrB_assign") ;
34     GB_RETURN_IF_NULL_OR_FAULTY (C) ;
35     GB_RETURN_IF_FAULTY (M) ;
36     GB_RETURN_IF_NULL_OR_FAULTY (u) ;
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<M'>(row,Cols) = accum (C(row,Cols), u')
46     //--------------------------------------------------------------------------
47 
48     // construct the row index list Rows = [ row ] of length nRows = 1
49     GrB_Index Rows [1] ;
50     Rows [0] = row ;
51 
52     info = GB_assign (
53         C,                  C_replace,      // C matrix and its descriptor
54         (GrB_Matrix) M, Mask_comp, Mask_struct, // mask and its descriptor
55         true,                               // transpose the mask
56         accum,                              // for accum (C(Rows,col),u)
57         (GrB_Matrix) u,     true,           // u as a matrix; always transposed
58         Rows, 1,                            // a single row index
59         Cols, nCols,                        // column indices
60         false, NULL, GB_ignore_code,        // no scalar expansion
61         GB_ROW_ASSIGN,
62         Context) ;
63 
64     GB_BURBLE_END ;
65     return (info) ;
66 }
67 
68