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: tucker_me.m
    path of file: ./repos/encode/external/tensor_toolbox_2.5/met
    
    the code of the file until where you have to start completion: function [T, max_mem, Uinit] = tucker_me(X, R, esz, opts)
%TUCKER_ME Memory-efficient Tucker higher-order orthogonal iteration.
%
%   T = TUCKER_ME(X,R,ESZ) computes the best rank(R1,R2,..,Rn)
%   approximation of tensor X, according to the specified dimensions
%   in vector R. ESZ specifies the number of dimensions that are to be
%   handled elementwise. The input X is sptensor. The result
%   returned in T is a ttensor. 
%
%   T = TUCKER_ME(X,R,ESZ,OPTS) specify options:
%   OPTS.tol: Tolerance on difference in fit {1.0e-4}
%   OPTS.maxiters: Maximum number of iterations {50}

    
function [T, max_mem, Uinit] = tucker_me(X, R, esz, opts)
%TUCKER_ME Memory-efficient Tucker higher-order orthogonal iteration.
%
%   T = TUCKER_ME(X,R,ESZ) computes the best rank(R1,R2,..,Rn)
%   approximation of tensor X, according to the specified dimensions
%   in vector R. ESZ specifies the number of dimensions that are to be
%   handled elementwise. The input X is sptensor. The result
%   returned in T is a ttensor. 
%
%   T = TUCKER_ME(X,R,ESZ,OPTS) specify options:
%   OPTS.tol: Tolerance on difference in fit {1.0e-4}
%   OPTS.maxiters: Maximum number of iterations {50}
%   OPTS.dimorder: Order to loop through dimensions {1:ndims(A)}
%   OPTS.init: Initial guess [{'random'}|'eigs'|cell array]
%
%   [T,MEM,U0] = TUCKER_ME(...) also returns the memory estimate and
%   the initial guess U0.  
%
%   See also TENSOR_TOOLBOX, TUCKER_ALS, TTM_ME, TTM_ME_PARTITION,
%   TTM_ME_MEM.
%
%   Code by Tamara Kolda and Jimeng Sun, 2008. Adapted with permission from
%   the MATLAB Tensor Toolbox function algorithms/tucker_als.
%
%   Based on the paper:
%   T. G. Kolda and J. Sun. Scalable Tensor Decompositions for Multi-aspect
%   Data Mining. In: ICDM 2008: Proceedings of the 8th IEEE International
%   Conference on Data Mining, December 2008.  

% $Id: tucker_me.m,v 1.3 2010/03/19 22:55:46 tgkolda Exp $


%% Fill in optional variable
if ~exist('opts','var')
    opts = struct;
end