/* A program that prints the Frobenius product of two matrices A and B: i.e. trace of the matrix transpose(A)*B. Demonstrating how to use the modulo % operator in accessing indices. */ #include using namespace std; double Frob_product( double A[2][2], double B[2][2] ) { double frob_product = 0.0; for (int i =0 ; i <2 ; ++i) { frob_product +=(A[i][i]*B[i][i] + A[i][(i+1)%2] *B[i][(i+1)%2]); // cout<< "a["<< i <<"]["<<(i+1)%2 <<"] = " << endl; for (int j=0; j<2; ++j) //cout<< "a["<< i <<"]["<