Re: mirror image of a square matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg66335] Re: [mg66318] mirror image of a square matrix
- From: Sseziwa Mukasa <mukasa at jeol.com>
- Date: Wed, 10 May 2006 06:33:23 -0400 (EDT)
- References: <200605090635.CAA18543@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On May 9, 2006, at 2:35 AM, ravi wrote:
> Let me define the mirror image of a matrix as the operation of
> flipping
> the columns such that the last column becomes the first, the second
> last becomes the second and so on. I would like to know if this can be
> done simpler than as follows:
>
> mat=Table[Random[],{n},{n}]
> matR=Transpose[Reverse[Transpose[mat]]]
You can avoid the transposition with:
matR=Reverse/@mat
Alternatively you can do
matR=mat[[All,Range[Last[Dimensions[mat]],1,-1]]]
> Are there any built in functions for operations like these?
Not for this particular one, although there is the
LinearAlgebra`MatrixManipulation package.
Regards,
Ssezi
- References:
- mirror image of a square matrix
- From: "ravi" <rv15i@yahoo.se>
- mirror image of a square matrix