home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / DRMATRIX.ZIP / DOC / REFERNCE.DOC < prev   
Encoding:
Text File  |  1997-01-01  |  35.0 KB  |  887 lines

  1.                               
  2. ────────────────────────────────────────────────────────────
  3. ────────────────────────────────────────────────────────────
  4.  
  5.                         DOCTOR MATRIX
  6.                         Version 1.00
  7.  
  8. ────────────────────────────────────────────────────────────
  9.                               
  10.              Shareware Vector and Matrix Algebra
  11.                  Programming Package for C++
  12.                               
  13. ────────────────────────────────────────────────────────────
  14.                               
  15.                      FUNCTION REFERENCE
  16.                               
  17. ────────────────────────────────────────────────────────────
  18.                               
  19.                       by Zvika Ben-Haim
  20.  
  21. ────────────────────────────────────────────────────────────
  22. ────────────────────────────────────────────────────────────
  23.  
  24.  
  25.  
  26. ────────────────────────────────────────────────────────────
  27.                       TABLE OF CONTENTS
  28. ────────────────────────────────────────────────────────────
  29.  
  30. GENERAL NOTES
  31.  
  32. VECTOR OPERATORS
  33. Addition
  34. Assignment (=)
  35. Equality
  36. Input (>>)
  37. Multiplication by Scalar
  38. Multiplication (Dot Product)
  39. Output (<<)
  40. Subscript
  41. Subtraction (Binary)
  42. Subtraction (Unary)
  43.  
  44. VECTOR MEMBER FUNCTIONS
  45. Absolute Value
  46. Alignment
  47. Constructors
  48. Destructor
  49. Leading Element
  50. Length (Order)
  51. Transpose
  52.  
  53. MATRIX OPERATORS
  54. Addition
  55. Assignment (=)
  56. Equality
  57. Input (>>)
  58. Multiplication by Scalar
  59. Multiplication (Matrix by Matrix)
  60. Output (<<)
  61. Subscript
  62. Subtraction (Binary)
  63. Subtraction (Unary)
  64.  
  65. MATRIX MEMBER FUNCTIONS
  66. Canonized Matrix, Equivalent
  67. Column
  68. Constructors
  69. Destructor
  70. Determinant
  71. Equivalent Matrices, see Canonized and Stepped Matrices
  72. Invert
  73. Leading Element
  74. Number of Columns
  75. Number of Rows
  76. Rank
  77. Row
  78. Stepped Matrix, Equivalent
  79. Trace
  80. Transpose
  81.  
  82. MATRIX PROPERTIES
  83. Antisymmetric Matrix
  84. Diagonal Matrix
  85. Identity Matrix
  86. Regular (Invertible) Matrix
  87. Scalar Matrix
  88. Singular (Non-Invertible) Matrix
  89. Square Matrix
  90. Stepped Matrix
  91. Symmetric Matrix
  92.  
  93. LIST OF ERROR MESSAGES
  94.  
  95.  
  96. ────────────────────────────────────────────────────────────
  97.                         GENERAL NOTES
  98. ────────────────────────────────────────────────────────────
  99.       The following list describes all of the functions  and
  100. operators supported by Doctor Matrix. Basic familiarity with
  101. Doctor Matrix classes is assumed. It is recommended that you
  102. read  the  Programmer's Guide before using the more advanced
  103. functions described here. Furthermore, a basic understanding
  104. of the C++ class mechanism is highly recommended.
  105.       Throughout this document, the word `scalar', where  it
  106. refers  to a data type, is to be understood as an object  of
  107. the  data  type of the elements of the matrix or  vector  in
  108. question.
  109.      In general, whenever an error is encountered, a message
  110. is  sent  to  the  `cerr'  stream. When  such  an  error  is
  111. reported, the value returned by the function is meaningless,
  112. and   is  to  be  ignored.  However,  all  such  cases   can
  113. effectively  be  avoided by checking  the  validity  of  the
  114. parameters  passed to the function before  calling  it.  For
  115. instance,  to avoid the `Subscript out of range' error,  the
  116. programmer  should  call  the member  functions  len()  (for
  117. vectors)  or nrows() and ncols() (for matrices), and  ensure
  118. that  the subscripts are within the range returned by  these
  119. functions. The only exception is the "out of memory" errors,
  120. which cause the program to abort. A full list of errors  and
  121. their explanations is supplied at the end of this document.
  122.  
  123.                               
  124. ────────────────────────────────────────────────────────────
  125.                       VECTOR OPERATORS
  126. ────────────────────────────────────────────────────────────
  127.  
  128. ADDITION
  129. ────────────────────────────────────────────────────────────
  130. Syntax:  v1+v2
  131. Operands:v1  and  v2  must be vectors of the same order  and
  132.          data type
  133. Returns: The sum of v1 and v2
  134. Notes:   The  sum  of two vectors is defined as the  sum  of
  135.          their   respective  elements.  In  particular,   if
  136.          S=v1+v2, then S(i)=v1(i)+v2(i) for all i.
  137.  
  138. ASSIGNMENT
  139. ────────────────────────────────────────────────────────────
  140. Syntax:  v1=v2;
  141. Operands:v1 and v2 must be vectors of the same type
  142. Returns: v2 is copied into v1, and is also the return value
  143. Notes:   v1's  new  alignment, order and elements are  equal
  144.          to those of v2.
  145.          The  effect  of  this  operator  is  equal  in  all
  146.          respects   to  the  effects  of  Form  4   of   the
  147.          constructor. The operator is required  for  reasons
  148.          of internal memory management.
  149.  
  150. EQUALITY
  151. ────────────────────────────────────────────────────────────
  152. Syntax:  v1==v2
  153. Operands:v1 and v2 must be vectors of the same data type
  154. Returns: TRUE (1) if v1 is equal to v2; FALSE (0) otherwise
  155. Notes:   Two  vectors v1 and v2 are said to be equal if they
  156.          are  of  the  same order and alignment and  if  all
  157.          elements  in  v1  are equal to their  corresponding
  158.          elements  in  v2. In other words, v1(i)==v2(i)  for
  159.          all i.
  160.  
  161. INPUT (>>)
  162. ────────────────────────────────────────────────────────────
  163. Syntax:  istr >> v;
  164. Operands:istr  is  any  object  of type istream  or  derived
  165.          types, e.g. cin
  166.          v is any vector
  167. Returns: istr
  168. Notes:   The  contents  of  v  are overwritten  with  values
  169.          entered  from the specified stream. The  number  of
  170.          items  read from the stream is equal to  the  order
  171.          of  the  vector. The vector preserves its  original
  172.          alignment.
  173.  
  174. MULTIPLICATION BY SCALAR
  175. ────────────────────────────────────────────────────────────
  176. Syntax:  a*v
  177. Operands:v is any vector
  178.          a  is any number of data type equal to that of  the
  179.          vector's   elements,  or  a  type   that   can   be
  180.          implicitly  cast to the vector's elements  (e.g.  a
  181.          Vector<float> can be multiplied by ints)
  182. Returns: The product of a and v
  183. Notes:   The product of a scalar by a vector is a vector  of
  184.          the  same  order and alignment as the original,  in
  185.          which  all  elements  are  equal  to  the  original
  186.          elements  multiplied by the scalar.  For  instance,
  187.          if P=n*V then P(i)=n*V(i) for all i.
  188.  
  189. MULTIPLICATION (DOT PRODUCT)
  190. ────────────────────────────────────────────────────────────
  191. Syntax:  v1*v2
  192. Operands:v1  and  v2 are vectors of the same data  type  and
  193.          order
  194.          v1  is  aligned  horizontally  and  v2  is  aligned
  195.          vertically
  196. Returns: The  dot  product v1.v2, which is a scalar  of  the
  197.          same type as the elements of v1 and v2
  198. Notes:   The  scalar product (or dot product) of v1  and  v2
  199.          is  equal  to  |v1|*|v2|*cos , where  |vn|  is  the
  200.          length  of the vector vn, and  is the angle between
  201.          v1  and v2. It can be shown that this is also equal
  202.          to:
  203.          v1(1)*v2(1) + v1(2)*v2(2) + ... + v1(n)*v2(n)
  204.          where n is the order of the two vectors.
  205.          Notice  that  the  vector  alignment  must  be   as
  206.          defined above, otherwise an error is generated.
  207.  
  208. OUTPUT (<<)
  209. ────────────────────────────────────────────────────────────
  210. Syntax:  ostr << v;
  211. Operands:ostr  is  any  object  of type ostream  or  derived
  212.          types, e.g. cout
  213.          v is any vector
  214. Returns: ostr
  215. Notes:   The  elements of v are displayed, starting  at  the
  216.          current   cursor   position.   The   elements   are
  217.          separated by `\n' (for vertically aligned  vectors)
  218.          or  `\t'  (for  horizontally aligned  vectors).  No
  219.          delimiter is added after the final element.
  220.  
  221. SUBSCRIPT
  222. ────────────────────────────────────────────────────────────
  223. Syntax:  v(i)
  224. Operands:v is any vector
  225.          i is an integer between 1 and the order of v
  226. Returns: Reference to the i-th element in v
  227. Notes:   The  first  element is v(1), as  opposed  to  C/C++
  228.          arrays, in which the first element is a[0].
  229.  
  230. SUBTRACTION (BINARY)
  231. ────────────────────────────────────────────────────────────
  232. Syntax:  v1-v2
  233. Operands:v1  and  v2  must be vectors of the same order  and
  234.          data type
  235. Returns: The difference between v1 and v2
  236. Notes:   The  difference between two vectors is  defined  as
  237.          the  difference between their respective  elements.
  238.          In  particular,  if S=v1-v2, then  S(i)=m1(i)-m2(i)
  239.          for all i.
  240.  
  241. SUBTRACTION (UNARY)
  242. ────────────────────────────────────────────────────────────
  243. Syntax:  -v
  244. Operands:v can be any vector type
  245. Returns: The  additive inverse of v, which is  a  vector  of
  246.          the same type, order and alignment
  247. Notes:   The  additive inverse is a vector vtag,  such  that
  248.          v+vtag  is  equal  to  a  vector  containing   only
  249.          zeroes. It follows that for all i, v(i)=-vtag(i).
  250.  
  251.  
  252. ────────────────────────────────────────────────────────────
  253.                    VECTOR MEMBER FUNCTIONS
  254. ────────────────────────────────────────────────────────────
  255.  
  256. ABSOLUTE VALUE
  257. ────────────────────────────────────────────────────────────
  258. Syntax:  v.abs()
  259. Parameters:   None
  260. Returns: Scalar  equal to the length (or absolute value)  of
  261.          v
  262. Notes:   The  abosulte  value of a vector is  equal  to  the
  263.          following:
  264.          sqrt(v(1)*v(1) + v(2)*v(2) + ... + v(n)*v(n))
  265.          The  geometric meaning of this value is the  length
  266.          of the vector v.
  267.          This   member   function  can  be  used   only   if
  268.          MATH_FUNCS  is defined. See the Programmer's  Guide
  269.          for more information on the MATH_FUNCS setting.
  270.  
  271. ALIGNMENT
  272. ────────────────────────────────────────────────────────────
  273. Syntax:  v.align()
  274. Parameters:   None
  275. Returns: If  v  is  aligned  horizontally (default),  return
  276.          value  is  V_HORIZ (0). Otherwise, return value  is
  277.          V_VERT (1).
  278. Notes:   The  return value is of an enumeration type  called
  279.          V_ALIGN.
  280.  
  281. CONSTRUCTORS
  282. ────────────────────────────────────────────────────────────
  283. Syntax:  Form 1: Vector<type> v(order);
  284.          Form 2: Vector<type> v(order, V_VERT);
  285.          Form 3: Vector<type> v(order, V_HORIZ);
  286.          Form 4: Vector<type> v=v2;
  287. Parameters:    type is any numeric data type (such as float,
  288.          int, etc.) or any numeric class (see below)
  289.          order  is  an  integer  specifying  the  number  of
  290.          elements in the vector
  291.          V_VERT  (1) or V_HORIZ (0) can optionally be  added
  292.          to  specify the vector's alignment. If no alignment
  293.          is  specified, the vector is assumed to be  aligned
  294.          horizontally  (V_HORIZ).  The  enumeration  V_ALIGN
  295.          defines the two alignment types.
  296.          In  Form 4, v2 must be of the same type as the  new
  297.          vector.  The  new  vector  will  have  the   order,
  298.          alignment and exact same elements as the original.
  299. Notes:   Numeric  classes  used as data types  must  support
  300.          arithmetic operators, assignment operators (=,  +=,
  301.          etc.),  the  equality  operator  (==),  and  stream
  302.          operators  (<<  and  >>). They  must  also  support
  303.          implicit  casting from type int. If  MATH_FUNCS  is
  304.          included,   an   sqrt()  function   receiving   and
  305.          returning  an  object of this  type  must  also  be
  306.          supplied.
  307.  
  308. DESTRUCTOR
  309. ────────────────────────────────────────────────────────────
  310.          The  destructor  is  invoked transparently  by  the
  311.          compiler  when a static Vector object goes  out  of
  312.          scope  or  when a dynamic Vector object is deleted.
  313.          The  destructor  frees  dynamic  memory  which   is
  314.          internally used by the Vector class.
  315.  
  316. LEADING ELEMENT
  317. ────────────────────────────────────────────────────────────
  318. Syntax:  lead()
  319. Parameters:   None
  320. Returns: Integer  specifying  the location  of  the  leading
  321.          element in v
  322. Notes:   The  leading  element  in a  vector  is  the  first
  323.          nonzero element, going from left to right (or  from
  324.          top to bottom, in vertically aligned vectors).
  325.  
  326. LENGTH (ORDER)
  327. ────────────────────────────────────────────────────────────
  328. Syntax:  v.len()
  329. Parameters:   None
  330. Returns: Integer   specifying  the  order  (or   number   of
  331.          elements) of the vector v
  332. Notes:   The   last   element   in  v  is   accessed   using
  333.          v(v.len()).
  334.  
  335. TRANSPOSE
  336. ────────────────────────────────────────────────────────────
  337. Syntax:  v.T()
  338. Parameters:   None
  339. Returns: A vector which is the transpose of v
  340. Notes:   The  transposed  vector is of  the  same  type  and
  341.          order  as v, and contains the same elements in  the
  342.          same order, but its alignment is opposite: if v  is
  343.          aligned   vertically,   then   v.T()   is   aligned
  344.          horizontally, and vice versa.
  345.  
  346.  
  347.  
  348. ────────────────────────────────────────────────────────────
  349.                       MATRIX OPERATORS
  350. ────────────────────────────────────────────────────────────
  351.  
  352. ADDITION
  353. ────────────────────────────────────────────────────────────
  354. Syntax:  m1+m2
  355. Operands:m1  and  m2 must be matrices of the same order  and
  356.          data type
  357. Returns: The sum of m1 and m2
  358. Notes:   The  sum of two matrices is defined as the  sum  of
  359.          their   respective  elements.  In  particular,   if
  360.          S=m1+m2, then S(i,j)=m1(i,j)+m2(i,j) for all i,j.
  361.  
  362. ASSIGNMENT
  363. ────────────────────────────────────────────────────────────
  364. Syntax:  m1=m2;
  365. Operands:m1 and m2 must be matrices of the same type
  366. Returns: m2 is copied into m1, and is also the return value
  367. Notes:   m1's  new  alignment, order and elements are  equal
  368.          to those of m2.
  369.          The  effect  of  this  operator  is  equal  in  all
  370.          respects   to  the  effects  of  Form  2   of   the
  371.          constructor. The operator is required  for  reasons
  372.          of internal memory management.
  373.  
  374. EQUALITY
  375. ────────────────────────────────────────────────────────────
  376. Syntax:  m1==m2
  377. Operands:m1 and m2 must be matrices of the same data type
  378. Returns: TRUE (1) if m1 is equal to m2; FALSE (0) otherwise
  379. Notes:   Two  matrices  m1 and m2 are said to  be  equal  if
  380.          they  are of the same order and if all elements  in
  381.          m1  are  equal to their corresponding  elements  in
  382.          m2. In other words, m1(i,j)==m2(i,j) for all i,j.
  383.  
  384. INPUT (>>)
  385. ────────────────────────────────────────────────────────────
  386. Syntax:  istr >> m;
  387. Operands:istr  is  any  object  of type istream  or  derived
  388.          types, e.g. cin
  389.          m is any matrix
  390. Returns: istr
  391. Notes:   The  elements  of  m  are overwritten  with  values
  392.          entered  from  the  specified  stream.  The  matrix
  393.          preserves its original order. If the matrix  has  i
  394.          rows  and j columns, the total number of items read
  395.          from istr is i*j.
  396.  
  397. MULTIPLICATION BY SCALAR
  398. ────────────────────────────────────────────────────────────
  399. Syntax:  a*m
  400. Operands:m is any matrix
  401.          a  is any number of data type equal to that of  the
  402.          matrix  elements, or a type that can be  implicitly
  403.          cast   to   the  matrix  elements  type   (e.g.   a
  404.          Vector<float> can be multiplied by ints)
  405. Returns: The product of a and m
  406. Notes:   The product of a scalar by a matrix is a matrix  of
  407.          the  same  order  as  the original,  in  which  all
  408.          elements  are  equal  to  the  original  respective
  409.          elements  multiplied by the scalar.  For  instance,
  410.          if P=n*M then P(i,j)=n*M(i,j) for all i,j.
  411.  
  412. MULTIPLICATION (MATRIX BY MATRIX)
  413. ────────────────────────────────────────────────────────────
  414. Syntax:  m1*m2
  415. Operands:m1  and  m2 are matrices of the same type, and  the
  416.          number  of columns in m1 is equal to the number  of
  417.          rows in m2
  418. Returns: A   matrix  containing  the  product  of  the   two
  419.          matrices.  The type of the matrix is  the  same  as
  420.          the  type  of the original matrices. The number  of
  421.          rows  in the result is equal to the number of  rows
  422.          in  m1, and the number of columns in the result  is
  423.          equal to the number of columns in m2.
  424. Notes:   If R=m1*m2, then R(i,j) is given by:
  425.          R(i,j) = m1(i,1)*m2(1,j) + m1(i,2)*m2(2,j) + ... +
  426.          m1(i,k)*m2(k,j)
  427.          where  k  is the number of columns in m1, and  also
  428.          the number of rows in m2.
  429.  
  430. OUTPUT (<<)
  431. ────────────────────────────────────────────────────────────
  432. Syntax:  ostr << m;
  433. Operands:ostr  is  any  object  of type ostream  or  derived
  434.          types, e.g. cout
  435.          m is any matrix
  436. Returns: ostr
  437. Notes:   The  elements of m are displayed, starting  at  the
  438.          current  cursor position. The elements in each  row
  439.          are  separated by `\t', and the rows are  separated
  440.          from  each  other  by `\n'. No delimiter  is  added
  441.          after the final element.
  442.  
  443. SUBSCRIPT
  444. ────────────────────────────────────────────────────────────
  445. Syntax:  m(i,j)
  446. Operands:m is any matrix
  447.          i  is  an integer between 1 and the number of  rows
  448.          in m
  449.          j  is  an  integer  between 1  and  the  number  of
  450.          columns in m
  451. Returns: Reference  to  element in the  i-th  row  and  j-th
  452.          column in m
  453. Notes:   The first element is m(1,1), and not m(0,0).
  454.  
  455. SUBTRACTION (BINARY)
  456. ────────────────────────────────────────────────────────────
  457. Syntax:  m1-m2
  458. Operands:m1  and  m2 must be matrices of the same order  and
  459.          data type
  460. Returns: The difference between m1 and m2
  461. Notes:   The  difference between two matrices is defined  as
  462.          the  difference between their respective  elements.
  463.          In  particular,  if  S=m1-m2, then  S(i,j)=m1(i,j)-
  464.          m2(i,j) for all i,j.
  465.  
  466. SUBTRACTION (UNARY)
  467. ────────────────────────────────────────────────────────────
  468. Syntax:  -m
  469. Operands:m can be any matrix
  470. Returns: The  additive inverse of m, which is  a  matrix  of
  471.          the same type and order
  472. Notes:   The  additive inverse is a matrix mtag,  such  that
  473.          m+mtag  is  equal  to  a  mastrix  containing  only
  474.          zeroes.  It follows that for all i and j,  m(i,j)=-
  475.          mtag(i,j).
  476.  
  477.                               
  478.                               
  479. ────────────────────────────────────────────────────────────
  480.                    MATRIX MEMBER FUNCTIONS
  481. ────────────────────────────────────────────────────────────
  482.  
  483. CANONIZED MATRIX, EQUIVALENT
  484. ────────────────────────────────────────────────────────────
  485. Syntax:  m.canon()
  486. Parameters:   None
  487. Returns: The equivalent, canonical matrix
  488. Notes:   A canonical matrix is a matrix which satisfies the
  489.          follows:
  490.          (a) it is stepped (see the step() function);
  491.          (b) all leading elements are 1;
  492.          (c) a  column  containing  a  leading  element  can
  493.              contain only zeroes,  except  for  the  leading
  494.              element itself.
  495.          Two  matrices are said to be equivalent if one  can
  496.          be  obtained  from  the other  using  a  series  of
  497.          allowed   operations.   Allowed   operations    are
  498.          operations of the following forms:
  499.          (1) Rn = Rn + k*Ri
  500.          (2) Rn and Ri are switched
  501.          Where  Rn and Ri are the n-th and i-th rows in  the
  502.          matrix  (treated as vectors), and  k  is  any  real
  503.          number.
  504.          Any   matrix  has  only  one  equivalent  canonical
  505.          matrix,  so  that two matrices are  equivalent  if,
  506.          and   only   if,   their  canonical  matrices   are
  507.          identical.
  508.          
  509. COLUMN
  510. ────────────────────────────────────────────────────────────
  511. Syntax:  m.col(i)
  512. Parameters:    i  is an integer specifying the column number
  513.          to be returned
  514. Returns: Vector containing the elements of column i
  515. Notes:   The  returned vector is a copy of the  elements  in
  516.          the  i-th column. Changing the returned vector does
  517.          not  alter  the  actual elements  in  the  original
  518.          matrix.
  519.  
  520. CONSTRUCTORS
  521. ────────────────────────────────────────────────────────────
  522. Syntax:  Form 1: Matrix<type> m(i,j);
  523.          Form 2: Matrix<type> m = mtag;
  524. Parameters:   type is any allowed data type
  525.          i is an integer specifying the number of rows
  526.          j is an integer specifying the number of columns
  527.          mtag  is  any matrix of the same type  as  the  new
  528.          matrix
  529. Notes:   In  Form  1,  a  new  matrix is allocated  and  its
  530.          elements  are  uninitialized.  In  Form  2,  a  new
  531.          matrix  is  created having the same  order  as  the
  532.          specified matrix, and containing elements equal  to
  533.          their respective elements in mtag.
  534.  
  535. DESTRUCTOR
  536. ────────────────────────────────────────────────────────────
  537.          The  destructor  is  invoked transparently  by  the
  538.          compiler  when a static Vector object goes  out  of
  539.          scope  or  when a dynamic Vector object is deleted.
  540.          The  destructor  frees  dynamic  memory  which   is
  541.          internally used by the Vector class.
  542.  
  543. DETERMINANT
  544. ────────────────────────────────────────────────────────────
  545. Syntax:  m.det()
  546. Parameters:   None
  547. Returns: The determinant of m (of type equal to the type  of
  548.          the matrix elements)
  549. Notes:   The  determinant of a square matrix of order 2-by-2
  550.          is equal to:
  551.          m(1,1)*m(2,2) - m(1,2)*m(2,1)
  552.          The  determinant of a square matrix of order n-by-n
  553.          is defined recursively as being equal to:
  554.          m(1,1)*mwithout11.det() - m(2,2)*mwithout22.det() +
  555.            + ... + m(n,n)*mwithoutnn.det()
  556.          where  mwithoutkk is a matrix equal to m, but  with
  557.          the  k-th row and k-th column removed. Notice  that
  558.          the signs of the sum are alternating.
  559.  
  560. INVERT
  561. ────────────────────────────────────────────────────────────
  562. Syntax:  m.inv()
  563. Parameters:   m is any square, regular matrix
  564. Returns: The inverse of matrix m
  565. Notes:   If  q is the inverse of m, then q*m=m*q=I, where  I
  566.          is the identity matrix of that order.
  567.  
  568. LEADING ELEMENT
  569. ────────────────────────────────────────────────────────────
  570. Syntax:  m.lead(i)
  571. Parameters:   m is any matrix with x rows
  572.          i is an integer between 1 and x
  573. Returns: The location of the leading element in row i
  574. Notes:   The  leading element of a row is the first  nonzero
  575.          element in that row.
  576.  
  577. NUMBER OF COLUMNS
  578. ────────────────────────────────────────────────────────────
  579. Syntax:  m.ncols()
  580. Parameters:   None
  581. Returns: Number of columns in m
  582.  
  583. NUMBER OF ROWS
  584. ────────────────────────────────────────────────────────────
  585. Syntax:  m.nrows()
  586. Parameters:   None
  587. Returns: Number of rows in m
  588.  
  589. RANK
  590. ────────────────────────────────────────────────────────────
  591. Syntax:  m.rank()
  592. Parameters:   None
  593. Returns: The rank of the matrix (integer)
  594. Notes:   The  rank  of a matrix is the number of independent
  595.          rows    in    that   matrix.   A   set   of    rows
  596.          R(1),  R(2),...  R(n) is said to be independent  if
  597.          there  are  no  coefficients a(1),  a(2),...  a(n),
  598.          such  that one of the rows (for instance R(n))  can
  599.          be described as:
  600.          R(n) = a(1)*R(1) + a(2)*R(2) + ... a(n-1)*R(n-1)
  601.          where each row is considered to be a vector.
  602.          It  can be shown that all equivalent matrices  have
  603.          the  same  rank (but not all matrices of  the  same
  604.          rank are equivalent).
  605.          If  you  have already found an equivalent  steppeor
  606.          canonical  matrix  of the matrix  m,  checking  the
  607.          rank  on  the equivalent matrix (rather than  on  m
  608.          itself)  will  give the same result and  work  much
  609.          faster.
  610.  
  611. ROW
  612. ────────────────────────────────────────────────────────────
  613. Syntax:  m.row(i)
  614. Parameters:    i is an integer specifying the row number  to
  615.          be returned
  616. Returns: Vector containing the elements of row i
  617. Notes:   The  returned vector is a copy of the  elements  in
  618.          the  i-th  row. Changing the returned  vector  does
  619.          not  alter  the  actual elements  in  the  original
  620.          matrix.
  621.  
  622. STEPPED MATRIX, EQUIVALENT
  623. ────────────────────────────────────────────────────────────
  624. Syntax:  m.step()
  625. Parameters:   None
  626. Returns: An equivalent, stepped matrix
  627. Notes:   A stepped matrix is a matrix in which:
  628.          (a) all rows containing  only  zeroes  are  at  the
  629.              bottom of  the  matrix  (in  the  highest-index
  630.              rows);
  631.          (b) for every row  except zero  rows,  the  leading
  632.              element is at least one place to the  right  of
  633.              the leading element in the previous row.
  634.          Two  matrices are said to be equivalent if one  can
  635.          be  obtained  from  the other  using  a  series  of
  636.          allowed   operations.   Allowed   operations    are
  637.          operations of the following forms:
  638.          (1) Rn = Rn + k*Ri
  639.          (2) Rn and Ri are switched
  640.          Where  Rn and Ri are the n-th and i-th rows in  the
  641.          matrix  (treated as vectors), and  k  is  any  real
  642.          number.
  643.          Finding  an  equivalent, stepped matrix is  useful,
  644.          among  other things, to determine matrix  rank,  to
  645.          solve linear equations and to invert matrices.
  646.          Equivalent  matrices  have  the  same   rank,   and
  647.          stepped  matrices are ranked very quickly  compared
  648.          to  non-stepped  matrices. If you  intend  to  find
  649.          both  the  rank  of  a  matrix  and  an  equivalent
  650.          stepped  matrix,  perform the  rank  check  on  the
  651.          stepped matrix to increase execution speed.
  652.  
  653. TRACE
  654. ────────────────────────────────────────────────────────────
  655. Syntax:  m.tr()
  656. Parameters:   None
  657. Returns: The trace of the given matrix
  658. Notes:   The  trace of a square matrix is defined as the sum
  659.          of  the diagonal elements (those having a row index
  660.          equal to their column index).
  661.  
  662. TRANSPOSE
  663. ────────────────────────────────────────────────────────────
  664. Syntax:  m.T()
  665. Parameters:   None
  666. Returns: The transposed matrix of m
  667. Notes:   The  transpose  of a matrix is a  matrix  in  which
  668.          each  row  was  rewritten as  a  column,  and  vice
  669.          versa.  Thus  element (i,j) in m will be  found  as
  670.          element (j,i) in m.T().
  671.          Writing values into m.T() has no effect. To  change
  672.          the  values  in  the  transposed  matrix,  use  the
  673.          syntax:
  674.          Matrix m2 = m.T();
  675.  
  676.  
  677.  
  678.  
  679. ────────────────────────────────────────────────────────────
  680.                       MATRIX PROPERTIES
  681. ────────────────────────────────────────────────────────────
  682. All  of  these  functions take no parameters, and  return  a
  683. value  of  type  BOOL. A return value of TRUE indicates  the
  684. matrix  possesses the specified property. A return value  of
  685. FALSE  specifies the matrix does not possess  the  specified
  686. property, including cases where matrices of that type cannot
  687. possess the specified property (e.g. diag() for a non-square
  688. matrix).
  689.  
  690. ANTISYMMETRIC MATRIX
  691. ────────────────────────────────────────────────────────────
  692. Syntax: m.antisym()
  693. Returns  TRUE  if the specified matrix is antisymmetric.  An
  694. antisymmetric  matrix is a square matrix that satisfies  the
  695. following  property:  For  all i and  j,  m(i,j)=m(j,i).  It
  696. follows  from  this  that  the diagonal  of  such  a  matrix
  697. contains only zeroes.
  698.  
  699. DIAGONAL MATRIX
  700. ────────────────────────────────────────────────────────────
  701. Syntax: m.diag()
  702. Returns TRUE if the specified matrix is diagonal. A diagonal
  703. matrix  is  a  square  matrix that contains  zeroes  in  all
  704. elements  except for the diagonal, that is, except  for  the
  705. elements of the form m(i,i) for all i.
  706.  
  707. IDENTITY MATRIX
  708. ────────────────────────────────────────────────────────────
  709. Syntax: m.iden()
  710. Returns TRUE if the specified matrix is the identity matrix.
  711. The identity matrix is a diagonal matrix containing only the
  712. number 1 in its diagonal.
  713.  
  714. REGULAR MATRIX
  715. ────────────────────────────────────────────────────────────
  716. Syntax: m.reg()
  717. Returns TRUE if the specified matrix is square and regular.
  718. A regular matrix is one that has an inverse.
  719.  
  720. SCALAR MATRIX
  721. ────────────────────────────────────────────────────────────
  722. Syntax: m.scalar()
  723. Returns  TRUE  if the specified matrix is scalar.  A  scalar
  724. matrix  is a matrix that can be obtained by multiplying  the
  725. identity matrix by a scalar.
  726.  
  727. SINGULAR MATRIX
  728. ────────────────────────────────────────────────────────────
  729. Syntax: m.sing()
  730. Returns TRUE if the matrix is either non-square or singular.
  731. A singular matrix is one that has no inverse.
  732.  
  733. SQUARE MATRIX
  734. ────────────────────────────────────────────────────────────
  735. Syntax: m.square()
  736. Returns  TRUE  if the specified matrix is square.  A  square
  737. matrix has the same number of rows and columns.
  738.  
  739. STEPPED MATRIX
  740. ────────────────────────────────────────────────────────────
  741. Syntax: m.stepped()
  742. Returns TRUE if the specified matrix is stepped. A matrix is
  743. stepped if it satisfies the following conditions:
  744. (a) all rows containing only zeroes are at the bottom of the
  745.     matrix (in the highest-index rows);
  746. (b) for every row except zero rows, the leading  element  is
  747.     at least one place to the right of the  leading  element
  748.     in the previous row.
  749.  
  750.  
  751. SYMMETRIC MATRIX
  752. ────────────────────────────────────────────────────────────
  753. Syntax: m.sym()
  754. Returns  TRUE  if  the  specified  matrix  is  symmetric.  A
  755. symmetric   matrix  is  a  square  matrix   that   satisfies
  756. m(i,j)=m(j,i) for all i and j.
  757.  
  758.  
  759.  
  760. ────────────────────────────────────────────────────────────
  761.                    LIST OF ERROR MESSAGES
  762. ────────────────────────────────────────────────────────────
  763. Error  messages  are  printed  when  a  critical  error  has
  764. occured,  or  when the function called has no other  way  of
  765. informing the program and/or user that an error has occured.
  766. Error messages are sent to cerr and can be redirected by the
  767. programmer.
  768.  
  769. Not enough memory to allocate vector!
  770. Not enough memory to create matrix!
  771. ────────────────────────────────────────────────────────────
  772.     There  is  not  enough memory for a  dynamic  allocation
  773.     during  construction of a vector or matrix. If  you  are
  774.     using a tiny, small or medium memory model, switch to  a
  775.     larger  memory  model (registered version  only).Try  to
  776.     free  up  memory by using operators new  and  delete  to
  777.     construct   memory-intensive  classes  when   they   are
  778.     required  and  destroy  them as soon  as  they  are  not
  779.     needed.   Avoid  large  wide-scope  objects,   including
  780.     global  and  static  objects. If you are  compiling  for
  781.     Windows, increase the size of the local memory heap.
  782.     If   all   else  fails,  you  may  consider  overloading
  783.     operators  new  and  delete to allocate  dynamic  memory
  784.     from  EMS or XMS (under DOS), or to allocate memory from
  785.     the  global  heap (under Windows). For  this  to  reduce
  786.     memory  use  of  Dr. Matrix classes, you  will  need  to
  787.     purchase Doctor Matrix Pro.
  788.     You  will also get this message if you attempt to create
  789.     a  vector or matrix with a non-positive number  of  rows
  790.     or columns.
  791.  
  792. Not enough memory!
  793. ────────────────────────────────────────────────────────────
  794.     This  error  occurs  when  an  internal  dynamic  memory
  795.     allocation  has failed, probably due to  a  shortage  of
  796.     available dynamic memory.
  797.     See  the above error for information on freeing up  more
  798.     memory.
  799.     
  800. Subscript out of range - #
  801. Subscript out of range - (#,#)
  802. Subscript out of range - Matrix::row(#)!
  803. Subscript out of range - Matrix::col(#)!
  804. Subscript out of range - Matrix::lead(#)!
  805. ────────────────────────────────────────────────────────────
  806.     The subscript operator was used to obtain an element  of
  807.     a  vector or matrix, but the index was out of range  for
  808.     the specified object. The requested index is indicated.
  809.     The  special  forms appear when a function  requiring  a
  810.     subscript  as a parameter receives an invalid subscript.
  811.     The  requested  subscript is indicated, along  with  the
  812.     function name and the class of which it is a member.
  813.     You will also get this error message if you enter a non-
  814.     positive number as a subscript.
  815.  
  816. Lengths of added vectors must be identical!
  817. Lengths of subtracted vectors must be identical!
  818. ────────────────────────────────────────────────────────────
  819.     Two   vectors  which  were  added  using  the   addition
  820.     operator,  or subtracted using the subtraction operator,
  821.     are  not  of  equal length. Only equal  vectors  can  be
  822.     added to one another.
  823.  
  824. Orientation of both vectors in vector sum must be identical!
  825. Orientation  of both vectors in vector subtraction  must  be
  826. identical!
  827. ────────────────────────────────────────────────────────────
  828.     You  attempted to add or subtract two vectors  with  the
  829.     same  number  of  items, but with  different  alignment.
  830.     Only vectors with the same alignment can be added to  or
  831.     subtracted from one another.
  832.     To  change  the alignment of a vector, use the transpose
  833.     function.
  834.  
  835. Both vectors must be the same length!
  836. ────────────────────────────────────────────────────────────
  837.     You  have attempted to multiply two vectors of different
  838.     lengths.  Only  vectors  of  identical  lengths  can  be
  839.     multiplied by one another.
  840.  
  841. Orientation  of  first  vector in  vector  product  must  be
  842. horizontal!
  843. Orientation  of  second  vector in vector  product  must  be
  844. vertical!
  845. ────────────────────────────────────────────────────────────
  846.     When  multiplying two vectors by one another, the  first
  847.     vector must be aligned horizontally and the second  must
  848.     be aligned vertically.
  849.     You  can  change  the alignment of a  vector  using  the
  850.     transpose function.
  851.  
  852. Trace function can only be used on square matrices!
  853. ────────────────────────────────────────────────────────────
  854.     The  trace function tr() can only be performed on square
  855.     matrices, but you attempted to perform a trace  function
  856.     on a non-square matrix.
  857.  
  858. Added matrices must have identical dimensions!
  859. Subtracted matrices must have identical dimensions!
  860. ────────────────────────────────────────────────────────────
  861.     In  order  to  add or subtract two matrices,  they  must
  862.     have the same number of rows and columns.
  863.  
  864. Undefined matrix multiplication!
  865. ────────────────────────────────────────────────────────────
  866.     You  have  attempted  to multiply two  matrices  by  one
  867.     another,   but  the  matrices  dnot  have  the   correct
  868.     dimensions  in  order to be multiplied.  The  number  of
  869.     columns  in  the left operand must equal the  number  of
  870.     rows in the right operand.
  871.  
  872. Can't calculate determinant of non-square matrix!
  873. Attempting to invert a non-square matrix!
  874. ────────────────────────────────────────────────────────────
  875.     You  have  called a function which works only on  square
  876.     matrices from a non-square matrix.
  877.  
  878. Attempting to invert a singular matrix!
  879. ────────────────────────────────────────────────────────────
  880.     You  have  attempted  to invert a singular  matrix,  but
  881.     singular matrices are non-invertible.
  882.     Singular  matrices are matrices for which  the  rank  is
  883.     not  equal  to  the  number of rows. You  can  determine
  884.     whether  a matrix is singular using the sing() function.
  885.     You  can  determine  whether it is invertible  (regular)
  886.     using the reg() function.
  887.