/* invert22.c - program to invert 2x2 matrices. * (C) Copyright 1999, by John Halleck * All rights reserved. */ #include /* We have print status messages */ #include "errors.h" /* We have to print final status messages */ #include "matdebug.h" /* The matrix debugging routines would be handy */ #include "qinv.h" /* And we need, of course, the routines we were testing. */ static double final[2][2], given[2][2], working[2][2]; int main() { int status; printf ("Non singular 2 by 2 matrix to invert:\n"); scanf ("%lf%lf%lf%lf", &given[0][0],&given[0][1],&given[1][0],&given[1][1]); matprint ("Inverting:", 2, 2, given); if ((status = invns (2, final, given, working))) { printf ("call failed...\n"); printerror (status); return status; } matprint ("Inverse:", 2, 2, final); return 0; }