@node Grids, Physical Quantities, Organization of Computation, Top
@chapter Grids
@cindex Vectors
...
...
@@ -1278,47 +1274,39 @@ For units defined by Antik, see the source file @file{antik/physical-quantities/
@node Systems of units, , Dimensions, Physical dimension
@subsection Systems of units
A @dfn{system of units} is a set of units, one for each of the physical dimensions that Antik can handle. A system of units is needed by Antik for printing output and in special cases for converting physical quantities that have a physical dimension defined (e.g. length), but no units. The system of units defined by
@code{(nf-option :system-of-units)} is used to determine the units in which the output is printed. There are pre-defined several systems of units, @code{*siu*}, @code{*englishu*}, @code{*cgsu*}:
@code{(nf-option :system-of-units)} is used to determine the units in which the output is printed. There are pre-defined several systems of units, @code{si}, @code{english}, @code{cgs}:
A new system of units may be defined with @code{define-system-of-units}. One need not define all physical dimensions, but if a unit is needed for a particular dimension and it's not defined, an error will be signalled. For convenience, a system of units may be defined by alteration of an existing system of units. For example, suppose that you wish to have a system of units that is like SI except that lengths are measured in km instead of meters. This will define such a system:
A new system of units may be defined with @code{define-system-of-units}. One need not define all physical dimensions, but if a unit is needed for a particular dimension and it's not defined, an error will be signalled. For convenience, a system of units may be defined by augmentation of an existing system of units. For example, suppose that you wish to have a system of units that is like SI except that lengths are measured in km instead of meters. This will define such a system:
To set the default system of units, use @code{set-default-system-of-units}. To define a symbol macro to set a default system of units, use @code{make-set-system-of-units-symbol}. The SI system is the initial default system of units. It may be reset as the system of units with the symbol macro @code{si}.
<p><aname="index-Class_002c-physical_002dquantity-318"></a>Antik has a class <code>physical-quantity</code> which is used to represent values that have physical dimension, such as mass or length; e.g.
<p><aname="index-Class_002c-physical_002dquantity-312"></a>Antik has a class <code>physical-quantity</code> which is used to represent values that have physical dimension, such as mass or length; e.g.
<blockquote><p><aname="index-grid_003a_002aarray_002delement_002dtypes_002dno_002dcomplex_002a-295"></a>All the array element types supported except for complex types.
<blockquote><p><aname="index-grid_003a_002aarray_002delement_002dtypes_002dno_002dcomplex_002a-289"></a>All the array element types supported except for complex types.
<blockquote><p><aname="index-grid_003a_002acstd_002dcl_002dtype_002dmapping_002a-301"></a>An alist of the <code>c</code> standard types as keywords, and the <code>cl</code> type
<blockquote><p><aname="index-grid_003a_002acstd_002dcl_002dtype_002dmapping_002a-295"></a>An alist of the <code>c</code> standard types as keywords, and the <code>cl</code> type
The exception is complex types, which don't have a definition
in the <code>c</code> standard; in that case, the <code>c</code> type is the foreign struct
<blockquote><p><aname="index-grid_003a_002acstd_002dinteger_002dtypes_002a-303"></a>List of integer types supported by <code>cffi</code>, from the <code>cffi</code> docs.
<blockquote><p><aname="index-grid_003a_002acstd_002dinteger_002dtypes_002a-297"></a>List of integer types supported by <code>cffi</code>, from the <code>cffi</code> docs.
<blockquote><p><aname="index-grid_003a_002aprint_002dforeign_002darray_002dreadably_002a-315"></a>Print the contents of the foreign-array with the #m reader macro.
<blockquote><p><aname="index-grid_003a_002aprint_002dforeign_002darray_002dreadably_002a-309"></a>Print the contents of the foreign-array with the #m reader macro.
<li><aaccesskey="1"href="Reader-macro-and-function-_003ccode_003egrid_003c_002fcode_003e.html#Reader-macro-and-function-_003ccode_003egrid_003c_002fcode_003e">Reader macro and function <code>grid</code></a>
<p><aname="index-Class_002c-date-and-time-356"></a><aname="index-Date-357"></a><aname="index-Time-_0028of-day_0029-358"></a><aname="index-Date-and-time_002c-creating-359"></a><aname="index-Reader-macro_002c-date-and-time-360"></a><aname="index-ISO8601-361"></a><aname="index-UTC-_0028coordinated-universal-time_0029-362"></a><aname="index-TAI-_0028atomic-time_0029-363"></a><aname="index-Coordinated-Universal-Time-_0028UTC_0029-364"></a><aname="index-International-Atomic-Time-_0028TAI_0029-365"></a><aname="index-UT1-366"></a><aname="index-Astronomical-time-_0028UT1_0029-367"></a><aname="index-Timezones-368"></a>Dates and times can be represented in Antik with the <code>timepoint</code> class. A timepoint is a specific point in Newtonian time, so includes a date and time, and a <dfn>timescale</dfn> (best thought of as a timezone). Timepoints are most conveniently made with the <dfn>#d</dfn> reader macro; the default timescale is <ahref="http://en.wikipedia.org/wiki/Coordinated_Universal_Time">UTC</a>, and the standard format for specification of timepoints is
<p><aname="index-Class_002c-date-and-time-338"></a><aname="index-Date-339"></a><aname="index-Time-_0028of-day_0029-340"></a><aname="index-Date-and-time_002c-creating-341"></a><aname="index-Reader-macro_002c-date-and-time-342"></a><aname="index-ISO8601-343"></a><aname="index-UTC-_0028coordinated-universal-time_0029-344"></a><aname="index-TAI-_0028atomic-time_0029-345"></a><aname="index-Coordinated-Universal-Time-_0028UTC_0029-346"></a><aname="index-International-Atomic-Time-_0028TAI_0029-347"></a><aname="index-UT1-348"></a><aname="index-Astronomical-time-_0028UT1_0029-349"></a><aname="index-Timezones-350"></a>Dates and times can be represented in Antik with the <code>timepoint</code> class. A timepoint is a specific point in Newtonian time, so includes a date and time, and a <dfn>timescale</dfn> (best thought of as a timezone). Timepoints are most conveniently made with the <dfn>#d</dfn> reader macro; the default timescale is <ahref="http://en.wikipedia.org/wiki/Coordinated_Universal_Time">UTC</a>, and the standard format for specification of timepoints is
<blockquote><p><aname="index-antik_003a_002areal_002dut1_002dutc_002a-372"></a>If <code>nil</code>, <code>ut1</code> will be taken the same as <code>utc</code>.
<blockquote><p><aname="index-antik_003a_002areal_002dut1_002dutc_002a-354"></a>If <code>nil</code>, <code>ut1</code> will be taken the same as <code>utc</code>.
<blockquote><p><aname="index-antik_003aread_002dtimepoint-376"></a>Read a timepoint from a string with specification for the position in the string of each component; pos-ymdhms is a list of year, month, day, hour, minute, and second as sequence numbers for the integers in the string. Scale is the timescale (zone) as a string or symbol. If pos-ymdhms has only three components, or only a date is provided, the timepoint created will be specifed as day-only. The default reads an <code>iso8601</code> string like <code>1999-03-30t12:33:45</code>.
<blockquote><p><aname="index-antik_003aread_002dtimepoint-358"></a>Read a timepoint from a string with specification for the position in the string of each component; pos-ymdhms is a list of year, month, day, hour, minute, and second as sequence numbers for the integers in the string. Scale is the timescale (zone) as a string or symbol. If pos-ymdhms has only three components, or only a date is provided, the timepoint created will be specifed as day-only. The default reads an <code>iso8601</code> string like <code>1999-03-30t12:33:45</code>.
<h2class="chapter">11 Download and installation</h2>
<p><aname="index-Installation-of-Antik-467"></a><aname="index-Download-of-Antik-468"></a><aname="index-Dependencies-of-Antik-on-external-libraries-469"></a>The recommended way to download and install this software is through
<p><aname="index-Installation-of-Antik-449"></a><aname="index-Download-of-Antik-450"></a><aname="index-Dependencies-of-Antik-on-external-libraries-451"></a>The recommended way to download and install this software is through
<ahref="http://www.quicklisp.org/">quicklisp</a>. Install quicklisp following
<p><aname="index-Efficiency-of-computation-for-grids-316"></a><aname="index-Grid_002c-efficiency-of-computation-317"></a>Access to elements of foreign arrays, for getting or setting, can be
<p><aname="index-Efficiency-of-computation-for-grids-310"></a><aname="index-Grid_002c-efficiency-of-computation-311"></a>Access to elements of foreign arrays, for getting or setting, can be
very slow if they are not declared. These declarations can take
<p><aname="index-Foreign-array-metadata-466"></a>Antik is designed with the idea that scientific and engineering libraries, particularly foreign (non-Lisp) libraries, can easily be integrated, so that data can be exchanged with and among the libraries. Function and other definitions, when duplicated, will be named the same, differing only in the package. For example, if libraries ‘<samp><spanclass="samp">foo</span></samp>’ and ‘<samp><spanclass="samp">bar</span></samp>’ both define a singular value decomposition (SVD), they would use the function names <code>foo:sv-decomposition</code> and <code>bar:sv-decomposition</code>, and the arguments would be as similar as possible. Then a user may call either one on a matrix (two-dimensional) grid, and compare results.
<p><aname="index-Foreign-array-metadata-448"></a>Antik is designed with the idea that scientific and engineering libraries, particularly foreign (non-Lisp) libraries, can easily be integrated, so that data can be exchanged with and among the libraries. Function and other definitions, when duplicated, will be named the same, differing only in the package. For example, if libraries ‘<samp><spanclass="samp">foo</span></samp>’ and ‘<samp><spanclass="samp">bar</span></samp>’ both define a singular value decomposition (SVD), they would use the function names <code>foo:sv-decomposition</code> and <code>bar:sv-decomposition</code>, and the arguments would be as similar as possible. Then a user may call either one on a matrix (two-dimensional) grid, and compare results.
<p>To facilitate the exchange of foreign arrays, the class <code>grid:foreign-array</code> has a slot <code>grid::foreign-metadata</code>. The interface code for a foreign library can save information there as a plist that the library needs in order to use the array, such as the dimensions.