这个是只是用行变换将非严格占优矩阵通过行变换转换为严格占有矩阵。

伪代码如下:

Input matrix:A

Output:

If A can transform into a dominance with our method,we can get the dominance.

Else output’Cannot transform the matrix into dominance’

Variable:

Set a matrix record with the size [row_of_matrix,3]

Record[row_length_matrix,3]  %This matrix is for record A’s situation.

% Record[1:,1] first volumn stands for this row of A should be put which row

% Record[1:,2] second volumn stands for whether this row satisfy the necessity of transform into a dominance.If yes,set 1;otherwise 0.

% Record[1:,3] third volumn stands for which initial row belong to.

Flag% this variable is to record whether the matrix A can transform into a dominance.

% If yes,Flag = 1;

% otherwise Flag = 0

% beneath code is to test whether the matrix can transform into a dominance

% and record the situation of every row.

for i = 1:size_of_matrix

Test every row(Record);

If test_row’s Record[1:,2] == 0

then break and output ’Cannot transform the matrix into dominance’

Flag = 0;

end

end

% If Flag = 1,we use row exchangement to transform A into dominance

If Flag = 1

Row_exchangment by record.

for i = 1:row-1

for j = 1:row

if record(j,1) == i         %exchange line if flag = 1,which

%means it can be transformed into dominance

exchange A(i,:) and A(record(j,3),:);

exchange record(j,:) and record(i,:);

break;

end

end

end

Display A;

end

具体实现代码如下:

% Project 1
% SMIE   name:ChenYu   class:1202   nunmber:12353032
% Change nondorminant to dorminant matrix
% this method is adapted for the matrix which can be changed to dorminant
% matrix only using row exchangement
% Input :A matrix
% Output:A matrix which maybe dorminant
function method1(A)
[row,volumn] = size(A);
record = ones(volumn,3);                 %use this matrix to record everyline situation
flag   = 1;                              %first volumn record if the matrix can change to
for i = 1:row                            %dominance,which row the row will

�long.Second volumn record
    every_line                = A(i,:);  %whether the matrix satisfy the necessity

%that everydominance
    record(i,3)               = i;       %third volumn record the rowth
    [record(i,1),record(i,2)] = which_row(every_line);
    if  record(i,2)           == 0
        disp('This Matrix cannot change to dorminant matrix by row exchange.');
        flag                  = 0;
        break;
    end
end
if flag == 1
    for i = 1:row-1
        for j = 1:row
            if record(j,1) == i         %exchange line if flag = 1,which means it can be transformed
                b                = A(i,:);             %into dorminance
                A(i,:)           = A(record(j,3),:);
                A(record(j,3),:) = b;
                temp             = record(j,:);
                record(j,:)      = record(i,:);
                record(i,:)      = temp;
                break;
            end
        end
    end
    disp(A);
end

调用函数:

% function judge_row:
% this function is to judge whether the line is a line of dorminance and
% return which row shuold this line stand
% Input : vector(a row of the matrix)
% Output:if(the line is dorminant) return flag = 1;
%                             else return flag = 0.
function [row,flag] = which_row(a)
n = length(a);
max  = a(1);
flag = 0;
row  = 1;
for i = 2:n
    if max < a(i)          %fing the max value of the line
       max = a(i);         %it's easy for us to know that if the max value is
       row = i;            %larger than the rest of all sum
    end                    %than the line is dorminance
end
and = 0;
for i = 1:n
   if i ~= row             %compare maxvalue and rest sum
        and = and + a(i);
    end
end
if a(row) >= and
    flag = 1;
end

