MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Matrix rows

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65796] Re: Matrix rows
  • From: "J Siehler" <jsiehler at gmail.com>
  • Date: Mon, 17 Apr 2006 02:28:52 -0400 (EDT)
  • References: <e1svao$d0o$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

> If I have a matrix (not square - nearly always has more rows than
> columns). Is there a simple way to check if two (or more) rows are the
> same. I don't need to know how many rows are the same just if any are
> the same. Clearly I could loop through the matrix but this must be of
> order n^2 for an n row matrix.

I don't think you can do better than O(n^2), but you can code it
without looping:

In[1]:=
M1={{1,2,3},{2,5,5},{1,2,3},{2,7,4}};
M2={{1,2,3},{4,5,6},{7,8,9},{10,11,12}};

In[3]:=
DupeQ[m_]:=MatchQ[m,{___,l_,___,l_,___}]

In[4]:=
M1//DupeQ
M2//DupeQ

Out[4]=
True

Out[5]=
False


  • Prev by Date: Re: Transfer function animation
  • Next by Date: Re: Help with 3D Drawing please
  • Previous by thread: Re: Matrix rows
  • Next by thread: Re: Matrix rows