File: Mat2Hrows.m

package info (click to toggle)
codec2 1.2.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 76,376 kB
  • sloc: ansic: 436,819; cpp: 2,091; objc: 1,736; sh: 1,510; python: 1,405; asm: 683; makefile: 605
file content (28 lines) | stat: -rw-r--r-- 461 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function [Hrows Hcols] = Mat2Hrows(HRA, RAmode); 

H = full(HRA); 
[Nr Nc] = size(H);

if nargin==1, RAmode = 1; end; 

if RAmode==1
   H= H(:,1:Nc-Nr); 
   [Nr Nc] = size(H); 
end 

Max_colwt = max(sum(H));
Max_rowwt = max(sum(H')); 
Hcols = zeros(Nc, Max_colwt); 
Hrows = zeros(Nr, Max_rowwt); 

for i = 1:Nr
    nz = find(H(i,:)); 
    Hrows(i,1:length(nz)) = nz; 
end

H = H'; 
for i = 1:Nc
    nz = find(H(i,:)); 
    Hcols(i,1:length(nz)) = nz; 
end