home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / pascal / 4512 < prev    next >
Encoding:
Text File  |  1992-07-22  |  2.2 KB  |  44 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!usc!sdd.hp.com!ux1.cso.uiuc.edu!news.cso.uiuc.edu!eagle!gill
  3. From: gill@eagle (Warren Gill)
  4. Subject: Re: Sparse matrices
  5. X-Newsreader: Tin 1.1 PL4
  6. References: <1992Jul20.042405.6954@usenet.ins.cwru.edu>
  7. Message-ID: <BrsxF5.DIw@news.cso.uiuc.edu>
  8. Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
  9. Organization: Sangamon State University
  10. Date: Wed, 22 Jul 1992 17:47:27 GMT
  11. Lines: 31
  12.  
  13.    You can do a sparce matrix using a doubly-linked list, where one link
  14.  represents the vertical, and the other the horizontal.
  15.    Each column of the matrix is represented by a circularly linked list
  16.  with a head node, as is each row. The head node for column x is also the
  17.  head node for row x.  Each head node has three fields: down, right, and
  18.  next.  _down_ links into a column list, _right_ links into a row list, 
  19.  and _next_ links the head nodes together.
  20.    All the other nodes have five fields: row, col, down, right, and value.
  21.  _row_ and _col_ are the row # and col #; _down_ and _right_ are pointers
  22.  to the next non-zero term in the same row/column.  This is a record type
  23.  you could use:
  24.  
  25.      Type SparceMatrix = ^MatrixNode;
  26.           MatrixNode   = Record
  27.                            down : SparceMatrix;
  28.                            right : SparceMatrix;
  29.                            Case head: Boolean of
  30.                              True: (next : SparceMatrix);
  31.                              False: (value : Integer;
  32.                                      row   : Integer;
  33.                                      col   : Integer);
  34.                          End;
  35.  
  36.       ______                                                               
  37.       )     (   Greetings from the Land of Lincoln                         
  38.      /       |  Sangamon State University, Springfield, IL                 
  39.     (        |                                                             
  40.      \_  *   |                                                             
  41.        \     |  Warren Gill, Microcomputer Software Specialist             
  42.        /    /   Internet:  Gill@Eagle.Sangamon.edu                         
  43.         \/\/                                                               
  44.