Reshapes X. function Xreshape = creshape(X,varargin) This function can be seen as reshape(X,varargin) but is compatible with structs with fields real and imag. See also: manoptADhelp
0001 function Xreshape = creshape(X, varargin) 0002 % Reshapes X. 0003 % 0004 % function Xreshape = creshape(X,varargin) 0005 % 0006 % This function can be seen as reshape(X,varargin) but is compatible with 0007 % structs with fields real and imag. 0008 % 0009 % See also: manoptADhelp 0010 0011 % This file is part of Manopt: www.manopt.org. 0012 % Original author: Xiaowen Jiang, July. 31, 2021. 0013 % Contributors: Nicolas Boumal 0014 % Change log: 0015 0016 if iscstruct(X) 0017 Xreshape.real = reshape(X.real, varargin{:}); 0018 Xreshape.imag = reshape(X.imag, varargin{:}); 0019 0020 elseif isnumeric(X) 0021 Xreshape = reshape(X, varargin{:}); 0022 0023 else 0024 ME = MException('creshape:inputError', ... 0025 'Input does not have the expected format.'); 0026 throw(ME); 0027 0028 end 0029 end