Skip to content

Commit

Permalink
check if Z has 0 rows #43
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwang15 committed Aug 10, 2024
1 parent aa54184 commit cc6db2d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/restrictions_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ arma::colvec zero_restrictions(
const arma::colvec vec_structural
) {
int N = Z(0).n_cols;

mat A0 = vec_structural.rows(0, N * N - 1);
A0 = reshape(A0, N, N);

mat A0 = reshape(vec_structural.rows(0, N * N - 1), N, N);

arma::field<arma::mat> ZF = ZIRF(Z, inv(A0.t()));

colvec z;
vec z;
for (int j=0; j<ZF.n_elem; j++) {
z = join_vert(z, ZF(j).col(j));
mat ZF_j = ZF(j);
if (ZF_j.n_rows > 0) z = join_vert(z, ZF_j.col(j));
}

return z;
Expand Down

0 comments on commit cc6db2d

Please sign in to comment.