Added to index.ts
This commit is contained in:
parent
57196c568b
commit
e065a57a66
|
@ -8,13 +8,39 @@ import type {
|
||||||
export type { SamplingInputs, exportEnv, exportDistribution };
|
export type { SamplingInputs, exportEnv, exportDistribution };
|
||||||
export type { t as DistPlus } from "../rescript/OldInterpreter/DistPlus.gen";
|
export type { t as DistPlus } from "../rescript/OldInterpreter/DistPlus.gen";
|
||||||
import type { Operation_genericFunctionCallInfo } from "../rescript/Distributions/GenericDist/GenericDist_Types.gen";
|
import type { Operation_genericFunctionCallInfo } from "../rescript/Distributions/GenericDist/GenericDist_Types.gen";
|
||||||
import { genericDist } from "../rescript/TSInterface.gen";
|
|
||||||
import {
|
import {
|
||||||
run as runR,
|
genericDist,
|
||||||
|
resultDist,
|
||||||
|
resultFloat,
|
||||||
|
resultString,
|
||||||
|
} from "../rescript/TSInterface.gen";
|
||||||
|
import {
|
||||||
env,
|
env,
|
||||||
outputType,
|
Constructors_UsingDists_mean,
|
||||||
|
Constructors_UsingDists_sample,
|
||||||
|
Constructors_UsingDists_pdf,
|
||||||
|
Constructors_UsingDists_cdf,
|
||||||
|
Constructors_UsingDists_inv,
|
||||||
|
Constructors_UsingDists_normalize,
|
||||||
|
Constructors_UsingDists_toPointSet,
|
||||||
|
Constructors_UsingDists_toSampleSet,
|
||||||
|
Constructors_UsingDists_truncate,
|
||||||
|
Constructors_UsingDists_inspect,
|
||||||
|
Constructors_UsingDists_toString,
|
||||||
|
Constructors_UsingDists_toSparkline,
|
||||||
|
Constructors_UsingDists_algebraicAdd,
|
||||||
|
Constructors_UsingDists_algebraicMultiply,
|
||||||
|
Constructors_UsingDists_algebraicDivide,
|
||||||
|
Constructors_UsingDists_algebraicSubtract,
|
||||||
|
Constructors_UsingDists_algebraicLogarithm,
|
||||||
|
Constructors_UsingDists_algebraicExponentiate,
|
||||||
|
Constructors_UsingDists_pointwiseAdd,
|
||||||
|
Constructors_UsingDists_pointwiseMultiply,
|
||||||
|
Constructors_UsingDists_pointwiseDivide,
|
||||||
|
Constructors_UsingDists_pointwiseSubtract,
|
||||||
|
Constructors_UsingDists_pointwiseLogarithm,
|
||||||
|
Constructors_UsingDists_pointwiseExponentiate,
|
||||||
} from "../rescript/Distributions/DistributionOperation/DistributionOperation.gen";
|
} from "../rescript/Distributions/DistributionOperation/DistributionOperation.gen";
|
||||||
import { add } from "lodash";
|
|
||||||
|
|
||||||
export let defaultSamplingInputs: SamplingInputs = {
|
export let defaultSamplingInputs: SamplingInputs = {
|
||||||
sampleCount: 10000,
|
sampleCount: 10000,
|
||||||
|
@ -42,140 +68,152 @@ class GenericDist {
|
||||||
this.t = t;
|
this.t = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
mean(): outputType {
|
mean(): resultFloat {
|
||||||
return runR(
|
return Constructors_UsingDists_mean({ env: this.env }, this.t);
|
||||||
|
}
|
||||||
|
|
||||||
|
sample(): resultFloat {
|
||||||
|
return Constructors_UsingDists_sample({ env: this.env }, this.t);
|
||||||
|
}
|
||||||
|
|
||||||
|
pdf(n: number): resultFloat {
|
||||||
|
return Constructors_UsingDists_pdf({ env: this.env }, this.t, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
cdf(n: number): resultFloat {
|
||||||
|
return Constructors_UsingDists_cdf({ env: this.env }, this.t, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
inv(n: number): resultFloat {
|
||||||
|
return Constructors_UsingDists_inv({ env: this.env }, this.t, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
normalize(): resultDist {
|
||||||
|
return Constructors_UsingDists_normalize({ env: this.env }, this.t);
|
||||||
|
}
|
||||||
|
|
||||||
|
toPointSet(): resultDist {
|
||||||
|
return Constructors_UsingDists_toPointSet({ env: this.env }, this.t);
|
||||||
|
}
|
||||||
|
|
||||||
|
toSampleSet(n: number): resultDist {
|
||||||
|
return Constructors_UsingDists_toSampleSet({ env: this.env }, this.t, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
truncate(left: number, right: number): resultDist {
|
||||||
|
return Constructors_UsingDists_truncate(
|
||||||
{ env: this.env },
|
{ env: this.env },
|
||||||
{ tag: "FromDist", value: [{ tag: "ToFloat", value: "Mean" }, this.t] }
|
this.t,
|
||||||
|
left,
|
||||||
|
right
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pdf(n: number): outputType {
|
inspect(): resultDist {
|
||||||
return runR(
|
return Constructors_UsingDists_inspect({ env: this.env }, this.t);
|
||||||
|
}
|
||||||
|
|
||||||
|
toString(): resultString {
|
||||||
|
return Constructors_UsingDists_toString({ env: this.env }, this.t);
|
||||||
|
}
|
||||||
|
|
||||||
|
toSparkline(n: number): resultString {
|
||||||
|
return Constructors_UsingDists_toSparkline({ env: this.env }, this.t, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
algebraicAdd(d2: GenericDist): resultDist {
|
||||||
|
return Constructors_UsingDists_algebraicAdd(
|
||||||
{ env: this.env },
|
{ env: this.env },
|
||||||
{
|
this.t,
|
||||||
tag: "FromDist",
|
d2.t
|
||||||
value: [{ tag: "ToFloat", value: { NAME: "Pdf", VAL: n } }, this.t],
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
cdf(n: number): outputType {
|
algebraicMultiply(d2: GenericDist): resultDist {
|
||||||
return runR(
|
return Constructors_UsingDists_algebraicMultiply(
|
||||||
{ env: this.env },
|
{ env: this.env },
|
||||||
{
|
this.t,
|
||||||
tag: "FromDist",
|
d2.t
|
||||||
value: [{ tag: "ToFloat", value: { NAME: "Pdf", VAL: n } }, this.t],
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
inv(n: number): outputType {
|
algebraicDivide(d2: GenericDist): resultDist {
|
||||||
return runR(
|
return Constructors_UsingDists_algebraicDivide(
|
||||||
{ env: this.env },
|
{ env: this.env },
|
||||||
{
|
this.t,
|
||||||
tag: "FromDist",
|
d2.t
|
||||||
value: [{ tag: "ToFloat", value: { NAME: "Pdf", VAL: n } }, this.t],
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
normalize(n: number): outputType {
|
algebraicSubtract(d2: GenericDist): resultDist {
|
||||||
return runR(
|
return Constructors_UsingDists_algebraicSubtract(
|
||||||
{ env: this.env },
|
{ env: this.env },
|
||||||
{
|
this.t,
|
||||||
tag: "FromDist",
|
d2.t
|
||||||
value: [{ tag: "ToDist", value: "Normalize" }, this.t],
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
toPointSet(): outputType {
|
algebraicLogarithm(d2: GenericDist): resultDist {
|
||||||
return runR(
|
return Constructors_UsingDists_algebraicLogarithm(
|
||||||
{ env: this.env },
|
{ env: this.env },
|
||||||
{
|
this.t,
|
||||||
tag: "FromDist",
|
d2.t
|
||||||
value: [{ tag: "ToDist", value: "ToPointSet" }, this.t],
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
inspect(): outputType {
|
algebraicExponentiate(d2: GenericDist): resultDist {
|
||||||
return runR(
|
return Constructors_UsingDists_algebraicExponentiate(
|
||||||
{ env: this.env },
|
{ env: this.env },
|
||||||
{ tag: "FromDist", value: [{ tag: "ToDist", value: "Inspect" }, this.t] }
|
this.t,
|
||||||
|
d2.t
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
toSampleSet(n: number): outputType {
|
pointwiseAdd(d2: GenericDist): resultDist {
|
||||||
return runR(
|
return Constructors_UsingDists_pointwiseAdd(
|
||||||
{ env: this.env },
|
{ env: this.env },
|
||||||
{
|
this.t,
|
||||||
tag: "FromDist",
|
d2.t
|
||||||
value: [
|
|
||||||
{ tag: "ToDist", value: { tag: "ToSampleSet", value: n } },
|
|
||||||
this.t,
|
|
||||||
],
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
truncate(
|
pointwiseMultiply(d2: GenericDist): resultDist {
|
||||||
left: null | undefined | number,
|
return Constructors_UsingDists_pointwiseMultiply(
|
||||||
right: null | undefined | number
|
|
||||||
): outputType {
|
|
||||||
return runR(
|
|
||||||
{ env: this.env },
|
{ env: this.env },
|
||||||
{
|
this.t,
|
||||||
tag: "FromDist",
|
d2.t
|
||||||
value: [
|
|
||||||
{ tag: "ToDist", value: { tag: "Truncate", value: [left, right] } },
|
|
||||||
this.t,
|
|
||||||
],
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
toString(): outputType {
|
pointwiseDivide(d2: GenericDist): resultDist {
|
||||||
return runR(
|
return Constructors_UsingDists_pointwiseDivide(
|
||||||
{ env: this.env },
|
{ env: this.env },
|
||||||
{
|
this.t,
|
||||||
tag: "FromDist",
|
d2.t
|
||||||
value: [{ tag: "ToString", value: "ToString" }, this.t],
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
toSparkline(n: number): outputType {
|
pointwiseSubtract(d2: GenericDist): resultDist {
|
||||||
return runR(
|
return Constructors_UsingDists_pointwiseSubtract(
|
||||||
{ env: this.env },
|
{ env: this.env },
|
||||||
{
|
this.t,
|
||||||
tag: "FromDist",
|
d2.t
|
||||||
value: [
|
|
||||||
{ tag: "ToString", value: { tag: "ToSparkline", value: n } },
|
|
||||||
this.t,
|
|
||||||
],
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
add(g2: genericDist): outputType {
|
pointwiseLogarithm(d2: GenericDist): resultDist {
|
||||||
return runR(
|
return Constructors_UsingDists_pointwiseLogarithm(
|
||||||
{ env: this.env },
|
{ env: this.env },
|
||||||
{
|
this.t,
|
||||||
tag: "FromDist",
|
d2.t
|
||||||
value: [
|
);
|
||||||
{
|
}
|
||||||
tag: "ToDistCombination",
|
|
||||||
value: [
|
pointwiseExponentiate(d2: GenericDist): resultDist {
|
||||||
{
|
return Constructors_UsingDists_pointwiseExponentiate(
|
||||||
tag: "ToDistCombination",
|
{ env: this.env },
|
||||||
value: ["Algebraic", "Add", { NAME: "Dist", VAL: g2 }],
|
this.t,
|
||||||
},
|
d2.t
|
||||||
],
|
|
||||||
},
|
|
||||||
this.t,
|
|
||||||
],
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,10 +190,7 @@ module Constructors = {
|
||||||
module UsingDists = {
|
module UsingDists = {
|
||||||
module C = GenericDist_Types.Constructors.UsingDists
|
module C = GenericDist_Types.Constructors.UsingDists
|
||||||
open OutputLocal
|
open OutputLocal
|
||||||
type dist = GenericDist_Types.genericDist
|
type floatResult= result<float, error>
|
||||||
type fResult = result<float, GenericDist_Types.error>
|
|
||||||
type dResult = result<dist, GenericDist_Types.error>
|
|
||||||
type sResult = result<string, GenericDist_Types.error>
|
|
||||||
|
|
||||||
let mean = (~env, dist) => run(~env, C.mean(dist))->toFloatR
|
let mean = (~env, dist) => run(~env, C.mean(dist))->toFloatR
|
||||||
let sample = (~env, dist) => run(~env, C.sample(dist))->toFloatR
|
let sample = (~env, dist) => run(~env, C.sample(dist))->toFloatR
|
||||||
|
|
|
@ -4,19 +4,21 @@ type env = {
|
||||||
xyPointLength: int,
|
xyPointLength: int,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open GenericDist_Types
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
type outputType =
|
type outputType =
|
||||||
| Dist(GenericDist_Types.genericDist)
|
| Dist(genericDist)
|
||||||
| Float(float)
|
| Float(float)
|
||||||
| String(string)
|
| String(string)
|
||||||
| GenDistError(GenericDist_Types.error)
|
| GenDistError(error)
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
let run: (~env: env, GenericDist_Types.Operation.genericFunctionCallInfo) => outputType
|
let run: (~env: env, GenericDist_Types.Operation.genericFunctionCallInfo) => outputType
|
||||||
let runFromDist: (
|
let runFromDist: (
|
||||||
~env: env,
|
~env: env,
|
||||||
~functionCallInfo: GenericDist_Types.Operation.fromDist,
|
~functionCallInfo: GenericDist_Types.Operation.fromDist,
|
||||||
GenericDist_Types.genericDist,
|
genericDist,
|
||||||
) => outputType
|
) => outputType
|
||||||
let runFromFloat: (
|
let runFromFloat: (
|
||||||
~env: env,
|
~env: env,
|
||||||
|
@ -26,45 +28,70 @@ let runFromFloat: (
|
||||||
|
|
||||||
module Output: {
|
module Output: {
|
||||||
type t = outputType
|
type t = outputType
|
||||||
let toDist: t => option<GenericDist_Types.genericDist>
|
let toDist: t => option<genericDist>
|
||||||
let toDistR: t => result<GenericDist_Types.genericDist, GenericDist_Types.error>
|
let toDistR: t => result<genericDist, error>
|
||||||
let toFloat: t => option<float>
|
let toFloat: t => option<float>
|
||||||
let toFloatR: t => result<float, GenericDist_Types.error>
|
let toFloatR: t => result<float, error>
|
||||||
let toString: t => option<string>
|
let toString: t => option<string>
|
||||||
let toStringR: t => result<string, GenericDist_Types.error>
|
let toStringR: t => result<string, error>
|
||||||
let toError: t => option<GenericDist_Types.error>
|
let toError: t => option<error>
|
||||||
let fmap: (~env: env, t, GenericDist_Types.Operation.singleParamaterFunction) => t
|
let fmap: (~env: env, t, GenericDist_Types.Operation.singleParamaterFunction) => t
|
||||||
}
|
}
|
||||||
|
|
||||||
module Constructors: {
|
module Constructors: {
|
||||||
module UsingDists: {
|
module UsingDists: {
|
||||||
type dist = GenericDist_Types.genericDist
|
@genType
|
||||||
type fResult = result<float, GenericDist_Types.error>
|
let mean: (~env: env, genericDist) => result<float, error>
|
||||||
type dResult = result<dist, GenericDist_Types.error>
|
@genType
|
||||||
type sResult = result<string, GenericDist_Types.error>
|
let sample: (~env: env, genericDist) => result<float, error>
|
||||||
let mean: (~env: env, dist) => fResult
|
@genType
|
||||||
let sample: (~env: env, dist) => fResult
|
let cdf: (~env: env, genericDist, float) => result<float, error>
|
||||||
let cdf: (~env: env, dist, float) => fResult
|
@genType
|
||||||
let inv: (~env: env, dist, float) => fResult
|
let inv: (~env: env, genericDist, float) => result<float, error>
|
||||||
let pdf: (~env: env, dist, float) => fResult
|
@genType
|
||||||
let normalize: (~env: env, dist) => dResult
|
let pdf: (~env: env, genericDist, float) => result<float, error>
|
||||||
let toPointSet: (~env: env, dist) => dResult
|
@genType
|
||||||
let toSampleSet: (~env: env, dist, int) => dResult
|
let normalize: (~env: env, genericDist) => result<genericDist, error>
|
||||||
let truncate: (~env: env, dist, option<float>, option<float>) => dResult
|
@genType
|
||||||
let inspect: (~env: env, dist) => dResult
|
let toPointSet: (~env: env, genericDist) => result<genericDist, error>
|
||||||
let toString: (~env: env, dist) => sResult
|
@genType
|
||||||
let toSparkline: (~env: env, dist, int) => sResult
|
let toSampleSet: (~env: env, genericDist, int) => result<genericDist, error>
|
||||||
let algebraicAdd: (~env: env, dist, dist) => dResult
|
@genType
|
||||||
let algebraicMultiply: (~env: env, dist, dist) => dResult
|
let truncate: (
|
||||||
let algebraicDivide: (~env: env, dist, dist) => dResult
|
~env: env,
|
||||||
let algebraicSubtract: (~env: env, dist, dist) => dResult
|
genericDist,
|
||||||
let algebraicLogarithm: (~env: env, dist, dist) => dResult
|
option<float>,
|
||||||
let algebraicExponentiate: (~env: env, dist, dist) => dResult
|
option<float>,
|
||||||
let pointwiseAdd: (~env: env, dist, dist) => dResult
|
) => result<genericDist, error>
|
||||||
let pointwiseMultiply: (~env: env, dist, dist) => dResult
|
@genType
|
||||||
let pointwiseDivide: (~env: env, dist, dist) => dResult
|
let inspect: (~env: env, genericDist) => result<genericDist, error>
|
||||||
let pointwiseSubtract: (~env: env, dist, dist) => dResult
|
@genType
|
||||||
let pointwiseLogarithm: (~env: env, dist, dist) => dResult
|
let toString: (~env: env, genericDist) => result<string, error>
|
||||||
let pointwiseExponentiate: (~env: env, dist, dist) => dResult
|
@genType
|
||||||
|
let toSparkline: (~env: env, genericDist, int) => result<string, error>
|
||||||
|
@genType
|
||||||
|
let algebraicAdd: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
||||||
|
@genType
|
||||||
|
let algebraicMultiply: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
||||||
|
@genType
|
||||||
|
let algebraicDivide: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
||||||
|
@genType
|
||||||
|
let algebraicSubtract: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
||||||
|
@genType
|
||||||
|
let algebraicLogarithm: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
||||||
|
@genType
|
||||||
|
let algebraicExponentiate: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
||||||
|
@genType
|
||||||
|
let pointwiseAdd: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
||||||
|
@genType
|
||||||
|
let pointwiseMultiply: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
||||||
|
@genType
|
||||||
|
let pointwiseDivide: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
||||||
|
@genType
|
||||||
|
let pointwiseSubtract: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
||||||
|
@genType
|
||||||
|
let pointwiseLogarithm: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
||||||
|
@genType
|
||||||
|
let pointwiseExponentiate: (~env: env, genericDist, genericDist) => result<genericDist, error>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ module Constructors = {
|
||||||
let inspect = (dist): t => FromDist(ToDist(Inspect), dist)
|
let inspect = (dist): t => FromDist(ToDist(Inspect), dist)
|
||||||
let toString = (dist): t => FromDist(ToString(ToString), dist)
|
let toString = (dist): t => FromDist(ToString(ToString), dist)
|
||||||
let toSparkline = (dist, n): t => FromDist(ToString(ToSparkline(n)), dist)
|
let toSparkline = (dist, n): t => FromDist(ToString(ToSparkline(n)), dist)
|
||||||
let algebraicAdd = (dist1, dist2:genericDist): t => FromDist(
|
let algebraicAdd = (dist1, dist2: genericDist): t => FromDist(
|
||||||
ToDistCombination(Algebraic, #Add, #Dist(dist2)),
|
ToDistCombination(Algebraic, #Add, #Dist(dist2)),
|
||||||
dist1,
|
dist1,
|
||||||
)
|
)
|
||||||
|
@ -164,3 +164,63 @@ module Constructors = {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module DistVariant = {
|
||||||
|
type t =
|
||||||
|
| Mean(genericDist)
|
||||||
|
| Sample(genericDist)
|
||||||
|
| Cdf(genericDist, float)
|
||||||
|
| Inv(genericDist, float)
|
||||||
|
| Pdf(genericDist, float)
|
||||||
|
| Normalize(genericDist)
|
||||||
|
| ToPointSet(genericDist)
|
||||||
|
| ToSampleSet(genericDist, int)
|
||||||
|
| Truncate(genericDist, option<float>, option<float>)
|
||||||
|
| Inspect(genericDist)
|
||||||
|
| ToString(genericDist)
|
||||||
|
| ToSparkline(genericDist, int)
|
||||||
|
| AlgebraicAdd(genericDist, genericDist)
|
||||||
|
| AlgebraicMultiply(genericDist, genericDist)
|
||||||
|
| AlgebraicDivide(genericDist, genericDist)
|
||||||
|
| AlgebraicSubtract(genericDist, genericDist)
|
||||||
|
| AlgebraicLogarithm(genericDist, genericDist)
|
||||||
|
| AlgebraicExponentiate(genericDist, genericDist)
|
||||||
|
| PointwiseAdd(genericDist, genericDist)
|
||||||
|
| PointwiseMultiply(genericDist, genericDist)
|
||||||
|
| PointwiseDivide(genericDist, genericDist)
|
||||||
|
| PointwiseSubtract(genericDist, genericDist)
|
||||||
|
| PointwiseLogarithm(genericDist, genericDist)
|
||||||
|
| PointwiseExponentiate(genericDist, genericDist)
|
||||||
|
|
||||||
|
let toGenericFunctionCallInfo = (t: t) =>
|
||||||
|
switch t {
|
||||||
|
| Mean(d) => Operation.FromDist(ToFloat(#Mean), d)
|
||||||
|
| Sample(d) => FromDist(ToFloat(#Mean), d)
|
||||||
|
| Cdf(d, f) => FromDist(ToFloat(#Cdf(f)), d)
|
||||||
|
| Inv(d, f) => FromDist(ToFloat(#Inv(f)), d)
|
||||||
|
| Pdf(d, f) => FromDist(ToFloat(#Pdf(f)), d)
|
||||||
|
| Normalize(d) => FromDist(ToDist(Normalize), d)
|
||||||
|
| ToPointSet(d) => FromDist(ToDist(ToPointSet), d)
|
||||||
|
| ToSampleSet(d, r) => FromDist(ToDist(ToSampleSet(r)), d)
|
||||||
|
| Truncate(d, left, right) => FromDist(ToDist(Truncate(left, right)), d)
|
||||||
|
| Inspect(d) => FromDist(ToDist(Inspect), d)
|
||||||
|
| ToString(d) => FromDist(ToString(ToString), d)
|
||||||
|
| ToSparkline(d, n) => FromDist(ToString(ToSparkline(n)), d)
|
||||||
|
| AlgebraicAdd(d1, d2) => FromDist(ToDistCombination(Algebraic, #Add, #Dist(d2)), d1)
|
||||||
|
| AlgebraicMultiply(d1, d2) => FromDist(ToDistCombination(Algebraic, #Multiply, #Dist(d2)), d1)
|
||||||
|
| AlgebraicDivide(d1, d2) => FromDist(ToDistCombination(Algebraic, #Divide, #Dist(d2)), d1)
|
||||||
|
| AlgebraicSubtract(d1, d2) => FromDist(ToDistCombination(Algebraic, #Subtract, #Dist(d2)), d1)
|
||||||
|
| AlgebraicLogarithm(d1, d2) =>
|
||||||
|
FromDist(ToDistCombination(Algebraic, #Logarithm, #Dist(d2)), d1)
|
||||||
|
| AlgebraicExponentiate(d1, d2) =>
|
||||||
|
FromDist(ToDistCombination(Algebraic, #Exponentiate, #Dist(d2)), d1)
|
||||||
|
| PointwiseAdd(d1, d2) => FromDist(ToDistCombination(Pointwise, #Add, #Dist(d2)), d1)
|
||||||
|
| PointwiseMultiply(d1, d2) => FromDist(ToDistCombination(Pointwise, #Multiply, #Dist(d2)), d1)
|
||||||
|
| PointwiseDivide(d1, d2) => FromDist(ToDistCombination(Pointwise, #Divide, #Dist(d2)), d1)
|
||||||
|
| PointwiseSubtract(d1, d2) => FromDist(ToDistCombination(Pointwise, #Subtract, #Dist(d2)), d1)
|
||||||
|
| PointwiseLogarithm(d1, d2) =>
|
||||||
|
FromDist(ToDistCombination(Pointwise, #Logarithm, #Dist(d2)), d1)
|
||||||
|
| PointwiseExponentiate(d1, d2) =>
|
||||||
|
FromDist(ToDistCombination(Pointwise, #Exponentiate, #Dist(d2)), d1)
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,3 +12,10 @@ type error = GenericDist_Types.error;
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
let runDistributionOperation = DistributionOperation.run;
|
let runDistributionOperation = DistributionOperation.run;
|
||||||
|
|
||||||
|
@genType
|
||||||
|
type resultDist = result<genericDist, error>
|
||||||
|
@genType
|
||||||
|
type resultFloat = result<float, error>
|
||||||
|
@genType
|
||||||
|
type resultString = result<string, error>
|
Loading…
Reference in New Issue
Block a user