/usr/share/doc/stilts/sun256/uk.ac.starlink.ttools.func.Arrays.html is in stilts-doc 3.1.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="sun-style.css">
<title>Arrays</title>
</head>
<body>
<hr>
<a href="uk.ac.starlink.ttools.func.Arithmetic.html">Next</a> <a href="uk.ac.starlink.ttools.func.Times.html">Previous</a> <a href="staticMethods.html">Up</a> <a href="index.html">Contents</a> <br> <b>Next: </b><a href="uk.ac.starlink.ttools.func.Arithmetic.html">Arithmetic</a><br>
<b>Up: </b><a href="staticMethods.html">Functions</a><br>
<b>Previous: </b><a href="uk.ac.starlink.ttools.func.Times.html">Times</a><br>
<hr>
<h4><a name="uk.ac.starlink.ttools.func.Arrays">10.5.6 Arrays</a></h4>
<p>Functions which operate on array-valued cells.
The array parameters of these functions can only be used on values
which are already arrays (usually, numeric arrays).
In most cases that means on values in table columns which are declared
as array-valued. FITS and VOTable tables can have columns which contain
array values, but other formats such as CSV cannot.
</p>
<p>If you want to calculate aggregating functions like sum, min, max etc
on multiple values which are not part of an array,
it's easier to use the functions from the <code>Lists</code> class.
</p>
<p>Note that none of these functions will calculate statistical functions
over a whole column of a table.
</p>
<p>The functions fall into a number of categories:
<ul>
<li>Aggregating operations, which map an array value to a scalar, including
<code>size</code>,
<code>count</code>,
<code>countTrue</code>,
<code>maximum</code>,
<code>minimum</code>,
<code>sum</code>,
<code>mean</code>,
<code>median</code>,
<code>quantile</code>,
<code>stdev</code>,
<code>variance</code>,
<code>join</code>.
</li>
<li>Operations on one or more arrays which produce array results, including
<code>add</code>,
<code>subtract</code>,
<code>multiply</code>,
<code>divide</code>,
<code>reciprocal</code>,
<code>condition</code>.
</li>
<li>The function <code>array</code>,
which lets you assemble an array value from a list of scalar numbers.
This can be used with the aggregating functions here,
but it's generally easier to use the corresponding functions from
the <code>Lists</code> class.
</li>
</ul>
</p>
<p>
<dl>
<dt><strong><code>sum( array )</code></strong></dt>
<dd>Returns the sum of all the non-blank elements in the array.
If <code>array</code> is not a numeric array, <code>null</code>
is returned.
<ul>
<li><code>array</code> <em>(Object)</em>: array of numbers
</li>
<li>return value <em>(floating point)</em>: sum of all the numeric values in <code>array</code></li>
</ul>
</dd>
<dt><strong><code>mean( array )</code></strong></dt>
<dd>Returns the mean of all the non-blank elements in the array.
If <code>array</code> is not a numeric array, <code>null</code>
is returned.
<ul>
<li><code>array</code> <em>(Object)</em>: array of numbers
</li>
<li>return value <em>(floating point)</em>: mean of all the numeric values in <code>array</code></li>
</ul>
</dd>
<dt><strong><code>variance( array )</code></strong></dt>
<dd>Returns the population variance of all the non-blank elements
in the array. If <code>array</code> is not a numeric array,
<code>null</code> is returned.
<ul>
<li><code>array</code> <em>(Object)</em>: array of numbers
</li>
<li>return value <em>(floating point)</em>: variance of the numeric values in <code>array</code></li>
</ul>
</dd>
<dt><strong><code>stdev( array )</code></strong></dt>
<dd>Returns the population standard deviation of all the non-blank elements
in the array. If <code>array</code> is not a numeric array,
<code>null</code> is returned.
<ul>
<li><code>array</code> <em>(Object)</em>: array of numbers
</li>
<li>return value <em>(floating point)</em>: standard deviation of the numeric values in <code>array</code></li>
</ul>
</dd>
<dt><strong><code>minimum( array )</code></strong></dt>
<dd>Returns the smallest of the non-blank elements in the array.
If <code>array</code> is not a numeric array, <code>null</code>
is returned.
<ul>
<li><code>array</code> <em>(Object)</em>: array of numbers
</li>
<li>return value <em>(floating point)</em>: minimum of the numeric values in <code>array</code></li>
</ul>
</dd>
<dt><strong><code>maximum( array )</code></strong></dt>
<dd>Returns the largest of the non-blank elements in the array.
If <code>array</code> is not a numeric array, <code>null</code>
is returned.
<ul>
<li><code>array</code> <em>(Object)</em>: array of numbers
</li>
<li>return value <em>(floating point)</em>: maximum of the numeric values in <code>array</code></li>
</ul>
</dd>
<dt><strong><code>median( array )</code></strong></dt>
<dd>Returns the median of the non-blank elements in the array.
If <code>array</code> is not a numeric array, <code>null</code>
is returned.
<ul>
<li><code>array</code> <em>(Object)</em>: array of numbers
</li>
<li>return value <em>(floating point)</em>: median of the numeric values in <code>array</code></li>
</ul>
</dd>
<dt><strong><code>quantile( array, quant )</code></strong></dt>
<dd>Returns a quantile value of the non-blank elements in the array.
Which quantile is determined by the <code>quant</code> value;
values of 0, 0.5 and 1 give the minimum, median and maximum
respectively. A value of 0.99 would give the 99th percentile.
<ul>
<li><code>array</code> <em>(Object)</em>: array of numbers
</li>
<li><code>quant</code> <em>(floating point)</em>: number in the range 0-1 deterining which quantile
to calculate
</li>
<li>return value <em>(floating point)</em>: quantile corresponding to <code>quant</code></li>
</ul>
</dd>
<dt><strong><code>size( array )</code></strong></dt>
<dd>Returns the number of elements in the array.
If <code>array</code> is not an array, zero is returned.
<ul>
<li><code>array</code> <em>(Object)</em>: array
</li>
<li>return value <em>(integer)</em>: size of <code>array</code></li>
</ul>
</dd>
<dt><strong><code>count( array )</code></strong></dt>
<dd>Returns the number of non-blank elements in the array.
If <code>array</code> is not an array, zero is returned.
<ul>
<li><code>array</code> <em>(Object)</em>: array (may or may not be numeric)
</li>
<li>return value <em>(integer)</em>: number of non-blank elements in <code>array</code></li>
</ul>
</dd>
<dt><strong><code>countTrue( array )</code></strong></dt>
<dd>Returns the number of true elements in an array of boolean values.
<ul>
<li><code>array</code> <em>(array of boolean)</em>: array of true/false values
</li>
<li>return value <em>(integer)</em>: number of true values in <code>array</code></li>
</ul>
</dd>
<dt><strong><code>join( array, joiner )</code></strong></dt>
<dd>Returns a string composed of concatenating all the elements of an
array, separated by a joiner string.
If <code>array</code> is not an array, null is returned.
<ul>
<li><code>array</code> <em>(Object)</em>: array of numbers or strings
</li>
<li><code>joiner</code> <em>(String)</em>: text string to interpose between adjacent elements
</li>
<li>return value <em>(String)</em>: string composed of <code>array</code> elements separated by
<code>joiner</code> strings
</li>
</ul>
</dd>
<dt><strong><code>add( array1, array2 )</code></strong></dt>
<dd>Returns the result of adding two numeric arrays element by element.
Both arrays must be numeric, and the arrays must have the same length.
If either of those conditions is not true, <code>null</code> is returned.
The types of the arrays do not need to be the same,
so for example it is permitted to add an integer array
to a floating point array.
<ul>
<li><code>array1</code> <em>(Object)</em>: first array of numeric values
</li>
<li><code>array2</code> <em>(Object)</em>: second array of numeric values
</li>
<li>return value <em>(array of floating point)</em>: element-by-element sum of
<code>array1</code> and <code>array2</code>,
the same length as the input arrays
</li>
</ul>
</dd>
<dt><strong><code>add( array, constant )</code></strong></dt>
<dd>Returns the result of adding a constant value to every element of
a numeric array.
If the supplied <code>array</code> argument is not a numeric array,
<code>null</code> is returned.
<ul>
<li><code>array</code> <em>(Object)</em>: array input
</li>
<li><code>constant</code> <em>(floating point)</em>: value to add to each array element
</li>
<li>return value <em>(array of floating point)</em>: array output,
the same length as the <code>array</code> parameter
</li>
</ul>
</dd>
<dt><strong><code>subtract( array1, array2 )</code></strong></dt>
<dd>Returns the result of subtracting one numeric array from the other
element by element.
Both arrays must be numeric, and the arrays must have the same length.
If either of those conditions is not true, <code>null</code> is returned.
The types of the arrays do not need to be the same,
so for example it is permitted to subtract an integer array
from a floating point array.
<ul>
<li><code>array1</code> <em>(Object)</em>: first array of numeric values
</li>
<li><code>array2</code> <em>(Object)</em>: second array of numeric values
</li>
<li>return value <em>(array of floating point)</em>: element-by-element difference of
<code>array1</code> and <code>array2</code>,
the same length as the input arrays
</li>
</ul>
</dd>
<dt><strong><code>multiply( array1, array2 )</code></strong></dt>
<dd>Returns the result of multiplying two numeric arrays element by element.
Both arrays must be numeric, and the arrays must have the same length.
If either of those conditions is not true, <code>null</code> is returned.
The types of the arrays do not need to be the same,
so for example it is permitted to multiply an integer array
by a floating point array.
<ul>
<li><code>array1</code> <em>(Object)</em>: first array of numeric values
</li>
<li><code>array2</code> <em>(Object)</em>: second array of numeric values
</li>
<li>return value <em>(array of floating point)</em>: element-by-element product of
<code>array1</code> and <code>array2</code>,
the same length as the input arrays
</li>
</ul>
</dd>
<dt><strong><code>multiply( array, constant )</code></strong></dt>
<dd>Returns the result of multiplying every element of a numeric array
by a constant value.
If the supplied <code>array</code> argument is not a numeric array,
<code>null</code> is returned.
<ul>
<li><code>array</code> <em>(Object)</em>: array input
</li>
<li><code>constant</code> <em>(floating point)</em>: value by which to multiply each array element
</li>
<li>return value <em>(array of floating point)</em>: array output,
the same length as the <code>array</code> parameter
</li>
</ul>
</dd>
<dt><strong><code>divide( array1, array2 )</code></strong></dt>
<dd>Returns the result of dividing two numeric arrays element by element.
Both arrays must be numeric, and the arrays must have the same length.
If either of those conditions is not true, <code>null</code> is returned.
The types of the arrays do not need to be the same,
so for example it is permitted to divide an integer array
by a floating point array.
<ul>
<li><code>array1</code> <em>(Object)</em>: array of numerator values (numeric)
</li>
<li><code>array2</code> <em>(Object)</em>: array of denominator values (numeric)
</li>
<li>return value <em>(array of floating point)</em>: element-by-element result of <code>array1[i]/array2[i]</code>
the same length as the input arrays
</li>
</ul>
</dd>
<dt><strong><code>reciprocal( array )</code></strong></dt>
<dd>Returns the result of taking the reciprocal of every element of
a numeric array.
If the supplied <code>array</code> argument is not a numeric array,
<code>null</code> is returned.
<ul>
<li><code>array</code> <em>(Object)</em>: array input
</li>
<li>return value <em>(array of floating point)</em>: array output,
the same length as the <code>array</code> parameter
</li>
</ul>
</dd>
<dt><strong><code>condition( flagArray, trueValue, falseValue )</code></strong></dt>
<dd>Maps a boolean array to a numeric array by using supplied numeric
values to represent true and false values from the input array.
<p>This has the same effect as applying the expression
<code>outArray[i] = flagArray[i] ? trueValue : falseValue</code>.
<ul>
<li><code>flagArray</code> <em>(array of boolean)</em>: array of boolean values
</li>
<li><code>trueValue</code> <em>(floating point)</em>: output value corresponding to an input true value
</li>
<li><code>falseValue</code> <em>(floating point)</em>: output value corresponding to an input false value
</li>
<li>return value <em>(array of floating point)</em>: output numeric array, same length as <code>flagArray</code></li>
</ul>
</p>
</dd>
<dt><strong><code>array( values, ... )</code></strong></dt>
<dd>Returns a floating point numeric array built from the given arguments.
<ul>
<li><code>values</code> <em>(floating point, one or more)</em>: one or more array elements
</li>
<li>return value <em>(array of floating point)</em>: array
</li>
</ul>
</dd>
<dt><strong><code>intArray( values, ... )</code></strong></dt>
<dd>Returns an integer numeric array built from the given arguments.
<ul>
<li><code>values</code> <em>(integer, one or more)</em>: one or more array elements
</li>
<li>return value <em>(array of integer)</em>: array
</li>
</ul>
</dd>
<dt><strong><code>stringArray( values, ... )</code></strong></dt>
<dd>Returns a String array built from the given arguments.
<ul>
<li><code>values</code> <em>(String, one or more)</em>: one or more array elements
</li>
<li>return value <em>(array of String)</em>: array
</li>
</ul>
</dd>
</dl>
</p>
<hr><a href="uk.ac.starlink.ttools.func.Arithmetic.html">Next</a> <a href="uk.ac.starlink.ttools.func.Times.html">Previous</a> <a href="staticMethods.html">Up</a> <a href="index.html">Contents</a> <br> <b>Next: </b><a href="uk.ac.starlink.ttools.func.Arithmetic.html">Arithmetic</a><br>
<b>Up: </b><a href="staticMethods.html">Functions</a><br>
<b>Previous: </b><a href="uk.ac.starlink.ttools.func.Times.html">Times</a><br>
<hr><i>STILTS - Starlink Tables Infrastructure Library Tool Set<br>Starlink User Note256<br>STILTS web page:
<a href="http://www.starlink.ac.uk/stilts/">http://www.starlink.ac.uk/stilts/</a><br>Author email:
<a href="mailto:m.b.taylor@bristol.ac.uk">m.b.taylor@bristol.ac.uk</a><br>Mailing list:
<a href="mailto:topcat-user@jiscmail.ac.uk">topcat-user@jiscmail.ac.uk</a><br></i></body>
</html>
|