Code covered by the BSD License  

Highlights from
Statistical Learning Toolbox

from Statistical Learning Toolbox by Dahua Lin
Functions for statistical learning, pattern recognition and computer vision, covering many topics.

Description of slmulvec
Home > sltoolbox > core > slmulvec.m

slmulvec

PURPOSE ^

SLMULVEC multiplies a vector to columns or rows of a matrix

SYNOPSIS ^

function Y = slmulvec(X, v, d)

DESCRIPTION ^

SLMULVEC multiplies a vector to columns or rows of a matrix

 $ Syntax $
   - Y = slmulvec(X, v, d)
   - Y = slmulvec(X, v)

 $ Arguments $
   - X:        The original matrix
   - v:        The addend vector
   - d:        The dimension along which the vector is to add
   - Y:        The resultant matrix

 $ Description $
   - Y = slmulvec(X, v, d) selects the most efficienct way to multiple a 
     vector v to every column/row of X. If d == 1, then v should be 
     a column vector, and is multiplied to each column of X, if d == 2,
     then v should be a row vector, and is multiplied to each row of X.

   - Y = slmulvec(X, v) will automatically determine d according to
     the shape of v.

 $ Remarks $
   - The implementation simply wraps the mex function vecop_core.

 $ History $
   - Created by Dahua Lin, on Sep 10, 2006

CROSS-REFERENCE INFORMATION ^

This function calls:
This function is called by:
  • sllabeledsum SLLABELEDSUM Sums the numbers according to labels
  • slmetric_cp SLMETRIC_CP Computes the metrics between corresponding pairs of samples
  • slmetric_pw SLMETRIC_PW Compute the metric between column vectors pairwisely
  • slnormalize SLNORMALIZE Normalize the sub-arrays
  • slsymgeig SLSYMGEIG Solve the generalized eigen decomposition for symmetric matrices
  • slkpca SLPCA Learns a Kernel PCA model from training samples
  • slgembed SLGEMBED Solves the general graph-based embedding
  • sllemap SLLEMAP Solves Laplacian Eigenmap Embedding
  • sllocaltanspace SLLOCALTANSPACE Solves the local tangent spaces
  • sllinreg SLLINREG Performs Multivariate Linear Regression and Ridge Regression
  • sllogistreg SLLOGISTREG Performs Multivariate Logistic Regression
  • slcov SLCOV Compute the covariance matrix
  • slfmm SLFMM Learns a Finite Mixture Model (FMM)
  • slgaussest SLGAUSSEST Estimates the Gaussian models from samples
  • slgaussrnd SLGAUSSRND Generates random samples from Gaussian models
  • slmean SLMEAN Compute the mean vector of samples
  • slposteriori SLPOSTERIORI Computes the posterioris
  • slposterioritrue SLPOSTERIORITRUE Computes the posteriori that samples belong to true class
  • slwhiten_from_cov SLWHITEN_FROM_COV Compute the whitening transform from covariance matrix
  • slwhiten_from_samples SLWHITEN_FROM_SAMPLES Compute the whitening matrix from sample matrix
  • slcopca SLCOPCA Performs Coupled PCA Learning
  • sldlda SLDLDA Performs Direct Linear Discriminant Analysis
  • slnlda SLNLDA Performs Nullspace-based Linear Discriminant Analysis
  • slpca SLPCA Learns a PCA model from training samples

SOURCE CODE ^

0001 function Y = slmulvec(X, v, d)
0002 %SLMULVEC multiplies a vector to columns or rows of a matrix
0003 %
0004 % $ Syntax $
0005 %   - Y = slmulvec(X, v, d)
0006 %   - Y = slmulvec(X, v)
0007 %
0008 % $ Arguments $
0009 %   - X:        The original matrix
0010 %   - v:        The addend vector
0011 %   - d:        The dimension along which the vector is to add
0012 %   - Y:        The resultant matrix
0013 %
0014 % $ Description $
0015 %   - Y = slmulvec(X, v, d) selects the most efficienct way to multiple a
0016 %     vector v to every column/row of X. If d == 1, then v should be
0017 %     a column vector, and is multiplied to each column of X, if d == 2,
0018 %     then v should be a row vector, and is multiplied to each row of X.
0019 %
0020 %   - Y = slmulvec(X, v) will automatically determine d according to
0021 %     the shape of v.
0022 %
0023 % $ Remarks $
0024 %   - The implementation simply wraps the mex function vecop_core.
0025 %
0026 % $ History $
0027 %   - Created by Dahua Lin, on Sep 10, 2006
0028 %
0029 
0030 if nargin < 3
0031     if size(v, 2) == 1
0032         d = 1;
0033     else
0034         d = 2;
0035     end
0036 end
0037 
0038 Y = vecop_core(X, v, d, 2);  % 2 is the opcode of multiplication in vecop_core

Generated on Wed 20-Sep-2006 12:43:11 by m2html © 2003

Contact us at files@mathworks.com