function obj = decomposition( A, varargin )
%DECOMPOSITION Matrix decomposition of codistributed array
%   DA = DECOMPOSITION(A)
%   DA = DECOMPOSITION(A, TYPE)
%   DA = DECOMPOSITION(..., 'CheckCondition', TF)
%   DA = DECOMPOSITION(..., 'RankTolerance', TOL)
%   DA = DECOMPOSITION(..., 'BandedDensity', TOL)
%   
%   Limitations:
%   * If A is sparse and TYPE is 'lu', then CheckCondition
%     must be false.
%   * If A is sparse, decomposition does not support TYPE 'chol'.
%   * If A is dense, decomposition does not support TYPE 'ldl'.
%   
%   Example:
%   spmd
%       N = 1000;
%       A = codistributed.rand(N);
%       decompA = decomposition(A);
%       x = decompA\sum(A,2);
%   end
%   
%   See also DECOMPOSITION, CODISTRIBUTED, CODISTRIBUTED/RAND.


%   Copyright 2018-2021 The MathWorks, Inc.

argList = distributedutil.CodistParser.gatherElements(varargin);
if ~iscodistributed(A)
    obj = decomposition(A, argList{:});
    return;
end

obj = parallel.codistributed.Decomposition.build(A, argList{:});
end
