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: chol.m
    path of file: ./repos/chebfun/@chebfun2
    
    the code of the file until where you have to start completion: function varargout = chol(varargin)
%CHOL    Cholesky factorization of a CHEBFUN2.
%

    
function varargout = chol(varargin)
%CHOL    Cholesky factorization of a CHEBFUN2.
%
% R = CHOL( F ), if F is a nonnegative definite CHEBFUN2 then this
% returns an upper triangular quasimatrix so that R'*R is a
% decomposition of F. If F is not nonnegative definite then an error is thrown.
%
% L = CHOL(F, 'lower'), if F is a nonnegative definite CHEBFUN2 then this
% produces a lower triangular quasimatrix so that L*L' is a decomposition of F.
% If F is not nonnegative definite then an error is thrown.
%
% [R, p] = CHOL( F ), with two outputs never throwns an error message. If F is
% nonnegative definite then p is 0 and R is the same as above. If F is
% symmetric but negative definite or semidefinite then p is a positive
% integer such that R has p columns and R'*R is a rank p nonnegative definite
% CHEBFUN2 that approximates F.
% This is particular useful when F is nonnegative definite, but rounding errors
% have perturbed it to be semidefinite.
%
% [L, p] = CHOL(F, 'lower') same as above but the first argument is lower
% triangular.
%
% For more information about the factorization:
% A. Townsend