判断并将矩阵转化为严格对角占优矩阵
来源:互联网 发布:玲珑醉梦网络剧 编辑:程序博客网 时间:2024/05/16 12:39
% Judge is a matrix is a strict diagonal dominance matrix% and Transform the matrix into a strict diagonal dominance matrix% input:% A: the original matrix% output:% X: the strict diagonal dominance matrix that we transform% t: the time that the transform process takesfunction [X t]= StrictDiagMatrix(A)tic% if the matrix is not a squre matrix,return error if size(A, 1) ~= size(A, 2) error('It is not a square matrix'); end% get the size of the matrix and initial a matrix X to store the output matrix n = size(A,1); X = zeros(n,n);% the record array is used to accord if all the row be set record = zeros(n); for i = 1 : n;% get the absolute value of every element in every row row_max = abs(A(i,:));% find out the max element of the row,and use pos to accord its position in [max_ele,pos] = max(row_max);% check if the max_ele is the realy max element of the row,if not,return error if max_ele <= sum(abs(A(i,:))) - max_ele error('The matrix can not be transformed into a strictly diagonally dominant matrix'); end% set the row pos of matrix X with A(i,:)% accord this row has been set X(pos,:) = A(i,:); record(pos) = 1; end% if there exits any row that has not been set,return error if sum(record) ~= n error('The matrix can not be transformed into a strictly diagonally dominant matrix'); end% output the time it take and output success fprintf('The oringinal matrix input is:\n'); disp(A); fprintf('The time it cost is: ') t = toc; disp(t); fprintf('It can be transformed to a strictly diagonally dominant matrix: \n');end
0 0
- 判断并将矩阵转化为严格对角占优矩阵
- Matlab之将非严格占优矩阵化为严格占优矩阵
- cdf2rdf--复对角矩阵转化为实对角矩阵
- 非严格主对角矩阵的转化(matlab实现)
- 对角矩阵
- 对角矩阵
- 将01矩阵转化为bitmap文件
- sas:将数组转化为矩阵
- Matlab对角矩阵
- diag--创建对角矩阵
- 矩阵对角求和
- 三对角矩阵
- 矩阵块对角
- 【2036】将稀疏矩阵转化为简式
- Householder变换将对称矩阵化为三对角形式
- Matlab实现——严格对角占优三对角方程组求解(高斯赛尔德Gauss-Seidel迭代、超松弛)
- 层次分析法(AHP) 将评判矩阵转化为权重矩阵代码实现 MATLAB
- vector转化为Mat矩阵
- ConcurrentHashMap
- python小项目1
- 一款功能强大的设备调试、接口调试工具
- const、static关键字
- 自定义TextView显示偏移问题
- 判断并将矩阵转化为严格对角占优矩阵
- 第三方cocoaPods管理工具的安装步骤
- Android控件架构
- day02
- 类初始化列表
- 轻松搞定Linux端口转发
- 心情无聊透底
- Go语言核心之美 3.6-template模版
- [转]php-fpm配置详解