Namechange: Exponential -> Power

This commit is contained in:
Ozzie Gooen 2022-04-09 12:37:26 -04:00
parent 344c989cb5
commit 9430653b7a
12 changed files with 40 additions and 40 deletions

View File

@ -32,13 +32,13 @@ import {
Constructors_algebraicDivide,
Constructors_algebraicSubtract,
Constructors_algebraicLogarithm,
Constructors_algebraicExponentiate,
Constructors_algebraicPower,
Constructors_pointwiseAdd,
Constructors_pointwiseMultiply,
Constructors_pointwiseDivide,
Constructors_pointwiseSubtract,
Constructors_pointwiseLogarithm,
Constructors_pointwiseExponentiate,
Constructors_pointwisePower,
} from "../rescript/Distributions/DistributionOperation/DistributionOperation.gen";
export let defaultSamplingInputs: SamplingInputs = {
@ -179,9 +179,9 @@ export class GenericDist {
);
}
algebraicExponentiate(d2: GenericDist) {
algebraicPower(d2: GenericDist) {
return this.mapResultDist(
Constructors_algebraicExponentiate({ env: this.env }, this.t, d2.t)
Constructors_algebraicPower({ env: this.env }, this.t, d2.t)
);
}
@ -215,9 +215,9 @@ export class GenericDist {
);
}
pointwiseExponentiate(d2: GenericDist) {
pointwisePower(d2: GenericDist) {
return this.mapResultDist(
Constructors_pointwiseExponentiate({ env: this.env }, this.t, d2.t)
Constructors_pointwisePower({ env: this.env }, this.t, d2.t)
);
}
}

View File

