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: symmetric_dirichlet.m
    path of file: ./repos/gptoolbox/mesh
    
    the code of the file until where you have to start completion: function [f,G,H] = symmetric_dirichlet(U,F,P,varargin)
  % SYMMETRIC_DIRICHLET Compute the symmetric Dirichlet energy (and its
  % derivatives) for 2D parameterization of a given *strictly feasible** 2D
  % mesh.  See "Bijective Parameterization with Free Boundaries" [Smith and
  % Schaefer 2015].
  %
  % Inputs:
  %   U  #V by 2 list of input 2D mesh vertex displacements
  %   F  #F by 3 list of triangle indices into rows of U/P
  %   P  #P by 2|3 list of input 3D mesh vertex positions
  %    or
  %      #F*3 by 2|3 list of input 3D mesh corner positions: P = V(F,:)
  %      e.g., the output of plane_project.m
  % Outputs:
  %   f  scalar total objective value
  %   G  #U*2 gradient 
  %   H  #U*2 by #U*2 sparse Hessian matrix
  %
  % Note: this function uses a special symbolic library trick which generates
  % file symmetric_dirichlet_sym.m if it doesn't already exist. If your change
  % the symbolic-math part of this file, you must delete this automatically
  % generated file.
  %

  psd_project = true;
  % Map of parameter names to variable names
  params_to_variables = containers.Map( ...
    {'PSD'}, ...
    {'psd_project'});
  v = 1;
  while v <= numel(varargin)
    param_name = varargin{v};
    if isKey(params_to_variables,param_name)
      assert(v+1<=numel(varargin));

    
function [f,G,H] = symmetric_dirichlet(U,F,P,varargin)
  % SYMMETRIC_DIRICHLET Compute the symmetric Dirichlet energy (and its
  % derivatives) for 2D parameterization of a given *strictly feasible** 2D
  % mesh.  See "Bijective Parameterization with Free Boundaries" [Smith and
  % Schaefer 2015].
  %
  % Inputs:
  %   U  #V by 2 list of input 2D mesh vertex displacements
  %   F  #F by 3 list of triangle indices into rows of U/P
  %   P  #P by 2|3 list of input 3D mesh vertex positions
  %    or
  %      #F*3 by 2|3 list of input 3D mesh corner positions: P = V(F,:)
  %      e.g., the output of plane_project.m
  % Outputs:
  %   f  scalar total objective value
  %   G  #U*2 gradient 
  %   H  #U*2 by #U*2 sparse Hessian matrix
  %
  % Note: this function uses a special symbolic library trick which generates
  % file symmetric_dirichlet_sym.m if it doesn't already exist. If your change
  % the symbolic-math part of this file, you must delete this automatically
  % generated file.
  %

  psd_project = true;
  % Map of parameter names to variable names
  params_to_variables = containers.Map( ...
    {'PSD'}, ...
    {'psd_project'});
  v = 1;
  while v <= numel(varargin)
    param_name = varargin{v};
    if isKey(params_to_variables,param_name)
      assert(v+1<=numel(varargin));
      v = v+1;
      % Trick: use feval on anonymous function to use assignin to this workspace
      feval(@()assignin('caller',params_to_variables(param_name),varargin{v}));
    else
      error('Unsupported parameter: %s',varargin{v});
    end