*/
Do you receive the Programmer's Heaven newsletter? If not, why not subscribe?
*/

View \Cinv03.c

Application of the identity matrix II. v05

Submitted By: xhunga
Rating: starstar (Rate It)


/* gjid03.c                         freeware                   [[Email Removed]]
*/


/* --------------------------------- INCLUDES ------------------------------- */
#include "xa_hfile.h"

/* --------------------------------- MAIN ----------------------------------- */
 main()
{

double pb[5][5*TWOCOL]=
{
-1,11,12,11,15,1,
 2,1, -1,14,12,14,1,
-2,10,11,10,13,1,
 2,13,15,1, -3,12,1,
-2,12,11,14,1, -1,1,
};
matrix m ={5,5*TWOCOL,&pb[0][0]};

double pbmAID [5][10*TWOCOL]; matrix mAID  ={5,10*TWOCOL,&pbmAID [0][0]};
double pbmAIDT[5][10*TWOCOL]; matrix mAIDT ={5,10*TWOCOL,&pbmAIDT[0][0]};
double pbinv  [5][5*TWOCOL];  matrix minv  ={5,5*TWOCOL,&pbinv   [0][0]};
double pbT    [5][5*TWOCOL];  matrix mT    ={5,5*TWOCOL,&pbT     [0][0]};
double pbID   [5][5*TWOCOL];  matrix mID   ={5,5*TWOCOL,&pbID    [0][0]};
/*-------------------------------- PROGRAM ---------------------------------- */
 copymF  (&m,&mT);
 copymAID(&m,&mAID);

 clrscrn();
 printf(" The matrix  mA \n");
 printmF2(&m);
 getchar();

 printf("\n");
 printf(" The matrix  mA_ID \n");
 printmF2(&mAID);
 getchar();

 clrscrn();
 printf(" Find mID (below the pivots) \n");
 idF4(&mID,&m);
 printmF2(&mID);
 getchar();

 printf("  mID * mA_ID \n");
 multmF(&mID,&mAID,&mAIDT);
 printmF2(&mAIDT);
 getchar();

 multmF(&mID,&mT,&m);

 clrscrn();
 printf(" Find mID (above the pivots) \n");
 idF4a(&mID,&m);
 printmF2(&mID);
 getchar();

 printf("  mID * mA_ID  \n");
 multmF(&mID,&mAIDT,&mAID);
 printmF2(&mAID);
  getchar();

 clrscrn();
 printmF2(&mAID);
 printf("\n");
 printf("The inverse matrix is : \n");
 copyinv(&mAID, &minv);
 printmF(&minv);
 getchar();

 copymF(&mT,&m);

 printf("\n mA * minv give \n");
 multmF(&m, &minv,&mID);
 printmF(        &mID);

 printf("\n Press return to continue");
 getchar();

 return 0;
}

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.