Home > vbmeg > functions > common > utility > vb_repmultiply.m

vb_repmultiply   Linux AMD Opteron, Windows, Windows 64

PURPOSE ^

MEX function to multiply a vector with a matrix without repmat

SYNOPSIS ^

function z = vb_repmultiply(x,y)

DESCRIPTION ^

 MEX function to multiply a vector with a matrix without repmat 
 Much faster than using repmat and no need to memory allocation
 --- Usage
 z = vb_repmultiply(x,y)
 x : M x N
 z : M x N

 case  y : 1 x N
  z = x .* repmat(y, [M 1])
    = x * diag(y)
  z(m,n) = x(m,n) * y(n)

 case  y : M x 1
  z = x .* repmat(y, [1 N])
    = diag(y) * x
  z(m,n) = x(m,n) * y(m)

 case  y : 1 x 1
  z = x * y
  z(m,n) = x(m,n) * y

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    z = vb_repmultiply(x,y)
0002 % MEX function to multiply a vector with a matrix without repmat
0003 % Much faster than using repmat and no need to memory allocation
0004 % --- Usage
0005 % z = vb_repmultiply(x,y)
0006 % x : M x N
0007 % z : M x N
0008 %
0009 % case  y : 1 x N
0010 %  z = x .* repmat(y, [M 1])
0011 %    = x * diag(y)
0012 %  z(m,n) = x(m,n) * y(n)
0013 %
0014 % case  y : M x 1
0015 %  z = x .* repmat(y, [1 N])
0016 %    = diag(y) * x
0017 %  z(m,n) = x(m,n) * y(m)
0018 %
0019 % case  y : 1 x 1
0020 %  z = x * y
0021 %  z(m,n) = x(m,n) * y
0022 %
0023 % Copyright (C) 2011, ATR All Rights Reserved.
0024 % License : New BSD License(see VBMEG_LICENSE.txt)

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005