Extracts the real part of x function Xreal = creal(X) Returns the real part of x. The input can be either a numeric array or a struct with fields real and imag. See also: manoptADhelp
0001 function Xreal = creal(X) 0002 % Extracts the real part of x 0003 % 0004 % function Xreal = creal(X) 0005 % 0006 % Returns the real part of x. The input can be either a numeric array 0007 % or a struct 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 Xreal = X.real; 0018 elseif isnumeric(X) 0019 Xreal = real(X); 0020 else 0021 ME = MException('creal:inputError', ... 0022 'Input does not have the expected format.'); 0023 throw(ME); 0024 end 0025 0026 end