@ -213,8 +213,8 @@ module Constructors = {
C.algebraicSubtract(dist1, dist2)->run(~env)->toDistR
let algebraicLogarithm = (~env, dist1, dist2) =>
C.algebraicLogarithm(dist1, dist2)->run(~env)->toDistR
let algebraicExponentiate = (~env, dist1, dist2) =>
C.algebraicExponentiate(dist1, dist2)->run(~env)->toDistR
let algebraicPower = (~env, dist1, dist2) =>
C.algebraicPower(dist1, dist2)->run(~env)->toDistR
let pointwiseAdd = (~env, dist1, dist2) => C.pointwiseAdd(dist1, dist2)->run(~env)->toDistR
let pointwiseMultiply = (~env, dist1, dist2) =>
C.pointwiseMultiply(dist1, dist2)->run(~env)->toDistR
@ -223,6 +223,6 @@ module Constructors = {
C.pointwiseSubtract(dist1, dist2)->run(~env)->toDistR
let pointwiseLogarithm = (~env, dist1, dist2) =>
C.pointwiseLogarithm(dist1, dist2)->run(~env)->toDistR
let pointwiseExponentiate = (~env, dist1, dist2) =>
C.pointwiseExponentiate(dist1, dist2)->run(~env)->toDistR
let pointwisePower = (~env, dist1, dist2) =>
C.pointwisePower(dist1, dist2)->run(~env)->toDistR
}

View File

@ -79,7 +79,7 @@ module Constructors: {
@genType
let algebraicLogarithm: (~env: env, genericDist, genericDist) => result<genericDist, error>
@genType
let algebraicExponentiate: (~env: env, genericDist, genericDist) => result<genericDist, error>
let algebraicPower: (~env: env, genericDist, genericDist) => result<genericDist, error>
@genType
let pointwiseAdd: (~env: env, genericDist, genericDist) => result<genericDist, error>
@genType
@ -91,5 +91,5 @@ module Constructors: {
@genType
let pointwiseLogarithm: (~env: env, genericDist, genericDist) => result<genericDist, error>
@genType
let pointwiseExponentiate: (~env: env, genericDist, genericDist) => result<genericDist, error>
let pointwisePower: (~env: env, genericDist, genericDist) => result<genericDist, error>
}

View File

@ -19,7 +19,7 @@ module Operation = {
| #Multiply
| #Subtract
| #Divide
| #Exponentiate
| #Power
| #Logarithm
]
@ -28,7 +28,7 @@ module Operation = {
| #Add => \"+."
| #Multiply => \"*."
| #Subtract => \"-."
| #Exponentiate => \"**"
| #Power => \"**"
| #Divide => \"/."
| #Logarithm => (a, b) => log(a) /. log(b)
}

View File

@ -247,7 +247,7 @@ let pointwiseCombinationFloat = (
): result<t, error> => {
let m = switch arithmeticOperation {
| #Add | #Subtract => Error(GenericDist_Types.DistributionVerticalShiftIsInvalid)
| (#Multiply | #Divide | #Exponentiate | #Logarithm) as arithmeticOperation =>
| (#Multiply | #Divide | #Power | #Logarithm) as arithmeticOperation =>
toPointSetFn(t)->E.R2.fmap(t => {
//TODO: Move to PointSet codebase
let fn = (secondary, main) => Operation.Scale.toFn(arithmeticOperation, main, secondary)

View File

@ -20,7 +20,7 @@ module Operation = {
| #Multiply
| #Subtract
| #Divide
| #Exponentiate
| #Power
| #Logarithm
]
@ -29,7 +29,7 @@ module Operation = {
| #Add => \"+."
| #Multiply => \"*."
| #Subtract => \"-."
| #Exponentiate => \"**"
| #Power => \"**"
| #Divide => \"/."
| #Logarithm => (a, b) => log(a) /. log(b)
}
@ -143,8 +143,8 @@ module Constructors = {
ToDistCombination(Algebraic, #Logarithm, #Dist(dist2)),
dist1,
)
let algebraicExponentiate = (dist1, dist2): t => FromDist(
ToDistCombination(Algebraic, #Exponentiate, #Dist(dist2)),
let algebraicPower = (dist1, dist2): t => FromDist(
ToDistCombination(Algebraic, #Power, #Dist(dist2)),
dist1,
)
let pointwiseAdd = (dist1, dist2): t => FromDist(
@ -167,8 +167,8 @@ module Constructors = {
ToDistCombination(Pointwise, #Logarithm, #Dist(dist2)),
dist1,
)
let pointwiseExponentiate = (dist1, dist2): t => FromDist(
ToDistCombination(Pointwise, #Exponentiate, #Dist(dist2)),
let pointwisePower = (dist1, dist2): t => FromDist(
ToDistCombination(Pointwise, #Power, #Dist(dist2)),
dist1,
)
}

View File

@ -114,7 +114,7 @@ let combineShapesContinuousContinuous = (
| #Subtract => (m1, m2) => m1 -. m2
| #Multiply => (m1, m2) => m1 *. m2
| #Divide => (m1, mInv2) => m1 *. mInv2
| #Exponentiate => (m1, mInv2) => m1 ** mInv2
| #Power => (m1, mInv2) => m1 ** mInv2
| #Logarithm => (m1, m2) => log(m1) /. log(m2)
} // note: here, mInv2 = mean(1 / t2) ~= 1 / mean(t2)
@ -124,7 +124,7 @@ let combineShapesContinuousContinuous = (
| #Add => (v1, v2, _, _) => v1 +. v2
| #Subtract => (v1, v2, _, _) => v1 +. v2
| #Multiply => (v1, v2, m1, m2) => v1 *. v2 +. v1 *. m2 ** 2. +. v2 *. m1 ** 2.
| #Exponentiate => (v1, v2, m1, m2) => v1 *. v2 +. v1 *. m2 ** 2. +. v2 *. m1 ** 2.
| #Power => (v1, v2, m1, m2) => v1 *. v2 +. v1 *. m2 ** 2. +. v2 *. m1 ** 2.
| #Logarithm => (v1, v2, m1, m2) => v1 *. v2 +. v1 *. m2 ** 2. +. v2 *. m1 ** 2.
| #Divide => (v1, vInv2, m1, mInv2) => v1 *. vInv2 +. v1 *. mInv2 ** 2. +. vInv2 *. m1 ** 2.
}
@ -233,7 +233,7 @@ let combineShapesContinuousDiscrete = (
()
}
| #Multiply
| #Exponentiate
| #Power
| #Logarithm
| #Divide =>
for j in 0 to t2n - 1 {

View File

@ -118,7 +118,7 @@ module PointwiseCombination = {
switch pointwiseOp {
| #Add => pointwiseAdd(evaluationParams, t1, t2)
| #Multiply => pointwiseCombine(\"*.", evaluationParams, t1, t2)
| #Exponentiate => pointwiseCombine(\"**", evaluationParams, t1, t2)
| #Power => pointwiseCombine(\"**", evaluationParams, t1, t2)
}
}

View File

@ -227,7 +227,7 @@ let all = [
},
(),
),
makeRenderedDistFloat("scaleExp", (dist, float) => verticalScaling(#Exponentiate, dist, float)),
makeRenderedDistFloat("scaleExp", (dist, float) => verticalScaling(#Power, dist, float)),
makeRenderedDistFloat("scaleMultiply", (dist, float) => verticalScaling(#Multiply, dist, float)),
makeRenderedDistFloat("scaleLog", (dist, float) => verticalScaling(#Logarithm, dist, float)),
Multimodal._function,

View File

@ -144,11 +144,11 @@ module MathAdtToDistDst = {
| ("subtract", _) => Error("Subtraction needs two operands")
| ("multiply", [l, r]) => toOkAlgebraic((#Multiply, l, r))
| ("multiply", _) => Error("Multiplication needs two operands")
| ("pow", [l, r]) => toOkAlgebraic((#Exponentiate, l, r))
| ("pow", [l, r]) => toOkAlgebraic((#Power, l, r))
| ("pow", _) => Error("Exponentiation needs two operands")
| ("dotMultiply", [l, r]) => toOkPointwise((#Multiply, l, r))
| ("dotMultiply", _) => Error("Dotwise multiplication needs two operands")
| ("dotPow", [l, r]) => toOkPointwise((#Exponentiate, l, r))
| ("dotPow", [l, r]) => toOkPointwise((#Power, l, r))
| ("dotPow", _) => Error("Dotwise exponentiation needs two operands")
| ("rightLogShift", [l, r]) => toOkPointwise((#Add, l, r))
| ("rightLogShift", _) => Error("Dotwise addition needs two operands")

View File

@ -18,8 +18,8 @@ module Helpers = {
| "divide" => #Divide
| "log" => #Logarithm
| "dotDivide" => #Divide
| "pow" => #Exponentiate
| "dotPow" => #Exponentiate
| "pow" => #Power
| "dotPow" => #Power
| "multiply" => #Multiply
| "dotMultiply" => #Multiply
| "dotLog" => #Logarithm

View File

@ -6,12 +6,12 @@ type algebraicOperation = [
| #Multiply
| #Subtract
| #Divide
| #Exponentiate
| #Power
| #Logarithm
]
@genType
type pointwiseOperation = [#Add | #Multiply | #Exponentiate]
type scaleOperation = [#Multiply | #Exponentiate | #Logarithm | #Divide]
type pointwiseOperation = [#Add | #Multiply | #Power]
type scaleOperation = [#Multiply | #Power | #Logarithm | #Divide]
type distToFloatOperation = [
| #Pdf(float)
| #Cdf(float)
@ -27,7 +27,7 @@ module Algebraic = {
| #Add => \"+."
| #Subtract => \"-."
| #Multiply => \"*."
| #Exponentiate => \"**"
| #Power => \"**"
| #Divide => \"/."
| #Logarithm => (a, b) => log(a) /. log(b)
}
@ -43,7 +43,7 @@ module Algebraic = {
| #Add => "+"
| #Subtract => "-"
| #Multiply => "*"
| #Exponentiate => "**"
| #Power => "**"
| #Divide => "/"
| #Logarithm => "log"
}
@ -56,7 +56,7 @@ module Pointwise = {
let toString = x =>
switch x {
| #Add => "+"
| #Exponentiate => "^"
| #Power => "^"
| #Multiply => "*"
}
@ -83,7 +83,7 @@ module Scale = {
switch x {
| #Multiply => \"*."
| #Divide => \"/."
| #Exponentiate => \"**"
| #Power => \"**"
| #Logarithm => (a, b) => log(a) /. log(b)
}
@ -91,7 +91,7 @@ module Scale = {
switch operation {
| #Multiply => j`verticalMultiply($value, $scaleBy) `
| #Divide => j`verticalDivide($value, $scaleBy) `
| #Exponentiate => j`verticalExponentiate($value, $scaleBy) `
| #Power => j`verticalPower($value, $scaleBy) `
| #Logarithm => j`verticalLog($value, $scaleBy) `
}
@ -99,7 +99,7 @@ module Scale = {
switch x {
| #Multiply => (a, b) => Some(a *. b)
| #Divide => (a, b) => Some(a /. b)
| #Exponentiate => (_, _) => None
| #Power => (_, _) => None
| #Logarithm => (_, _) => None
}
@ -107,7 +107,7 @@ module Scale = {
switch x {
| #Multiply => (_, _) => None // TODO: this could probably just be multiplied out (using Continuous.scaleBy)
| #Divide => (_, _) => None
| #Exponentiate => (_, _) => None
| #Power => (_, _) => None
| #Logarithm => (_, _) => None
}
}