![]() Volume 9, Issue 2 Articles Tricks of the Trade In and Out Trott's Corner New Products New Publications Calendar News Bulletins New Resources Classifieds Download This Issue Editorial Policy Staff Submissions Subscriptions Advertising Back Issues Contact Information |
In and Out
Sparse Matrices Q: One can use LinearSolve to solve a system of linear equations. However, I work with very large matrices having only five nonzero diagonals. Are there efficient methods for dealing with such matrices? A: Daniel Lichtblau (danl@wolfram.com) answers: If you require only machine arithmetic, this can be done effectively using the built-in sparse linear solver in Version 5. Here is an example. Create a diagonally-dominant random sparse
With
Use Normal to obtain the ordinary array corresponding to a sparse array object.
Produce a pentadiagonal sparse matrix of dimension 2000.
Solve for a random right-hand side.
Compare with the time required for an ordinary (nonsparse) matrix.
Check that the solutions agree using
|
||||||||
About Mathematica | Download Mathematica Player Copyright © 2004 Wolfram Media, Inc. All rights reserved. |