⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 explode.html

📁 矩阵算法库newmat10.tar.gz的帮助文件
💻 HTML
字号:
<HTML><HEAD><TITLE>Newmat09 - explode</TITLE></HEAD><BODY><H2>How to overcome an explosion in number of operations</H2><A HREF="destr.html">  next</A> -<A HREF="destr.html">  skip</A> -<A HREF="design.html">  up</A> -<A HREF="index.html">  start</A><P>The package attempts to solve the problem of the large numberof versions of the binary operations required when one has avariety of types.<P>With <I>n</I> types of matrices the binary operations will eachrequire <I>n</I>-squared separate algorithms. Some reduction in thenumber may be possible by carrying out conversions. However, thesituation rapidly becomes impossible with more than 4 or 5 types.Doug Lea told me that it was possible to avoid this problem. Idon't know what his solution is. Here's mine.<P>Each matrix type includes routines for extracting individualrows or columns. I assume a row or column consists of a sequenceof zeros, a sequence of stored values and then another sequenceof zeros. Only a single algorithm is then required for eachbinary operation. The rows can be located very quickly since mostof the matrices are stored row by row. Columns must be copied andso the access is somewhat slower. As far as possible myalgorithms access the matrices by row.<P>There is another approach. Each of the matrix types defined inthis package can be set up so both rows and columns have theirelements at equal intervals provided we are prepared to store therows and columns in up to three chunks. With such an approach onecould write a single &quot;generic&quot; algorithm for each ofmultiply and add. This would be a reasonable alternative to myapproach.<P>I provide several algorithms for operations like + . If one isadding two matrices of the same type then there is no need toaccess the individual rows or columns and a faster generalalgorithm is appropriate.<P>Generally the method works well. However symmetric matricesare not always handled very efficiently (yet) since complete rowsare not stored explicitly.<P>The original version of the package did not use this access byrow or column method and provided the multitude of algorithms forthe combination of different matrix types. The code file lengthturned out to be just a little longer than the present one whenproviding the same facilities with 5 distinct types of matrices.It would have been very difficult to increase the number ofmatrix types in the original version. Apparently 4 to 5 types isabout the break even point for switching to the approach adopted inthe present package.<P>However it must also be admitted that there is a substantialoverhead in the approach adopted in the present package for smallmatrices. The test program developed for the original version ofthe package takes 30 to 50% longer to run with the currentversion (though there may be some other reasons for this).This is for matrices in the range 6x6 to 10x10.<P>To try to improve the situation a little I do provide anordinary matrix multiplication routine for the case when all thematrices involved are rectangular.<P><A HREF="destr.html">  next</A> -<A HREF="destr.html">  skip</A> -<A HREF="design.html">  up</A> -<A HREF="index.html">  start</A></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -