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

std::unique_ptr of base class holding reference of derived class does not show warning in gcc compiler while naked pointer shows it. Why?

Complex numbers z=-3-4i polar form

Find a stone which is not the lightest one

How can I wire a 9-position switch so that each position turns on one more LED than the one before?

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

Apply a different color ramp to subset of categorized symbols in QGIS?

Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?

Was Dennis Ritchie being too modest in this quote about C and Pascal?

How do I check if a string is entirely made of the same substring?

How do I reattach a shelf to the wall when it ripped out of the wall?

Restricting the options of a lookup field, based on the value of another lookup field?

Does the damage from the Absorb Elements spell apply to your next attack, or to your first attack on your next turn?

What is the unit of time_lock_delta in LND?

Multiple fireplaces in an apartment building?

Older movie/show about humans on derelict alien warship which refuels by passing through a star

How to not starve gigantic beasts

Should the Product Owner dictate what info the UI needs to display?

How to have a sharp product image?

What to do with someone that cheated their way through university and a PhD program?

What is the most expensive material in the world that could be used to create Pun-Pun's lute?

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

Why did Rep. Omar conclude her criticism of US troops with the phrase "NotTodaySatan"?

Prove that the countable union of countable sets is also countable

How long after the last departure shall the airport stay open for an emergency return?



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$







  • 2




    $begingroup$
    Try Values[PositionIndex[M]]
    $endgroup$
    – Coolwater
    2 hours ago










  • $begingroup$
    @Coolwater If there is a unique row, your method will fail. At least one needs to delete if list has length 1
    $endgroup$
    – Okkes Dulgerci
    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$







  • 2




    $begingroup$
    Try Values[PositionIndex[M]]
    $endgroup$
    – Coolwater
    2 hours ago










  • $begingroup$
    @Coolwater If there is a unique row, your method will fail. At least one needs to delete if list has length 1
    $endgroup$
    – Okkes Dulgerci
    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 4 hours ago









m_goldberg

89.1k873200




89.1k873200










asked 5 hours ago









PRGPRG

1028




1028







  • 2




    $begingroup$
    Try Values[PositionIndex[M]]
    $endgroup$
    – Coolwater
    2 hours ago










  • $begingroup$
    @Coolwater If there is a unique row, your method will fail. At least one needs to delete if list has length 1
    $endgroup$
    – Okkes Dulgerci
    1 hour ago












  • 2




    $begingroup$
    Try Values[PositionIndex[M]]
    $endgroup$
    – Coolwater
    2 hours ago










  • $begingroup$
    @Coolwater If there is a unique row, your method will fail. At least one needs to delete if list has length 1
    $endgroup$
    – Okkes Dulgerci
    1 hour ago







2




2




$begingroup$
Try Values[PositionIndex[M]]
$endgroup$
– Coolwater
2 hours ago




$begingroup$
Try Values[PositionIndex[M]]
$endgroup$
– Coolwater
2 hours ago












$begingroup$
@Coolwater If there is a unique row, your method will fail. At least one needs to delete if list has length 1
$endgroup$
– Okkes Dulgerci
1 hour ago




$begingroup$
@Coolwater If there is a unique row, your method will fail. At least one needs to delete if list has length 1
$endgroup$
– Okkes Dulgerci
1 hour ago










2 Answers
2






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
    4 hours ago










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










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


















0












$begingroup$

Here is an alternative.



row, col = Dimensions@M; 

