Outerm: Difference between revisions
Jump to navigation
Jump to search
imported>Jeremy (Importing text file) |
imported>Jeremy (Importing text file) |
||
Line 1: | Line 1: | ||
===Purpose=== | ===Purpose=== | ||
Computes the outer product of any number of vectors with multiple factors. | Computes the outer product of any number of vectors with multiple factors. | ||
===Synopsis=== | ===Synopsis=== | ||
:mwa = outerm(facts,''lo,vect'') | :mwa = outerm(facts,''lo,vect'') | ||
===Description=== | ===Description=== | ||
The input to outer is a 1 by ''N'' cell array facts, where each cell contains a matrix of factors for one of the modes (a.k.a. ways, dimensions, or orders), with each factor being a column in the matrix. | The input to outer is a 1 by ''N'' cell array facts, where each cell contains a matrix of factors for one of the modes (a.k.a. ways, dimensions, or orders), with each factor being a column in the matrix. | ||
Optional inputs are lo the number of a mode to leave out in the formation of the outer product, and a flag vect which causes the function to not sum and reshape the final factors when set to 1. (This option is used in the alternating least squares steps in PARAFAC.) | Optional inputs are lo the number of a mode to leave out in the formation of the outer product, and a flag vect which causes the function to not sum and reshape the final factors when set to 1. (This option is used in the alternating least squares steps in PARAFAC.) | ||
The output is the multiway array resulting from multiplying the factors together mwa, or the strung out individual factors. | The output is the multiway array resulting from multiplying the factors together mwa, or the strung out individual factors. | ||
===Examples:=== | ===Examples:=== | ||
:a = [[1:7]' [2 4 1 3 5 7 6]']; % 7x2 | :a = [[1:7]' [2 4 1 3 5 7 6]']; % 7x2 | ||
:b = [sin([1:.5:5]') cos([1:.5:5]')]; % 9x2 | :b = [sin([1:.5:5]') cos([1:.5:5]')]; % 9x2 | ||
:c = [[1:8 0 0]', [0 0 1:8]']; % 10x2 | :c = [[1:8 0 0]', [0 0 1:8]']; % 10x2 | ||
:x = outerm({a,b,c}); % 7x9x10 | :x = outerm({a,b,c}); % 7x9x10 | ||
===See Also=== | ===See Also=== | ||
[[gram]], [[mpca]], [[parafac]], [[tld]] | [[gram]], [[mpca]], [[parafac]], [[tld]] |
Revision as of 14:26, 3 September 2008
Purpose
Computes the outer product of any number of vectors with multiple factors.
Synopsis
- mwa = outerm(facts,lo,vect)
Description
The input to outer is a 1 by N cell array facts, where each cell contains a matrix of factors for one of the modes (a.k.a. ways, dimensions, or orders), with each factor being a column in the matrix.
Optional inputs are lo the number of a mode to leave out in the formation of the outer product, and a flag vect which causes the function to not sum and reshape the final factors when set to 1. (This option is used in the alternating least squares steps in PARAFAC.)
The output is the multiway array resulting from multiplying the factors together mwa, or the strung out individual factors.
Examples:
- a = [[1:7]' [2 4 1 3 5 7 6]']; % 7x2
- b = [sin([1:.5:5]') cos([1:.5:5]')]; % 9x2
- c = [[1:8 0 0]', [0 0 1:8]']; % 10x2
- x = outerm({a,b,c}); % 7x9x10