Re: how to build pattern for a square matrix of reals?
- To: mathgroup at smc.vnet.net
- Subject: [mg98442] Re: how to build pattern for a square matrix of reals?
- From: Szabolcs <szhorvat at gmail.com>
- Date: Fri, 10 Apr 2009 04:50:50 -0400 (EDT)
- References: <email@example.com>
On Apr 8, 12:03 pm, sagra... at gmail.com wrote: > As in subject: how to build a pattern that will specify that given > argument of a function has to be square matrix of reals? Tried with > following for "square matrix" part: > f[x_?MatrixQ[#] && Dimensions[#][] == Dimensions[#][] > &] := ... > but it doesn't seem to be working... > One way is f[mat_] /; MatrixQ[mat, Im[#] == 0 &] && SameQ @@ Dimensions [mat] = ... You forgot the & from the end of your pure functions.