Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9509

Re: How to Invert Rows and Columns for a Grid of List of Lists

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: How to Invert Rows and Columns for a Grid of List of Lists
Date 2012-04-07 10:03 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jlp3dv$18c$1@smc.vnet.net> (permalink)
References <201204061002.GAA23061@smc.vnet.net>

Show all headers | View raw


a = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
b = {{1, 4, 7}, {2, 5, 8}, {3, 6, 9}};

rules = Thread[Flatten /@ (a -> b)]

{1 -> 1, 2 -> 4, 3 -> 7, 4 -> 2, 5 -> 5, 6 -> 8, 7 -> 3, 8 -> 6,
 9 -> 9}

(a /. rules) == b

True


Bob Hanlon

On Fri, Apr 6, 2012 at 6:02 AM,  <brtubb@pdmusic.org> wrote:
> Consider two lists
>
> a = {{1,2,3},{4,5,6},{7,8,9}};
> b = {{1,4,7},{2,5,8},{3,6,9}};
>
> I want to transform a "into" b for use in a project for displaying chord diagrams in a GraphicsGrid. the list values will be used to indicate ArrayPlot scale fingering "dots" for any given tuning. The Riffle function would seem to be the most likely candidate, other than a "brute force" user defined function to do a rules table.
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: How to Invert Rows and Columns for a Grid of List of Lists Bob Hanlon <hanlonr357@gmail.com> - 2012-04-07 10:03 +0000

csiph-web