Skip to content

Commit 1c0654c

Browse files
committed
Add inv_erfc signatures
1 parent 727c762 commit 1c0654c

File tree

6 files changed

+348
-0
lines changed

6 files changed

+348
-0
lines changed

src/middle/Stan_math_signatures.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ let math_sigs =
297297
; ([UnaryVectorized], "floor", [DDeepVectorized], AoS)
298298
; ([UnaryVectorized], "inv", [DDeepVectorized], AoS)
299299
; ([UnaryVectorized], "inv_cloglog", [DDeepVectorized], AoS)
300+
; ([UnaryVectorized], "inv_erfc", [DDeepVectorized], AoS)
300301
; ([UnaryVectorized], "inv_logit", [DDeepVectorized], AoS)
301302
; ([UnaryVectorized], "inv_Phi", [DDeepVectorized], AoS)
302303
; ([UnaryVectorized], "inv_sqrt", [DDeepVectorized], AoS)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
data {
2+
int d_int;
3+
real d_real;
4+
}
5+
transformed data {
6+
int transformed_data_int;
7+
real transformed_data_real;
8+
9+
transformed_data_real = inv_erfc(d_int);
10+
transformed_data_real = inv_erfc(d_real);
11+
}
12+
parameters {
13+
real p_real;
14+
real y_p;
15+
}
16+
transformed parameters {
17+
real transformed_param_real;
18+
19+
transformed_param_real = inv_erfc(d_int);
20+
transformed_param_real = inv_erfc(d_real);
21+
transformed_param_real = inv_erfc(p_real);
22+
}
23+
model {
24+
y_p ~ normal(0,1);
25+
}

