[Date Index] [Thread Index] [Author Index]
Re: how to build pattern for a square matrix of reals?
On Apr 8, 2:03 am, 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... > > Thanks. squareRealMatrixQ[___] = False; squareRealMatrixQ[m_?MatrixQ] := SameQ @@ Dimensions[m] && VectorQ[m, Element[#, Reals] &];