|
From: | Daniel J Sebald |
Subject: | Re: Ignorance |
Date: | Mon, 05 Mar 2012 21:45:49 -0600 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 |
On 03/05/2012 09:34 PM, John W. Eaton wrote:
On 5-Mar-2012, Robert T. Short wrote: | I don't know the dimensions or the direction a-priori. The obvious | answer is 1:N followed by a repmat but there are so many cute little | octave tricks that I was hoping there was something really clever. Given x = 1:4; y = ones (3, 1); z = ones (3, 4); here are the ways I can think of: Repmat: repmat (x, [3,1]) Kron: kron (x, y) Indexing: x(y,:) Outer product: y * x Broadcasting: z .* x Are there any others? jwe
Cumulative sum: cumsum(z,2) Dan
[Prev in Thread] | Current Thread | [Next in Thread] |