test/integration/good/function-signatures/math/functions/pretty.expected

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,33 @@ transformed parameters {
12921292
transformed_param_real = inv_cloglog(d_real);
12931293
transformed_param_real = inv_cloglog(p_real);
12941294
}
1295+
model {
1296+
y_p ~ normal(0, 1);
1297+
}
1298+
1299+
$ ../../../../../../../install/default/bin/stanc --auto-format inv_erfc.stan
1300+
data {
1301+
int d_int;
1302+
real d_real;
1303+
}
1304+
transformed data {
1305+
int transformed_data_int;
1306+
real transformed_data_real;
1307+
1308+
transformed_data_real = inv_erfc(d_int);
1309+
transformed_data_real = inv_erfc(d_real);
1310+
}
1311+
parameters {
1312+
real p_real;
1313+
real y_p;
1314+
}
1315+
transformed parameters {
1316+
real transformed_param_real;
1317+
1318+
transformed_param_real = inv_erfc(d_int);
1319+
transformed_param_real = inv_erfc(d_real);
1320+
transformed_param_real = inv_erfc(p_real);
1321+
}
12951322
model {
12961323
y_p ~ normal(0, 1);
12971324
}
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
data {
2+
int d_int;
3+
array[d_int] int d_int_array;
4+
array[d_int] real d_real_array;
5+
matrix[d_int, d_int] d_matrix;
6+
vector[d_int] d_vector;
7+
row_vector[d_int] d_row_vector;
8+
9+
array[3] vector[2] x3y;
10+
array[3] row_vector[2] x4y;
11+
array[3] matrix[2, 3] x5y;
12+
13+
array[3, 4] int x1z;
14+
array[3, 4] real x2z;
15+
array[3, 4] vector[2] x3z;
16+
array[3, 4] row_vector[2] x4z;
17+
array[3, 4] matrix[2, 3] x5z;
18+
19+
array[3, 4, 5] int x1w;
20+
array[3, 4, 5] real x2w;
21+
array[3, 4, 5] vector[2] x3w;
22+
array[3, 4, 5] row_vector[2] x4w;
23+
array[3, 4, 5] matrix[2, 3] x5w;
24+
}
25+
transformed data {
26+
matrix[d_int, d_int] transformed_data_matrix;
27+
vector[d_int] transformed_data_vector;
28+
row_vector[d_int] transformed_data_row_vector;
29+
30+
array[3] vector[2] trans_x3y;
31+
array[3] row_vector[2] trans_x4y;
32+
array[3] matrix[2, 3] trans_x5y;
33+
34+
array[3, 4] real trans_x2z;
35+
array[3, 4] vector[2] trans_x3z;
36+
array[3, 4] row_vector[2] trans_x4z;
37+
array[3, 4] matrix[2, 3] trans_x5z;
38+
39+
array[3, 4, 5] real trans_x2w;
40+
array[3, 4, 5] vector[2] trans_x3w;
41+
array[3, 4, 5] row_vector[2] trans_x4w;
42+
array[3, 4, 5] matrix[2, 3] trans_x5w;
43+
44+
transformed_data_matrix = inv_erfc(d_matrix);
45+
transformed_data_vector = inv_erfc(d_vector);
46+
transformed_data_row_vector = inv_erfc(d_row_vector);
47+
trans_x3y = inv_erfc(x3y);
48+
trans_x4y = inv_erfc(x4y);
49+
trans_x5y = inv_erfc(x5y);
50+
51+
trans_x2z = inv_erfc(x1z);
52+
trans_x2z = inv_erfc(x2z);
53+
trans_x3z = inv_erfc(x3z);
54+
trans_x4z = inv_erfc(x4z);
55+
trans_x5z = inv_erfc(x5z);
56+
57+
trans_x2w = inv_erfc(x1w);
58+
trans_x2w = inv_erfc(x2w);
59+
trans_x3w = inv_erfc(x3w);
60+
trans_x4w = inv_erfc(x4w);
61+
trans_x5w = inv_erfc(x5w);
62+
}
63+
parameters {
64+
real p_real;
65+
real y_p;
66+
array[d_int] real p_real_array;
67+
matrix[d_int, d_int] p_matrix;
68+
vector[d_int] p_vector;
69+
row_vector[d_int] p_row_vector;
70+
71+
array[3] vector[2] p_x3y;
72+
array[3] row_vector[2] p_x4y;
73+
array[3] matrix[2, 3] p_x5y;
74+
75+
array[3, 4] real p_x2z;
76+
array[3, 4] vector[2] p_x3z;
77+
array[3, 4] row_vector[2] p_x4z;
78+
array[3, 4] matrix[2, 3] p_x5z;
79+
80+
array[3, 4, 5] real p_x2w;
81+
array[3, 4, 5] vector[2] p_x3w;
82+
array[3, 4, 5] row_vector[2] p_x4w;
83+
array[3, 4, 5] matrix[2, 3] p_x5w;
84+
}
85+
transformed parameters {
86+
matrix[d_int, d_int] transformed_param_matrix;
87+
vector[d_int] transformed_param_vector;
88+
row_vector[d_int] transformed_param_row_vector;
89+
array[3] vector[2] trans_p_x3y;
90+
array[3] row_vector[2] trans_p_x4y;
91+
array[3] matrix[2, 3] trans_p_x5y;
92+
93+
array[3, 4] real trans_p_x2z;
94+
array[3, 4] vector[2] trans_p_x3z;
95+
array[3, 4] row_vector[2] trans_p_x4z;
96+
array[3, 4] matrix[2, 3] trans_p_x5z;
97+
98+
array[3, 4, 5] real trans_p_x2w;
99+
array[3, 4, 5] vector[2] trans_p_x3w;
100+
array[3, 4, 5] row_vector[2] trans_p_x4w;
101+
array[3, 4, 5] matrix[2, 3] trans_p_x5w;
102+
103+
transformed_param_matrix = inv_erfc(d_matrix);
104+
transformed_param_vector = inv_erfc(d_vector);
105+
transformed_param_row_vector = inv_erfc(d_row_vector);
106+
transformed_param_matrix = inv_erfc(p_matrix);
107+
transformed_param_vector = inv_erfc(p_vector);
108+
transformed_param_row_vector = inv_erfc(p_row_vector);
109+
110+
trans_p_x3y = inv_erfc(p_x3y);
111+
trans_p_x4y = inv_erfc(p_x4y);
112+
trans_p_x5y = inv_erfc(p_x5y);
113+
114+
trans_p_x2z = inv_erfc(p_x2z);
115+
trans_p_x3z = inv_erfc(p_x3z);
116+
trans_p_x4z = inv_erfc(p_x4z);
117+
trans_p_x5z = inv_erfc(p_x5z);
118+
119+
trans_p_x2w = inv_erfc(p_x2w);
120+
trans_p_x3w = inv_erfc(p_x3w);
121+
trans_p_x4w = inv_erfc(p_x4w);
122+
trans_p_x5w = inv_erfc(p_x5w);
123+
}
124+
model {
125+
y_p ~ normal(0, 1);
126+
}
127+

