This commit is contained in:
Roman Galochkin 2020-02-21 16:03:27 +03:00
parent 36ad96d129
commit 8448b388fa

View File

@ -12,4 +12,12 @@ module Make = (Config: Config) => {
if (!validateSize()) {
raise(ShapeWrong("Arrays of \"xs\" and \"ys\" have different sizes."));
};
let order = (): DistributionTypes.xyShape => {
let xy =
Config.shape.xs
|> Array.mapi((i, x) => [x, Config.shape.ys[i]])
|> Belt.SortArray.stableSortBy(_, ([a], [b]) => a > b ? (-1) : 1);
{xs: xy |> Array.map(([x]) => x), ys: xy |> Array.map(([_, y]) => y)};
};
};