home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!usc!sdd.hp.com!ux1.cso.uiuc.edu!news.cso.uiuc.edu!eagle!gill
- From: gill@eagle (Warren Gill)
- Subject: Re: Sparse matrices
- X-Newsreader: Tin 1.1 PL4
- References: <1992Jul20.042405.6954@usenet.ins.cwru.edu>
- Message-ID: <BrsxF5.DIw@news.cso.uiuc.edu>
- Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
- Organization: Sangamon State University
- Date: Wed, 22 Jul 1992 17:47:27 GMT
- Lines: 31
-
- You can do a sparce matrix using a doubly-linked list, where one link
- represents the vertical, and the other the horizontal.
- Each column of the matrix is represented by a circularly linked list
- with a head node, as is each row. The head node for column x is also the
- head node for row x. Each head node has three fields: down, right, and
- next. _down_ links into a column list, _right_ links into a row list,
- and _next_ links the head nodes together.
- All the other nodes have five fields: row, col, down, right, and value.
- _row_ and _col_ are the row # and col #; _down_ and _right_ are pointers
- to the next non-zero term in the same row/column. This is a record type
- you could use:
-
- Type SparceMatrix = ^MatrixNode;
- MatrixNode = Record
- down : SparceMatrix;
- right : SparceMatrix;
- Case head: Boolean of
- True: (next : SparceMatrix);
- False: (value : Integer;
- row : Integer;
- col : Integer);
- End;
-
- ______
- ) ( Greetings from the Land of Lincoln
- / | Sangamon State University, Springfield, IL
- ( |
- \_ * |
- \ | Warren Gill, Microcomputer Software Specialist
- / / Internet: Gill@Eagle.Sangamon.edu
- \/\/
-