const int N = 10;
 
struct Matice
{
	double m [N][N];
};
 
void add (Matice & a, Matice & b, Matice & c)
{
	for (int i = 0; i < N; i++)
   	   for (int j = 0; j < N; j++)
		   c.m[i][j] = a.m[i][j] + b.m[i][j];
}
 
void mul (Matice  a, Matice  b, Matice & c)
{
	for (int i = 0; i < N; i++)
   	   for (int j = 0; j < N; j++)
	   {
		   double s = 0;
   	       for (int k = 0; k < N; k++)
			   s = s + a.m[i][k] + b.m[k][j];
		   c.m[i][j] = s;
	   }
}
 
Matice x, y, z;
 
void f ()
{
	add (x, y, z);
	 mul (x, y, z);
 
	 add (x, y, x);
	 mul (x, y, x);
}
 
matice_add_mul.txt · Last modified: 2017/04/18 10:26 by 147.32.8.115
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki