Institut de Robòtica i Informàtica Industrial

Product

PURPOSE ^

Product of two Gaussians.

SYNOPSIS ^

function [g d]=Product(g1,g2)

DESCRIPTION ^

   Product of two Gaussians.

   Returns the Gaussian resulting from multiplying two other Gaussians.
   Note that the result of multiplying two Gaussians is a un-normalized
   Gaussian. Here we return the normalized Gaussian 'g' and the
   'un-normalization' factor 'd'.

CROSS-REFERENCE INFORMATION ^

This function calls:
  • size Returns the size of a policy.
  • ProductNormFactor Normalization constant of the product of two Gaussians.
This function is called by:
  • Product gmOut=Product(gm1,gm2)
  • mtimes Product of a GMixture and a constant/GMixture.
  • mtimes Product of a Gaussian and a constant/Gaussian.

SOURCE CODE ^

0001 function [g d]=Product(g1,g2)
0002 %   Product of two Gaussians.
0003 %
0004 %   Returns the Gaussian resulting from multiplying two other Gaussians.
0005 %   Note that the result of multiplying two Gaussians is a un-normalized
0006 %   Gaussian. Here we return the normalized Gaussian 'g' and the
0007 %   'un-normalization' factor 'd'.
0008 
0009   if g1.dim~=g2.dim
0010         error('Gaussians with different dimensions in Gaussian product');
0011   end
0012     
0013   iS=g1.iS+g2.iS;
0014   
0015   R=chol(iS);
0016   iR=R\eye(size(R));
0017   S=iR*iR';
0018   
0019   % Matlab object fields must be defined always in the same order...
0020   g.m=S*(g1.iS*g1.m+g2.iS*g2.m);
0021   g.dim=g1.dim;
0022   g.S=S;
0023   g.d=1/(prod(diag(R))^2);
0024   g.iS=iS;
0025   g.ct=1/sqrt(((2*pi)^g.dim)*g.d);
0026   
0027   g=class(g,'Gaussian');
0028     
0029   d=ProductNormFactor(g1,g2);


Institut de Robòtica i Informàtica Industrial

Generated on Wed 05-Aug-2009 15:05:21 by m2html © 2003