Home > freetb4matlab > linear-algebra > cartprod.m

cartprod

PURPOSE ^

%

SYNOPSIS ^

function P = cartprod( varargin )

DESCRIPTION ^

% -*- texinfo -*-
% @deftypefn {Function File} {} cartprod (@var{varargin} )
%
% Computes the cartesian product of given column vectors ( row vectors ).
% The vector elements are assumend to be numbers.
%
% Alternatively the vectors can be specified by as a matrix, by its columns.
%
% To calculate the cartesian product of vectors,
% P = A x B x C x D ... . Requires A, B, C, D be column vectors.
% The algorithm is iteratively calcualte the products,
%  ( ( (A x B ) x C ) x D ) x  etc.
%
% @example
% @group
%   cartprod(1:2,3:4,0:1)
%   ans =   1   3   0
%           2   3   0
%           1   4   0
%           2   4   0
%           1   3   1
%           2   3   1
%           1   4   1
%           2   4   1
% @end group
% @end example
% @end deftypefn
% @seealso{kron}

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Sat 16-May-2009 00:04:49 by m2html © 2003