Find the identical rows in a matrixHow to find rows that have maximum value?How to do equality check of a large matrix and get the corresponding index position?List manipulation: Dropping first or last row or column of a matrixIs it possible to colour only one column of a matrix?Make a vector of sums of matrix rowsHow to operate on spans of rows in a matrix?Efficiently select the smallest magnitude element from each column of a matrixMatrix expansion and reorganisationMatrix using For LoopChanging the position of rows and columns in a matrix

Retract an already submitted recommendation letter (written for an undergrad student)

What does "function" actually mean in music?

Philosophical question on logistic regression: why isn't the optimal threshold value trained?

"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?

Is there metaphorical meaning of "aus der Haft entlassen"?

How to have a sharp product image?

Mistake in years of experience in resume?

A strange hotel

Are there moral objections to a life motivated purely by money? How to sway a person from this lifestyle?

Is there really no use for MD5 anymore?

Drawing a german abacus as in the books of Adam Ries

Crossed out red box fitting tightly around image

Why did C use the -> operator instead of reusing the . operator?

What is purpose of DB Browser(dbbrowser.aspx) under admin tool?

How to not starve gigantic beasts

Can a stored procedure reference the database in which it is stored?

Is Electric Central Heating worth it if using Solar Panels?

How can I practically buy stocks?

What does a straight horizontal line above a few notes, after a changed tempo mean?

Help with my training data

How much cash can I safely carry into the USA and avoid civil forfeiture?

How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?

As an international instructor, should I openly talk about my accent?

How to keep bees out of canned beverages?



Find the identical rows in a matrix


How to find rows that have maximum value?How to do equality check of a large matrix and get the corresponding index position?List manipulation: Dropping first or last row or column of a matrixIs it possible to colour only one column of a matrix?Make a vector of sums of matrix rowsHow to operate on spans of rows in a matrix?Efficiently select the smallest magnitude element from each column of a matrixMatrix expansion and reorganisationMatrix using For LoopChanging the position of rows and columns in a matrix













3












$begingroup$


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.










share|improve this question











$endgroup$











  • $begingroup$
    Try Values[PositionIndex[M]]
    $endgroup$
    – Coolwater
    1 hour ago















3












$begingroup$


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.










share|improve this question











$endgroup$











  • $begingroup$
    Try Values[PositionIndex[M]]
    $endgroup$
    – Coolwater
    1 hour ago













3












3








3





$begingroup$


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.










share|improve this question











$endgroup$




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.







list-manipulation matrix






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 hours ago









m_goldberg

89.1k873200




89.1k873200










asked 3 hours ago









PRGPRG

1028




1028











  • $begingroup$
    Try Values[PositionIndex[M]]
    $endgroup$
    – Coolwater
    1 hour ago
















  • $begingroup$
    Try Values[PositionIndex[M]]
    $endgroup$
    – Coolwater
    1 hour ago















$begingroup$
Try Values[PositionIndex[M]]
$endgroup$
– Coolwater
1 hour ago




$begingroup$
Try Values[PositionIndex[M]]
$endgroup$
– Coolwater
1 hour ago










1 Answer
1






active

oldest

votes


















4












$begingroup$

idx = DeleteDuplicates[Sort /@ Nearest[M -> Automatic, M, ∞, 0]]



1, 8, 2, 3, 4, 5, 6, 7




In order to obtain the labels of the rows, you may use the following:



