1function i = end (G, k, ndims)
2%END Last index in an indexing expression for a GraphBLAS matrix.
3%
4% See also GrB/size, GrB/length.
5
6% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
7% SPDX-License-Identifier: GPL-3.0-or-later
8
9% FUTURE: add linear indexing
10% FUTURE: use hypersparse matrices to implement multidimensionl nD arrays
11
12if (ndims == 1)
13    if (~isvector (G))
14        error ('Linear indexing not yet supported') ;
15    end
16    i = length (G) ;
17elseif (ndims == 2)
18    s = size (G) ;
19    i = s (k) ;
20else
21    error ('%dD indexing not yet supported', ndims) ;
22end
23
24