-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c7f948
commit 2c0c91a
Showing
5 changed files
with
44 additions
and
9 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
function jointoperator(operators, Q::Array) | ||
N = length(operators) | ||
wn = size(operators[1], 1) | ||
@assert all(o isa Tridiagonal for o in operators) | ||
# check if all os have same size | ||
@assert all(size(o) == (wn, wn) for o in operators) | ||
# check if the size of transition matrix is | ||
# same as the number of operators | ||
@assert size(Q,1) == size(Q,2) == N | ||
J = BandedBlockBandedMatrix(Zeros(wn * N, wn * N), fill(wn, N) ,fill(wn, N), (N-1, N-1), (1, 1)) | ||
for i in 1:N | ||
J[Block(i,i)] = operators[i] | ||
end | ||
for i in 1:N | ||
for j in 1:N | ||
J[Block(i,j)] += Tridiagonal(zeros(wn -1), fill(Q[i, j], wn), zeros(wn-1)) | ||
end | ||
end | ||
return J | ||
end |