-
-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow for more O1 optimization #1382
- Loading branch information
1 parent
bd99fe0
commit 8d7eeb7
Showing
29 changed files
with
172 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
/* compute the cauchit link | ||
* Args: | ||
* p: a scalar in (0, 1) | ||
* p: a vector in (0, 1) | ||
* Returns: | ||
* a scalar in (-Inf, Inf) | ||
* a vector in (-Inf, Inf) | ||
*/ | ||
real cauchit(real p) { | ||
vector cauchit(vector p) { | ||
return tan(pi() * (p - 0.5)); | ||
} | ||
/* compute the inverse of the cauchit link | ||
* Args: | ||
* y: a scalar in (-Inf, Inf) | ||
* y: a vector in (-Inf, Inf) | ||
* Returns: | ||
* a scalar in (0, 1) | ||
* a vector in (0, 1) | ||
*/ | ||
real inv_cauchit(real y) { | ||
return cauchy_cdf(y, 0, 1); | ||
vector inv_cauchit(vector y) { | ||
return atan(y) / pi() + 0.5; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
/* compute the cloglog link | ||
* Args: | ||
* p: a scalar in (0, 1) | ||
* p: a vector in (0, 1) | ||
* Returns: | ||
* a scalar in (-Inf, Inf) | ||
* a vector in (-Inf, Inf) | ||
*/ | ||
real cloglog(real p) { | ||
vector cloglog(vector p) { | ||
return log(-log1m(p)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
/* compute the logm1 link | ||
* Args: | ||
* p: a positive scalar | ||
* p: a positive vector | ||
* Returns: | ||
* a scalar in (-Inf, Inf) | ||
* a vector in (-Inf, Inf) | ||
*/ | ||
real logm1(real y) { | ||
return log(y - 1); | ||
vector logm1(vector y) { | ||
return log(y - 1.0); | ||
} | ||
/* compute the inverse of the logm1 link | ||
* Args: | ||
* y: a scalar in (-Inf, Inf) | ||
* y: a vector in (-Inf, Inf) | ||
* Returns: | ||
* a positive scalar | ||
* a positive vector | ||
*/ | ||
real expp1(real y) { | ||
return exp(y) + 1; | ||
vector expp1(vector y) { | ||
return exp(y) + 1.0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
/* compute the softit link | ||
* Args: | ||
* p: a scalar in (0, 1) | ||
* p: a vector in (0, 1) | ||
* Returns: | ||
* a scalar in (-Inf, Inf) | ||
* a vector in (-Inf, Inf) | ||
*/ | ||
real softit(real p) { | ||
vector softit(vector p) { | ||
return log(expm1(-p / (p - 1))); | ||
} | ||
/* compute the inverse of the sofit link | ||
* Args: | ||
* y: a scalar in (-Inf, Inf) | ||
* y: a vector in (-Inf, Inf) | ||
* Returns: | ||
* a scalar in (0, 1) | ||
* a vector in (0, 1) | ||
*/ | ||
real inv_softit(real y) { | ||
vector inv_softit(vector y) { | ||
return log1p_exp(y) / (1 + log1p_exp(y)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
/* softplus link function inverse to 'log1p_exp' | ||
* Args: | ||
* x: a positive scalar | ||
* x: a positive vector | ||
* Returns: | ||
* a scalar in (-Inf, Inf) | ||
* a vector in (-Inf, Inf) | ||
*/ | ||
real log_expm1(real x) { | ||
vector log_expm1(vector x) { | ||
return log(expm1(x)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
/* squareplus inverse link function (squareplus itself) | ||
* Args: | ||
* x: a scalar in (-Inf, Inf) | ||
* x: a vector in (-Inf, Inf) | ||
* Returns: | ||
* a positive scalar | ||
* a positive vector | ||
*/ | ||
real squareplus(real x) { | ||
return (x + sqrt(x^2 + 4)) / 2; | ||
vector squareplus(vector x) { | ||
return (x + sqrt(square(x) + 4)) / 2; | ||
} | ||
/* squareplus link function (inverse squareplus) | ||
* Args: | ||
* x: a positive scalar | ||
* x: a positive vector | ||
* Returns: | ||
* a scalar in (-Inf, Inf) | ||
* a vector in (-Inf, Inf) | ||
*/ | ||
real inv_squareplus(real x) { | ||
return (x^2 - 1) / x; | ||
vector inv_squareplus(vector x) { | ||
return (square(x) - 1) ./ x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
/* compute the tan_half link | ||
* Args: | ||
* x: a scalar in (-pi, pi) | ||
* x: a vector in (-pi, pi) | ||
* Returns: | ||
* a scalar in (-Inf, Inf) | ||
* a vector in (-Inf, Inf) | ||
*/ | ||
real tan_half(real x) { | ||
vector tan_half(vector x) { | ||
return tan(x / 2); | ||
} | ||
/* compute the inverse of the tan_half link | ||
* Args: | ||
* y: a scalar in (-Inf, Inf) | ||
* y: a vector in (-Inf, Inf) | ||
* Returns: | ||
* a scalar in (-pi, pi) | ||
* a vector in (-pi, pi) | ||
*/ | ||
real inv_tan_half(real y) { | ||
vector inv_tan_half(vector y) { | ||
return 2 * atan(y); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.