annotate scripts/java/java_set.m @ 20818:9d2023d1a63c

binoinv.m: Implement binary search algorithm for 28X performance increase (bug #34363). * binoinv.m: Call new functions scalar_binoinv or vector_binoinv to calculate binoinv. If there are still uncalculated values then call bin_search_binoinv to perform binary search for remaining values. Add more BIST tests. * binoinv.m (scalar_binoinv): New subfunction to calculate binoinv for scalar x. Stops when x > 1000. * binoinv.m (vector_binoinv): New subfunction to calculate binoinv for scalar x. Stops when x > 1000.
author Lachlan Andrew <lachlanbis@gmail.com>
date Sun, 11 Oct 2015 19:49:40 -0700
parents 03b9d17a2d95
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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{obj} =} java_set (@var{obj}, @var{name}, @var{val})
15771
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
21 ## Set the value of the field @var{name} of the Java object @var{obj} to
20370
03b9d17a2d95 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19898
diff changeset
22 ## @var{val}.
03b9d17a2d95 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19898
diff changeset
23 ##
03b9d17a2d95 doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19898
diff changeset
24 ## 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
25 ## qualified named of the corresponding Java class.
19790
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19099
diff changeset
26 ##
15771
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
27 ## 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
28 ## 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
29 ## equivalent
19790
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19099
diff changeset
30 ##
15771
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
31 ## @example
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
32 ## @group
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
33 ## java_set (x, "field1", val)
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
34 ## x.field1 = val
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
35 ## @end group
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
36 ## @end example
19790
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 19099
diff changeset
37 ##
15789
8056d0e36bef doc: First pass at updating Java documentation.
Rik <rik@octave.org>
parents: 15786
diff changeset
38 ## @seealso{java_get, javaMethod, javaObject}
15771
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
39 ## @end deftypefn
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
40
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
41 function retval = java_set (obj, name, val)
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
42
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
43 if (nargin != 3)
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
44 print_usage ();
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
45 endif
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
46
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
47 if (isjava (obj))
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
48 obj.(name) = val;
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
49 elseif (ischar (obj))
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
50 retval = __java_set__ (obj, name, val);
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
51 else
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
52 error ("java_set: 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
53 endif
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
54
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
55 endfunction
4698ea77aa75 Hide java_init, java_exit functions. Deprecate java_new, java_set, java_get.
Rik <rik@octave.org>
parents:
diff changeset
56