labels = S1, S2, S3, S4, S5, S6, S7, S8;
Map[labels[[#]] &, idx, 2]



S1, S8, S2, S3, S4, S5, S6, S7







share|improve this answer











$endgroup$












  • $begingroup$
    Henrik: Can I add the S in front of the result; e.g., (S1,S8),(S3,S4),(S5,S6,S7)?
    $endgroup$
    – PRG
    3 hours ago










  • $begingroup$
    MANY THANKS, HENRIK!
    $endgroup$
    – PRG
    2 hours ago










  • $begingroup$
    YOU'RE WELCOME, PRG! =D
    $endgroup$
    – Henrik Schumacher
    2 hours ago











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "387"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f197039%2ffind-the-identical-rows-in-a-matrix%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4












$begingroup$

idx = DeleteDuplicates[Sort /@ Nearest[M -> Automatic, M, ∞, 0]]



1, 8, 2, 3, 4, 5, 6, 7




In order to obtain the labels of the rows, you may use the following:



labels = S1, S2, S3, S4, S5, S6, S7, S8;
Map[labels[[#]] &, idx, 2]



S1, S8, S2, S3, S4, S5, S6, S7







share|improve this answer











$endgroup$












  • $begingroup$
    Henrik: Can I add the S in front of the result; e.g., (S1,S8),(S3,S4),(S5,S6,S7)?
    $endgroup$
    – PRG
    3 hours ago










  • $begingroup$
    MANY THANKS, HENRIK!
    $endgroup$
    – PRG
    2 hours ago










  • $begingroup$
    YOU'RE WELCOME, PRG! =D
    $endgroup$
    – Henrik Schumacher
    2 hours ago















4












$begingroup$

idx = DeleteDuplicates[Sort /@ Nearest[M -> Automatic, M, ∞, 0]]



1, 8, 2, 3, 4, 5, 6, 7




In order to obtain the labels of the rows, you may use the following:



labels = S1, S2, S3, S4, S5, S6, S7, S8;
Map[labels[[#]] &, idx, 2]



S1, S8, S2, S3, S4, S5, S6, S7







share|improve this answer











$endgroup$












  • $begingroup$
    Henrik: Can I add the S in front of the result; e.g., (S1,S8),(S3,S4),(S5,S6,S7)?
    $endgroup$
    – PRG
    3 hours ago










  • $begingroup$
    MANY THANKS, HENRIK!
    $endgroup$
    – PRG
    2 hours ago










  • $begingroup$
    YOU'RE WELCOME, PRG! =D
    $endgroup$
    – Henrik Schumacher
    2 hours ago













4












4








4





$begingroup$

idx = DeleteDuplicates[Sort /@ Nearest[M -> Automatic, M, ∞, 0]]



1, 8, 2, 3, 4, 5, 6, 7




In order to obtain the labels of the rows, you may use the following:



labels = S1, S2, S3, S4, S5, S6, S7, S8;
Map[labels[[#]] &, idx, 2]



S1, S8, S2, S3, S4, S5, S6, S7







share|improve this answer











$endgroup$



idx = DeleteDuplicates[Sort /@ Nearest[M -> Automatic, M, ∞, 0]]



1, 8, 2, 3, 4, 5, 6, 7




In order to obtain the labels of the rows, you may use the following:



labels = S1, S2, S3, S4, S5, S6, S7, S8;
Map[labels[[#]] &, idx, 2]



S1, S8, S2, S3, S4, S5, S6, S7








share|improve this answer














share|improve this answer



share|improve this answer








edited 2 hours ago

























answered 3 hours ago









Henrik SchumacherHenrik Schumacher

61.2k585171




61.2k585171











  • $begingroup$
    Henrik: Can I add the S in front of the result; e.g., (S1,S8),(S3,S4),(S5,S6,S7)?
    $endgroup$
    – PRG
    3 hours ago










  • $begingroup$
    MANY THANKS, HENRIK!
    $endgroup$
    – PRG
    2 hours ago










  • $begingroup$
    YOU'RE WELCOME, PRG! =D
    $endgroup$
    – Henrik Schumacher
    2 hours ago
















  • $begingroup$
    Henrik: Can I add the S in front of the result; e.g., (S1,S8),(S3,S4),(S5,S6,S7)?
    $endgroup$
    – PRG
    3 hours ago










  • $begingroup$
    MANY THANKS, HENRIK!
    $endgroup$
    – PRG
    2 hours ago










  • $begingroup$
    YOU'RE WELCOME, PRG! =D
    $endgroup$
    – Henrik Schumacher
    2 hours ago















$begingroup$
Henrik: Can I add the S in front of the result; e.g., (S1,S8),(S3,S4),(S5,S6,S7)?
$endgroup$
– PRG
3 hours ago




$begingroup$
Henrik: Can I add the S in front of the result; e.g., (S1,S8),(S3,S4),(S5,S6,S7)?
$endgroup$
– PRG
3 hours ago












$begingroup$
MANY THANKS, HENRIK!
$endgroup$
– PRG
2 hours ago




$begingroup$
MANY THANKS, HENRIK!
$endgroup$
– PRG
2 hours ago












$begingroup$
YOU'RE WELCOME, PRG! =D
$endgroup$
– Henrik Schumacher
2 hours ago




$begingroup$
YOU'RE WELCOME, PRG! =D
$endgroup$
– Henrik Schumacher
2 hours ago

















draft saved

draft discarded
















































Thanks for contributing an answer to Mathematica Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f197039%2ffind-the-identical-rows-in-a-matrix%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Францішак Багушэвіч Змест Сям'я | Біяграфія | Творчасць | Мова Багушэвіча | Ацэнкі дзейнасці | Цікавыя факты | Спадчына | Выбраная бібліяграфія | Ушанаванне памяці | У філатэліі | Зноскі | Літаратура | Спасылкі | НавігацыяЛяхоўскі У. Рупіўся дзеля Бога і людзей: Жыццёвы шлях Лявона Вітан-Дубейкаўскага // Вольскі і Памідораў з песняй пра немца Адвакат, паэт, народны заступнік Ашмянскі веснікВ Минске появится площадь Богушевича и улица Сырокомли, Белорусская деловая газета, 19 июля 2001 г.Айцец беларускай нацыянальнай ідэі паўстаў у бронзе Сяргей Аляксандравіч Адашкевіч (1918, Мінск). 80-я гады. Бюст «Францішак Багушэвіч».Яўген Мікалаевіч Ціхановіч. «Партрэт Францішка Багушэвіча»Мікола Мікалаевіч Купава. «Партрэт зачынальніка новай беларускай літаратуры Францішка Багушэвіча»Уладзімір Іванавіч Мелехаў. На помніку «Змагарам за родную мову» Барэльеф «Францішак Багушэвіч»Памяць пра Багушэвіча на Віленшчыне Страчаная сталіца. Беларускія шыльды на вуліцах Вільні«Krynica». Ideologia i przywódcy białoruskiego katolicyzmuФранцішак БагушэвічТворы на knihi.comТворы Францішка Багушэвіча на bellib.byСодаль Уладзімір. Францішак Багушэвіч на Лідчыне;Луцкевіч Антон. Жыцьцё і творчасьць Фр. Багушэвіча ў успамінах ягоных сучасьнікаў // Запісы Беларускага Навуковага таварыства. Вільня, 1938. Сшытак 1. С. 16-34.Большая российская1188761710000 0000 5537 633Xn9209310021619551927869394п

Partai Komunis Tiongkok Daftar isi Kepemimpinan | Pranala luar | Referensi | Menu navigasidiperiksa1 perubahan tertundacpc.people.com.cnSitus resmiSurat kabar resmi"Why the Communist Party is alive, well and flourishing in China"0307-1235"Full text of Constitution of Communist Party of China"smengembangkannyas

ValueError: Expected n_neighbors <= n_samples, but n_samples = 1, n_neighbors = 6 (SMOTE) The 2019 Stack Overflow Developer Survey Results Are InCan SMOTE be applied over sequence of words (sentences)?ValueError when doing validation with random forestsSMOTE and multi class oversamplingLogic behind SMOTE-NC?ValueError: Error when checking target: expected dense_1 to have shape (7,) but got array with shape (1,)SmoteBoost: Should SMOTE be ran individually for each iteration/tree in the boosting?solving multi-class imbalance classification using smote and OSSUsing SMOTE for Synthetic Data generation to improve performance on unbalanced dataproblem of entry format for a simple model in KerasSVM SMOTE fit_resample() function runs forever with no result