Flatten /@ DeleteDuplicates[Position[#, ConstantArray[0, col]] & /@ Outer[Subtract, M, M, 1]]



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







share|improve this answer











$endgroup$













    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

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    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
      4 hours ago










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










    • $begingroup$
      YOU'RE WELCOME, PRG! =D
      $endgroup$
      – Henrik Schumacher
      3 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
      4 hours ago










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










    • $begingroup$
      YOU'RE WELCOME, PRG! =D
      $endgroup$
      – Henrik Schumacher
      3 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 4 hours ago

























    answered 5 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
      4 hours ago










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










    • $begingroup$
      YOU'RE WELCOME, PRG! =D
      $endgroup$
      – Henrik Schumacher
      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
      4 hours ago










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










    • $begingroup$
      YOU'RE WELCOME, PRG! =D
      $endgroup$
      – Henrik Schumacher
      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
    4 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
    4 hours ago












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




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












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




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











    0












    $begingroup$

    Here is an alternative.



    row, col = Dimensions@M; 

    Flatten /@ DeleteDuplicates[Position[#, ConstantArray[0, col]] & /@ Outer[Subtract, M, M, 1]]



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







    share|improve this answer











    $endgroup$

















      0












      $begingroup$

      Here is an alternative.



      row, col = Dimensions@M; 

      Flatten /@ DeleteDuplicates[Position[#, ConstantArray[0, col]] & /@ Outer[Subtract, M, M, 1]]



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







      share|improve this answer











      $endgroup$















        0












        0








        0





        $begingroup$

        Here is an alternative.



        row, col = Dimensions@M; 

        Flatten /@ DeleteDuplicates[Position[#, ConstantArray[0, col]] & /@ Outer[Subtract, M, M, 1]]



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







        share|improve this answer











        $endgroup$



        Here is an alternative.



        row, col = Dimensions@M; 

        Flatten /@ DeleteDuplicates[Position[#, ConstantArray[0, col]] & /@ Outer[Subtract, M, M, 1]]



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








        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 1 hour ago

























        answered 1 hour ago









        Okkes DulgerciOkkes Dulgerci

        5,5511919




        5,5511919



























            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

            How to create a command for the “strange m” symbol in latex? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)How do you make your own symbol when Detexify fails?Writing bold small caps with mathpazo packageplus-minus symbol with parenthesis around the minus signGreek character in Beamer document titleHow to create dashed right arrow over symbol?Currency symbol: Turkish LiraDouble prec as a single symbol?Plus Sign Too Big; How to Call adfbullet?Is there a TeX macro for three-legged pi?How do I get my integral-like symbol to align like the integral?How to selectively substitute a letter with another symbol representing the same letterHow do I generate a less than symbol and vertical bar that are the same height?

            Българска екзархия Съдържание История | Български екзарси | Вижте също | Външни препратки | Литература | Бележки | НавигацияУстав за управлението на българската екзархия. Цариград, 1870Слово на Ловешкия митрополит Иларион при откриването на Българския народен събор в Цариград на 23. II. 1870 г.Българската правда и гръцката кривда. От С. М. (= Софийски Мелетий). Цариград, 1872Предстоятели на Българската екзархияПодмененият ВеликденИнформационна агенция „Фокус“Димитър Ризов. Българите в техните исторически, етнографически и политически граници (Атлас съдържащ 40 карти). Berlin, Königliche Hoflithographie, Hof-Buch- und -Steindruckerei Wilhelm Greve, 1917Report of the International Commission to Inquire into the Causes and Conduct of the Balkan Wars

            Чепеларе Съдържание География | История | Население | Спортни и природни забележителности | Културни и исторически обекти | Религии | Обществени институции | Известни личности | Редовни събития | Галерия | Източници | Литература | Външни препратки | Навигация41°43′23.99″ с. ш. 24°41′09.99″ и. д. / 41.723333° с. ш. 24.686111° и. д.*ЧепелареЧепеларски Linux fest 2002Начало на Зимен сезон 2005/06Национални хайдушки празници „Капитан Петко Войвода“Град ЧепелареЧепеларе – народният ски курортbgrod.orgwww.terranatura.hit.bgСправка за населението на гр. Исперих, общ. Исперих, обл. РазградМузей на родопския карстМузей на спорта и скитеЧепеларебългарскибългарскианглийскитукИстория на градаСки писти в ЧепелареВремето в ЧепелареРадио и телевизия в ЧепелареЧепеларе мами с родопски чар и добри пистиЕвтин туризъм и снежни атракции в ЧепелареМестоположениеИнформация и снимки от музея на родопския карст3D панорами от ЧепелареЧепелареррр