-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1347 from stan-dev/fix/soa-ad-scalar-data-matrix-…
…checks Fix: Logic for demotion rules around scalar ad types and data matrices
- Loading branch information
Showing
8 changed files
with
2,894 additions
and
145 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,6 @@ test/*.log | |
|
||
# .hpp files in test folder | ||
test/**/*.hpp | ||
|
||
# .omir files in test folder | ||
test/**/*.omir |
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
31 changes: 31 additions & 0 deletions
31
test/integration/good/compiler-optimizations/mem_patterns/ad_scalar_data_matrix.stan
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
data { | ||
int N; | ||
matrix[N, N] X_data; | ||
vector[N] y_data; | ||
} | ||
parameters { | ||
real alpha; | ||
real sigma; | ||
vector[N] beta; | ||
} | ||
model{ | ||
vector[N] soa_simple= alpha + rep_vector(0.0, N) + beta; | ||
vector[N] aos_deep = 2 * Phi(y_data / sigma) - 1; | ||
vector[N] soa_dual_rep = transpose(rep_row_vector(0.0, N)) + rep_vector(sigma, N); | ||
vector[N] soa_data_rep = rep_vector(0.0, N) + rep_vector(N, N); | ||
vector[N] soa_mix = Phi(y_data / sigma) + soa_simple; | ||
vector[N] aos_from_data = alpha + sigma * alpha + y_data - alpha - sigma * alpha; | ||
matrix[N, N] soa_mat_rep = transpose(rep_matrix(2.0, N, N)) + rep_matrix(sum(rep_vector(sigma, N)), N, N); | ||
matrix[N, N] soa_mat_rep_vec = transpose(rep_matrix(2.0, N, N)) + rep_matrix(rep_vector(sigma, N), N); | ||
matrix[N, N] aos_mat_rep = transpose(rep_matrix(aos_deep, N)) + rep_matrix(aos_deep, N); | ||
matrix[2, 2] aos_mat_from_vecs = [[alpha ^ 2, sigma], [alpha, sigma ^ 2]]; | ||
y_data ~ normal(soa_simple, aos_deep); | ||
target += sum(soa_dual_rep); | ||
target += sum(aos_from_data); | ||
target += sum(soa_data_rep); | ||
target += sum(soa_mix); | ||
target += sum(soa_mat_rep); | ||
target += sum(soa_mat_rep_vec); | ||
target += sum(aos_mat_rep); | ||
target += sum(aos_mat_from_vecs); | ||
} |
Oops, something went wrong.