Mercurial > hg > octave-nkf
annotate scripts/java/java_get.m @ 20819:d6d04088ac9e
nbininv.m: Increase speed (85X) and accuracy of function (bug #34363).
* nbininv.m: Call new function scalar_nbininv to calculate nbininv for scalar.
If there are still uncalculated values then call bin_search_nbininv. Call
bin_search_nbininv directly for vectors. Add more BIST tests.
* nbininv.m (scalar_binoinv): New subfunction to calculate nbininv for scalar x.
Stops when x > 1000.
* nbininv.m (bin_search_nbininv): New subfunction to do binary search for nbininv.
author | Lachlan Andrew <lachlanbis@gmail.com> |
---|---|
date | Sun, 11 Oct 2015 20:33:37 -0700 |
parents | 03b9d17a2d95 |
children |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19790
diff
changeset
|
1 ## Copyright (C) 2012-2015 Rik Wehbring |
15771
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
2 ## |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
4 ## |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
8 ## your option) any later version. |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
9 ## |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
13 ## General Public License for more details. |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
14 ## |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
18 |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
19099
9887440ceb2e
doc: Update documentation around java_get, java_set.
Rik <rik@octave.org>
parents:
19097
diff
changeset
|
20 ## @deftypefn {Function File} {@var{val} =} java_get (@var{obj}, @var{name}) |
20370
03b9d17a2d95
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
21 ## Get the value of the field @var{name} of the Java object @var{obj}. |
03b9d17a2d95
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
22 ## |
03b9d17a2d95
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
23 ## For static fields, @var{obj} can be a string representing the fully |
03b9d17a2d95
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
24 ## qualified name of the corresponding class. |
19790
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19099
diff
changeset
|
25 ## |
15771
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
26 ## When @var{obj} is a regular Java object, structure-like indexing can be |
20370
03b9d17a2d95
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
27 ## used as a shortcut syntax. For instance, the following two statements are |
15771
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
28 ## equivalent |
19790
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19099
diff
changeset
|
29 ## |
15771
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
30 ## @example |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
31 ## @group |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
32 ## java_get (x, "field1") |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
33 ## x.field1 |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
34 ## @end group |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
35 ## @end example |
19790
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19099
diff
changeset
|
36 ## |
15789
8056d0e36bef
doc: First pass at updating Java documentation.
Rik <rik@octave.org>
parents:
15786
diff
changeset
|
37 ## @seealso{java_set, javaMethod, javaObject} |
15771
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
38 ## @end deftypefn |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
39 |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
40 function retval = java_get (obj, name) |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
41 |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
42 if (nargin != 2) |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
43 print_usage (); |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
44 endif |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
45 |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
46 if (isjava (obj)) |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
47 retval = obj.(name); |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
48 elseif (ischar (obj)) |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
49 retval = __java_get__ (obj, name); |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
50 else |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
51 error ("java_get: OBJ must be a Java object"); |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
52 endif |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
53 |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
54 endfunction |
4698ea77aa75
Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff
changeset
|
55 |