博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
「总结」 高斯消元
阅读量:6958 次
发布时间:2019-06-27

本文共 981 字,大约阅读时间需要 3 分钟。

我是不是太菜了,现在什么都不会.

过程

  1. 对于每一个未知元求解.
  2. 对于一个未知元\(x_i\),找到对应系数的绝对值的最大的那一个方程.
  3. 如果这个东西是0,那么就无唯一解.
  4. 然后把第\(i\)行和最大的那一行交换,然后消元.
  5. 重复1

最后每一行的常数就是对应的解.

代码实现

/*  mail: mleautomaton@foxmail.com  author: MLEAutoMaton  This Code is made by MLEAutoMaton*/#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;#define ll long long#define re register#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)inline int gi(){ int f=1,sum=0;char ch=getchar(); while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();} return f*sum;}const int N=110;double a[N][N];int n;const double eps=1e-10;bool Gauss(){ for(int i=1;i<=n;i++)//Delete x_i { int k=i; for(int j=i+1;j<=n;j++) if(fabs(a[j][i])>fabs(a[k][i]))k=j; if(fabs(a[k][i])

转载于:https://www.cnblogs.com/mle-world/p/10646685.html

你可能感兴趣的文章
Cassandra创建用户
查看>>
python socket模拟游戏开服
查看>>
可变长参数列表误区与陷阱——va_arg不可接受的类型
查看>>
说说自己对nofollow标签的一些看法
查看>>
通过URL参数请求不同的后端服务器
查看>>
OC Xcode 注释插件VVDocumenter-Xcode
查看>>
安装Windows7系统
查看>>
SElinux以及防火墙的关闭
查看>>
android中dip、dp、px、sp和屏幕密度
查看>>
MySQL 可以用localhost 连接,但不能用IP连接的问题
查看>>
linux学习(之二)-初识linux的一些常用命令
查看>>
linux基础系统管理---系统管理
查看>>
重启网络出现RTNETLINK answers: File exists问题解决
查看>>
清空微信浏览器缓存debug页面清除法
查看>>
组策略 之 正确理解STARTER GPO
查看>>
分布式搜索elasticsearch的5种分片查询优先级
查看>>
python + selenium 弹出Alert提示窗, 自动确认。python语法注意
查看>>
PHP htmlspecialchars和htmlspecialchars_decode(函数)
查看>>
adt-bundle-windows-x86 出现的问题
查看>>
VHD and BitLocker
查看>>