6778
|
1 @c Copyright (C) 1996, 1997, 2007 John W. Eaton |
7018
|
2 @c |
|
3 @c This file is part of Octave. |
|
4 @c |
|
5 @c Octave is free software; you can redistribute it and/or modify it |
|
6 @c under the terms of the GNU General Public License as published by the |
|
7 @c Free Software Foundation; either version 3 of the License, or (at |
|
8 @c your option) any later version. |
|
9 @c |
|
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT |
|
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 @c for more details. |
|
14 @c |
|
15 @c You should have received a copy of the GNU General Public License |
|
16 @c along with Octave; see the file COPYING. If not, see |
|
17 @c <http://www.gnu.org/licenses/>. |
3294
|
18 |
4167
|
19 @node Numeric Data Types |
3294
|
20 @chapter Numeric Data Types |
|
21 @cindex numeric constant |
|
22 @cindex numeric value |
|
23 |
|
24 A @dfn{numeric constant} may be a scalar, a vector, or a matrix, and it |
|
25 may contain complex values. |
|
26 |
|
27 The simplest form of a numeric constant, a scalar, is a single number |
|
28 that can be an integer, a decimal fraction, a number in scientific |
6620
|
29 (exponential) notation, or a complex number. Note that by default numeric |
3294
|
30 constants are represented within Octave in double-precision floating |
|
31 point format (complex constants are stored as pairs of double-precision |
6620
|
32 floating point values). It is however possible to represent real |
|
33 integers as described in @ref{Integer Data Types}. Here are some examples |
|
34 of real-valued numeric constants, which all have the same value: |
3294
|
35 |
|
36 @example |
|
37 @group |
|
38 105 |
|
39 1.05e+2 |
|
40 1050e-1 |
|
41 @end group |
|
42 @end example |
|
43 |
|
44 To specify complex constants, you can write an expression of the form |
|
45 |
|
46 @example |
|
47 @group |
|
48 3 + 4i |
|
49 3.0 + 4.0i |
|
50 0.3e1 + 40e-1i |
|
51 @end group |
|
52 @end example |
|
53 |
6620
|
54 @noindent |
3294
|
55 all of which are equivalent. The letter @samp{i} in the previous example |
|
56 stands for the pure imaginary constant, defined as |
|
57 @iftex |
|
58 @tex |
|
59 $\sqrt{-1}$. |
|
60 @end tex |
|
61 @end iftex |
6620
|
62 @ifnottex |
3294
|
63 @code{sqrt (-1)}. |
6620
|
64 @end ifnottex |
3294
|
65 |
|
66 For Octave to recognize a value as the imaginary part of a complex |
|
67 constant, a space must not appear between the number and the @samp{i}. |
|
68 If it does, Octave will print an error message, like this: |
|
69 |
|
70 @example |
|
71 @group |
|
72 octave:13> 3 + 4 i |
|
73 |
|
74 parse error: |
|
75 |
|
76 3 + 4 i |
|
77 ^ |
|
78 @end group |
|
79 @end example |
|
80 |
6620
|
81 @noindent |
3294
|
82 You may also use @samp{j}, @samp{I}, or @samp{J} in place of the |
|
83 @samp{i} above. All four forms are equivalent. |
|
84 |
6549
|
85 @DOCSTRING(double) |
|
86 |
|
87 @DOCSTRING(single) |
|
88 |
|
89 @DOCSTRING(complex) |
|
90 |
3294
|
91 @menu |
|
92 * Matrices:: |
|
93 * Ranges:: |
6549
|
94 * Integer Data Types:: |
6781
|
95 * Bit Manipulations:: |
3428
|
96 * Logical Values:: |
3294
|
97 * Predicates for Numeric Objects:: |
|
98 @end menu |
|
99 |
4167
|
100 @node Matrices |
3294
|
101 @section Matrices |
|
102 @cindex matrices |
|
103 |
|
104 @opindex [ |
|
105 @opindex ] |
|
106 @opindex ; |
|
107 @opindex , |
|
108 |
|
109 It is easy to define a matrix of values in Octave. The size of the |
|
110 matrix is determined automatically, so it is not necessary to explicitly |
|
111 state the dimensions. The expression |
|
112 |
|
113 @example |
|
114 a = [1, 2; 3, 4] |
|
115 @end example |
|
116 |
|
117 @noindent |
|
118 results in the matrix |
|
119 @iftex |
|
120 @tex |
|
121 $$ a = \left[ \matrix{ 1 & 2 \cr 3 & 4 } \right] $$ |
|
122 @end tex |
|
123 @end iftex |
6620
|
124 @ifnottex |
3294
|
125 |
|
126 @example |
|
127 @group |
|
128 |
|
129 / \ |
|
130 | 1 2 | |
|
131 a = | | |
|
132 | 3 4 | |
|
133 \ / |
|
134 |
|
135 @end group |
|
136 @end example |
6620
|
137 @end ifnottex |
3294
|
138 |
|
139 Elements of a matrix may be arbitrary expressions, provided that the |
|
140 dimensions all make sense when combining the various pieces. For |
|
141 example, given the above matrix, the expression |
|
142 |
|
143 @example |
|
144 [ a, a ] |
|
145 @end example |
|
146 |
|
147 @noindent |
|
148 produces the matrix |
|
149 |
|
150 @example |
|
151 @group |
|
152 ans = |
|
153 |
|
154 1 2 1 2 |
|
155 3 4 3 4 |
|
156 @end group |
|
157 @end example |
|
158 |
|
159 @noindent |
|
160 but the expression |
|
161 |
|
162 @example |
|
163 [ a, 1 ] |
|
164 @end example |
|
165 |
|
166 @noindent |
|
167 produces the error |
|
168 |
|
169 @example |
|
170 error: number of rows must match near line 13, column 6 |
|
171 @end example |
|
172 |
|
173 @noindent |
|
174 (assuming that this expression was entered as the first thing on line |
|
175 13, of course). |
|
176 |
|
177 Inside the square brackets that delimit a matrix expression, Octave |
|
178 looks at the surrounding context to determine whether spaces and newline |
|
179 characters should be converted into element and row separators, or |
4476
|
180 simply ignored, so an expression like |
3294
|
181 |
|
182 @example |
|
183 @group |
|
184 a = [ 1 2 |
|
185 3 4 ] |
|
186 @end group |
|
187 @end example |
|
188 |
|
189 @noindent |
|
190 will work. However, some possible sources of confusion remain. For |
|
191 example, in the expression |
|
192 |
|
193 @example |
|
194 [ 1 - 1 ] |
|
195 @end example |
|
196 |
|
197 @noindent |
|
198 the @samp{-} is treated as a binary operator and the result is the |
|
199 scalar 0, but in the expression |
|
200 |
|
201 @example |
|
202 [ 1 -1 ] |
|
203 @end example |
|
204 |
|
205 @noindent |
|
206 the @samp{-} is treated as a unary operator and the result is the |
4476
|
207 vector @code{[ 1, -1 ]}. Similarly, the expression |
|
208 |
|
209 @example |
|
210 [ sin (pi) ] |
|
211 @end example |
|
212 |
|
213 @noindent |
|
214 will be parsed as |
|
215 |
|
216 @example |
|
217 [ sin, (pi) ] |
|
218 @end example |
3294
|
219 |
4476
|
220 @noindent |
|
221 and will result in an error since the @code{sin} function will be |
|
222 called with no arguments. To get around this, you must omit the space |
|
223 between @code{sin} and the opening parenthesis, or enclose the |
|
224 expression in a set of parentheses: |
|
225 |
|
226 @example |
|
227 [ (sin (pi)) ] |
|
228 @end example |
|
229 |
|
230 Whitespace surrounding the single quote character (@samp{'}, used as a |
|
231 transpose operator and for delimiting character strings) can also cause |
|
232 confusion. Given @code{a = 1}, the expression |
3294
|
233 |
|
234 @example |
|
235 [ 1 a' ] |
|
236 @end example |
|
237 |
|
238 @noindent |
4476
|
239 results in the single quote character being treated as a |
3294
|
240 transpose operator and the result is the vector @code{[ 1, 1 ]}, but the |
|
241 expression |
|
242 |
|
243 @example |
|
244 [ 1 a ' ] |
|
245 @end example |
|
246 |
|
247 @noindent |
|
248 produces the error message |
|
249 |
|
250 @example |
|
251 error: unterminated string constant |
|
252 @end example |
|
253 |
|
254 @noindent |
6620
|
255 because not doing so would cause trouble when parsing the valid expression |
3294
|
256 |
|
257 @example |
|
258 [ a 'foo' ] |
|
259 @end example |
|
260 |
|
261 For clarity, it is probably best to always use commas and semicolons to |
4476
|
262 separate matrix elements and rows. |
3294
|
263 |
|
264 When you type a matrix or the name of a variable whose value is a |
|
265 matrix, Octave responds by printing the matrix in with neatly aligned |
|
266 rows and columns. If the rows of the matrix are too large to fit on the |
|
267 screen, Octave splits the matrix and displays a header before each |
|
268 section to indicate which columns are being displayed. You can use the |
|
269 following variables to control the format of the output. |
|
270 |
3321
|
271 @DOCSTRING(output_max_field_width) |
3294
|
272 |
3321
|
273 @DOCSTRING(output_precision) |
3294
|
274 |
|
275 It is possible to achieve a wide range of output styles by using |
|
276 different values of @code{output_precision} and |
|
277 @code{output_max_field_width}. Reasonable combinations can be set using |
|
278 the @code{format} function. @xref{Basic Input and Output}. |
|
279 |
3321
|
280 @DOCSTRING(split_long_rows) |
3294
|
281 |
|
282 Octave automatically switches to scientific notation when values become |
|
283 very large or very small. This guarantees that you will see several |
|
284 significant figures for every value in a matrix. If you would prefer to |
|
285 see all values in a matrix printed in a fixed point format, you can set |
|
286 the built-in variable @code{fixed_point_format} to a nonzero value. But |
|
287 doing so is not recommended, because it can produce output that can |
|
288 easily be misinterpreted. |
|
289 |
3321
|
290 @DOCSTRING(fixed_point_format) |
3294
|
291 |
|
292 @menu |
|
293 * Empty Matrices:: |
|
294 @end menu |
|
295 |
4167
|
296 @node Empty Matrices |
3294
|
297 @subsection Empty Matrices |
|
298 |
|
299 A matrix may have one or both dimensions zero, and operations on empty |
|
300 matrices are handled as described by Carl de Boor in @cite{An Empty |
|
301 Exercise}, SIGNUM, Volume 25, pages 2--6, 1990 and C. N. Nett and W. M. |
|
302 Haddad, in @cite{A System-Theoretic Appropriate Realization of the Empty |
|
303 Matrix Concept}, IEEE Transactions on Automatic Control, Volume 38, |
|
304 Number 5, May 1993. |
|
305 @iftex |
|
306 @tex |
|
307 Briefly, given a scalar $s$, an $m\times n$ matrix $M_{m\times n}$, |
|
308 and an $m\times n$ empty matrix $[\,]_{m\times n}$ (with either one or |
|
309 both dimensions equal to zero), the following are true: |
|
310 $$ |
|
311 \eqalign{% |
|
312 s \cdot [\,]_{m\times n} = [\,]_{m\times n} \cdot s &= [\,]_{m\times n}\cr |
|
313 [\,]_{m\times n} + [\,]_{m\times n} &= [\,]_{m\times n}\cr |
|
314 [\,]_{0\times m} \cdot M_{m\times n} &= [\,]_{0\times n}\cr |
|
315 M_{m\times n} \cdot [\,]_{n\times 0} &= [\,]_{m\times 0}\cr |
|
316 [\,]_{m\times 0} \cdot [\,]_{0\times n} &= 0_{m\times n}} |
|
317 $$ |
|
318 @end tex |
|
319 @end iftex |
6620
|
320 @ifnottex |
3294
|
321 Briefly, given a scalar @var{s}, an @var{m} by |
|
322 @var{n} matrix @code{M(mxn)}, and an @var{m} by @var{n} empty matrix |
|
323 @code{[](mxn)} (with either one or both dimensions equal to zero), the |
|
324 following are true: |
|
325 |
|
326 @example |
|
327 @group |
|
328 s * [](mxn) = [](mxn) * s = [](mxn) |
|
329 |
|
330 [](mxn) + [](mxn) = [](mxn) |
|
331 |
|
332 [](0xm) * M(mxn) = [](0xn) |
|
333 |
|
334 M(mxn) * [](nx0) = [](mx0) |
|
335 |
|
336 [](mx0) * [](0xn) = 0(mxn) |
|
337 @end group |
|
338 @end example |
6620
|
339 @end ifnottex |
3294
|
340 |
|
341 By default, dimensions of the empty matrix are printed along with the |
|
342 empty matrix symbol, @samp{[]}. The built-in variable |
|
343 @code{print_empty_dimensions} controls this behavior. |
|
344 |
3321
|
345 @DOCSTRING(print_empty_dimensions) |
3294
|
346 |
|
347 Empty matrices may also be used in assignment statements as a convenient |
|
348 way to delete rows or columns of matrices. |
|
349 @xref{Assignment Ops, ,Assignment Expressions}. |
|
350 |
|
351 When Octave parses a matrix expression, it examines the elements of the |
|
352 list to determine whether they are all constants. If they are, it |
|
353 replaces the list with a single matrix constant. |
|
354 |
4167
|
355 @node Ranges |
3294
|
356 @section Ranges |
|
357 @cindex range expressions |
|
358 @cindex expression, range |
|
359 |
3920
|
360 @opindex colon |
3294
|
361 |
|
362 A @dfn{range} is a convenient way to write a row vector with evenly |
|
363 spaced elements. A range expression is defined by the value of the first |
|
364 element in the range, an optional value for the increment between |
|
365 elements, and a maximum value which the elements of the range will not |
|
366 exceed. The base, increment, and limit are separated by colons (the |
|
367 @samp{:} character) and may contain any arithmetic expressions and |
|
368 function calls. If the increment is omitted, it is assumed to be 1. |
|
369 For example, the range |
|
370 |
|
371 @example |
|
372 1 : 5 |
|
373 @end example |
|
374 |
|
375 @noindent |
|
376 defines the set of values @samp{[ 1, 2, 3, 4, 5 ]}, and the range |
|
377 |
|
378 @example |
|
379 1 : 3 : 5 |
|
380 @end example |
|
381 |
|
382 @noindent |
|
383 defines the set of values @samp{[ 1, 4 ]}. |
|
384 |
|
385 Although a range constant specifies a row vector, Octave does @emph{not} |
|
386 convert range constants to vectors unless it is necessary to do so. |
|
387 This allows you to write a constant like @samp{1 : 10000} without using |
|
388 80,000 bytes of storage on a typical 32-bit workstation. |
|
389 |
|
390 Note that the upper (or lower, if the increment is negative) bound on |
|
391 the range is not always included in the set of values, and that ranges |
|
392 defined by floating point values can produce surprising results because |
|
393 Octave uses floating point arithmetic to compute the values in the |
|
394 range. If it is important to include the endpoints of a range and the |
|
395 number of elements is known, you should use the @code{linspace} function |
|
396 instead (@pxref{Special Utility Matrices}). |
|
397 |
|
398 When Octave parses a range expression, it examines the elements of the |
|
399 expression to determine whether they are all constants. If they are, it |
|
400 replaces the range expression with a single range constant. |
|
401 |
6549
|
402 @node Integer Data Types |
|
403 @section Integer Data Types |
|
404 |
6620
|
405 Octave supports integer matrices as an alternative to using double |
|
406 precision. It is possible to use both signed and unsigned integers |
|
407 represented by 8, 16, 32, or 64 bits. It should be noted that most |
|
408 computations require floating point data, meaning that integers will |
|
409 often change type when involved in numeric computations. For this |
|
410 reason integers are most often used to store data, and not for |
|
411 calculations. |
|
412 |
|
413 In general most integer matrices are created by casting |
|
414 existing matrices to integers. The following example shows how to cast |
|
415 a matrix into 32 bit integers. |
|
416 |
|
417 @example |
|
418 float = rand (2, 2) |
|
419 @result{} float = 0.37569 0.92982 |
|
420 0.11962 0.50876 |
|
421 integer = int32 (float) |
|
422 @result{} integer = 0 1 |
|
423 0 1 |
|
424 @end example |
|
425 |
|
426 @noindent |
|
427 As can be seen, floating point values are rounded to the nearest integer |
|
428 when converted. |
|
429 |
6549
|
430 @DOCSTRING(isinteger) |
|
431 |
|
432 @DOCSTRING(int8) |
|
433 |
|
434 @DOCSTRING(uint8) |
|
435 |
|
436 @DOCSTRING(int16) |
|
437 |
|
438 @DOCSTRING(uint16) |
|
439 |
|
440 @DOCSTRING(int32) |
|
441 |
|
442 @DOCSTRING(uint32) |
|
443 |
|
444 @DOCSTRING(int64) |
|
445 |
|
446 @DOCSTRING(uint64) |
|
447 |
|
448 @DOCSTRING(intmax) |
|
449 |
|
450 @DOCSTRING(intmin) |
|
451 |
6624
|
452 @menu |
|
453 * Integer Arithmetic:: |
|
454 @end menu |
|
455 |
6620
|
456 @node Integer Arithmetic |
|
457 @subsection Integer Arithmetic |
|
458 |
|
459 While many numerical computations can't be carried out in integers, |
|
460 Octave does support basic operations like addition and multiplication |
|
461 on integers. The operators @code{+}, @code{-}, @code{.*}, and @code{./} |
|
462 works on integers of the same type. So, it is possible to add two 32 bit |
|
463 integers, but not to add a 32 bit integer and a 16 bit integer. |
|
464 |
6715
|
465 The arithmetic operations on integers are performed by casting the |
|
466 integer values to double precision values, performing the operation, and |
|
467 then re-casting the values back to the original integer type. As the |
|
468 double precision type of Octave is only capable of representing integers |
|
469 with up to 53 bits of precision, it is not possible to perform |
|
470 arithmetic of the 64 bit integer types. |
|
471 |
6620
|
472 When doing integer arithmetic one should consider the possibility of |
|
473 underflow and overflow. This happens when the result of the computation |
|
474 can't be represented using the chosen integer type. As an example it is |
|
475 not possible to represent the result of @math{10 - 20} when using |
|
476 unsigned integers. Octave makes sure that the result of integer |
|
477 computations is the integer that is closest to the true result. So, the |
|
478 result of @math{10 - 20} when using unsigned integers is zero. |
|
479 |
|
480 When doing integer division Octave will round the result to the nearest |
|
481 integer. This is different from most programming languages, where the |
|
482 result is often floored to the nearest integer. So, the result of |
|
483 @code{int32(5)./int32(8)} is @code{1}. |
|
484 |
6781
|
485 @node Bit Manipulations |
|
486 @section Bit Manipulations |
|
487 |
|
488 Octave provides a number of functions for the manipulation of numeric |
|
489 values on a bit by bit basis. The basic functions to set and obtain the |
|
490 values of individual bits are @code{bitset} and @code{bitget}. |
|
491 |
|
492 @DOCSTRING(bitset) |
|
493 |
|
494 @DOCSTRING(bitget) |
|
495 |
|
496 The arguments to all of Octave's bitwise operations can be scalar or |
|
497 arrays, except for @code{bitcmp}, whose @var{k} argument must a |
|
498 scalar. In the case where more than one argument is an array, then all |
|
499 arguments must have the same shape, and the bitwise operator is applied |
|
500 to each of the elements of the argument individually. If at least one |
|
501 argument is a scalar and one an array, then the scalar argument is |
|
502 duplicated. Therefore |
|
503 |
|
504 @example |
|
505 bitget (100, 8:-1:1) |
|
506 @end example |
|
507 |
|
508 is the same as |
|
509 |
|
510 @example |
|
511 bitget (100 * ones (1, 8), 8:-1:1) |
|
512 @end example |
|
513 |
|
514 It should be noted that all values passed to the bit manipulation |
|
515 functions of Octave are treated as integers. Therefore, even though the |
|
516 example for @code{bitset} above passes the floating point value |
|
517 @code{10}, it is treated as the bits @code{[1, 0, 1, 0]} rather than the |
|
518 bits of the native floating point format representation of @code{10}. |
|
519 |
|
520 As the maximum number that can be represented by a number is important |
|
521 for bit manipulation, particularly when forming masks, Octave supplies |
|
522 the function @code{bitmax}. |
|
523 |
|
524 @DOCSTRING(bitmax) |
|
525 |
|
526 This is the double precision version of the functions @code{intmax}, |
|
527 previously discussed. |
|
528 |
|
529 Octave also include the basic bitwise 'and', 'or' and 'exclusive or' |
|
530 operators. |
|
531 |
|
532 @DOCSTRING(bitand) |
|
533 |
|
534 @DOCSTRING(bitor) |
|
535 |
|
536 @DOCSTRING(bitxor) |
|
537 |
|
538 The bitwise 'not' operator is unary operator that performs a logial |
|
539 negation of each of the bits of the value. For this to make sense, the |
|
540 mask against which the value is negated must be defined. Octave's |
|
541 bitwise 'not' operator is @code{bitcmp}. |
|
542 |
|
543 @DOCSTRING(bitcmp) |
|
544 |
|
545 Octave also includes the ability to left and right values bitwise. |
|
546 |
|
547 @DOCSTRING(bitshift) |
|
548 |
|
549 Bits that are shifted out of either end of the value are lost. Octave |
|
550 also uses arithmetic shifts, where the sign bit of the value is keep |
|
551 during a right shift. For example |
|
552 |
|
553 @example |
|
554 @group |
|
555 bitshift (-10, -1) |
|
556 @result{} -5 |
|
557 bitshift (int8 (-1), -1) |
|
558 @result{} -1 |
|
559 @end group |
|
560 @end example |
|
561 |
|
562 Note that @code{bitshift (int8 (-1), -1)} is @code{-1} since the bit |
|
563 representation of @code{-1} in the @code{int8} data type is @code{[1, 1, |
|
564 1, 1, 1, 1, 1, 1]}. |
|
565 |
4167
|
566 @node Logical Values |
3428
|
567 @section Logical Values |
|
568 |
6620
|
569 Octave has built-in support for logical values, i.e. variables that |
|
570 are either @code{true} or @code{false}. When comparing two variables, |
|
571 the result will be a logical value whose value depends on whether or |
|
572 not the comparison is true. |
|
573 |
|
574 The basic logical operations are @code{&}, @code{|}, and @code{!}, |
|
575 that corresponds to ``Logical And'', ``Logical Or'', and ``Logical |
|
576 Negation''. These operations all follow the rules of logic. |
|
577 |
|
578 It is also possible to use logical values as part of standard numerical |
|
579 calculations. In this case @code{true} is converted to @code{1}, and |
|
580 @code{false} to 0, both represented using double precision floating |
|
581 point numbers. So, the result of @code{true*22 - false/6} is @code{22}. |
|
582 |
|
583 Logical values can also be used to index matrices and cell arrays. |
|
584 When indexing with a logical array the result will be a vector containing |
|
585 the values corresponding to @code{true} parts of the logical array. |
|
586 The following example illustrates this. |
|
587 |
|
588 @example |
|
589 data = [ 1, 2; 3, 4 ]; |
|
590 idx = (data <= 2); |
|
591 data(idx) |
|
592 @result{} ans = [ 1; 4 ] |
|
593 @end example |
|
594 |
|
595 @noindent |
|
596 Instead of creating the @code{idx} array it is possible to replace |
|
597 @code{data(idx)} with @code{data( data <= 2 )} in the above code. |
|
598 |
|
599 Besides when doing comparisons, logical values can be constructed by |
|
600 casting numeric objects to logical values, or by using the @code{true} |
|
601 or @code{false} functions. |
|
602 |
6549
|
603 @DOCSTRING(logical) |
|
604 |
3428
|
605 @DOCSTRING(true) |
|
606 |
|
607 @DOCSTRING(false) |
|
608 |
4167
|
609 @node Predicates for Numeric Objects |
3294
|
610 @section Predicates for Numeric Objects |
|
611 |
6620
|
612 Since the type of a variable may change during the execution of a |
|
613 program, it can be necessary to type checking at run-time. Doing this |
|
614 also allows you to change the behaviour of a function depending on the |
|
615 type of the input. As an example, this naive implementation of @code{abs} |
7001
|
616 returns the absolute value of the input if it is a real number, and the |
6620
|
617 length of the input if it is a complex number. |
|
618 |
|
619 @example |
|
620 function a = abs (x) |
|
621 if (isreal (x)) |
|
622 a = sign (x) .* x; |
|
623 elseif (iscomplex (x)) |
|
624 a = sqrt (real(x).^2 + imag(x).^2); |
|
625 endif |
|
626 endfunction |
|
627 @end example |
|
628 |
|
629 The following functions are available for determining the type of a |
|
630 variable. |
|
631 |
3428
|
632 @DOCSTRING(isnumeric) |
|
633 |
|
634 @DOCSTRING(isreal) |
|
635 |
4029
|
636 @DOCSTRING(iscomplex) |
3428
|
637 |
4029
|
638 @DOCSTRING(ismatrix) |
3294
|
639 |
4029
|
640 @DOCSTRING(isvector) |
3294
|
641 |
4029
|
642 @DOCSTRING(isscalar) |
3294
|
643 |
4029
|
644 @DOCSTRING(issquare) |
3294
|
645 |
4029
|
646 @DOCSTRING(issymmetric) |
3428
|
647 |
6550
|
648 @DOCSTRING(isdefinite) |
|
649 |
6688
|
650 @DOCSTRING(islogical) |
6550
|
651 |
|
652 @DOCSTRING(isprime) |