You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.1 KiB

25 years ago
25 years ago
25 years ago
  1. <HTML>
  2. <HEAD>
  3. <!-- Created by texi2html 1.56k from cln.texi on 5 May 2000 -->
  4. <TITLE>CLN, a Class Library for Numbers - 6. Rings</TITLE>
  5. </HEAD>
  6. <BODY>
  7. Go to the <A HREF="cln_1.html">first</A>, <A HREF="cln_5.html">previous</A>, <A HREF="cln_7.html">next</A>, <A HREF="cln_13.html">last</A> section, <A HREF="cln_toc.html">table of contents</A>.
  8. <P><HR><P>
  9. <H1><A NAME="SEC48" HREF="cln_toc.html#TOC48">6. Rings</A></H1>
  10. <P>
  11. CLN has a class of abstract rings.
  12. <PRE>
  13. Ring
  14. cl_ring
  15. &#60;cl_ring.h&#62;
  16. </PRE>
  17. <P>
  18. Rings can be compared for equality:
  19. <DL COMPACT>
  20. <DT><CODE>bool operator== (const cl_ring&#38;, const cl_ring&#38;)</CODE>
  21. <DD>
  22. <DT><CODE>bool operator!= (const cl_ring&#38;, const cl_ring&#38;)</CODE>
  23. <DD>
  24. These compare two rings for equality.
  25. </DL>
  26. <P>
  27. Given a ring <CODE>R</CODE>, the following members can be used.
  28. <DL COMPACT>
  29. <DT><CODE>void R-&#62;fprint (cl_ostream stream, const cl_ring_element&#38; x)</CODE>
  30. <DD>
  31. <DT><CODE>cl_boolean R-&#62;equal (const cl_ring_element&#38; x, const cl_ring_element&#38; y)</CODE>
  32. <DD>
  33. <DT><CODE>cl_ring_element R-&#62;zero ()</CODE>
  34. <DD>
  35. <DT><CODE>cl_boolean R-&#62;zerop (const cl_ring_element&#38; x)</CODE>
  36. <DD>
  37. <DT><CODE>cl_ring_element R-&#62;plus (const cl_ring_element&#38; x, const cl_ring_element&#38; y)</CODE>
  38. <DD>
  39. <DT><CODE>cl_ring_element R-&#62;minus (const cl_ring_element&#38; x, const cl_ring_element&#38; y)</CODE>
  40. <DD>
  41. <DT><CODE>cl_ring_element R-&#62;uminus (const cl_ring_element&#38; x)</CODE>
  42. <DD>
  43. <DT><CODE>cl_ring_element R-&#62;one ()</CODE>
  44. <DD>
  45. <DT><CODE>cl_ring_element R-&#62;canonhom (const cl_I&#38; x)</CODE>
  46. <DD>
  47. <DT><CODE>cl_ring_element R-&#62;mul (const cl_ring_element&#38; x, const cl_ring_element&#38; y)</CODE>
  48. <DD>
  49. <DT><CODE>cl_ring_element R-&#62;square (const cl_ring_element&#38; x)</CODE>
  50. <DD>
  51. <DT><CODE>cl_ring_element R-&#62;expt_pos (const cl_ring_element&#38; x, const cl_I&#38; y)</CODE>
  52. <DD>
  53. </DL>
  54. <P>
  55. The following rings are built-in.
  56. <DL COMPACT>
  57. <DT><CODE>cl_null_ring cl_0_ring</CODE>
  58. <DD>
  59. The null ring, containing only zero.
  60. <DT><CODE>cl_complex_ring cl_C_ring</CODE>
  61. <DD>
  62. The ring of complex numbers. This corresponds to the type <CODE>cl_N</CODE>.
  63. <DT><CODE>cl_real_ring cl_R_ring</CODE>
  64. <DD>
  65. The ring of real numbers. This corresponds to the type <CODE>cl_R</CODE>.
  66. <DT><CODE>cl_rational_ring cl_RA_ring</CODE>
  67. <DD>
  68. The ring of rational numbers. This corresponds to the type <CODE>cl_RA</CODE>.
  69. <DT><CODE>cl_integer_ring cl_I_ring</CODE>
  70. <DD>
  71. The ring of integers. This corresponds to the type <CODE>cl_I</CODE>.
  72. </DL>
  73. <P>
  74. Type tests can be performed for any of <CODE>cl_C_ring</CODE>, <CODE>cl_R_ring</CODE>,
  75. <CODE>cl_RA_ring</CODE>, <CODE>cl_I_ring</CODE>:
  76. <DL COMPACT>
  77. <DT><CODE>cl_boolean instanceof (const cl_number&#38; x, const cl_number_ring&#38; R)</CODE>
  78. <DD>
  79. Tests whether the given number is an element of the number ring R.
  80. </DL>
  81. <P><HR><P>
  82. Go to the <A HREF="cln_1.html">first</A>, <A HREF="cln_5.html">previous</A>, <A HREF="cln_7.html">next</A>, <A HREF="cln_13.html">last</A> section, <A HREF="cln_toc.html">table of contents</A>.
  83. </BODY>
  84. </HTML>