You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: dhmm_logprob_brute_force.m
    path of file: ./repos/bnt/HMM
    
    the code of the file until where you have to start completion: function logp = enumerate_HMM_loglik(prior, transmat, obsmat)
% ENUMERATE_HMM_LOGLIK Compute the log likelihood of a sequence by exhaustive (O(Q^T)) enumeration.
% logp = enumerate_HMM_loglik(prior, transmat, obsmat)

    
function logp = enumerate_HMM_loglik(prior, transmat, obsmat)
% ENUMERATE_HMM_LOGLIK Compute the log likelihood of a sequence by exhaustive (O(Q^T)) enumeration.
% logp = enumerate_HMM_loglik(prior, transmat, obsmat)
%
% Inputs:
% prior(i) = Pr(Q(1) = i)
% transmat(i,j) = Pr(Q(t+1)=j | Q(t)=i)
% obsmat(i,t) = Pr(y(t) | Q(t)=i)

Q = length(prior);
T = size(obsmat, 2);
sizes = repmat(Q, 1, T);

psum = 0;
for i=1:Q^T
  qs = ind2subv(sizes, i); % make the state sequence 
  psum = psum + prob_path(prior, transmat, obsmat, qs);
end