From da910315777a9db786c61a5d79afa29642464f05 Mon Sep 17 00:00:00 2001 From: Nuwan Yapa Date: Wed, 21 Feb 2024 16:59:22 -0500 Subject: [PATCH] s.p. T matrix (untested) --- ho_basis.jl | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ho_basis.jl b/ho_basis.jl index e1cc7ed..d97f53a 100644 --- a/ho_basis.jl +++ b/ho_basis.jl @@ -49,7 +49,23 @@ end get_V_matrix(V_l, ls, ns) = throw("unimplemented") -get_T_matrix(ns, ls) = throw("unimplemented") +function sp_T_matrix(ns, ls) + mat = zeros(length(ns), length(ns)) + for idx in CartesianIndices(mat) + (i, j) = Tuple(idx) + if ls[i] == ls[j] + mat[idx] = ls[i] + if ns[i] == ns[j] + mat[idx] += 1/4 * (4*ns[j] + 3) + elseif ns[i] == ns[j] + 1 + mat[idx] += -1/4 * sqrt((2*ns[j] + 2) * (2*ns[j] + 3)) + elseif ns[i] == ns[j] - 1 + mat[idx] += -1/4 * sqrt((2*ns[j] + 1) * 2*ns[j]) + end + end + end + return mat +end get_H_matrix(V_l, ns, ls) = get_T_matrix(ns, ls) + get_V_matrix(V_l, ns, ls)