Matlab之将非严格占优矩阵化为严格占优矩阵相关推荐

  1. 如何将一个矩阵化为行阶梯形矩阵

    2016-03-29尾巴线性代数 有同学反映上一课过于冷冰冰,都是一些不带证明的公式.如果线性代数所有公式都要证明的话,线性代数的难度会上好几个量级,有的公式的证明是特别特别难的.还有一个,虽然我们需 ...

  2. matlab把向量转化为矩阵,MATLAB小函数:将列向量转化为0-1矩阵

    MATLAB小函数:将列向量转化为0-1矩阵 将列向量转化为0-1矩阵,例如 A = 1 2 1 5 3 4 1 4 3 转换为: B = 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 ...

  3. MATLAB基础操作,矩阵乘法、数组矩阵索引、最大最小运算符、零矩阵/随机矩阵/单位矩阵的生成、log函数、Inf和NaN的含义,语句过长用连接符换行、逻辑运算符以及区别

    提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 前言 一.矩阵相乘 二.矩阵生成 1.直接输入 2.单位矩阵 3.全零矩阵 2.全一矩阵 2.随机矩阵 三.矩阵操作 四.矩 ...

  4. 如何将矩阵化为约旦标准型_【解题方法】矩阵初等变换的应用

    [本文为了赚点知乎盐值而写, 供各位同学一笑 :P] 本文将介绍并总结矩阵初等变换的一系列的解题应用包括,内容全部整理自本人本科期间的学习笔,对于正在学习高等代数的同学解题应该很有用. 本文主要内容 ...

  5. matlab矩阵定义、矩阵元素引用、矩阵操作

    矩阵定义 直接输入法 A=[1 2 3;4 5 6;7 8 9] 矩阵用方括号 "[ ]" 括起 矩阵同一行中的元素之间用 空格 或 逗号 分隔 矩阵行与行之间用 分号 分开 直接 ...

  6. 矩阵化为最简型矩阵JAVA语言实现――线性代数

    目录 文章目录 前言 一.输入矩阵的信息 二.矩阵的初始处理 三.矩阵的进一步处理 四.显示最终结果 五.代码使用过程 六.整体代码 总结 文章目录 文章目录 前言 一.输入矩阵的信息 二.矩阵的初始 ...

  7. matlab riccati法 临界转速,利用传递矩阵法和Riccati传递矩阵法分析转子临界转速...

    利用传递矩阵法和Riccati传递矩阵法分析转子临界转速 利用传递矩阵法和Riccati传递矩阵法分析转子临界转速 一. 所需求解转子参数 将转子简化为如下所示: 三个盘的参数为: 另,阶梯轴的三段轴 ...

  8. Matlab学习笔记——矩阵求幂和矩阵指数

    写在这里的初衷,一是备忘,二是希望得到高人指点,三是希望能遇到志同道合的朋友. 目录 矩阵求幂和矩阵指数 矩阵求幂和矩阵指数 利用MATLAB对矩阵求幂可以很容易地得到结果,例如: 矩阵求幂 元素对元 ...

  9. matlab中predictor怎么填,在MATLAB中求解非線性有限元

    我嘗試在MATLAB中求解帶有節點熱源的四面體有限元的熱擴散問題,這個節點取決於解矢量.非線性方程系統如下:在MATLAB中求解非線性有限元 乙U」 + A U = Q(T) 與B是熱capactiy ...

最新文章

  1. leetcode刷题 153.寻找旋转排序数组中的最小值
  2. php免费下载手册,php手册|php中文手册下载|好特下载
  3. n皇后问题c语言_用栈解决N皇后问题(C语言)
  4. Android 折线图(MPAndroidChart框架)
  5. 计算机基础-初步认识软件和硬件
  6. 如何修改图像尺寸?教你两招轻松修改图像宽高像素
  7. 有道云笔记分享_写完笔记后干啥 有道云笔记分享技巧
  8. 维多利亚计算机研究生,2020年惠灵顿维多利亚大学计算机信息硕士申请条件
  9. Altera的单时钟同步FIFO,带almost_empty和almost_full端口
  10. 深入理解bootloader_1----- bootloader的初步概念
  11. 数据仓库架构演进与菜鸟实时数据仓库设计
  12. rc4加密问题漏洞修复_服务器SSL不安全漏洞修复方案
  13. java中的构造方法必须和类名相同,在Java中,关于构造方法,下列说法错误的是()A、构造方法的名称必须与类名相同B、构造方法可以...
  14. 用Matlab解决数学问题
  15. lisp角度转换弪度_角度和弧度换算(角度和弧度怎么换算)
  16. Received status code 502 from server: Bad Gateway
  17. 相关系数 Correlation Coefficient 的理解
  18. Win11家庭版安装+PE 完结版
  19. CefSharp 常用设置
  20. 服务器中木马病毒问题解决

热门文章

  1. wireshark 无捕获过滤器/找不到重要的接口列表 net start npf 服务器名无效
  2. i7 6700hq安装linux,联想拯救者E700(i7 6700HQ)如何用u盘装系统win8
  3. 莱布尼茨数学思想的统一性
  4. docker php-fpm 优化,利用docker-compose快速部署php-fpm+nginx环境
  5. go入门--设置 GOPATH 有什么意义?
  6. 游戏原画学习步骤,零基础一步步学原画!
  7. 【RDMA】RDMA技术详解(二):Send Receive操作
  8. STM32FF030 替代国产单片机——DP32G030
  9. 如果一个用户查询不到自己的购买记录了,这个时候作为测试,应该怎么找问题
  10. 【SAP-PS笔记】项目下的可配置物料(Configurable Materials In Project)