[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: row vectors changed to column vectors?
From: |
Henry F. Mollet |
Subject: |
Re: row vectors changed to column vectors? |
Date: |
Wed, 11 Feb 2004 09:11:22 -0800 |
User-agent: |
Microsoft-Entourage/10.1.1.2418 |
Just trying to learn a little here in view of Octave 2.1.53 ff having column
vector default instead of row vector default if we use a=1:5 (for Matlab
compatibility). Therefore toeplitz(a,shift(fliplr(a),1)) will produce
something different with a warning:
octave:11> a=1:5;
octave:12> a=a';
octave:13> toeplitz(a,shift(fliplr(a),1))
warning: in /sw/share/octave/2.1.46/m/special-matrix/toeplitz.m near line
84, column 5:
>>> warning ("toeplitz: column wins diagonal conflict");
warning: toeplitz: column wins diagonal conflict
ans =
1 1 2 3 4
2 1 1 2 3
3 2 1 1 2
4 3 2 1 1
5 4 3 2 1
Henry
on 2/10/04 11:28 PM, Christian T. Steigies at address@hidden wrote:
> On Tue, Feb 10, 2004 at 02:16:02PM -0500, Przemek Klosowski wrote:
>> But what takes much more time is creating a N:N matrix out of these
>> vectors.
>> I have to "glue" the matrix using a() as a column, where for each column
>> a()
>> has to be "rotated" by one position. I tried first with two for loops. Now
>> I
>>
>> Would this be what you need:
>>
>> a=1:5 ; toeplitz(a,shift(fliplr(a),1))
>> ans =
>>
>> 1 5 4 3 2
>> 2 1 5 4 3
>> 3 2 1 5 4
>> 4 3 2 1 5
>> 5 4 3 2 1
>
> Thats exactly it, thanks a lot! 0.6s instead of 60s.
>
> Christian
>
>
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.octave.org
> How to fund new projects: http://www.octave.org/funding.html
> Subscription information: http://www.octave.org/archive.html
> -------------------------------------------------------------
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------