# v_cep2pow

## PURPOSE

V_CEP2POW convert cepstral means and variances to the power domain

## SYNOPSIS

function [m,c]=v_cep2pow(u,v,mode)

## DESCRIPTION

    V_CEP2POW convert cepstral means and variances to the power domain
     Inputs:
        u: vector giving the cepstral means with u(1) the 0'th cepstral coefficient
        v: cepstral covariance matrix or else a vector containing the diagonal elements
     mode: 'c'  pow=exp(v_irdct(cep))    [default]
           'f'  pow=exp(v_rsfft(cep)/n)  [fft length even]
           'fo' pow=exp(v_rsfft(cep)/n)  [fft length odd]
           'i'  pow=exp(cep)           [ no transformation ]

     Outputs:
        m: row vector giving means in the power domain
        c: covariance matrix in the power domain

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

## SOURCE CODE

    0001 function [m,c]=v_cep2pow(u,v,mode)
    0002 %V_CEP2POW convert cepstral means and variances to the power domain
    0003 % Inputs:
    0004 %    u: vector giving the cepstral means with u(1) the 0'th cepstral coefficient
    0005 %    v: cepstral covariance matrix or else a vector containing the diagonal elements
    0006 % mode: 'c'  pow=exp(v_irdct(cep))    [default]
    0007 %       'f'  pow=exp(v_rsfft(cep)/n)  [fft length even]
    0008 %       'fo' pow=exp(v_rsfft(cep)/n)  [fft length odd]
    0009 %       'i'  pow=exp(cep)           [ no transformation ]
    0010 %
    0011 % Outputs:
    0012 %    m: row vector giving means in the power domain
    0013 %    c: covariance matrix in the power domain
    0014
    0015 %      Copyright (C) Mike Brookes 1998
    0016 %      Version: $Id: v_cep2pow.m 10865 2018-09-21 17:22:45Z dmb $
    0017 %
    0018 %   VOICEBOX is a MATLAB toolbox for speech processing.
    0019 %   Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
    0020 %
    0021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0022 %   This program is free software; you can redistribute it and/or modify
    0023 %   it under the terms of the GNU Lesser General Public License as published by
    0024 %   the Free Software Foundation; either version 3 of the License, or
    0025 %   (at your option) any later version.
    0026 %
    0027 %   This program is distributed in the hope that it will be useful,
    0028 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
    0029 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0030 %   GNU Lesser General Public License for more details.
    0031 %
    0032 %   You can obtain a copy of the GNU Lesser General Public License from
    0033 %   https://www.gnu.org/licenses/ .
    0034 %
    0035 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    0036
    0037 if nargin<3 mode='c'; end
    0038 if min(size(v))==1
    0039    v=diag(v);
    0040 end
    0041 u=u(:)';    % force u to be a row vector
    0042 if any(mode=='f')
    0043    n=2*length(u)-2;
    0044    if any(mode=='o')
    0045       n=n+1;
    0046    end
    0047    p=rsfft(u',n)/n;
    0048    q=rsfft(rsfft(v,n)',n)/n^2;
    0049 elseif any(mode=='i')
    0050     p=u';
    0051     q=v';
    0052 else
    0053    p=irdct(u');
    0054    q=irdct(irdct(v)');
    0055 end
    0056 m=exp(p+0.5*diag(q))';
    0057 c=(m'*m).*(exp(q)-1);