help-octave
[Top][All Lists]

## Re: rank(gf) doesn't really work?

 From: David Bateman Subject: Re: rank(gf) doesn't really work? Date: Tue, 11 Oct 2005 15:51:15 +0200 User-agent: Mozilla Thunderbird 0.8 (X11/20040923)

```Lapo Luchini wrote:

```
```Maybe I'm missing some important point (e.g. "gfrank" is not defined) and this
is really not supported, but it gives different result on gf() than on a normal
array so just maybe it shuold work..?

\$ B=gf([0,1,0,0,1,1;
0,0,1,1,1,0;
0,1,1,1,0,0;
1,0,1,1,0,0;
1,1,0,1,0,0;
1,1,1,0,0,0]);
\$ D=gf([0,1,0,0,1,1;
0,0,1,1,1,0;
0,1,1,1,0,0;
1,0,1,1,0,0;
1,1,0,1,0,0;
0,1,1,0,0,0]);
\$ B+D
ans =
GF(2) array.

Array elements =

0  0  0  0  0  0
0  0  0  0  0  0
0  0  0  0  0  0
0  0  0  0  0  0
0  0  0  0  0  0
1  0  0  0  0  0
\$ rank(B)
ans = 6
\$ rank(D)
ans = 4

Then, if B is full-rank (6 out of 6) how can possibly D be rank 4 if the first 5
lines are the very same 5 lines that in B were linearly independent?

It just seems that it works, but only on square matrices, and it just ignores
any other column:
\$ rank(B(1:5,1:5))
ans = 4
\$ rank(B(1:5,2:6))
ans = 5
\$ rank(B(1:5,:))
ans = 4

I would expect last line to be 5 as well. Maybe rank(B(1:5,:)) just uses the
first 5 columns in the 5x6 matrix?

Mhh...?

Lapo

```
Yes this is a bug.. The rank function does an LU factorization of the galois array which pivots where it can and then attempts to count the rank deficiencies where it can't. Unfortunately, I messed this up. The relevant function is galois.cc (LU::factor) and the "info" variable. I'll look at it and try and fix it...
```
D.

--
```
Motorola Labs - Paris +33 1 69 35 48 04 (Ph) Parc Les Algorithmes, Commune de St Aubin +33 1 69 35 77 01 (Fax) 91193 Gif-Sur-Yvette FRANCE
```
```
The information contained in this communication has been classified as: [x] General Business Information [ ] Motorola Internal Use Only [ ] Motorola Confidential Proprietary
```

-------------------------------------------------------------
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
-------------------------------------------------------------

```