Permute matrix columns to find the matrix with biggest trace

I am trying to make a Labview Vi that picks any 3x3 matrix and permutes the columns (not rows!) until it gets the ordenation that has a greatest trace (sum of diagonal elements). The program should also allow a sign change of the elements of one or more columns. If I am not wrong for a given 3x3 matrix and considering the column sign change there are 36 possible matrices, and the program should automatically show the one with greatest trace
For example: 
 1   6    3                                             6   -1   -3
-8  -2    4   should be converted to        -2    8   -4
 3   2   -7                                             2   -3    7
I know it should be a quite simple program, but after spending several hours with L. V. 8.5  I end with a too complicated block diagram that does not work.
Ideally the program should also show of the permutation/sign change that has given the greatest trace but this part I think I am capable to do by myself.
Message Edited by obarriel on 12-28-2009 06:00 PM

Sorry, I pasted the wrong permutation matrix diagram constant for some reason. As you can see, it has only two unique permutations instead of six. Silly! You can easily paste Darin's permutation matrix and it will work correctly.
Here's a more general version that generates all permutations on the fly (LV 8.5). It does a 10x10 in under two seconds (3628800 permutations!).
See if this works better for you.
The permutation algorithm is from wikipedia:
For every number k, with 0 = k < n!, the following algorithm generates a unique permutation of the initial sequence sj, j = 1, ..., n:  
function permutation(k, s) {
     for j = 2 to length(s) {
        swap s[(k mod j) + 1] with s[j]; // note that our array is indexed starting at 1
        k := k / j;        // integer division cuts off the remainder
     return s;
NOTE: Indexing in LabVIEW starts at 0, so the code is changed accordingly.
For larger matrices you'll run out of steam very quickly because the permutations increase with N factorial. I am sure there would be a much more
intelligent algorithm to solve all that in much less time.
Message Edited by altenbach on 12-29-2009 09:31 AM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
MaxTraceCA2.vi ‏27 KB
MaxTraceCA2.png ‏61 KB

Similar Messages

  • HT204382 I purchased icloud on my iPhone but i don't know how to coordinate with my macbook pro or add info like music.  Does all of my activity show up on both of the devices? Also how do I find the iphone with the macbook or ipad that I plan on purchasi

    I dont know how to use icloud on the mac book when I bought it on the phone..I need to know how to find the iphone with my mac book

    http://www.apple.com/iphone/icloud/

  • How do I find the screen with my personal iPod (my name's iPod) so I can download from my purchased or free songs/pods from my computer? My iPod has opened to that for 3 years and this week I can't find it: not on purchased page or on Apple store page.

    QUESTION from an American in India:
    How do I find the screen with my personal iPod (my name's iPod) so I can download from my purchased or free songs/pods from my computer? My iPod has opened to that for 3 years and this week I can't find it: not on purchased page or on Apple store page.

    See:
    Recovering your iTunes library from your iPod or iOS device: Apple Support Communities

  • Hi Everyone.  I have an old Mac Book.  I have saved a ton of emails in my inbox 'On My Mac'.  There are so many it is slowing down my computer.  Where do I find the folder with all the emails so I can cut and paste them to an external hard drive?Pls.help.

    Hi Everyone.  I have an old Mac Book with software updated to 10.6.8.  I have saved a ton of emails in my inbox 'On My Mac'.  There are so many it is slowing down my computer.  Where do I find the folder with all the emails so I can cut and paste them to an external hard drive? Pls.help.  Tks.

    Depending on which email client software you use
    the files should be in 'your home folder' library, esp.
    if you use Mail application.... ~/Library/Mail
    Since you don't specify what mail application,
    that would most be associated with the file.
    I notice there are some items to the right of your post
    where it says "more like this' so that may be worth a
    look to see if similar issues were answered. Also, the
    Help viewer in your system is a searchable database.
    Seems that google also brings up fair information, too.
    Do you have a complete bootable clone of your entire
    Mac system on an externally enclosed hard disk drive?
    Good luck & happy computing!

  • Does anyone know what the file "memeodhelper is? It's preventing me from backing up my home directory. I can't even find the file with search. Hidden somehow?

    I would like to backup my Mac by copying my home directory to an external disk. When I try this, it always gets hung up on a file called "memeodhelper" saying I don't have permission to access the file and the paste stops. Can't find the file with a search. Any ideas?

    Hi Ray,
    Spotlight is no good for finding anything Apple thinks you don't need to find.
    You can "fix" that error...
    http://www.somewhereville.com/?tag=memeodhelper
    Or likely trash it...
    https://discussions.apple.com/message/11237019?messageID=11237019&tstart=0#11237 019?messageID=11237019&tstart=0
    Find Any File...
    http://apps.tempel.org/FindAnyFile/
    Hold Option or alt key when selecting Find to Find All.
    EasyFind...
    http://www.devon-technologies.com/download/
    Near the bottom of the page.

  • With the new software for the I phone it appears 12 000 mails without reading and I can't find the solution, With the new software for the I phone it appears 12 000 mails without reading and I can't find the solution

    With the new software for the I phone it appears 12 000 mails without reading and I can't find the solution, With the new software for the I phone it appears 12 000 mails without reading and I can't find the solution

    Actually your suggestions are the ones that i have tried. i have seen that you have tried to help others with this issue and the only one that i could find that said they found the problem said that it was an ilife update issue and it fixed it and i have no available updates. i know it has to do with something in photo stream because it happens when i create a new library and it is loading the photos but i get the message before i reach the maximum 1000 photos. so i've tried updating, new library(first backing up photos and then deleting them from iPhoto), reinstalling OSX many times, running disc utilities. I called Apple the first day i had this issue and i was the first person to call them for support with the retina display and i actually had it escalated to a senior advisor and we thought we fixed the problem but we did not. i am pretty fluent in dealing with troubleshooting these type of issues and this is the first time i'm reaching out to the community. i figured now that the retina has been out some time now that there would be an obvious answer to this issue. thanks for the quick reply.
    Bebers5

  • I am using iPhone 3GS. I am living in Saudi Arabia. I cannot find the directions with in GCC contries in the Navigation Application "COMPASS" of iphone. Can you please explain me how to work on it??

    I am using iPhone 3GS. I am living in Saudi Arabia. I cannot find the directions with in GCC contries in the Navigation Application "COMPASS" of iphone. Only the map is displayed. I am not gtting the directions or information when I use it. Can you please explain me how to work on it??

    See http://kb.mozillazine.org/Editing_configuration#How_to_edit_configuration_files
    Add code to [http://kb.mozillazine.org/UserChrome.css userChrome.css] below the @namespace line.
    <pre><nowiki>@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    #context-sendlink {display:none !important;}</nowiki></pre>
    See also http://kb.mozillazine.org/Chrome_element_names_and_IDs

  • How can I find the element with the closest value to a calculated "target value" in a 1D array?

    Hello all,
    may be the following question is very simple, but I am relatively new in labview and it would be great if somebody could help me:
    I have a acquaried 1D array of data-points. Now, I have to find the element in this array which value is the closest to a calculated "target value".
    After finding the element with the value close to the "target value", I have to get the position of this element (i.e. the index) in the 1D array.
    Now, I have to use this index to find and extract the element at this position in an other 1D array.
    It would be very nice if somebody could help me with this problem.
    Thank you,
    beam

    Find attached a sample vi that you can modify.
    Attachments:
    select_target_value.vi ‏22 KB

  • TS1424 there are 43 available apps' update  which couldn't be made with my current account. How i can find the account with which i bought them in order to update them

    there are 43 available apps' update  which couldn't be made with my current account. How i can find the account with which i bought them in order to update them

    Use get info in iTunes on your Mac.

  • FindChildIndex cannot find the child with the given itemName

    Hi,
    I am getting error " findChildIndex cannot find the child with the given itemName" when runs the page from jdeveloper.
    I didnt use findChildIndex in my CO or AM.
    Please help me to resolve it.
    Thanks
    Amit Jaitly

    Amit
    Check old threads
    Re: how to call concurrent programs from oaf page
    http://forums.oracle.com/forums/search.jspa?threadID=&q=findChildIndex+cannot+find+the+child+with+the+given+itemName&objID=f210&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks
    AJ

  • I purchased an ipad for my husband in 12/2011 - it was stolen last night and i can't find the receipt with insurance and warranty

    I purchased an ipad for my husband in 12/2011 - it was stolen last night and i can't find the receipt with insurance and warranty.

    The warraty doesn't cover lost or stolen.
    If the iPad was running iOS 7, the thief/finder will not ever be able to use it.
    iCloud: Find My iPhone Activation Lock in iOS 7
    http://support.apple.com/kb/HT5818
    Apple (and no one else) can not assist (with serial number or iCloud) in finding a lost or stolen iPad.
    Report to police along with serial number. Change all your passwords.
    These links may be helpful.
    How to Track and Report Stolen iPad
    http://www.ipadastic.com/tutorials/how-to-track-and-report-stolen-ipadhttp://www.ipadastic.com/tutorials/how-to-track-and-report-stolen-ipad
    Reporting a lost or stolen Apple product
    http://support.apple.com/kb/ht2526
    What to do if your iOS device is lost or stolen
    http://support.apple.com/kb/HT5668
    iCloud: Locate your device on a map
    http://support.apple.com/kb/PH2698
    iCloud: Lost Mode - Lock and Trace
    http://support.apple.com/kb/PH2700
    iCloud: Remotely Erase your device
    http://support.apple.com/kb/PH2701
    Report Stolen iPad Tips and iPad Theft Prevention
    http://www.stolen-property.com/report-stolen-ipad.phphttp://www.stolen-property.com/report-stolen-ipad.php
    How to recover a lost or stolen iPad
    http://ipadhelp.com/ipad-help/how-to-recover-a-lost-or-stolen-ipad/
    How to Find a Stolen iPad
    http://www.ehow.com/how_7586429_stolen-ipad.htmlhttp://www.ehow.com/how_7586429_stolen-ipad.html
    What NOT to do if your iPhone or iPad is lost or stolen
    http://www.tomahaiku.com/what-not-to-do-if-your-iphone-or-ipad-lost-or-stolen/http://www.tomahaiku.com/what-not-to-do-if-your-iphone-or-ipad-lost-or-stolen/
    Apple Product Lost or Stolen
    http://sites.google.com/site/appleclubfhs/support/advice-and-articles/lost-or-st olen
    Oops! iForgot My New iPad On the Plane; Now What?
    http://online.wsj.com/article/SB10001424052702303459004577362194012634000.html
    If you don't know your lost/stolen iPad's serial number, use the instructions below. The S/N is also on the iPad's box.
    How to Find Your iPad Serial Number
    http://www.ipadastic.com/tutorials/how-to-find-your-ipad-serial-numberhttp://www.ipadastic.com/tutorials/how-to-find-your-ipad-serial-number
    iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number
    http://support.apple.com/kb/HT4061
     Cheers, Tom

  • I can't seem to find the bar with "file, edit, view, etc". I can view it if I press "alt", but when I hit any other key it disappears again. The back and forward arrow, house, refresh and "url" space is missing

    I can't seem to find the bar with "file, edit, view, etc". I can view it if I press "alt", but when I hit any other key it disappears again. The back and forward arrow, house, refresh and "url" space is missing

    * In Firefox 3.6 and later on Windows you can hide the "Menu Bar" via "View > Toolbars" or via the right-click context menu on a toolbar.
    * Press F10 or press and hold the Alt key down to bring up the "Menu Bar" temporarily.
    * Go to "View > Toolbars" or right-click the "Menu Bar" or press Alt+V T to select which toolbars to show or hide (click on an entry to toggle the state).
    See also:
    * [[Menu bar is missing]]
    * http://kb.mozillazine.org/Toolbar_customization

  • HT4812 I recently fixed my computer and need to reinstall logic pro 9 but I can't find the booklet with my serial number, is there any other way I can get the serial number for logic pro 9 (box)?

    I recently fixed my computer and need to reinstall logic pro 9 but I can't find the booklet with my serial number, is there any other way I can get the serial number for logic pro 9 (box)?

    If you still have the receipt or other proof of purchase, you can ask Apple to send you the serial. Otherwise, bad luck mate.. Good news is, you can now buy Logic Pro 9 from App Store for just 199 USD

  • I can't find the device with the help

    I can't find the device with the help https://myxperia.sonymobile.com/
    I want it to tie to the new mailbox

    You can try google device manager instead.
    All we have to decide is what to do with the time that is given to us - J.R.R. Tolkien

  • I have got a new pc and want to save the bookmarks. Where do I find the folder with the bookmarks?

    I have got a new pc and I want to save the old bookmarks. Where do I find the folder with bookmarks?

    See this:
    http://support.mozilla.com/en-US/kb/Recovering+important+data+from+an+old+profile

Maybe you are looking for

  • Error Message for the cancellation of paid billing document

    Hi, Can i create and error message for the cancellation of paid billing document? If yes, how can i create such. Overview: Accounting document is created upon creation of billing document. Upon payment, document cleared is the accounting document cre

  • My Computer monitor wont turn on

    Hello.Today i noticed that my desktop PC's monitor wont turn on.I tried various method es to configure this problem but nothing worked. My Desktop model is :HP Media Center m7250n Desktop PC. My Monitor Number Is HP w2007.Please Reply!

  • No sound on music videos

    I download music videos from a peer to peer group. They all seem to come in a Movie File (mpeg) format. I have loaded one on to my ipod and the video played ok but there was no sound. To check the ipod was ok I downloaded a couple from the itunes sto

  • Providing files for editors

    I work with a large company in Burbank, California and we are currently providing video content on Dbeta to affiliates and news organizations. Earlier this year we started providing the same content over the internet. The end user can sign on and dow

  • Merging records through C# code

    Below is the offending code. Merge.MergeRecordsWS_MergeRecords_Input mergei = new Merge.MergeRecordsWS_MergeRecords_Input(); Merge.MergeRecordsWS_MergeRecords_Output mergeo; mergei.PrimaryId = LeadID; mergei.DuplicateId = ELead.LeadId; mergei.RecordT