Home > functions > common > utility > vb_repadd.m

vb_repadd   Linux PC, Linux AMD Opteron, Windows, Windows 32, Windows 64

PURPOSE ^

MEX function to add a vector with a matrix without repmat

SYNOPSIS ^

function z = vb_repadd(x,y)

DESCRIPTION ^

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

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

 case  y : M x 1
  z = x + repmat(y, [1 N])
  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_repadd(x,y)
0002 % MEX function to add a vector with a matrix without repmat
0003 % Much faster than using repmat and no need to memory allocation
0004 % --- Usage
0005 % z = vb_repadd(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 %  z(m,n) = x(m,n) + y(n)
0012 %
0013 % case  y : M x 1
0014 %  z = x + repmat(y, [1 N])
0015 %  z(m,n) = x(m,n) + y(m)
0016 %
0017 % case  y : 1 x 1
0018 %  z = x + y
0019 %  z(m,n) = x(m,n) + y
0020 %
0021 % Copyright (C) 2011, ATR All Rights Reserved.
0022 % License : New BSD License(see VBMEG_LICENSE.txt)

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005