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