function localL = hIcholRowWise(codistrA, localA, setup, isMatrixKnownSymmetric)
%hIcholColWise incomplete Cholesky of a sparse matrix distributed row wise.
%
%   L = hIcholRowWise(CODISTRA, LOCALA, SETUP)

%   Copyright 2020 The MathWorks, Inc.

% A is distributed by rows, we call hIcholColImplCpp on A.' and transpose
% back the result. As localA is stored by columns (CSC format), this is
% faster than implementing the row-wise counterpart of hIcholColWise.
% We need to change the shape provided by the user. Note that we don't need
% to handle diagcomp here.
if isfield(setup, "shape")
    % If a shape is given, we pass the other one
    shapeOpts = ["lower" "upper"];
    setup.shape = shapeOpts(~strcmpi(shapeOpts, setup.shape));
else
    % Default shape is lower so we pass upper
    setup.shape = "upper";
end
codistrA = codistrA.pTransposeCodistributor();
localL = codistrA.hIcholColWise(localA.', setup, isMatrixKnownSymmetric);
localL = localL.';
end
