欢迎来到得力文库 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
得力文库 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    科学计算科学计算 (13).pdf

    • 资源ID:67732190       资源大小:663.26KB        全文页数:17页
    • 资源格式: PDF        下载积分:8金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要8金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    科学计算科学计算 (13).pdf

    2 2.5 5 SparseSparse MatricesMatricesStorage forms of matrixSparse storage formsApplication example of sparse matrix1 1S Storage torage Forms of Matrix Forms of Matrix Full storage form:store all elements of the matrix by columns.Sparse storage form:only store the nonzero elements and their positions,row numbersand column numbers.Note that when sparse storage is used,the storage order of matrix elements does notchange,and they are also stored in the order of columns.A100005002007=sparse storage form of Matrix A:(1,1),1(3,1),2(2,2),5(3,4),7When the size of matrix is large,It can save a lot of storage space to use sparsestorage form.2 2GGenerate enerate S Sparse parse S Storagetorage(1)Transformation between full storage and sparse storageA=sparse(S):The matrix S is transformed into the matrix Aof sparse storage.S=full(A):The matrix Ais transformed into the matrix S of full storage form.A=sparse(eye(5)A=(1,1)1(2,2)1(3,3)1(4,4)1(5,5)1 B=full(A)B=1 0 0 0 00 1 0 0 00 0 1 0 00 0 0 1 00 0 0 0 1 whosName Size Bytes Class AttributesA 5x5 128 double sparse B 5x5 200 double(2)Create sparse storage matrix directlyOther call forms of the sparse function:sparse(m,n):Generates an mn sparse matrix where all elements are zero.sparse(u,v,S):Where u,v and S are 3 equal-length vectors.S is the non-zero elementof the sparse storage matrix to be built,and u(i)and v(i)are the row and columnsubscripts of S(i),respectively.A=sparse(1,2,2,2,1,4,4,5,-7)A=(2,1)5(1,2)4(2,4)-7 B=full(A)B=0 4 0 05 0 0 -7Use the spconvert function to directly create a sparse storage matrix,the syntax is:B=spconvert(A)Among them,A is an m3 or m4 matrix,and each row represents a non-zero element,andm is the number of non-zero elements.A(i,1)represents the row of the i-th non-zero element.A(i,2)represents the column of the i-th non-zero element.A(i,3)represents the real part of the i-th non-zero element value.A(i,4)represents the imaginary part of the i-th non-zero element value.If all elements of the matrix are real numbers,the fourth column is not required.A=2,2,1;2,1,-1;2,4,3A=2 2 12 1 -12 4 3 B=spconvert(A)B=(2,1)-1(2,2)1(2,4)3(3)Sparse storage of banded sparse matrixThere are two basic types of sparse matrix:sparse matrix with irregularstructure and sparse matrix with regular structure.Banded sparse matrix is a very typical sparse matrix with regular structure,which refers to a matrix where all non-zero elements are concentrated on thediagonal.B,d=spdiags(A):extracts all non-zero diagonal elements from the banded sparse matrixA and assign them to the matrix B and the vector d which is composed of the positions ofnonzero diagonals.A=spdiags(B,d,m,n):generates a sparse storage matrix A of banded sparse matrix,where m and n are respectively the row number and column number of the banded sparsematrix,the i-th column of matrix B is the i-th non-zero diagonal of the original bandedsparse matrix,the vector d is the position of all nonzero diagonals of the original bandedsparse matrix.A=11,0,0,12,0,0;0,21,0,0,22,0;0,0,31,0,0,32;41,0,0,42,0,0;0,51,0,0,52,0A=11 0 0 12 0 00 21 0 0 22 00 0 31 0 0 3241 0 0 42 0 00 51 0 0 52 0 B,d=spdiags(A)B=0 11 120 21 220 31 3241 42 051 52 0d=-303 A=spdiags(B,d,5,6)A=(1,1)11(4,1)41(2,2)21(5,2)51(3,3)31(1,4)12(4,4)42(2,5)22(5,5)52(3,6)32By using the matrix B composed of non-zero diagonal elements of the banded sparsematrix and the vector D composed of diagonal position,a sparse storage matrix A isgenerated after the command is executed.Use the spdiags function to generate the sparse storage Aof the banded sparse matrix:A=spdiags(B,d,m,n)Where m and n are the numbers of rows and columns of the original banded matrix.B is the rpmatrix,where r=min(m,n),p is the number of all non-zero diagonals of the original bandedmatrix,the i-th column of the matrix B is the i-th non-zero diagonal of the original banded matrix.The method of getting the value is:if the number of elements on the non-zero diagonal isequal to r,then all elements are taken;if the number of elements on the non-zero diagonal isless than r,then zero elements should be used to replenish r elements.The principle of zero padding is:if mn(number of rows number of columns),then whend0(above the main diagonal),add 0 in the back;When m n(number of rows number of columns),then 0 is added at theback when d0.(4)Sparse storage of identity matrixThe function speye(m,n)returns an mn sparse storage identity matrix.speye(3)ans=(1,1)1(2,2)1(3,3)1xxxxx12345231411642621103215=3.3.Application Application E Example of xample of S Sparse parse MMatrixatrixSolve tridiagonal systems of equations.kf1=1;1;2;1;0;k0=2;4;6;6;1;k1=0;3;1;4;2;B=kf1,k0,k1;d=-1;0;1;A=spdiags(B,d,5,5);f=0;3;2;1;5;x=Afx=-0.16670.11112.7222-3.61118.6111

    注意事项

    本文(科学计算科学计算 (13).pdf)为本站会员(奉***)主动上传,得力文库 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知得力文库 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于得利文库 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

    © 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

    黑龙江省互联网违法和不良信息举报
    举报电话:0468-3380021 邮箱:hgswwxb@163.com  

    收起
    展开