test/integration/good/function-signatures/math/matrix/pretty.expected

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9250,6 +9250,134 @@ transformed parameters {
92509250
trans_p_x4w = inv_cloglog(p_x4w);
92519251
trans_p_x5w = inv_cloglog(p_x5w);
92529252
}
9253+
model {
9254+
y_p ~ normal(0, 1);
9255+
}
9256+
9257+
$ ../../../../../../../install/default/bin/stanc --auto-format inv_erfc.stan
9258+
data {
9259+
int d_int;
9260+
array[d_int] int d_int_array;
9261+
array[d_int] real d_real_array;
9262+
matrix[d_int, d_int] d_matrix;
9263+
vector[d_int] d_vector;
9264+
row_vector[d_int] d_row_vector;
9265+
9266+
array[3] vector[2] x3y;
9267+
array[3] row_vector[2] x4y;
9268+
array[3] matrix[2, 3] x5y;
9269+
9270+
array[3, 4] int x1z;
9271+
array[3, 4] real x2z;
9272+
array[3, 4] vector[2] x3z;
9273+
array[3, 4] row_vector[2] x4z;
9274+
array[3, 4] matrix[2, 3] x5z;
9275+
9276+
array[3, 4, 5] int x1w;
9277+
array[3, 4, 5] real x2w;
9278+
array[3, 4, 5] vector[2] x3w;
9279+
array[3, 4, 5] row_vector[2] x4w;
9280+
array[3, 4, 5] matrix[2, 3] x5w;
9281+
}
9282+
transformed data {
9283+
matrix[d_int, d_int] transformed_data_matrix;
9284+
vector[d_int] transformed_data_vector;
9285+
row_vector[d_int] transformed_data_row_vector;
9286+
9287+
array[3] vector[2] trans_x3y;
9288+
array[3] row_vector[2] trans_x4y;
9289+
array[3] matrix[2, 3] trans_x5y;
9290+
9291+
array[3, 4] real trans_x2z;
9292+
array[3, 4] vector[2] trans_x3z;
9293+
array[3, 4] row_vector[2] trans_x4z;
9294+
array[3, 4] matrix[2, 3] trans_x5z;
9295+
9296+
array[3, 4, 5] real trans_x2w;
9297+
array[3, 4, 5] vector[2] trans_x3w;
9298+
array[3, 4, 5] row_vector[2] trans_x4w;
9299+
array[3, 4, 5] matrix[2, 3] trans_x5w;
9300+
9301+
transformed_data_matrix = inv_erfc(d_matrix);
9302+
transformed_data_vector = inv_erfc(d_vector);
9303+
transformed_data_row_vector = inv_erfc(d_row_vector);
9304+
trans_x3y = inv_erfc(x3y);
9305+
trans_x4y = inv_erfc(x4y);
9306+
trans_x5y = inv_erfc(x5y);
9307+
9308+
trans_x2z = inv_erfc(x1z);
9309+
trans_x2z = inv_erfc(x2z);
9310+
trans_x3z = inv_erfc(x3z);
9311+
trans_x4z = inv_erfc(x4z);
9312+
trans_x5z = inv_erfc(x5z);
9313+
9314+
trans_x2w = inv_erfc(x1w);
9315+
trans_x2w = inv_erfc(x2w);
9316+
trans_x3w = inv_erfc(x3w);
9317+
trans_x4w = inv_erfc(x4w);
9318+
trans_x5w = inv_erfc(x5w);
9319+
}
9320+
parameters {
9321+
real p_real;
9322+
real y_p;
9323+
array[d_int] real p_real_array;
9324+
matrix[d_int, d_int] p_matrix;
9325+
vector[d_int] p_vector;
9326+
row_vector[d_int] p_row_vector;
9327+
9328+
array[3] vector[2] p_x3y;
9329+
array[3] row_vector[2] p_x4y;
9330+
array[3] matrix[2, 3] p_x5y;
9331+
9332+
array[3, 4] real p_x2z;
9333+
array[3, 4] vector[2] p_x3z;
9334+
array[3, 4] row_vector[2] p_x4z;
9335+
array[3, 4] matrix[2, 3] p_x5z;
9336+
9337+
array[3, 4, 5] real p_x2w;
9338+
array[3, 4, 5] vector[2] p_x3w;
9339+
array[3, 4, 5] row_vector[2] p_x4w;
9340+
array[3, 4, 5] matrix[2, 3] p_x5w;
9341+
}
9342+
transformed parameters {
9343+
matrix[d_int, d_int] transformed_param_matrix;
9344+
vector[d_int] transformed_param_vector;
9345+
row_vector[d_int] transformed_param_row_vector;
9346+
array[3] vector[2] trans_p_x3y;
9347+
array[3] row_vector[2] trans_p_x4y;
9348+
array[3] matrix[2, 3] trans_p_x5y;
9349+
9350+
array[3, 4] real trans_p_x2z;
9351+
array[3, 4] vector[2] trans_p_x3z;
9352+
array[3, 4] row_vector[2] trans_p_x4z;
9353+
array[3, 4] matrix[2, 3] trans_p_x5z;
9354+
9355+
array[3, 4, 5] real trans_p_x2w;
9356+
array[3, 4, 5] vector[2] trans_p_x3w;
9357+
array[3, 4, 5] row_vector[2] trans_p_x4w;
9358+
array[3, 4, 5] matrix[2, 3] trans_p_x5w;
9359+
9360+
transformed_param_matrix = inv_erfc(d_matrix);
9361+
transformed_param_vector = inv_erfc(d_vector);
9362+
transformed_param_row_vector = inv_erfc(d_row_vector);
9363+
transformed_param_matrix = inv_erfc(p_matrix);
9364+
transformed_param_vector = inv_erfc(p_vector);
9365+
transformed_param_row_vector = inv_erfc(p_row_vector);
9366+
9367+
trans_p_x3y = inv_erfc(p_x3y);
9368+
trans_p_x4y = inv_erfc(p_x4y);
9369+
trans_p_x5y = inv_erfc(p_x5y);
9370+
9371+
trans_p_x2z = inv_erfc(p_x2z);
9372+
trans_p_x3z = inv_erfc(p_x3z);
9373+
trans_p_x4z = inv_erfc(p_x4z);
9374+
trans_p_x5z = inv_erfc(p_x5z);
9375+
9376+
trans_p_x2w = inv_erfc(p_x2w);
9377+
trans_p_x3w = inv_erfc(p_x3w);
9378+
trans_p_x4w = inv_erfc(p_x4w);
9379+
trans_p_x5w = inv_erfc(p_x5w);
9380+
}
92539381
model {
92549382
y_p ~ normal(0, 1);
92559383
}

