"symmetrical" rows of matrix
    조회 수: 5 (최근 30일)
  
       이전 댓글 표시
    
I have integer matrix  A (nA x c)  with even number of columns (e.g. mod(c,2) = 0) and unique rows.
How to effectivelly (by speed and memory optimized function "symmetricRows") find  the "symmetric" rows of matrix A  iA1 and iA2, where "symmetric" rows iA1 and iA2 are defined as:
all(A(iA1,1:end/2) == A(iA2,end/2+1:end) & A(iA1,end/2+1:end) == A(iA2,1:end/2),2) = true
Example:
A = [1 1 1 1; 
     2 2 2 2; 
     1 2 3 4;
     4 3 2 1; 
     2 2 3 3; 
     3 4 1 2; 
     3 3 2 2]
[iA1, iA2] = symmetricRows(A)
  iA1 =
        1
        2
        3
        5 
   iA2 =
        1
        2
        6
        7
Typical size of matrices A: nA ~ 1e4-1e6, c ~ 60 - 120
The problem is motivated by pre-processing of large dataset, where "symmetrical" rows are irrelevant from the point of user defined distance metric.
댓글 수: 0
채택된 답변
  Michal
      
 2020년 2월 11일
        
      편집: Michal
      
 2020년 2월 11일
  
      
      댓글 수: 4
  the cyclist
      
      
 2020년 2월 11일
				Yeah, I should have mentioned that I did my testing on MATLAB Online, so it's probably not the most powerful platform. :-)
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

