Home > manopt > autodiff > functions_AD > crepmat.m

crepmat

PURPOSE ^

Replicates an array.

SYNOPSIS ^

function Xrepmat = crepmat(X, varargin)

DESCRIPTION ^

 Replicates an array.

 function Xrepmat = crepmat(X,varargin)

 This function can be seen as repmat(X,varargin) but is compatible with
 structs with fields real and imag.

 See also: manoptADhelp

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function Xrepmat = crepmat(X, varargin)
0002 % Replicates an array.
0003 %
0004 % function Xrepmat = crepmat(X,varargin)
0005 %
0006 % This function can be seen as repmat(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         Xrepmat.real = repmat(X.real, varargin{:});
0018         Xrepmat.imag = repmat(X.imag, varargin{:});
0019         
0020     elseif isnumeric(X)
0021         Xrepmat = repmat(X, varargin{:});
0022         
0023     else
0024         ME = MException('crepmat:inputError', ...
0025                         'Input does not have the expected format.');
0026         throw(ME);
0027         
0028     end
0029 
0030 end

Generated on Fri 30-Sep-2022 13:18:25 by m2html © 2005