Skip to main content
Post Closed as "Duplicate" by Michael E2, m_goldberg, vapor, bbgodfrey, C. E.
Tweeted twitter.com/StackMma/status/1121564668672335873
Became Hot Network Question
Routine cleanup
Source Link
m_goldberg
  • 108.6k
  • 16
  • 107
  • 263

Find and List All Rowsthe identical rows in a Matrix With Equal Element Values Located in Identical Positionsmatrix

Suppose I have the following matrix:

M =  {{0, 0, 0, 0, 0, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0, 1, 0, 0, 0, 0},  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,  0},  {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0},  {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0},  {0, 0, 0, 0, 1, 0, 0, 0, 1,  1, 1, 1, 0, 0, 0, 0},  {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,  0, 0}}; MatrixForm[M];TableForm[M TableForm[M, TableHeadings -> {{S1, S2, S3, S4, S5, S6, S7, S8}}] 

matrix

In this case, it turns out that rows (S1,S8 S8),  (S3S2,S4 S3, S4),  (S5,S6 S6,S7 S7) have equal element values in identical rowcolumn positions. I have a 1000x10001000 x 1000 matrix to examine and would appreciate any assistance in coding this problem.

Find and List All Rows in a Matrix With Equal Element Values Located in Identical Positions

Suppose I have the following matrix:

M = {{0, 0, 0, 0, 0, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,  0}, {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 1,  1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,  0, 0}}; MatrixForm[M];TableForm[M, TableHeadings -> {{S1, S2, S3, S4, S5, S6, S7, S8}}] 

In this case, it turns out that rows (S1,S8),(S3,S4),(S5,S6,S7) have equal element values in identical row positions. I have a 1000x1000 matrix to examine and would appreciate any assistance in coding this problem.

Find the identical rows in a matrix

Suppose I have the following matrix:

M =  {{0, 0, 0, 0, 0, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0},  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0},  {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0},  {0, 0, 0, 0,1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0},  {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0},  {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};  TableForm[M, TableHeadings -> {{S1, S2, S3, S4, S5, S6, S7, S8}}] 

matrix

In this case, it turns out that rows (S1, S8),  (S2, S3, S4),  (S5, S6, S7) have equal element values in identical column positions. I have a 1000 x 1000 matrix to examine and would appreciate any assistance in coding this problem.

added 14 characters in body
Source Link
Henrik Schumacher
  • 112.9k
  • 7
  • 197
  • 339

M = {{0, 0, 0, 0, 0, 1, 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, 0,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 1, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; MatrixForm[M];TableForm[M, TableHeadings -> {{S1, S2, S3, S4, S5, S6, S7, S8}}]

M = {{0, 0, 0, 0, 0, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; MatrixForm[M];TableForm[M, TableHeadings -> {{S1, S2, S3, S4, S5, S6, S7, S8}}] 
Source Link
user42700
  • 2k
  • 10
  • 14

Find and List All Rows in a Matrix With Equal Element Values Located in Identical Positions

Suppose I have the following matrix:

M = {{0, 0, 0, 0, 0, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}; MatrixForm[M];TableForm[M, TableHeadings -> {{S1, S2, S3, S4, S5, S6, S7, S8}}]

In this case, it turns out that rows (S1,S8),(S3,S4),(S5,S6,S7) have equal element values in identical row positions. I have a 1000x1000 matrix to examine and would appreciate any assistance in coding this problem.