1function C = GB_spec_Row_assign (C, Mask, accum, A, i, J, descriptor)
2%GB_SPEC_ROW_ASSIGN a MATLAB mimic of GrB_Row_assign
3%
4% Usage:
5% C = GB_spec_Row_assign (C, Mask, accum, A, i, J, descriptor)
6%
7% Computes C<Mask'>(i,J) = accum(C(i,J),A'), in GraphBLAS notation.
8% Both Mask and A must be column vectors of size m, if C is m-by-1
9%
10% This function does the same thing as GrB_Row_assign
11
12% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
13% SPDX-License-Identifier: Apache-2.0
14
15%-------------------------------------------------------------------------------
16% get inputs
17%-------------------------------------------------------------------------------
18
19if (nargout > 1 || nargin ~= 7)
20    error ('usage: C = GB_spec_Row_assign (C, Mask, accum, A, i, J, descriptor)') ;
21end
22
23if (length (i) ~= 1)
24    error ('i must be a scalar') ;
25end
26
27% Convert inputs to dense matrices with explicit patterns and types,
28C = GB_spec_matrix (C) ;
29
30% extract the C(i,:) row and transpose it
31X.matrix  = C.matrix  (i,:)' ;
32X.pattern = C.pattern (i,:)' ;
33X.class   = C.class ;
34
35% X<Mask>(J) = accum (X(J),A), on the column vector X
36X = GB_spec_assign (X, Mask, accum, A, J, 1, descriptor, 0) ;
37
38% put the C(i,:) row back
39C.matrix  (i,:) = X.matrix' ;
40C.pattern (i,:) = X.pattern' ;
41
42