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: spm_dcm_fmri_mode_gen.m
    path of file: ./repos/spm12
    
    the code of the file until where you have to start completion: function [Ep,Cp] = spm_dcm_fmri_mode_gen(Ev,modes,Cv)
% Generates adjacency matrix for spectral DCM from Lyapunov exponents
% FORMAT [Ep,Cp] = spm_dcm_fmri_mode_gen(Ev,modes,Cv)
% Ev    - Lyapunov exponents or eigenvalues of effective connectivity
% modes - modes or eigenvectors
% Cv    - optional (posterior) covariance matrix
%
% Ep    - Jacobian or (symmetric) effective connectivity matrix
% Cp    - posterior covariance matrix of Jacobian elements
%

    
function [Ep,Cp] = spm_dcm_fmri_mode_gen(Ev,modes,Cv)
% Generates adjacency matrix for spectral DCM from Lyapunov exponents
% FORMAT [Ep,Cp] = spm_dcm_fmri_mode_gen(Ev,modes,Cv)
% Ev    - Lyapunov exponents or eigenvalues of effective connectivity
% modes - modes or eigenvectors
% Cv    - optional (posterior) covariance matrix
%
% Ep    - Jacobian or (symmetric) effective connectivity matrix
% Cp    - posterior covariance matrix of Jacobian elements
%
% This routine computes the connecivity graph for spectral DCM (modes).
%__________________________________________________________________________
% Copyright (C) 2014 Wellcome Trust Centre for Neuroimaging

% Karl Friston
% $Id: spm_dcm_fmri_mode_gen.m 5823 2014-01-02 14:01:10Z guillaume $

    
% outer product
%==========================================================================
Ep    = modes*diag(-exp(-Ev))*modes';

if nargout == 1, return, end