如题:

function X = IsStrictDiagMatrix(A)
% input: A matrix
% output: The matrix after transformation % if the matrix is not a square matrix, return error
if size(A, 1) ~= size(A, 2)
error('It is not a square matrix');
end % get the size of A and set the size of X
% use an array to accord if all the row be set
N = size(A, 1);
X = zeros(N, N);
has_set = zeros(N); for i = 1 : N
% find out the max element in a row
row_max = max(abs(A(i, : )));
% if the max element is not larger than sum of others, return error
if (row_max <= (sum(abs(A(i, : ))) - row_max))
error('It can not be transformed to strict diagonal dominance matrix');
end
% find out the index of max element and set the row j of matrix X
% accord row j has been set
for j = 1 : N
if (abs(A(i, j)) == row_max)
X(j, : ) = A(i, : );
has_set(j) = 1;
end
end
end % if any hasn't been set, return error
for i = 1 : N
if (has_set == 0)
error('It can not be transformed to strict diagonal dominance matrix');
end
end % output success
fprintf('It can be transformed to a strict diagonal dominance matrix: \n');
end

matlab实现判断是否能否生成严格对角占优矩阵的更多相关文章

  1. MATLAB高斯混合数据的生成

    MATLAB高斯混合数据的生成 作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ 高斯混合模型的基本原理:聚类——GMM,MATLAB中GMM聚类算法:M ...

  2. matlab中元胞数组(cell)转换为矩阵

    matlab中元胞数组(cell)转换为矩阵. cell转换为矩阵函数为:cell2mat(c),其中c为待转换的元胞数组: 转化之后的矩阵可能不满足我们对矩阵维数的要求,那么也许还需要下面两个函数: ...

  3. MATLAB小函数:将列向量转化为0-1矩阵

    MATLAB小函数:将列向量转化为0-1矩阵 作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ 将列向量转化为0-1矩阵,例如 A = 1 2 1 5 3 ...

  4. matlab inpolygon 判断点在多边形内

    如何判断一个点在多边形内部? xv= [0 3 3 0 0]; %x坐标 yv= [0 0 3 3 0];%y坐标 x=1.5; y=1.5; in=inpolygon(x,y,xv,yv) plot ...

  5. 【转载】matlab如何判断一个点是否在多面体内

    转载自:http://www.52souji.net/point-within-a-polyhedron/ 我遇到的一个实际问题是:要在空位区域随机放置一定数量的原子,这些原子在空位区域任何一处存在的 ...

  6. matlab (.m)文件生成 windows 可执行(.exe)文件

    mex -setup:设置 C 语言编译器:(如果本地安装有 visual studio 20xx 集成开发环境,则会自动选择其下的 C/C++ 编译器 ) 将运行时环境(runtime enviro ...

  7. Matlab绘图基础——散点生成三角网(TIN)

    %例一:二维三角网TIN模型的生成 X=rand(10,2)*5; dt=DelaunayTri(X(:,1),X(:,2));       %生成三角网 triplot(dt);hold on;   ...

  8. matlab中randi代替randint生成随机均匀分布信号的用法

    %%新函数  2*randi([0,1],2,1)-1   等价于老函数     2*randint(2,1)-1 函数形式:randi([imin,imax],m,n) 参数解释: [imin,im ...

  9. java学习-zxing生成二维码矩阵的简单例子

    这个例子需要使用google的开源项目zxing的核心jar包 core-3.2.0.jar 可以百度搜索下载jar文件,也可使用maven添加依赖 <dependency> <gr ...

随机推荐

  1. 剑指Offer25 二叉搜索树转换为排序双向链表

    /************************************************************************* > File Name: 25_BSTCon ...

  2. 转: React系统的入门系统

    评注:React系统的入门系统. 转:  http://www.infoq.com/cn/search.action?queryString=%E6%B7%B1%E5%85%A5%E6%B5%85%E ...

  3. 初识 Asp.Net内置对象之Application对象

    Application对象 Applocation对象用于共享应用程序级信息,即多个用户可以共享一个Applocation对象. 用户在请求Asp.Net文件时,将启动应用程序并且创建Applicat ...

  4. 拓展开源库SwipeToLoadLayout实现EmptyView和Empty时自动禁用LoadMore

    Android应用开发中,经常需要使用到界面的下拉刷新和上拉加载,在support v7之前,一般都是用ListView去做列表视图,而ListView对EmptyView是提供支持的,并且有许多开源 ...

  5. Part 14 ng hide and ng show in AngularJS

    ng-hide and ng-show directives are used to control the visibility of the HTML elements. Let us under ...

  6. shell常用代码积累

    1.使用getopts从命令行接收参数 例: while getopts h:u:p: OPTION do case $OPTION in h) echo "主机地址:$OPTARG&quo ...

  7. js如何检测打开窗口是否存在的三个方法?

    js打开窗口一般也就是使用window.open方法: win = window.open(CHILD_WINDOW_URL, CHILD_WINDOW_NAME, CHILD_WINDOW_ATTR ...

  8. (转)MongoDB分片实战 集群搭建

    环境准备 Linux环境 主机 OS 备注 192.168.32.13 CentOS6.3 64位 普通PC 192.168.71.43 CentOS6.2 64位 服务器,NUMA CPU架构 Mo ...

  9. (转)IIS设置优化(需根据服务器性能,调整具体参数值)

    IIS7 优化-网站请求并发数>> /*调整IIS 7应用程序池队列长度*/队列长度 5000-20000(原来默认1000,最大65535,建议10000 ) /*调整IIS 7的app ...

  10. git与github

    Git-版本控制,多人协作,分布式: Github-开源项目,远程仓库: 我在github上建立了一个仓库 https://github.com/abcd/2016ife: 现在我要把它下载到本地: ...