以上是我们算法的依据
下面的是例题。
我们用高斯-约旦消元把分块矩阵: A|E 中的A初等变化为E , 整体矩阵变为:
输入右块矩阵即可。
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M = 400+7;
const int mod =1e9+7;
int a[M][M<<1];
ll qpow(ll a,ll b)
{
ll ans=1;
while(b)
{
if(b&1)ans=ans*a%mod;
a=a*a%mod;
b>>=1;
}
return ans;
}
//返回自由元个数,及无穷解个数
bool Gauss(int n,int m)//对矩阵a高斯消元得到(E|C) C为等式右边的列矩阵
{
int row;//当前处理的行
int col;//当前处理的列
for(row=1,col=1;row<=n&&co