📄 aar_nullityr.c
字号:
/* .h freeware http://groups.yahoo.com/group/mathc/ */
/* --------------------------------- INCLUDES ------------------------------- */
#include "v_ahfile.h"
/* ------------------------------------- FUNCTION -------------------------- */
/* Do : */
/* */
/* -------------------------------------------------------------------------- */
void gjA(int n)
{
int i;
int col1;
int col2;
int rank;
int coldim;
int nullity;
double pbv [MXR][MXC];mR mv ={MXR,MXC,&pbv [0][0]};
double pbvT [MXR][MXC];mR mvT ={MXR,MXC,&pbvT [0][0]};
mv.rows = n; mv.cols = (n+1);
mvT.rows = n; mvT.cols = n ;
/*-------------------------------- PROGRAM ---------------------------------- */
rnd0_mR(&mvT,4);
zeros_mR(&mv);
copy_mR(&mvT,&mv);
for(i=0;i<4;i++)
{
col1 = rndp0_I(n-1);
col2 = rndp0_I(n-1);
copy_r_R(&mv,col1,&mv,col2);
}
clrscrn();
printf("\n rank(A) + nullity(A) = coldim(A)\n");
printf("\n If the augmented matrixof the system is :\n");
p_mR( &mv);
gaussjordan_mR( &mv);
printf("\n The reduced row echelon form is :\n");
p_mR( &mv);
rank = rank_mR(&mv);
coldim = coldim_mR(&mv);
printf("\n coldim = %d; rank = %d; \n",coldim,rank);
nullity = nullity_mR(&mv);
printf("\n coldim(A) - rank(A) = nullity = %d \n",nullity);
}
void hello(void)
{
printf("\n Freeware by : xhunga bernard 06000 Nice France.\n");
printf("\n ");
printf("\n rank(A) + nullity(A) = coldim(A) ");
printf("\n ******************************** \n");
printf("\n The size of mv : 2x3 ... 4x5. \n");
printf("\n ex : \"nullityI.exe\" \n");
printf("\n You can choose the size : \n");
printf("\n ex : \"nullityI.exe 2\" -> mA 2x3 ");
printf("\n \"nullityI.exe 3\" -> mA 3x4 ");
printf("\n \"nullityI.exe 4\" -> mA 4x5 ");
printf("\n\n ");
printf("\n Distributed by : http://www.simtel.net/ ");
printf("\n ");
printf("\n Press Return to continue ");
printf("\n ");
getchar();
}
/* --------------------------------- MAIN ----------------------------------- */
int main(int argc, char *argv[])
{
time_t t;
int n = 2;
/*-------------------------------- PROGRAM ---------------------------------- */
srand(time(&t));
hello();
do
{
if( argc == 2 && atoi(argv[1]))
{ n = atoi(argv[1]); if( n > 6){n=6;}}
else
{
++n;
if(n>6){n=2;}
}
if(n<2){n=2;}
gjA(n);
printf("\n Press 'X' Return to stop :\n");
} while(toupper(getchar())!='X');
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -