//@ All rights reserved by Liu Huan. Source from: https://doi.org/10.58473/JQPMC0010
#include <bits/stdc++.h>
using namespace std;
int a[101][101],b[101][101],c[101][101],d[101][101],e[101][101],f[101][101],g[101][101],H[101][101],I[101][101],J[101][101],K[101][101],L[101][101],M[101][101],N[101][101],O[101][101],P[101][101],Q[101][101],R[101][101];
int main ()
{
cout << "\n=== Input the values' amount (n) for each array ===" << endl;
int i,j,n,t;
cin>>n;
cout << "\n=== Input the values (0 or 1) for n*8 Yin matrix [j] (leaving a space between values) ===" << endl;
for(i=1;i<=n;i++)
for(j=1;j<=8;j++)
cin>>a[j]; //input the value in Yin array£¬a[j] can be 0 or 1
cout << "\n=== Input the values (0 or 1) for n*8 Yang matrix [j] (leaving a space between values) ===" << endl;
for(i=1;i<=n;i++)
for(j=1;j<=8;j++)
cin>>b[j]; // input the value in Yang array£¬b[j] can be 0 or 1
cout<<endl;
cout << "\n=== In total 8 Matrices (n*n) to show the interaction between Yin and Yang matrix ===" << endl;
for(i=1;i<=8;i++)
for(j=1;j<=n;j++)
c[j]=b[j]; // To calculate the inverted Yang matrix
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
for(t=1;t<=8;t++)
{
d[j]+=a[t]*c[t][j]; // To calculate the Yin Matrix multiplied by the inverted Yang Matrix
}
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
cout<<d[j]<<" "; // Output the matrix of the Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£©
cout<<endl;
}
cout<<endl;
for(i=1;i<=n;i++)
{
for(j=1;j<=8;j++)
{
if(j==1) e[j]=a[8];
else e[j]=a[j-1]; // The transformed Yin Matrix after it circles to the next grid at the clockwise direction
}
}
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
for(t=1;t<=8;t++)
f[j]+=e[t]*c[t][j]; // To calculate the result of the transformed Yin Matrix multiplied by the inverted Yang Matrix
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
cout<<f[j]<<" "; // Output the matrix of Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£©
cout<<endl;
}
cout<<endl;
for(i=1;i<=n;i++)
{
for(j=1;j<=8;j++)
{
if(j==1) g[j]=e[8];
else g[j]=e[j-1]; // The transformed Yin Matrix after it circles to the next grid at the clockwise direction again
}
}
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
for(t=1;t<=8;t++)
H[j]+=g[t]*c[t][j]; // To calculate the result of the transformed Yin Matrix multiplied by the inverted Yang Matrix
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
cout<<H[j]<<" "; // Output the matrix of Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£©
cout<<endl;
}
cout<<endl;
for(i=1;i<=n;i++)
{
for(j=1;j<=8;j++)
{
if(j==1) I[j]=g[8];
else I[j]=g[j-1]; // The transformed Yin Matrix after it circles to the next grid at the clockwise direction again
}
}
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
for(t=1;t<=8;t++)
J[j]+=I[t]*c[t][j]; // To calculate the result of the transformed Yin Matrix multiplied by the inverted Yang Matrix
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
cout<<J[j]<<" "; // Output the matrix of Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£©
cout<<endl;
}
cout<<endl;
for(i=1;i<=n;i++)
{
for(j=1;j<=8;j++)
{
if(j==1) K[j]=I[8];
else K[j]=I[j-1]; // The transformed Yin Matrix after it circles to the next grid at the clockwise direction again
}
}
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
for(t=1;t<=8;t++)
L[j]+=K[t]*c[t][j]; // To calculate the result of the transformed Yin Matrix multiplied by the inverted Yang Matrix
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
cout<<L[j]<<" "; // Output the matrix of Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£©
cout<<endl;
}
cout<<endl;
for(i=1;i<=n;i++)
{
for(j=1;j<=8;j++)
{
if(j==1) M[j]=K[8];
else M[j]=K[j-1]; // The transformed Yin Matrix after it circles to the next grid at the clockwise direction again
}
}
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
for(t=1;t<=8;t++)
N[j]+=M[t]*c[t][j]; // To calculate the result of the transformed Yin Matrix multiplied by the inverted Yang Matrix
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
cout<<N[j]<<" "; // Output the matrix of Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£©
cout<<endl;
}
cout<<endl;
for(i=1;i<=n;i++)
{
for(j=1;j<=8;j++)
{
if(j==1) O[j]=M[8];
else O[j]=M[j-1]; // The transformed Yin Matrix after it circles to the next grid at the clockwise direction again
}
}
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
for(t=1;t<=8;t++)
P[j]+=O[t]*c[t][j]; // To calculate the result of the transformed Yin Matrix multiplied by the inverted Yang Matrix
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
cout<<P[j]<<" "; // Output the matrix of Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£©
cout<<endl;
}
cout<<endl;
for(i=1;i<=n;i++)
{
for(j=1;j<=8;j++)
{
if(j==1) Q[j]=O[8];
else Q[j]=O[j-1]; // The transformed Yin Matrix after it circles to the next grid at the clockwise direction again
}
}
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
for(t=1;t<=8;t++)
R[j]+=Q[t]*c[t][j]; // To calculate the result of the transformed Yin Matrix multiplied by the inverted Yang Matrix
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
cout<<R[j]<<" "; // Output the matrix of Yin Matrix multiplied by the inverted Yang Matrix£¨n*n£©
cout<<endl;
} // In total 8 Matrices£¨n*n£© used for the next statistics.
return 0;
}