[vsni.co.uk] Contact us
Author Message
Post new topic

  GenStat  ~  Rearrange rows/columns of a matrix

Posted: Sun Apr 22, 2018 11:05 pm Reply with quote
Thanks Rodger

I’m running a simulation so the matrices generated are likely to be in different orders, of which I don’t know what they will be. However, knowing it can be done, I will work with your solution and see if I can adapt it.

Thanks for your time and solution.

From: GENSTAT-Request [mailto:GENSTAT@jiscmail.ac.uk] On Behalf Of Rodger White
Sent: Friday, 20 April 2018 8:17 PM
Subject: Re: Rearrange rows/columns of a matrix

You need to use a qualified identifier with a variable for the symmetric matrix in a calculate statement

Symmetric [row=4; val=*,2,*,0,1,*,3,0,0,*] sa
Variate [val=2,3,4,1] roword
Calc [pr=s] sb = sa$[roword]

Print sa
Print sb


Rodger White
Statistics Group
Centre for Computational and Systems Biology
Rothamsted Research
West Common
e-mail: rodger.white@rothamsted.ac.uk (rodger.white@rothamsted.ac.uk)
[url=Tel:01582938378(direct]Tel: 01582938378(direct[/url] line)
[url=Tel:01582763133]Tel: 01582763133[/url] ext 2378

From: GENSTAT-Request [mailto:GENSTAT@jiscmail.ac.uk (GENSTAT@jiscmail.ac.uk)] On Behalf Of WRIGHT Carole
Sent: 20 April 2018 04:23
Subject: Rearrange rows/columns of a matrix


Does anyone know how to rearrange the rows and columns of a symmetric matrix based on the row/column labels? For example, if I have the following matrix

4 *
1 2.0000 *
2 0.0000 1.0000 *
3 3.0000 0.0000 0.0000 *
4 1 2 3

can I rearrange it to be

1 *
2 1.0000 *
3 0.0000 0.0000 *
4 2.0000 0.0000 3.0000 *
1 2 3 4


The information in this email together with any attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. There is no waiver of any confidentiality/privilege by your inadvertent receipt of this material.
Any form of review, disclosure, modification, distribution and/or publication of this email message is prohibited, unless as a necessary part of Departmental business.
If you have received this message in error, you are asked to inform the sender as quickly as possible and delete this message and any copies of this message from your computer and/or your computer system network.

Rothamsted Research is a company limited by guarantee, registered in England at Harpenden, Hertfordshire, AL5 2JQ under the registration number 2393175 and a not for profit charity number 802038.

Post generated using Mail2Forum (http://www.mail2forum.com)

Display posts from previous:  

All times are GMT
Page 1 of 1
Post new topic

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum