Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 418346#include"typedef.h"1#include"getput.h"2#include"longtools.h"345int INFO_LEVEL;6int SFLAG;789main (int argc, char *argv[])10{1112matrix_TYP **A, **B, **X;13int i, Aanz, Banz;141516read_header(argc, argv);17if(FILEANZ != 1 && FILEANZ != 2)18{19printf("Usage: %s 'file1' ['file2']\n", argv[0]);20printf("\n");21printf("file1: matrix_TYP containing the matrices A_i\n");22printf("file2: matrix_TYP containing the matrices B_i\n");23printf("\n");24printf("Calculates matrices X_i such that A_i X_i = B_i for all matrices\n");25printf("A_i in file1. If 'file2' is omitted the B_i are assumed to be 0.\n");26printf("\n");27printf("Cf. Gauss.\n");28if (is_option('h')){29exit(0);30}31else{32exit(31);33}34}3536if (is_option('h')){ INFO_LEVEL = optionnumber('h');}37if (INFO_LEVEL & 8){38SFLAG = 1;39}4041A = mget_mat (FILENAMES[0], &Aanz);42if(FILEANZ == 2){43B = mget_mat(FILENAMES[1], &Banz);44}45else{46Banz = 0;47}48if(Aanz > 1)49printf("#%d\n", Aanz);50for(i=0;i<Aanz;i++)51{52if(i<Banz)53X = long_solve_mat(A[i], B[i]);54else55X = long_solve_mat(A[i], NULL);56if(X[0] != 0)57{58put_mat(X[0], NULL, "inhomogenous solution", 2);59free_mat(X[0]);60}61else if (i<Banz && B[i] != NULL){62printf("there does not exists an inhomogenous solution\n");63}64if(X[1] != NULL)65{66put_mat(X[1], NULL, "homogenous solutions as columns", 0);67free_mat(X[1]);68}69free(X);70}7172for (i=0;i<Aanz;i++) free_mat(A[i]);73for (i=0;i<Banz;i++) free_mat(B[i]);74free(A);75if (B!=NULL) free(B);76if (INFO_LEVEL & 8){77pointer_statistics(0,0);78}7980exit(0);81}828384