Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % functions to get a Walsh permutation's compression matrix from the compression vector and vice versa
- % for the bin class see http://pastebin.com/K02wGsae
- function y = cv2cm(x)
- % compression vector of type bin to compression matrix of type logical
- Long = length(x) ;
- Mat = false(Long) ;
- for n = 1 : Long
- for k = 1 : x(n).Weight
- Mat( x(n).Expo(k)+1 , n ) = 1 ;
- end
- end
- y = Mat ;
- end
- function y = cm2cv(x)
- % compression matrix of type logical to compression vector of type bin
- Long = size(x,1) ;
- CV = bin([1 Long],'pre') ;
- for n=1:Long
- Weight = sum(x(:,n)) ;
- Expo = zeros( 1 , Weight ) ;
- Count = 1 ;
- for m=1:Long
- if x(m,n) == 1
- Expo(Count) = m-1 ;
- Count = Count + 1 ;
- end
- end
- CV(n) = bin(Expo) ;
- end
- y = CV ;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement