You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: cod_sparse.m
    path of file: ./repos/SuiteSparse/MATLAB_Tools/Factorize
    
    the code of the file until where you have to start completion: function [U, R, V, r] = cod_sparse (A, arg)
%COD_SPARSE complete orthogonal decomposition of a sparse matrix A = U*R*V'
%
%   [U, R, V, r] = cod_sparse (A)
%   [U, R, V, r] = cod_sparse (A, opts)
%
% The sparse m-by-n matrix A is factorized into U*R*V' where R is m-by-n and
% all zero except for R(1:r,1:r), which is upper triangular.  The first r
% diagonal entries of R have magnitude greater than tol, where r is the

    
function [U, R, V, r] = cod_sparse (A, arg)
%COD_SPARSE complete orthogonal decomposition of a sparse matrix A = U*R*V'
%
%   [U, R, V, r] = cod_sparse (A)
%   [U, R, V, r] = cod_sparse (A, opts)
%
% The sparse m-by-n matrix A is factorized into U*R*V' where R is m-by-n and
% all zero except for R(1:r,1:r), which is upper triangular.  The first r
% diagonal entries of R have magnitude greater than tol, where r is the
% estimated rank of A.  All other diagonal entries are zero.  The default tol
% of 20*(m+n)*eps(max(diag(R))) is used if tol is not present or if tol<0.
% Use COD for full matrices.
%
% By default, U and V are not returned as sparse matrices, but as structs that
% represent a sequence of Householder transformations (U of size m-by-m and V
% of size n-by-n).  They can be passed to COD_QMULT to multiply them with other
% matrices or to convert them into matrices.  Alternatively, you can have U and
% V returned as matrices with opts.Q='matrix'.
%
% If A has full rank and m >= n, then this function simply returns the QR
% factorization Q*R*P' = U*R*V' = A where V=P is the fill-reducing ordering.
% If m < n, then U is the fill-reducing ordering and V' the orthgonal factor in
% Householder form.  If A is rank deficient, then both U and V contain
% non-trivial Householder transformations.
%
% If condest (R (1:r,1:r)) is large (> 1e12 or so) then the estimated rank of A
% might be incorrect.  Try increasing tol in that case, which will make R
% better conditioned and reduce the estimated rank of A.
%
% If the opts input parameter is a scalar, then it is used as the value of tol.
% If it is a struct, it can contain non-default options:
%
%   opts.tol    the tolerance to be used.  tol < 0 means the default is used.
%   opts.Q      'Householder' to return U and V as structs (default), 'matrix'
%               to return them as sparse matrices.  In their matrix form, U and
%               V can take a huge amount of memory, however.
%
% Example:
%
%   A = sparse (magic (4))
%   [U, R, V] = cod_sparse (A)
%   norm (A - cod_qmult (U, cod_qmult (V, R, 2),1),1)   % 1-norm of A - U*R*V'
%   U = cod_qmult (U, speye (size (A,1)), 1) ;      % convert U into a matrix
%   V = cod_qmult (V, speye (size (A,2)), 1) ;      % convert V into a matrix
%   norm (A - U*R*V',1)
%   opts.Q = 'matrix'
%   [U, R, V] = cod_sparse (A,opts)
%   norm (A - U*R*V',1)
%
%   A = sparse (rand (4,3)),  [U, R, V] = cod_sparse (A)
%   norm (A - cod_qmult (U, cod_qmult (V, R, 2), 1), 1)
%   A = sparse (rand (4,3)),  [U, R, V] = cod_sparse (A)
%   norm (A - cod_qmult (U, cod_qmult (V, R, 2), 1), 1)
%
% Requires the SPQR and SPQR_QMULT functions from SuiteSparse,
% http://www.suitesparse.com
%
% See also qr, cod, cod_qmult, spqr, spqr_qmult.

% Factorize, Copyright (c) 2011-2012, Timothy A Davis. All Rights Reserved.
% SPDX-License-Identifier: BSD-3-clause

%-------------------------------------------------------------------------------
% get the inputs
%-------------------------------------------------------------------------------

if (~issparse (A))
    error ('FACTORIZE:cod_sparse', ...
        'COD_SPARSE is not designed for full matrices.  Use COD instead.') ;
end