test/integration/signatures/stan_math_signatures.t

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9956,6 +9956,46 @@ Display all Stan math signatures exposed in the language
99569956
inv_cloglog(array[,,,,,,] vector) => array[,,,,,,] vector
99579957
inv_cloglog(array[,,,,,,] row_vector) => array[,,,,,,] row_vector
99589958
inv_cloglog(array[,,,,,,] matrix) => array[,,,,,,] matrix
9959+
inv_erfc(int) => real
9960+
inv_erfc(real) => real
9961+
inv_erfc(vector) => vector
9962+
inv_erfc(row_vector) => row_vector
9963+
inv_erfc(matrix) => matrix
9964+
inv_erfc(array[] int) => array[] real
9965+
inv_erfc(array[] real) => array[] real
9966+
inv_erfc(array[] vector) => array[] vector
9967+
inv_erfc(array[] row_vector) => array[] row_vector
9968+
inv_erfc(array[] matrix) => array[] matrix
9969+
inv_erfc(array[,] int) => array[,] real
9970+
inv_erfc(array[,] real) => array[,] real
9971+
inv_erfc(array[,] vector) => array[,] vector
9972+
inv_erfc(array[,] row_vector) => array[,] row_vector
9973+
inv_erfc(array[,] matrix) => array[,] matrix
9974+
inv_erfc(array[,,] int) => array[,,] real
9975+
inv_erfc(array[,,] real) => array[,,] real
9976+
inv_erfc(array[,,] vector) => array[,,] vector
9977+
inv_erfc(array[,,] row_vector) => array[,,] row_vector
9978+
inv_erfc(array[,,] matrix) => array[,,] matrix
9979+
inv_erfc(array[,,,] int) => array[,,,] real
9980+
inv_erfc(array[,,,] real) => array[,,,] real
9981+
inv_erfc(array[,,,] vector) => array[,,,] vector
9982+
inv_erfc(array[,,,] row_vector) => array[,,,] row_vector
9983+
inv_erfc(array[,,,] matrix) => array[,,,] matrix
9984+
inv_erfc(array[,,,,] int) => array[,,,,] real
9985+
inv_erfc(array[,,,,] real) => array[,,,,] real
9986+
inv_erfc(array[,,,,] vector) => array[,,,,] vector
9987+
inv_erfc(array[,,,,] row_vector) => array[,,,,] row_vector
9988+
inv_erfc(array[,,,,] matrix) => array[,,,,] matrix
9989+
inv_erfc(array[,,,,,] int) => array[,,,,,] real
9990+
inv_erfc(array[,,,,,] real) => array[,,,,,] real
9991+
inv_erfc(array[,,,,,] vector) => array[,,,,,] vector
9992+
inv_erfc(array[,,,,,] row_vector) => array[,,,,,] row_vector
9993+
inv_erfc(array[,,,,,] matrix) => array[,,,,,] matrix
9994+
inv_erfc(array[,,,,,,] int) => array[,,,,,,] real
9995+
inv_erfc(array[,,,,,,] real) => array[,,,,,,] real
9996+
inv_erfc(array[,,,,,,] vector) => array[,,,,,,] vector
9997+
inv_erfc(array[,,,,,,] row_vector) => array[,,,,,,] row_vector
9998+
inv_erfc(array[,,,,,,] matrix) => array[,,,,,,] matrix
99599999
inv_gamma_ccdf_log(real, real, real) => real
996010000
inv_gamma_ccdf_log(real, real, vector) => real
996110001
inv_gamma_ccdf_log(real, real, row_vector) => real

0 commit comments

Comments
 (0)