summaryrefslogtreecommitdiffstats
path: root/scilab/modules/linear_algebra
diff options
context:
space:
mode:
authorClément David <clement.david@esi-group.com>2021-07-15 15:50:48 +0200
committerClément David <clement.david@esi-group.com>2021-07-15 15:50:48 +0200
commit81a9cc049332de0c712cf56da585fcd25c8e59e3 (patch)
treef365c25a05c1782a16b2985bf7481116c106952d /scilab/modules/linear_algebra
parentb0937f19e4b8ddf416ca9a9a433bcbbd3f4ef2c0 (diff)
parent90b4ecb9b57ac6ad4e00d4a99b0d8bd1a6424403 (diff)
downloadscilab-master.zip
scilab-master.tar.gz
Merge remote-tracking branch 'origin/6.1'HEADmaster
Change-Id: I5d26fc380a28efe0bb6d0096fe9684b274b55bfe
Diffstat (limited to 'scilab/modules/linear_algebra')
-rw-r--r--scilab/modules/linear_algebra/Makefile.in2
-rw-r--r--scilab/modules/linear_algebra/help/en_US/eigen/bdiag.xml55
-rw-r--r--scilab/modules/linear_algebra/help/en_US/eigen/eigs.xml543
-rw-r--r--scilab/modules/linear_algebra/help/en_US/factorization/chol.xml (renamed from scilab/modules/linear_algebra/help/en_US/linear/chol.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/en_US/factorization/fullrf.xml (renamed from scilab/modules/linear_algebra/help/en_US/kernel/fullrf.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/en_US/factorization/fullrfk.xml (renamed from scilab/modules/linear_algebra/help/en_US/kernel/fullrfk.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/en_US/factorization/hess.xml (renamed from scilab/modules/linear_algebra/help/en_US/eigen/hess.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/en_US/factorization/lu.xml (renamed from scilab/modules/linear_algebra/help/en_US/linear/lu.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/en_US/factorization/qr.xml (renamed from scilab/modules/linear_algebra/help/en_US/linear/qr.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/en_US/factorization/rankqr.xml (renamed from scilab/modules/linear_algebra/help/en_US/linear/rankqr.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/en_US/factorization/schur.xml (renamed from scilab/modules/linear_algebra/help/en_US/eigen/schur.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/en_US/givens.xml (renamed from scilab/modules/linear_algebra/help/en_US/factorization/givens.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/en_US/householder.xml (renamed from scilab/modules/linear_algebra/help/en_US/factorization/householder.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/en_US/matrix/det.xml218
-rw-r--r--scilab/modules/linear_algebra/help/fr_FR/eigen/bdiag.xml47
-rw-r--r--scilab/modules/linear_algebra/help/fr_FR/factorization/chol.xml (renamed from scilab/modules/linear_algebra/help/fr_FR/linear/chol.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/fr_FR/factorization/fullrf.xml (renamed from scilab/modules/linear_algebra/help/fr_FR/kernel/fullrf.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/fr_FR/factorization/fullrfk.xml (renamed from scilab/modules/linear_algebra/help/fr_FR/kernel/fullrfk.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/fr_FR/factorization/hess.xml (renamed from scilab/modules/linear_algebra/help/fr_FR/eigen/hess.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/fr_FR/factorization/lu.xml (renamed from scilab/modules/linear_algebra/help/fr_FR/linear/lu.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/fr_FR/factorization/qr.xml (renamed from scilab/modules/linear_algebra/help/fr_FR/linear/qr.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/fr_FR/givens.xml (renamed from scilab/modules/linear_algebra/help/fr_FR/factorization/givens.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/fr_FR/householder.xml (renamed from scilab/modules/linear_algebra/help/fr_FR/factorization/householder.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/fr_FR/matrix/det.xml221
-rw-r--r--scilab/modules/linear_algebra/help/ja_JP/eigen/bdiag.xml51
-rw-r--r--scilab/modules/linear_algebra/help/ja_JP/eigen/eigs.xml543
-rw-r--r--scilab/modules/linear_algebra/help/ja_JP/factorization/chol.xml (renamed from scilab/modules/linear_algebra/help/ja_JP/linear/chol.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/ja_JP/factorization/fullrf.xml (renamed from scilab/modules/linear_algebra/help/ja_JP/kernel/fullrf.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/ja_JP/factorization/fullrfk.xml (renamed from scilab/modules/linear_algebra/help/ja_JP/kernel/fullrfk.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/ja_JP/factorization/hess.xml (renamed from scilab/modules/linear_algebra/help/ja_JP/eigen/hess.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/ja_JP/factorization/lu.xml (renamed from scilab/modules/linear_algebra/help/ja_JP/linear/lu.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/ja_JP/factorization/qr.xml (renamed from scilab/modules/linear_algebra/help/ja_JP/linear/qr.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/ja_JP/factorization/rankqr.xml (renamed from scilab/modules/linear_algebra/help/ja_JP/linear/rankqr.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/ja_JP/factorization/schur.xml (renamed from scilab/modules/linear_algebra/help/ja_JP/eigen/schur.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/ja_JP/givens.xml (renamed from scilab/modules/linear_algebra/help/ja_JP/factorization/givens.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/ja_JP/matrix/det.xml215
-rw-r--r--scilab/modules/linear_algebra/help/pt_BR/eigen/bdiag.xml60
-rw-r--r--scilab/modules/linear_algebra/help/pt_BR/factorization/chol.xml (renamed from scilab/modules/linear_algebra/help/pt_BR/linear/chol.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/pt_BR/factorization/fullrf.xml (renamed from scilab/modules/linear_algebra/help/pt_BR/kernel/fullrf.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/pt_BR/factorization/fullrfk.xml (renamed from scilab/modules/linear_algebra/help/pt_BR/kernel/fullrfk.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/pt_BR/factorization/hess.xml (renamed from scilab/modules/linear_algebra/help/pt_BR/eigen/hess.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/pt_BR/factorization/lu.xml (renamed from scilab/modules/linear_algebra/help/pt_BR/linear/lu.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/pt_BR/factorization/qr.xml (renamed from scilab/modules/linear_algebra/help/pt_BR/linear/qr.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/pt_BR/factorization/rankqr.xml (renamed from scilab/modules/linear_algebra/help/pt_BR/linear/rankqr.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/pt_BR/factorization/schur.xml (renamed from scilab/modules/linear_algebra/help/pt_BR/eigen/schur.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/pt_BR/givens.xml (renamed from scilab/modules/linear_algebra/help/pt_BR/factorization/givens.xml)0
-rw-r--r--scilab/modules/linear_algebra/help/pt_BR/matrix/det.xml97
-rw-r--r--scilab/modules/linear_algebra/help/ru_RU/eigen/bdiag.xml126
-rw-r--r--scilab/modules/linear_algebra/help/ru_RU/matrix/det.xml264
-rw-r--r--scilab/modules/linear_algebra/macros/eigs.sci1135
-rw-r--r--scilab/modules/linear_algebra/sci_gateway/cpp/sci_spec.cpp14
-rw-r--r--scilab/modules/linear_algebra/src/c/eigen.c5
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_11653.dia.ref108
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_11653.tst136
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_12120.dia.ref18
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_12120.tst22
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_12137.dia.ref34
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_12137.tst39
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_12138.dia.ref81
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_12138.tst90
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_12139.dia.ref17
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_12139.tst20
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_12238.dia.ref19
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_12238.tst23
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_12772.dia.ref23
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_12772.tst27
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_12992.dia.ref28
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_12992.tst29
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_13058.dia.ref26
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_13058.tst31
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_13381.dia.ref23
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_13381.tst26
-rw-r--r--scilab/modules/linear_algebra/tests/nonreg_tests/bug_13480.tst24
-rw-r--r--scilab/modules/linear_algebra/tests/unit_tests/det.tst81
-rw-r--r--scilab/modules/linear_algebra/tests/unit_tests/eigs.dia.ref835
-rw-r--r--scilab/modules/linear_algebra/tests/unit_tests/eigs.tst1131
76 files changed, 6040 insertions, 447 deletions
diff --git a/scilab/modules/linear_algebra/Makefile.in b/scilab/modules/linear_algebra/Makefile.in
index 96cc364..0d5a032 100644
--- a/scilab/modules/linear_algebra/Makefile.in
+++ b/scilab/modules/linear_algebra/Makefile.in
@@ -509,9 +509,11 @@ NMEDIT = @NMEDIT@
509OBJDUMP = @OBJDUMP@ 509OBJDUMP = @OBJDUMP@
510OBJEXT = @OBJEXT@ 510OBJEXT = @OBJEXT@
511OCAMLC = @OCAMLC@ 511OCAMLC = @OCAMLC@
512OCAMLCFLAGS = @OCAMLCFLAGS@
512OCAMLDEP = @OCAMLDEP@ 513OCAMLDEP = @OCAMLDEP@
513OCAMLLEX = @OCAMLLEX@ 514OCAMLLEX = @OCAMLLEX@
514OCAMLOPT = @OCAMLOPT@ 515OCAMLOPT = @OCAMLOPT@
516OCAMLOPTFLAGS = @OCAMLOPTFLAGS@
515OCAMLYACC = @OCAMLYACC@ 517OCAMLYACC = @OCAMLYACC@
516OPENMPI_CC = @OPENMPI_CC@ 518OPENMPI_CC = @OPENMPI_CC@
517OPENMPI_CFLAGS = @OPENMPI_CFLAGS@ 519OPENMPI_CFLAGS = @OPENMPI_CFLAGS@
diff --git a/scilab/modules/linear_algebra/help/en_US/eigen/bdiag.xml b/scilab/modules/linear_algebra/help/en_US/eigen/bdiag.xml
index bedf5ff..09a5570 100644
--- a/scilab/modules/linear_algebra/help/en_US/eigen/bdiag.xml
+++ b/scilab/modules/linear_algebra/help/en_US/eigen/bdiag.xml
@@ -13,14 +13,19 @@
13 * along with this program. 13 * along with this program.
14 * 14 *
15 --> 15 -->
16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="bdiag"> 16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
18 xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="bdiag">
17 <refnamediv> 19 <refnamediv>
18 <refname>bdiag</refname> 20 <refname>bdiag</refname>
19 <refpurpose>block diagonalization, generalized eigenvectors</refpurpose> 21 <refpurpose>block diagonalization, generalized eigenvectors</refpurpose>
20 </refnamediv> 22 </refnamediv>
21 <refsynopsisdiv> 23 <refsynopsisdiv>
22 <title>Syntax</title> 24 <title>Syntax</title>
23 <synopsis>[Ab [,X [,bs]]]=bdiag(A [,rmax])</synopsis> 25 <synopsis>
26 [Ab, X, bs] = bdiag(A)
27 [Ab, X, bs] = bdiag(A, rmax)
28 </synopsis>
24 </refsynopsisdiv> 29 </refsynopsisdiv>
25 <refsection> 30 <refsection>
26 <title>Arguments</title> 31 <title>Arguments</title>
@@ -59,34 +64,43 @@
59 </refsection> 64 </refsection>
60 <refsection> 65 <refsection>
61 <title>Description</title> 66 <title>Description</title>
62 <programlisting role=""><![CDATA[
63[Ab [,X [,bs]]]=bdiag(A [,rmax])
64 ]]></programlisting>
65 <para> 67 <para>
66 performs the block-diagonalization of matrix <literal>A</literal>. bs 68 <emphasis role="bold">[Ab, X, bs] = bdiag(A, rmax)</emphasis> performs the
67 gives the structure of the blocks (respective sizes of the 69 block-diagonalization of matrix <literal>A</literal>. <varname>bs</varname>
68 blocks). <literal>X</literal> is the change of basis i.e 70 gives the structure of the blocks (respective sizes of the blocks).
69 <literal>Ab = inv(X)*A*X</literal>is block diagonal. 71 <varname>X</varname> is the change of basis i.e. <literal>Ab = inv(X)*A*X</literal>
72 is block diagonal.
70 </para> 73 </para>
71 <para> 74 <para>
72 <literal>rmax</literal> controls the conditioning of <literal>X</literal>; the 75 <varname>rmax</varname> controls the conditioning of <varname>X</varname>. The
73 default value is the l1 norm of <literal>A</literal>. 76 default value is the l1 norm of <varname>A</varname>.
74 </para> 77 </para>
75 <para> 78 <para>
76 To get a diagonal form (if it exists) choose a large value for 79 To get a diagonal form (if it exists), choose a large value for
77 <literal>rmax</literal> (<literal>rmax=1/%eps</literal> for example). 80 <varname>rmax</varname> (<literal>rmax=1/%eps</literal> for example).
78 Generically (for real random A) the blocks are (1x1) and (2x2) and 81 Generically (for real random A) the blocks are (1x1) and (2x2) and
79 <literal>X</literal> is the matrix of eigenvectors. 82 <varname>X</varname> is the matrix of eigenvectors.
80 </para> 83 </para>
81 </refsection> 84 </refsection>
82 <refsection> 85 <refsection>
83 <title>Examples</title> 86 <title>Examples</title>
84 <programlisting role="example"><![CDATA[ 87 <programlisting role="example"><![CDATA[
85//Real case: 1x1 and 2x2 blocks 88// Real case: 1x1 and 2x2 blocks
86a=rand(5,5);[ab,x,bs]=bdiag(a);ab 89a = rand(5,5);
87 90[ab, x, bs] = bdiag(a);ab
88//Complex case: complex 1x1 blocks 91 ]]></programlisting>
89[ab,x,bs]=bdiag(a+%i*0);ab 92 <screen><![CDATA[
93--> [ab, x, bs] = bdiag(a);ab
94 ab =
95 2.4777836 0. 0. 0. 0.
96 0. 0.0757087 0.4869251 0. 0.
97 0. -0.5777956 -0.1248605 0. 0.
98 0. 0. 0. 0.069654 0.
99 0. 0. 0. 0. 0.5341598
100]]></screen>
101 <programlisting role="example"><![CDATA[
102// Complex case: complex 1x1 blocks
103[ab, x, bs] = bdiag(a+%i*0); ab
90 ]]></programlisting> 104 ]]></programlisting>
91 </refsection> 105 </refsection>
92 <refsection role="see also"> 106 <refsection role="see also">
@@ -104,6 +118,9 @@ a=rand(5,5);[ab,x,bs]=bdiag(a);ab
104 <member> 118 <member>
105 <link linkend="blockdiag">blockdiag</link> 119 <link linkend="blockdiag">blockdiag</link>
106 </member> 120 </member>
121 <member>
122 <link linkend="lcmdiag">lcmdiag</link>
123 </member>
107 </simplelist> 124 </simplelist>
108 </refsection> 125 </refsection>
109</refentry> 126</refentry>
diff --git a/scilab/modules/linear_algebra/help/en_US/eigen/eigs.xml b/scilab/modules/linear_algebra/help/en_US/eigen/eigs.xml
new file mode 100644
index 0000000..a69eedd
--- /dev/null
+++ b/scilab/modules/linear_algebra/help/en_US/eigen/eigs.xml
@@ -0,0 +1,543 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2012 - Scilab Enterprises - Adeline CARNIS
5 *
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises
7 *
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
14 *
15 -->
16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml"
18 xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
19 xmlns:scilab="http://www.scilab.org" xml:id="eigs" xml:lang="en">
20 <refnamediv>
21 <refname>eigs</refname>
22 <refpurpose>calculates largest eigenvalues and eigenvectors of matrices</refpurpose>
23 </refnamediv>
24 <refsynopsisdiv>
25 <title>Syntax</title>
26 <synopsis>
27 d = eigs(A)
28 d = eigs(Af, n)
29 d = eigs(.., B)
30 d = eigs(.., B, k)
31 d = eigs(.., B, k, sigma)
32 d = eigs(.., B, k, sigma, opts)
33 [d, v] = eigs(..)
34 </synopsis>
35 </refsynopsisdiv>
36 <refsection>
37 <title>Arguments</title>
38 <variablelist>
39 <varlistentry>
40 <term>A </term>
41 <listitem>
42 <para>a full or sparse, real or complex, symmetric or non-symmetric square matrix</para>
43 </listitem>
44 </varlistentry>
45 <varlistentry>
46 <term>B</term>
47 <listitem>
48 <para>
49 a sparse, real or complex, square matrix with same dimensions as
50 <literal> A</literal>
51 </para>
52 </listitem>
53 </varlistentry>
54 <varlistentry>
55 <term>k</term>
56 <listitem>
57 <para>
58 positive integer: number of eigenvalues to be computed. By default,
59 <literal>k=min(n-1, 6)</literal> (<varname>A</varname> real symetric) or
60 <literal>k=min(n-2, 6)</literal> (otherwise) eigen values are computed,
61 with n=size(A,1).
62 </para>
63 </listitem>
64 </varlistentry>
65 <varlistentry>
66 <term>sigma</term>
67 <listitem>
68 <para>a real scalar or a string of length 2</para>
69 </listitem>
70 </varlistentry>
71 <varlistentry>
72 <term>opts</term>
73 <listitem>
74 <para>a structure</para>
75 </listitem>
76 </varlistentry>
77 <varlistentry>
78 <term>Af </term>
79 <listitem>
80 <para>a function</para>
81 </listitem>
82 </varlistentry>
83 <varlistentry>
84 <term>n </term>
85 <listitem>
86 <para>
87 a scalar, defined only if <literal>A</literal> is a function
88 </para>
89 </listitem>
90 </varlistentry>
91 <varlistentry>
92 <term>d</term>
93 <listitem>
94 <para>a real or complex eigenvalues vector or diagonal matrix (eigenvalues along the diagonal)</para>
95 </listitem>
96 </varlistentry>
97 <varlistentry>
98 <term>v</term>
99 <listitem>
100 <para>
101 real or complex eigenvector matrix
102 </para>
103 </listitem>
104 </varlistentry>
105 </variablelist>
106 </refsection>
107 <refsection>
108 <title>Description</title>
109 <para>
110 The purpose of the eigs function is to compute the largest eigenvalues of sparse, large matrices.
111 </para>
112 <variablelist>
113 <varlistentry>
114 <term>d = eigs(A) or d = eigs(Af, n)</term>
115 <listitem>
116 <para>
117 solves the eigenvalue problem <literal>A * v = lambda * v</literal>. This calling returns a vector <literal>d</literal> containing the six largest magnitude eigenvalues.
118 <literal>A</literal> is either a square matrix, which can be symmetric or non-symmetric, real or complex, full or sparse.
119 </para>
120 <para>
121 <literal>A</literal> should be represented by a function <literal>Af</literal>. In this instance, a scalar <literal>n</literal> designating
122 the length of the vector argument, must be defined. It must have the following header :
123 </para>
124 <programlisting role="no-scilab-exec">
125 <![CDATA[
126function y = A ( x )
127 ]]>
128 </programlisting>
129 <para>
130 This function <literal>Af</literal> must return one of the four following expressions :
131 <itemizedlist>
132 <listitem>
133 <term>A * x</term>
134 <para> if sigma is not given or is a string other than 'SM'.</para>
135 </listitem>
136 <listitem>
137 <term>A \ x</term>
138 <para> if sigma is 0 or 'SM'.</para>
139 </listitem>
140 <listitem>
141 <term>(A - sigma * I) \ x</term>
142 <para>for the standard eigenvalue problem, where I is the identity matrix.</para>
143 </listitem>
144 <listitem>
145 <term>(A - sigma * B) \ x</term>
146 <para> for the generalized eigenvalue problem.</para>
147 </listitem>
148 </itemizedlist>
149 </para>
150 </listitem>
151 </varlistentry>
152 <varlistentry>
153 <term>[d, v] = eigs(A) or [d, v] = eigs(Af, n)</term>
154 <listitem>
155 <para>
156 returns a diagonal matrix <literal>d</literal> containing the six largest magnitude eigenvalues on the diagonal.
157 <literal>v</literal> is a n by six matrix whose columns are the six eigenvectors corresponding to the returned eigenvalues.
158 </para>
159 </listitem>
160 </varlistentry>
161 <varlistentry>
162 <term>d = eigs(A, B)</term>
163 <listitem>
164 <para>
165 solves the generalized eigenvalue problem <literal>A * v = lambda * B * v </literal> with positive, definite matrix <literal>B</literal>.
166 </para>
167 <itemizedlist>
168 <listitem>
169 <para>
170 if <literal>B</literal> is not specified, <literal>B = []</literal> is used.
171 </para>
172 </listitem>
173 <listitem>
174 <para>
175 if <literal>B</literal> is specified, <literal>B</literal> must be the same size as A.
176 </para>
177 </listitem>
178 </itemizedlist>
179 </listitem>
180 </varlistentry>
181 <varlistentry>
182 <term>d = eigs(A, B, k)</term>
183 <listitem>
184 <para>
185 returns in vector <literal>d</literal> the <literal>k</literal> eigenvalues.
186 </para>
187 </listitem>
188 </varlistentry>
189 <varlistentry>
190 <term>d = eigs(A, B, k, sigma)</term>
191 <listitem>
192 <para>
193 returns in vector <literal>d</literal> the <literal>k</literal> eigenvalues determined by <literal>sigma</literal>.
194 <literal>sigma</literal> can be either a real or complex including 0 scalar or string.
195 If sigma is a string of length 2, it takes one of the following values :
196 </para>
197 <itemizedlist>
198 <listitem>
199 <para>
200 <literal>'LM'</literal> compute the <varname>k</varname> largest in magnitude eigenvalues (by default).
201 </para>
202 </listitem>
203 <listitem>
204 <para>
205 <literal>'SM'</literal> compute the <varname>k</varname> smallest in magnitude eigenvalues (same as sigma = 0).
206 </para>
207 </listitem>
208 <listitem>
209 <para>
210 <literal>'LA'</literal> compute the <varname>k</varname> Largest Algebraic eigenvalues, only for real symmetric problems.
211 </para>
212 </listitem>
213 <listitem>
214 <para>
215 <literal>'SA'</literal> compute the <varname>k</varname> Smallest Algebraic eigenvalues, only for real symmetric problems.
216 </para>
217 </listitem>
218 <listitem>
219 <para>
220 <literal>'BE'</literal> compute <varname>k</varname> eigenvalues, half from each end of the spectrum, only for real
221 symmetric problems.
222 </para>
223 </listitem>
224 <listitem>
225 <para>
226 <literal>'LR'</literal> compute the <varname>k</varname> eigenvalues of Largest Real part, only for real non-symmetric or
227 complex problems.
228 </para>
229 </listitem>
230 <listitem>
231 <para>
232 <literal>'SR'</literal> compute the <varname>k</varname> eigenvalues of Smallest Real part, only for real non-symmetric or
233 complex problems.
234 </para>
235 </listitem>
236 <listitem>
237 <para>
238 <literal>'LI'</literal> compute the <varname>k</varname> eigenvalues of Largest Imaginary part, only for real non-symmetric
239 or complex problems.
240 </para>
241 </listitem>
242 <listitem>
243 <para>
244 <literal>'SI'</literal> compute the <varname>k</varname> eigenvalues of Smallest Imaginary part, only for real non-symmetric
245 or complex problems.
246 </para>
247 </listitem>
248 </itemizedlist>
249 </listitem>
250 </varlistentry>
251 <varlistentry>
252 <term>d = eigs(A, B, k, sigma, opts)</term>
253 <listitem>
254 <para>
255 If the <literal> opts </literal> structure is specified, different options can be used to compute the <literal>k</literal> eigenvalues :
256 </para>
257 <itemizedlist>
258 <listitem>
259 <para>
260 <term>tol</term>
261 <para>
262 required convergence tolerance. By default, <literal>tol = %eps</literal>.
263 </para>
264 </para>
265 </listitem>
266 <listitem>
267 <para>
268 <term>maxiter</term>
269 <para>
270 maximum number of iterations. By default, <literal>maxiter = 300</literal>.
271 </para>
272 </para>
273 </listitem>
274 <listitem>
275 <para>
276 <term>ncv</term>
277 <para>
278 number of Lanzcos basis vectors to use. For real non-symmetric problems, the <literal>ncv</literal> value must be greater or equal than <literal>2 * k + 1 </literal> and, by default, <literal>ncv = min(max(2 * k + 1, 20), nA) </literal>. For real symmetric or complex problems, <literal>ncv</literal> must be greater or equal <literal>2 * k </literal> and, by default, <literal> ncv = min(max(2 * k, 20), nA) </literal> with <literal> nA = size(A, 2) </literal>.
279 </para>
280 </para>
281 </listitem>
282 <listitem>
283 <para>
284 <term>resid</term>
285 <para>
286 starting vector whose contains the initial residual vector, possibly from a previous run. By default,
287 <literal>resid</literal> is a random initial vector.
288 </para>
289 </para>
290 </listitem>
291 <listitem>
292 <para>
293 <term>cholB</term>
294 <para>
295 if <literal>chol(B)</literal> is passed rather than <literal>B</literal>. By default, <literal>cholB</literal> is %f.
296 </para>
297 </para>
298 </listitem>
299 <listitem>
300 <para>
301 <term>isreal</term>
302 <para>
303 if <literal>Af</literal> is given, <literal>isreal</literal> can be defined. By default, <literal>isreal</literal> is %t.
304 This argument must not be indicated if <literal>A</literal> is a matrix.
305 </para>
306 </para>
307 </listitem>
308 <listitem>
309 <para>
310 <term>issym</term>
311 <para>
312 if <literal>Af</literal> is given, <literal>issym</literal> can be defined. By default, <literal>issym</literal> is %f.
313 This argument must not be indicated if <literal>A</literal> is a matrix.
314 </para>
315 </para>
316 </listitem>
317 </itemizedlist>
318 </listitem>
319 </varlistentry>
320 </variablelist>
321 </refsection>
322 <refsection>
323 <title>References</title>
324 <para>
325 This function is based on the ARPACK package written by R. Lehoucq, K. Maschhoff, D. Sorensen, and C. Yang.
326 </para>
327 <itemizedlist>
328 <listitem>
329 <para>DSAUPD and DSEUPD routines for real symmetric problems,</para>
330 </listitem>
331 <listitem>
332 <para>DNAUPD and DNEUPD routines for real non-symmetric problems.</para>
333 </listitem>
334 <listitem>
335 <para>ZNAUPD and ZNEUPD routines for complex problems.</para>
336 </listitem>
337 </itemizedlist>
338 </refsection>
339 <refsection>
340 <title>Example for real symmetric problems</title>
341 <programlisting role="example">
342 <![CDATA[
343clear opts
344A = diag(10*ones(10,1));
345A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(9,1));
346A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6*ones(9,1));
347
348B = eye(10,10);
349k = 8;
350sigma = 'SM';
351opts.cholB = %t;
352
353d = eigs(A)
354[d, v] = eigs(A)
355
356d = eigs(A, B, k, sigma)
357[d, v] = eigs(A, B, k, sigma)
358
359d = eigs(A, B, k, sigma, opts)
360[d, v] = eigs(A, B, k, sigma, opts)
361
362// With sparses
363AS = sparse(A);
364BS = sparse(B);
365
366d = eigs(AS)
367[d, v] = eigs(AS)
368
369d = eigs(AS, BS, k, sigma)
370[d, v] = eigs(AS, BS, k, sigma)
371
372d = eigs(AS, BS, k, sigma, opts)
373[d, v] = eigs(AS, BS, k, sigma, opts)
374
375// With function
376clear opts
377function y = fn(x)
378 y = A * x;
379endfunction
380
381opts.isreal = %t;
382opts.issym = %t;
383
384d = eigs(fn, 10, [], k, 'LM', opts)
385
386function y = fn(x)
387 y = A \ x;
388endfunction
389
390d = eigs(fn, 10, [], k, 'SM', opts)
391
392function y = fn(x)
393 y = (A - 4 * eye(10,10)) \ x;
394endfunction
395
396d = eigs(fn, 10, [], k, 4, opts)
397 ]]>
398 </programlisting>
399 </refsection>
400 <refsection>
401 <title>Example for real non-symmetric problems</title>
402 <programlisting role="example">
403 <![CDATA[
404 clear opts
405 A = diag(10*ones(10,1));
406 A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(9,1));
407 A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(9,1));
408
409 B = eye(10,10);
410 k = 8;
411 sigma = 'SM';
412 opts.cholB = %t;
413
414 d = eigs(A)
415[d, v] = eigs(A)
416
417 d = eigs(A, B, k, sigma)
418 [d, v] = eigs(A, B, k, sigma)
419
420 d = eigs(A, B, k, sigma, opts)
421 [d, v] = eigs(A, B, k, sigma, opts)
422
423// With sparses
424 AS = sparse(A);
425 BS = sparse(B);
426
427d = eigs(AS)
428[d, v] = eigs(AS)
429 d = eigs(AS, BS, k, sigma)
430 [d, v] = eigs(AS, BS, k, sigma)
431
432 d = eigs(AS, BS, k, sigma, opts)
433 [d, v] = eigs(AS, BS, k, sigma, opts)
434
435 // With function
436clear opts
437function y = fn(x)
438 y = A * x;
439endfunction
440
441opts.isreal = %t;
442opts.issym = %f;
443
444d = eigs(fn, 10, [], k, 'LM', opts)
445
446function y = fn(x)
447 y = A \ x;
448endfunction
449
450d = eigs(fn, 10, [], k, 'SM', opts)
451
452function y = fn(x)
453 y = (A - 4 * eye(10,10)) \ x;
454endfunction
455
456d = eigs(fn, 10, [], k, 4, opts)
457 ]]>
458 </programlisting>
459 </refsection>
460 <refsection>
461 <title>Example for complex problems</title>
462 <programlisting role="example">
463 <![CDATA[
464 clear opts
465 A = diag(10*ones(10,1) + %i * ones(10,1));
466 A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(9,1));
467 A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(9,1));
468
469 B = eye(10,10);
470 k = 8;
471 sigma = 'LM';
472 opts.cholB = %t;
473
474 d = eigs(A)
475[d, v] = eigs(A)
476
477 d = eigs(A, B, k, sigma)
478 [d, v] = eigs(A, B, k, sigma)
479 d = eigs(A, B, k, sigma, opts)
480 [d, v] = eigs(A, B, k, sigma, opts)
481
482 // With sparses
483 AS = sparse(A);
484 BS = sparse(B);
485
486 d = eigs(AS)
487[d, v] = eigs(AS)
488
489 d = eigs(AS, BS, k, sigma)
490 [d, v] = eigs(AS, BS, k, sigma)
491
492 d = eigs(AS, BS, k, sigma, opts)
493 [d, v] = eigs(AS, BS, k, sigma, opts)
494
495 // With function
496clear opts
497function y = fn(x)
498 y = A * x;
499endfunction
500
501opts.isreal = %f;
502opts.issym = %f;
503
504d = eigs(fn, 10, [], k, 'LM', opts)
505
506function y = fn(x)
507 y = A \ x;
508endfunction
509
510d = eigs(fn, 10, [], k, 'SM', opts)
511
512function y = fn(x)
513 y = (A - 4 * eye(10,10)) \ x;
514endfunction
515
516d = eigs(fn, 10, [], k, 4, opts)
517 ]]>
518 </programlisting>
519 </refsection>
520 <refsection role="see also">
521 <title>See also</title>
522 <simplelist type="inline">
523 <member>
524 <link linkend="spec">spec</link>
525 </member>
526 </simplelist>
527 </refsection>
528 <refsection>
529 <title>History</title>
530 <revhistory>
531 <revision>
532 <revnumber>5.4.0</revnumber>
533 <revremark>Function introduced.</revremark>
534 </revision>
535 <revision>
536 <revnumber>6.1.1</revnumber>
537 <revremark>
538 dnaupd, dneupd, dsaupd, dseupd, znaupd and zneupd become internal.
539 </revremark>
540 </revision>
541 </revhistory>
542 </refsection>
543</refentry>
diff --git a/scilab/modules/linear_algebra/help/en_US/linear/chol.xml b/scilab/modules/linear_algebra/help/en_US/factorization/chol.xml
index bf263b1..bf263b1 100644
--- a/scilab/modules/linear_algebra/help/en_US/linear/chol.xml
+++ b/scilab/modules/linear_algebra/help/en_US/factorization/chol.xml
diff --git a/scilab/modules/linear_algebra/help/en_US/kernel/fullrf.xml b/scilab/modules/linear_algebra/help/en_US/factorization/fullrf.xml
index 3f3e566..3f3e566 100644
--- a/scilab/modules/linear_algebra/help/en_US/kernel/fullrf.xml
+++ b/scilab/modules/linear_algebra/help/en_US/factorization/fullrf.xml
diff --git a/scilab/modules/linear_algebra/help/en_US/kernel/fullrfk.xml b/scilab/modules/linear_algebra/help/en_US/factorization/fullrfk.xml
index 71dbd27..71dbd27 100644
--- a/scilab/modules/linear_algebra/help/en_US/kernel/fullrfk.xml
+++ b/scilab/modules/linear_algebra/help/en_US/factorization/fullrfk.xml
diff --git a/scilab/modules/linear_algebra/help/en_US/eigen/hess.xml b/scilab/modules/linear_algebra/help/en_US/factorization/hess.xml
index 9a9ea37..9a9ea37 100644
--- a/scilab/modules/linear_algebra/help/en_US/eigen/hess.xml
+++ b/scilab/modules/linear_algebra/help/en_US/factorization/hess.xml
diff --git a/scilab/modules/linear_algebra/help/en_US/linear/lu.xml b/scilab/modules/linear_algebra/help/en_US/factorization/lu.xml
index 65ef3ab..65ef3ab 100644
--- a/scilab/modules/linear_algebra/help/en_US/linear/lu.xml
+++ b/scilab/modules/linear_algebra/help/en_US/factorization/lu.xml
diff --git a/scilab/modules/linear_algebra/help/en_US/linear/qr.xml b/scilab/modules/linear_algebra/help/en_US/factorization/qr.xml
index a8fb2dc..a8fb2dc 100644
--- a/scilab/modules/linear_algebra/help/en_US/linear/qr.xml
+++ b/scilab/modules/linear_algebra/help/en_US/factorization/qr.xml
diff --git a/scilab/modules/linear_algebra/help/en_US/linear/rankqr.xml b/scilab/modules/linear_algebra/help/en_US/factorization/rankqr.xml
index 9fd29eb..9fd29eb 100644
--- a/scilab/modules/linear_algebra/help/en_US/linear/rankqr.xml
+++ b/scilab/modules/linear_algebra/help/en_US/factorization/rankqr.xml
diff --git a/scilab/modules/linear_algebra/help/en_US/eigen/schur.xml b/scilab/modules/linear_algebra/help/en_US/factorization/schur.xml
index 8dc1b96..8dc1b96 100644
--- a/scilab/modules/linear_algebra/help/en_US/eigen/schur.xml
+++ b/scilab/modules/linear_algebra/help/en_US/factorization/schur.xml
diff --git a/scilab/modules/linear_algebra/help/en_US/factorization/givens.xml b/scilab/modules/linear_algebra/help/en_US/givens.xml
index ccb3ecb..ccb3ecb 100644
--- a/scilab/modules/linear_algebra/help/en_US/factorization/givens.xml
+++ b/scilab/modules/linear_algebra/help/en_US/givens.xml
diff --git a/scilab/modules/linear_algebra/help/en_US/factorization/householder.xml b/scilab/modules/linear_algebra/help/en_US/householder.xml
index 2c41a84..2c41a84 100644
--- a/scilab/modules/linear_algebra/help/en_US/factorization/householder.xml
+++ b/scilab/modules/linear_algebra/help/en_US/householder.xml
diff --git a/scilab/modules/linear_algebra/help/en_US/matrix/det.xml b/scilab/modules/linear_algebra/help/en_US/matrix/det.xml
index a032d96..c6df862 100644
--- a/scilab/modules/linear_algebra/help/en_US/matrix/det.xml
+++ b/scilab/modules/linear_algebra/help/en_US/matrix/det.xml
@@ -2,8 +2,8 @@
2<!-- 2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2008 - INRIA 4 * Copyright (C) 2008 - INRIA
5 *
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises 5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
6 * Copyright (C) 2021 - Samuel GOUGEON - Le Mans Université
7 * 7 *
8 * This file is hereby licensed under the terms of the GNU GPL v2.0, 8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1. 9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
@@ -13,15 +13,19 @@
13 * along with this program. 13 * along with this program.
14 * 14 *
15 --> 15 -->
16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="det"> 16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
18 xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
19 xml:lang="en" xml:id="det">
17 <refnamediv> 20 <refnamediv>
18 <refname>det</refname> 21 <refname>det</refname>
19 <refpurpose>determinant</refpurpose> 22 <refpurpose>determinant of a square matrix</refpurpose>
20 </refnamediv> 23 </refnamediv>
21 <refsynopsisdiv> 24 <refsynopsisdiv>
22 <title>Syntax</title> 25 <title>Syntax</title>
23 <synopsis>det(X) 26 <synopsis>
24 [e,m]=det(X) 27 d = det(X)
28 [e,m] = det(X)
25 </synopsis> 29 </synopsis>
26 </refsynopsisdiv> 30 </refsynopsisdiv>
27 <refsection> 31 <refsection>
@@ -30,19 +34,36 @@
30 <varlistentry> 34 <varlistentry>
31 <term>X</term> 35 <term>X</term>
32 <listitem> 36 <listitem>
33 <para>real or complex square matrix, polynomial or rational matrix.</para> 37 square matrix of real or complex numbers, polynomials, or rationals.
38 Sparse-encoded matrices accepted.
39 <para/>
40 </listitem>
41 </varlistentry>
42 <varlistentry>
43 <term>d</term>
44 <listitem>
45 Scalar of the <varname>X</varname>'s type: the determinant of
46 <varname>X</varname>. If <varname>X</varname> is sparse-encoded,
47 <varname>d</varname> is dense.
48 <para/>
34 </listitem> 49 </listitem>
35 </varlistentry> 50 </varlistentry>
36 <varlistentry> 51 <varlistentry>
37 <term>m</term> 52 <term>m</term>
38 <listitem> 53 <listitem>
39 <para>real or complex number, the determinant base 10 mantissae</para> 54 real or complex number: the determinant base 10 mantissa, with
55 <literal>abs(m) ∈ [1,10)</literal>. Not supported for <varname>X</varname>
56 polynomial or rational.
57 <para/>
40 </listitem> 58 </listitem>
41 </varlistentry> 59 </varlistentry>
42 <varlistentry> 60 <varlistentry>
43 <term>e</term> 61 <term>e</term>
44 <listitem> 62 <listitem>
45 <para>integer, the determinant base 10 exponent</para> 63 integer: the determinant base 10 exponent, such that
64 <literal>d = m * 10<superscript>e</superscript></literal>.
65 Not supported for <varname>X</varname> polynomial or rational.
66 <para/>
46 </listitem> 67 </listitem>
47 </varlistentry> 68 </varlistentry>
48 </variablelist> 69 </variablelist>
@@ -50,45 +71,165 @@
50 <refsection> 71 <refsection>
51 <title>Description</title> 72 <title>Description</title>
52 <para> 73 <para>
53 <literal>det(X)</literal> ( <literal>m*10^e</literal> is the determinant of the square matrix <literal>X</literal>. 74 <emphasis role="bold">d = det(X)</emphasis> yields the determinant of the matrix
75 <varname>X</varname>.
76 </para>
77 <para>
78 For a polynomial or rational matrix, <literal>d=det(X)</literal> uses <literal>determ(..)</literal>
79 whose algorithm is based on the FFT.
80 <literal>d=detr(X)</literal> can be alternatively used, based on the Leverrier algorithm.
81 Both methods yield equivalent results. For rational matrices, turning off <code>simp_mode(%f)</code>
82 might be required to get identical results.
54 </para> 83 </para>
55 <para> 84 <para>
56 For polynomial matrix <literal>det(X)</literal> is equivalent to <literal>determ(X)</literal>. 85 <emphasis role="bold">[e, m] = det(X)</emphasis> can be used only for a matrix of numbers.
86 This syntax allows to overcome computation's underflow or overflow, when <literal>abs(d)</literal>
87 is smaller than
88 <literal>number_properties("tiny")</literal> ≈ 2.23 10<superscript>-308</superscript> or
89 bigger than <literal>number_properties("huge")</literal> ≈ 1.80 10<superscript>308</superscript>.
57 </para> 90 </para>
58 <para> 91 <para>
59 For rational matrices <literal>det(X)</literal> is equivalent to <literal>detr(X)</literal>. 92 For denses matrices, <literal>det(..)</literal> is based on the Lapack routines
93 DGETRF for real matrices and ZGETRF for the complex case.
60 </para> 94 </para>
61 <para> 95 <para>
62 <important> 96 For sparse matrices, the determinant is obtained from LU factorization thanks to the umfpack library.
63 The <literal>det</literal> and <literal>detr</literal> functions don't use the same algorithm.
64 For a rational fraction, <literal>det(X)</literal> is overloaded by <literal>%r_det(X)</literal> which is based on the <literal>determ</literal> function.
65 <literal>detr()</literal> uses the Leverrier method.
66 </important>
67 <warning>
68 Sometimes the <literal>det</literal> and <literal>detr</literal> functions may return different values for rational matrices.
69 In such cases you should set rational simplification mode off by using <code>simp_mode(%f)</code> to get the same result.
70 </warning>
71 </para> 97 </para>
72 </refsection> 98 </refsection>
73 <refsection> 99 <refsection>
74 <title>References</title> 100 <title>Examples</title>
101 <programlisting role="example"><![CDATA[
102A = rand(3,3)*5;
103det(A)
104[e, m] = det(A)
105
106// Matrix of complex numbers:
107// A = grand(3,3,"uin",0,10) + grand(3,3,"uin",0,10)*%i
108A = [3+%i, 9+%i*3, 9+%i ; 8+%i*8, 4+%i*3, 7+%i*7 ; 4, 6+%i*2, 6+%i*9]
109det(A)
110[e, m] = det(A)
111abs(m) // in [1, 10)
112 ]]></programlisting>
113 <screen><![CDATA[
114--> A = rand(3,3)*5;
115--> det(A)
116 ans =
117 -10.805163
118
119--> [e, m] = det(A)
120 e =
121 1.
122 m =
123 -1.0805163
124
125--> // Matrix of complex numbers:
126--> A = [3+%i, 9+%i*3, 9+%i ; 8+%i*8, 4+%i*3, 7+%i*7 ; 4, 6+%i*2, 6+%i*9]
127 A =
128 3. + i 9. + 3.i 9. + i
129 8. + 8.i 4. + 3.i 7. + 7.i
130 4. + 0.i 6. + 2.i 6. + 9.i
131
132--> det(A)
133 ans =
134 745. - 225.i
135
136--> [e, m] = det(A)
137 e =
138 2.
139 m =
140 7.45 - 2.25i
141
142--> abs(m) // in [1, 10)
143 ans =
144 7.7823518
145]]></screen>
146 <para/>
75 <para> 147 <para>
76 det computations are based on the Lapack routines 148 Very big or small determinants: underflow and overflow handling:
77 DGETRF for real matrices and ZGETRF for the complex case.
78 </para> 149 </para>
150 <programlisting role="example"><![CDATA[
151// Very big determinant:
152n = 1000;
153A = rand(n, n);
154det(A)
155[e, m] = det(A)
156
157// Very small determinant (of a sparse-encoded matrix):
158A = (triu(sprand(n,n,1)) + diag(rand(1,n)))/1.5;
159det(A)
160prod(diag(A))
161[e, m] = det(A)
162A = A/2;
163det(A)
164[e, m] = det(A)
165 ]]></programlisting>
166 <screen><![CDATA[
167--> // Very big determinant:
168--> A = rand(n, n);
169--> det(A)
170 ans =
171 -Inf
172
173--> [e, m] = det(A) // -3.1199e743
174 e =
175 743.
176 m =
177 -3.1198687
178
179--> // Very small determinant (of a sparse-encoded matrix):
180--> n = 1000;
181--> A = (triu(sprand(n,n,1)) + diag(rand(1,n)))/1.5;
182--> det(A)
183 ans =
184 5.21D-236
185
186--> prod(diag(A))
187 ans =
188 5.21D-236
189
190--> [e, m] = det(A)
191 e =
192 -236.
193 m =
194 5.2119757
195
196--> A = A/2;
197--> det(A)
198 ans =
199 0.
200
201--> [e, m] = det(A)
202 e =
203 -537.
204 m =
205 4.8641473
206]]></screen>
207 <para/>
79 <para> 208 <para>
80 Concerning sparse matrices, the determinant is obtained from LU factorization of umfpack library. 209 Determinant of a polynomial matrix:
81 </para> 210 </para>
82 </refsection>
83 <refsection>
84 <title>Examples</title>
85 <programlisting role="example"><![CDATA[ 211 <programlisting role="example"><![CDATA[
86x=poly(0,'x'); 212s = %s;
87det([x,1+x;2-x,x^2]) 213det([s, 1+s ; 2-s, s^2])
88w=ssrand(2,2,4);roots(det(systmat(w))),trzeros(w) //zeros of linear system 214
89A=rand(3,3); 215w = ssrand(2,2,4);
90det(A), prod(spec(A)) 216roots(det(systmat(w))),trzeros(w) //zeros of linear system
91 ]]></programlisting> 217 ]]></programlisting>
218 <screen><![CDATA[
219--> det([s, 1+s ; 2-s, s^2])
220 ans =
221 -2 -s +s² +s³
222
223--> w = ssrand(2,2,4);
224--> roots(det(systmat(w))),trzeros(w)
225 ans =
226 -3.1907522 + 0.i
227 2.3596502 + 0.i
228
229 ans =
230 2.3596502 + 0.i
231 -3.1907522 + 0.i
232]]></screen>
92 </refsection> 233 </refsection>
93 <refsection role="see also"> 234 <refsection role="see also">
94 <title>See also</title> 235 <title>See also</title>
@@ -104,4 +245,15 @@ det(A), prod(spec(A))
104 </member> 245 </member>
105 </simplelist> 246 </simplelist>
106 </refsection> 247 </refsection>
248 <refsection role="history">
249 <title>History</title>
250 <revhistory>
251 <revision>
252 <revnumber>6.1.1</revnumber>
253 <revdescription>
254 [e,m]=det(X) syntax extended to sparse matrices.
255 </revdescription>
256 </revision>
257 </revhistory>
258 </refsection>
107</refentry> 259</refentry>
diff --git a/scilab/modules/linear_algebra/help/fr_FR/eigen/bdiag.xml b/scilab/modules/linear_algebra/help/fr_FR/eigen/bdiag.xml
index 1544a79..06d2242 100644
--- a/scilab/modules/linear_algebra/help/fr_FR/eigen/bdiag.xml
+++ b/scilab/modules/linear_algebra/help/fr_FR/eigen/bdiag.xml
@@ -13,14 +13,19 @@
13 * along with this program. 13 * along with this program.
14 * 14 *
15 --> 15 -->
16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="fr" xml:id="bdiag"> 16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
18 xmlns:scilab="http://www.scilab.org" xml:lang="fr" xml:id="bdiag">
17 <refnamediv> 19 <refnamediv>
18 <refname>bdiag</refname> 20 <refname>bdiag</refname>
19 <refpurpose>bloc-diagonalisation, vecteurs propres généralisés </refpurpose> 21 <refpurpose>bloc-diagonalisation, vecteurs propres généralisés </refpurpose>
20 </refnamediv> 22 </refnamediv>
21 <refsynopsisdiv> 23 <refsynopsisdiv>
22 <title>Séquence d'appel</title> 24 <title>Séquence d'appel</title>
23 <synopsis>[Ab [,X [,bs]]]=bdiag(A [,rmax])</synopsis> 25 <synopsis>
26 [Ab, X, bs] = bdiag(A)
27 [Ab, X, bs] = bdiag(A, rmax)
28 </synopsis>
24 </refsynopsisdiv> 29 </refsynopsisdiv>
25 <refsection> 30 <refsection>
26 <title>Paramètres</title> 31 <title>Paramètres</title>
@@ -64,27 +69,22 @@
64 </refsection> 69 </refsection>
65 <refsection> 70 <refsection>
66 <title>Description</title> 71 <title>Description</title>
67 <programlisting role=""><![CDATA[
68[Ab [,X [,bs]]]=bdiag(A [,rmax])
69 ]]></programlisting>
70 <para> 72 <para>
71 <literal>[Ab [,X [,bs]]]=bdiag(A [,rmax])</literal> calcule la forme 73 <emphasis role="bold">[Ab, X, bs] = bdiag(A, rmax)</emphasis> calcule la forme
72 bloc-diagonale de <literal>A</literal>. bs précise la structure des 74 bloc-diagonale de <literal>A</literal>. bs précise la structure des
73 blocs (tailles respectives des blocs). <literal>X</literal> est la 75 blocs (tailles respectives des blocs). <varname>X</varname> est la
74 matrice de changement de base, c'est à dire que <literal>Ab = 76 matrice de changement de base, c'est à dire que <literal>Ab = inv(X)*A*X</literal>
75 inv(X)*A*X
76 </literal>
77 est bloc-diagonale. 77 est bloc-diagonale.
78 </para> 78 </para>
79 <para> 79 <para>
80 <literal>rmax</literal> contrôle le conditionnement de <literal>X</literal>; 80 <varname>rmax</varname> contrôle le conditionnement de <varname>X</varname>.
81 la valeur par défaut est la norme l1 de <literal>A</literal>. 81 La valeur par défaut est la norme l1 de <varname>A</varname>.
82 </para> 82 </para>
83 <para> 83 <para>
84 Pour obtenir une forme diagonale (si celle-ci existe) choisissez 84 Pour obtenir une forme diagonale (si celle-ci existe) choisissez
85 une valeur élevée de <literal>rmax</literal> (<literal>rmax=1/%eps</literal> 85 une valeur élevée de <varname>rmax</varname> (<literal>rmax=1/%eps</literal>
86 par exemple). Pour une matrice réelle quelconque, les blocs sont 86 par exemple). Pour une matrice réelle quelconque, les blocs sont
87 de taille (1x1) ou (2x2) et <literal>X</literal> est la matrice des 87 de taille (1x1) ou (2x2) et <varname>X</varname> est la matrice des
88 vecteurs propres. 88 vecteurs propres.
89 </para> 89 </para>
90 </refsection> 90 </refsection>
@@ -92,9 +92,21 @@
92 <title>Exemples</title> 92 <title>Exemples</title>
93 <programlisting role="example"><![CDATA[ 93 <programlisting role="example"><![CDATA[
94// Cas réel: blocs 1x1 et 2x2 94// Cas réel: blocs 1x1 et 2x2
95a=rand(5,5);[ab,x,bs]=bdiag(a);ab 95a = rand(5,5);
96[ab, x, bs] = bdiag(a);ab
97 ]]></programlisting>
98 <screen><![CDATA[
99--> [ab, x, bs] = bdiag(a);ab
100 ab =
101 2.4777836 0. 0. 0. 0.
102 0. 0.0757087 0.4869251 0. 0.
103 0. -0.5777956 -0.1248605 0. 0.
104 0. 0. 0. 0.069654 0.
105 0. 0. 0. 0. 0.5341598
106]]></screen>
107 <programlisting role="example"><![CDATA[
96// Cas complexe : blocs complexes 1x1 108// Cas complexe : blocs complexes 1x1
97[ab,x,bs]=bdiag(a+%i*0);ab 109[ab, x, bs] = bdiag(a+%i*0); ab
98 ]]></programlisting> 110 ]]></programlisting>
99 </refsection> 111 </refsection>
100 <refsection role="see also"> 112 <refsection role="see also">
@@ -112,6 +124,9 @@ a=rand(5,5);[ab,x,bs]=bdiag(a);ab
112 <member> 124 <member>
113 <link linkend="blockdiag">blockdiag</link> 125 <link linkend="blockdiag">blockdiag</link>
114 </member> 126 </member>
127 <member>
128 <link linkend="lcmdiag">lcmdiag</link>
129 </member>
115 </simplelist> 130 </simplelist>
116 </refsection> 131 </refsection>
117</refentry> 132</refentry>
diff --git a/scilab/modules/linear_algebra/help/fr_FR/linear/chol.xml b/scilab/modules/linear_algebra/help/fr_FR/factorization/chol.xml
index af48622..af48622 100644
--- a/scilab/modules/linear_algebra/help/fr_FR/linear/chol.xml
+++ b/scilab/modules/linear_algebra/help/fr_FR/factorization/chol.xml
diff --git a/scilab/modules/linear_algebra/help/fr_FR/kernel/fullrf.xml b/scilab/modules/linear_algebra/help/fr_FR/factorization/fullrf.xml
index ec39860..ec39860 100644
--- a/scilab/modules/linear_algebra/help/fr_FR/kernel/fullrf.xml
+++ b/scilab/modules/linear_algebra/help/fr_FR/factorization/fullrf.xml
diff --git a/scilab/modules/linear_algebra/help/fr_FR/kernel/fullrfk.xml b/scilab/modules/linear_algebra/help/fr_FR/factorization/fullrfk.xml
index df125a7..df125a7 100644
--- a/scilab/modules/linear_algebra/help/fr_FR/kernel/fullrfk.xml
+++ b/scilab/modules/linear_algebra/help/fr_FR/factorization/fullrfk.xml
diff --git a/scilab/modules/linear_algebra/help/fr_FR/eigen/hess.xml b/scilab/modules/linear_algebra/help/fr_FR/factorization/hess.xml
index 63c643a..63c643a 100644
--- a/scilab/modules/linear_algebra/help/fr_FR/eigen/hess.xml
+++ b/scilab/modules/linear_algebra/help/fr_FR/factorization/hess.xml
diff --git a/scilab/modules/linear_algebra/help/fr_FR/linear/lu.xml b/scilab/modules/linear_algebra/help/fr_FR/factorization/lu.xml
index 415a6a0..415a6a0 100644
--- a/scilab/modules/linear_algebra/help/fr_FR/linear/lu.xml
+++ b/scilab/modules/linear_algebra/help/fr_FR/factorization/lu.xml
diff --git a/scilab/modules/linear_algebra/help/fr_FR/linear/qr.xml b/scilab/modules/linear_algebra/help/fr_FR/factorization/qr.xml
index f67710a..f67710a 100644
--- a/scilab/modules/linear_algebra/help/fr_FR/linear/qr.xml
+++ b/scilab/modules/linear_algebra/help/fr_FR/factorization/qr.xml
diff --git a/scilab/modules/linear_algebra/help/fr_FR/factorization/givens.xml b/scilab/modules/linear_algebra/help/fr_FR/givens.xml
index e3c74c4..e3c74c4 100644
--- a/scilab/modules/linear_algebra/help/fr_FR/factorization/givens.xml
+++ b/scilab/modules/linear_algebra/help/fr_FR/givens.xml
diff --git a/scilab/modules/linear_algebra/help/fr_FR/factorization/householder.xml b/scilab/modules/linear_algebra/help/fr_FR/householder.xml
index 42a43dc..42a43dc 100644
--- a/scilab/modules/linear_algebra/help/fr_FR/factorization/householder.xml
+++ b/scilab/modules/linear_algebra/help/fr_FR/householder.xml
diff --git a/scilab/modules/linear_algebra/help/fr_FR/matrix/det.xml b/scilab/modules/linear_algebra/help/fr_FR/matrix/det.xml
index c598296..8220cf2 100644
--- a/scilab/modules/linear_algebra/help/fr_FR/matrix/det.xml
+++ b/scilab/modules/linear_algebra/help/fr_FR/matrix/det.xml
@@ -2,8 +2,8 @@
2<!-- 2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2008 - INRIA 4 * Copyright (C) 2008 - INRIA
5 *
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises 5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
6 * Copyright (C) 2021 - Samuel GOUGEON - Le Mans Université
7 * 7 *
8 * This file is hereby licensed under the terms of the GNU GPL v2.0, 8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1. 9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
@@ -13,39 +13,58 @@
13 * along with this program. 13 * along with this program.
14 * 14 *
15 --> 15 -->
16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="fr" xml:id="det"> 16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
18 xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
19 xml:lang="fr" xml:id="det">
17 <refnamediv> 20 <refnamediv>
18 <refname>det </refname> 21 <refname>det </refname>
19 <refpurpose>déterminant </refpurpose> 22 <refpurpose>déterminant </refpurpose>
20 </refnamediv> 23 </refnamediv>
21 <refsynopsisdiv> 24 <refsynopsisdiv>
22 <title>Séquence d'appel</title> 25 <title>Séquence d'appel</title>
23 <synopsis>det(X) 26 <synopsis>
24 [e,m]=det(X) 27 d = det(X)
28 [e,m] = det(X)
25 </synopsis> 29 </synopsis>
26 </refsynopsisdiv> 30 </refsynopsisdiv>
27 <refsection> 31 <refsection>
28 <title>Paramètres</title> 32 <title>Paramètres</title>
29 <variablelist> 33 <variablelist>
30 <varlistentry> 34 <varlistentry>
31 <term>X </term> 35 <term>X</term>
36 <listitem>
37 matrice carrée de nombres ou polynômes ou fractions rationnelles (à coefficients)
38 réels ou complexes. Matrices creuses acceptées.
39 <para/>
40 </listitem>
41 </varlistentry>
42 <varlistentry>
43 <term>d</term>
32 <listitem> 44 <listitem>
33 <para>matrice carrée réelle ou complexe (creuse ou pleine), polynomiale ou rationnelle 45 Scalaire du type de <varname>X</varname> : le déterminant de la matrice
34 </para> 46 <varname>X</varname>. Si <varname>X</varname> est creuse,
47 <varname>d</varname> est toujours dense.
48 <para/>
35 </listitem> 49 </listitem>
36 </varlistentry> 50 </varlistentry>
37 <varlistentry> 51 <varlistentry>
38 <term>m </term> 52 <term>m</term>
39 <listitem> 53 <listitem>
40 <para>nombre réel ou complexe, mantisse du déterminant en base 10 54 nombre réel ou complexe : mantisse du déterminant en base 10, telle que
41 </para> 55 <literal>abs(m) ∈ [1,10)</literal>. Argument non supporté lorsque <varname>X</varname>
56 est polynômiale ou en fractions rationnelles.
57 <para/>
42 </listitem> 58 </listitem>
43 </varlistentry> 59 </varlistentry>
44 <varlistentry> 60 <varlistentry>
45 <term>e </term> 61 <term>e</term>
46 <listitem> 62 <listitem>
47 <para>entier, exposant du déterminant en base 10 63 entier : la puissance de 10 du déterminant, telle que
48 </para> 64 <literal>d = m * 10<superscript>e</superscript></literal>.
65 Argument non supporté lorsque <varname>X</varname> est polynômiale ou
66 en fractions rationnelles.
67 <para/>
49 </listitem> 68 </listitem>
50 </varlistentry> 69 </varlistentry>
51 </variablelist> 70 </variablelist>
@@ -53,24 +72,168 @@
53 <refsection> 72 <refsection>
54 <title>Description</title> 73 <title>Description</title>
55 <para> 74 <para>
56 <literal>det(X)</literal> ( <literal>m*10^e</literal> ) est le déterminant de la matrice carrée <literal>X</literal>. 75 <emphasis role="bold">d = det(X)</emphasis> calcule et donne le déterminant de la matrice
76 <varname>X</varname>.
77 </para>
78 <para>
79 Pour une matrice de polynômes ou de fractions rationelles, <literal>d=det(X)</literal>
80 utilise <literal>determ(..)</literal> dont l'algorithme est basé sur la transformée de
81 Fourier.
82 <literal>d=detr(X)</literal> peut être utilisée de manière alternative, utilisant
83 l'algorithme de Leverrier. Les deux méthodes produisent des résultats équivalents.
84 Pour une matrice de fractions rationnelles, neutraliser la simplification avec
85 <code>simp_mode(%f)</code> peut être requis pour obtenir deux résultats identiques.
86 </para>
87 <para>
88 <emphasis role="bold">[e, m] = det(X)</emphasis> peut être utilisé uniquement pour des
89 matrices de nombres. Cette syntaxe permet de remédier aux débordements numériques vers 0
90 ou vers l'infini, lorsque <literal>abs(d)</literal> est plus petit que
91 <literal>number_properties("tiny")</literal> ≈ 2.23 10<superscript>-308</superscript> ou
92 plus grand que <literal>number_properties("huge")</literal> ≈ 1.80 10<superscript>308</superscript>.
57 </para> 93 </para>
58 <para> 94 <para>
59 Pour les matrices polynomiales <literal>det(X)</literal> est équivalent à <literal>determ(X)</literal>. 95 Pour les matrices numériques denses, <literal>det(..)</literal> est basée sur les routines LAPACK
96 DGETRF pour les matrices réelles et ZGETRF pour les matrices de nombres complexes.
60 </para> 97 </para>
61 <para> 98 <para>
62 Pour les matrices rationnelles <literal>det(X)</literal> est équivalent à <literal>detr(X)</literal>. 99 Pour les matrices numériques creuses, le déterminant est calculé d'après la factorisation
100 LU de <varname>X</varname>, réalisée à l'aide de la bibliothèque UMFPACK.
63 </para> 101 </para>
64 </refsection> 102 </refsection>
65 <refsection> 103 <refsection>
66 <title>Exemples</title> 104 <title>Exemples</title>
67 <programlisting role="example"><![CDATA[ 105 <programlisting role="example"><![CDATA[
68x=poly(0,'x'); 106A = rand(3,3)*5;
69det([x,1+x;2-x,x^2]) 107det(A)
70w=ssrand(2,2,4);roots(det(systmat(w))),trzeros(w) // zéros du système linéaire 108[e, m] = det(A)
71A=rand(3,3); 109
72det(A), prod(spec(A)) 110// Matrice de nombres complexes :
73 ]]></programlisting> 111// A = grand(3,3,"uin",0,10) + grand(3,3,"uin",0,10)*%i
112A = [3+%i, 9+%i*3, 9+%i ; 8+%i*8, 4+%i*3, 7+%i*7 ; 4, 6+%i*2, 6+%i*9]
113det(A)
114[e, m] = det(A)
115abs(m) // dans [1, 10)
116 ]]></programlisting>
117 <screen><![CDATA[
118--> A = rand(3,3)*5;
119--> det(A)
120 ans =
121 -10.805163
122
123--> [e, m] = det(A)
124 e =
125 1.
126 m =
127 -1.0805163
128
129--> // Matrice de nombres complexes :
130--> A = [3+%i,9+%i*3,9+%i;8+%i*8,4+%i*3,7+%i*7;4,6+%i*2,6+%i*9]
131 A =
132 3. + i 9. + 3.i 9. + i
133 8. + 8.i 4. + 3.i 7. + 7.i
134 4. + 0.i 6. + 2.i 6. + 9.i
135
136--> det(A)
137 ans =
138 745. - 225.i
139
140--> [e, m] = det(A)
141 e =
142 2.
143 m =
144 7.45 - 2.25i
145
146--> abs(m) // dans [1, 10)
147 ans =
148 7.7823518
149]]></screen>
150 <para/>
151 <para>
152 Déterminants très grands ou très petits : gestion des débordements numériques :
153 </para>
154 <programlisting role="example"><![CDATA[
155// Très grand déterminant :
156n = 1000;
157A = rand(n, n);
158det(A)
159[e, m] = det(A)
160
161// Très petit déterminant (d'une matrice encodée creuse) :
162A = (triu(sprand(n,n,1)) + diag(rand(1,n)))/1.5;
163det(A)
164prod(diag(A))
165[e, m] = det(A)
166A = A/2;
167det(A)
168[e, m] = det(A)
169 ]]></programlisting>
170 <screen><![CDATA[
171--> // Très grand déterminant :
172--> A = rand(n, n);
173--> det(A)
174 ans =
175 -Inf
176
177--> [e, m] = det(A) // -3.1199e743
178 e =
179 743.
180 m =
181 -3.1198687
182
183--> // Très petit déterminant (d'une matrice encodée creuse) :
184--> n = 1000;
185--> A = (triu(sprand(n,n,1)) + diag(rand(1,n)))/1.5;
186--> det(A)
187 ans =
188 5.21D-236
189
190--> prod(diag(A))
191 ans =
192 5.21D-236
193
194--> [e, m] = det(A)
195 e =
196 -236.
197 m =
198 5.2119757
199
200--> A = A/2;
201--> det(A)
202 ans =
203 0.
204
205--> [e, m] = det(A)
206 e =
207 -537.
208 m =
209 4.8641473
210]]></screen>
211 <para/>
212 <para>
213 Déterminant de matrices polynômiales :
214 </para>
215 <programlisting role="example"><![CDATA[
216s = %s;
217det([s, 1+s ; 2-s, s^2])
218
219w = ssrand(2,2,4);
220roots(det(systmat(w))),trzeros(w) //zeros of linear system
221 ]]></programlisting>
222 <screen><![CDATA[
223--> det([s, 1+s ; 2-s, s^2])
224 ans =
225 -2 -s +s² +s³
226
227--> w = ssrand(2,2,4);
228--> roots(det(systmat(w))),trzeros(w)
229 ans =
230 -3.1907522 + 0.i
231 2.3596502 + 0.i
232
233 ans =
234 2.3596502 + 0.i
235 -3.1907522 + 0.i
236]]></screen>
74 </refsection> 237 </refsection>
75 <refsection role="see also"> 238 <refsection role="see also">
76 <title>Voir aussi</title> 239 <title>Voir aussi</title>
@@ -81,6 +244,9 @@ det(A), prod(spec(A))
81 <member> 244 <member>
82 <link linkend="determ">determ</link> 245 <link linkend="determ">determ</link>
83 </member> 246 </member>
247 <member>
248 <link linkend="simp_mode">simp_mode</link>
249 </member>
84 </simplelist> 250 </simplelist>
85 </refsection> 251 </refsection>
86 <refsection> 252 <refsection>
@@ -94,4 +260,15 @@ det(A), prod(spec(A))
94 à partir de la décomposition LU de la librairie umfpack. 260 à partir de la décomposition LU de la librairie umfpack.
95 </para> 261 </para>
96 </refsection> 262 </refsection>
263 <refsection role="history">
264 <title>Historique</title>
265 <revhistory>
266 <revision>
267 <revnumber>6.1.1</revnumber>
268 <revdescription>
269 [e,m]=det(X) syntax extended to sparse matrices.
270 </revdescription>
271 </revision>
272 </revhistory>
273 </refsection>
97</refentry> 274</refentry>
diff --git a/scilab/modules/linear_algebra/help/ja_JP/eigen/bdiag.xml b/scilab/modules/linear_algebra/help/ja_JP/eigen/bdiag.xml
index 5ed528e..525c5f9 100644
--- a/scilab/modules/linear_algebra/help/ja_JP/eigen/bdiag.xml
+++ b/scilab/modules/linear_algebra/help/ja_JP/eigen/bdiag.xml
@@ -13,14 +13,19 @@
13 * along with this program. 13 * along with this program.
14 * 14 *
15 --> 15 -->
16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="bdiag"> 16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
18 xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="bdiag">
17 <refnamediv> 19 <refnamediv>
18 <refname>bdiag</refname> 20 <refname>bdiag</refname>
19 <refpurpose>ブロック対角化, 一般化固有ベクトル</refpurpose> 21 <refpurpose>ブロック対角化, 一般化固有ベクトル</refpurpose>
20 </refnamediv> 22 </refnamediv>
21 <refsynopsisdiv> 23 <refsynopsisdiv>
22 <title>呼び出し手順</title> 24 <title>呼び出し手順</title>
23 <synopsis>[Ab [,X [,bs]]]=bdiag(A [,rmax])</synopsis> 25 <synopsis>
26 [Ab, X, bs] = bdiag(A)
27 [Ab, X, bs] = bdiag(A, rmax)
28 </synopsis>
24 </refsynopsisdiv> 29 </refsynopsisdiv>
25 <refsection> 30 <refsection>
26 <title>引数</title> 31 <title>引数</title>
@@ -59,36 +64,45 @@
59 </refsection> 64 </refsection>
60 <refsection> 65 <refsection>
61 <title>説明</title> 66 <title>説明</title>
62 <programlisting role=""><![CDATA[
63[Ab [,X [,bs]]]=bdiag(A [,rmax])
64 ]]></programlisting>
65 <para> 67 <para>
66 は,行列<literal>A</literal>のブロック対角化を行ないます. 68 <emphasis role="bold">[Ab, X, bs] = bdiag(A, rmax)</emphasis>
69 は,行列<varname>A</varname>のブロック対角化を行ないます.
67 bs はブロックの構造(個々のブロックの大きさ)を出力します. 70 bs はブロックの構造(個々のブロックの大きさ)を出力します.
68 <literal>X</literal> は基底変換です. 71 <varname>X</varname> は基底変換です.
69 すなわち, <literal>Ab = inv(X)*A*X</literal> はブロック対角です. 72 すなわち, <literal>Ab = inv(X)*A*X</literal> はブロック対角です.
70 </para> 73 </para>
71 <para> 74 <para>
72 <literal>rmax</literal> は<literal>X</literal>の 75 <varname>rmax</varname> は<varname>X</varname>の
73 条件数を制御します; 76 条件数を制御します;
74 デフォルト値は <literal>A</literal> の l1ノルムです. 77 デフォルト値は <varname>A</varname> の l1ノルムです.
75 </para> 78 </para>
76 <para> 79 <para>
77 (存在する場合,)対角形式を得るには<literal>rmax</literal>に 80 (存在する場合,)対角形式を得るには<varname>rmax</varname>に
78 大きな値を指定します(例えば,<literal>rmax=1/%eps</literal>). 81 大きな値を指定します(例えば,<literal>rmax=1/%eps</literal>).
79 一般に(ランダムな実数の Aの場合) ブロックは (1x1) および (2x2) で, 82 一般に(ランダムな実数の Aの場合) ブロックは (1x1) および (2x2) で,
80 <literal>X</literal> は固有値の行列です. 83 <varname>X</varname> は固有値の行列です.
81 </para> 84 </para>
82 </refsection> 85 </refsection>
83 <refsection> 86 <refsection>
84 <title>例</title> 87 <title>例</title>
85 <programlisting role="example"><![CDATA[ 88 <programlisting role="example"><![CDATA[
86//実数の場合: 1x1 および 2x2 ブロック 89// 実数の場合: 1x1 および 2x2 ブロック
87a=rand(5,5);[ab,x,bs]=bdiag(a);ab 90a = rand(5,5);
88 91[ab, x, bs] = bdiag(a);ab
89//複素数の場合: 複素数 1x1 ブロック 92 ]]></programlisting>
90[ab,x,bs]=bdiag(a+%i*0);ab 93 <screen><![CDATA[
91 ]]></programlisting> 94--> [ab, x, bs] = bdiag(a);ab
95 ab =
96 2.4777836 0. 0. 0. 0.
97 0. 0.0757087 0.4869251 0. 0.
98 0. -0.5777956 -0.1248605 0. 0.
99 0. 0. 0. 0.069654 0.
100 0. 0. 0. 0. 0.5341598
101]]></screen>
102 <programlisting role="example"><![CDATA[
103// 複素数の場合: 複素数 1x1 ブロック
104[ab, x, bs] = bdiag(a+%i*0); ab
105 ]]></programlisting>
92 </refsection> 106 </refsection>
93 <refsection role="see also"> 107 <refsection role="see also">
94 <title>参照</title> 108 <title>参照</title>
@@ -105,6 +119,9 @@ a=rand(5,5);[ab,x,bs]=bdiag(a);ab
105 <member> 119 <member>
106 <link linkend="blockdiag">blockdiag</link> 120 <link linkend="blockdiag">blockdiag</link>
107 </member> 121 </member>
122 <member>
123 <link linkend="lcmdiag">lcmdiag</link>
124 </member>
108 </simplelist> 125 </simplelist>
109 </refsection> 126 </refsection>
110</refentry> \ No newline at end of file 127</refentry> \ No newline at end of file
diff --git a/scilab/modules/linear_algebra/help/ja_JP/eigen/eigs.xml b/scilab/modules/linear_algebra/help/ja_JP/eigen/eigs.xml
new file mode 100644
index 0000000..06f3c37
--- /dev/null
+++ b/scilab/modules/linear_algebra/help/ja_JP/eigen/eigs.xml
@@ -0,0 +1,543 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2012 - Scilab Enterprises - Adeline CARNIS
5 *
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises
7 *
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
14 *
15 -->
16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml"
18 xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
19 xmlns:scilab="http://www.scilab.org" xml:id="eigs" xml:lang="ja">
20 <refnamediv>
21 <refname>eigs</refname>
22 <refpurpose>
23 行列の最大固有値と固有ベクトルを計算
24 </refpurpose>
25 </refnamediv>
26 <refsynopsisdiv>
27 <title>呼び出し手順</title>
28 <synopsis>
29 d = eigs(A)
30 d = eigs(Af, n)
31 d = eigs(.., B)
32 d = eigs(.., B, k)
33 d = eigs(.., B, k, sigma)
34 d = eigs(.., B, k, sigma, opts)
35 [d, v] = eigs(..)
36 </synopsis>
37 </refsynopsisdiv>
38 <refsection>
39 <title>引数</title>
40 <variablelist>
41 <varlistentry>
42 <term>A </term>
43 <listitem>
44 <para>通常または疎, 実数または複素数, 対称または非対称正方行列</para>
45 </listitem>
46 </varlistentry>
47 <varlistentry>
48 <term>B</term>
49 <listitem>
50 <para>
51 <literal>A</literal>と同じ次元の疎, 実数または複素数, 正方行列.
52 Specify <literal>[]</literal> to skip it, as by default.
53 </para>
54 </listitem>
55 </varlistentry>
56 <varlistentry>
57 <term>k</term>
58 <listitem>
59 <para>
60 整数, 計算する固有値の数. By default,
61 <literal>k=min(n-1, 6)</literal> (<varname>A</varname> real symetric) or
62 <literal>k=min(n-2, 6)</literal> (otherwise) eigen values are computed,
63 with n=size(A,1).
64 </para>
65 </listitem>
66 </varlistentry>
67 <varlistentry>
68 <term>sigma</term>
69 <listitem>
70 <para>実スカラーまたは長さ2の文字列</para>
71 </listitem>
72 </varlistentry>
73 <varlistentry>
74 <term>opts</term>
75 <listitem>
76 <para>構造体</para>
77 </listitem>
78 </varlistentry>
79 <varlistentry>
80 <term>Af </term>
81 <listitem>
82 <para>関数</para>
83 </listitem>
84 </varlistentry>
85 <varlistentry>
86 <term>n </term>
87 <listitem>
88 <para>
89 スカラー, Aが関数の場合のみ <literal>A</literal> 定義
90 </para>
91 </listitem>
92 </varlistentry>
93 <varlistentry>
94 <term>d</term>
95 <listitem>
96 <para>実数または複素数の固有値ベクトルまたは対角行列 (対角項に固有値)</para>
97 </listitem>
98 </varlistentry>
99 <varlistentry>
100 <term>v</term>
101 <listitem>
102 <para>
103 実数または複素数の固有ベクトル行列
104 </para>
105 </listitem>
106 </varlistentry>
107 </variablelist>
108 </refsection>
109 <refsection>
110 <title>説明</title>
111 <para>
112 eigs関数の目的は,疎で大きな行列の最大固有値を計算することです.
113 </para>
114 <variablelist>
115 <varlistentry>
116 <term>d = eigs(A) または d = eigs(Af, n)</term>
117 <listitem>
118 <para>
119 は,固有値問題<literal>A * v = lambda * v</literal>を解きます.
120 このコールは,大きさが最大の6個の固有値を有する
121 ベクトル <literal>d</literal>を返します.
122 <literal>A</literal> は正方行列で,
123 対称または非対称, 実数または複素数, 通常または複素数
124 とすることができます.
125 </para>
126 <para>
127 <literal>A</literal> は関数<literal>Af</literal>で
128 表すことも可能です.この場合,
129 ベクトル引数の長さを指定するスカラー<literal>n</literal>を
130 定義する必要があります.
131 この関数は,以下のヘッダを有する必要があります:
132 </para>
133 <programlisting role="no-scilab-exec">
134 <![CDATA[
135function y = A ( x )
136 ]]>
137 </programlisting>
138 <para>
139 この関数 <literal>Af</literal> は以下の4つの式の1つを返す必要があります:
140 <itemizedlist>
141 <listitem>
142 <term>A * x</term>
143 <para> sigmaが指定されないか文字列が'SM'以外の場合.</para>
144 </listitem>
145 <listitem>
146 <term>A \ x</term>
147 <para>sigmaが0または'SM'の場合.</para>
148 </listitem>
149 <listitem>
150 <term>(A - sigma * I) \ x</term>
151 <para>標準固有値問題の場合, ただし I は単位行列.</para>
152 </listitem>
153 <listitem>
154 <term>(A - sigma * B) \ x</term>
155 <para> 一般化固有値問題の場合.</para>
156 </listitem>
157 </itemizedlist>
158 </para>
159 </listitem>
160 </varlistentry>
161 <varlistentry>
162 <term>[d, v] = eigs(A) or [d, v] = eigs(Af, n)</term>
163 <listitem>
164 <para>
165 は,6個の最大固有値を対角項に有する対角行列 <literal>d</literal> を返します.
166 <literal>v</literal> は n行6列の行列で,
167 その列は返された固有値に対応する6個の固有値ベクトルです.
168 </para>
169 </listitem>
170 </varlistentry>
171 <varlistentry>
172 <term>d = eigs(A, B)</term>
173 <listitem>
174 <para>
175 は,正定行列<literal>B</literal>を指定して,
176 一般化固有値問題 <literal>A * v = lambda * B * v </literal>
177 を解きます.
178 </para>
179 <itemizedlist>
180 <listitem>
181 <para>
182 <literal>B</literal> が指定されない場合,
183 <literal>B = []</literal> が使用されます.
184 </para>
185 </listitem>
186 <listitem>
187 <para>
188 <literal>B</literal> が指定された場合,
189 <literal>B</literal> はAと同じ大きさとする必要があります.
190 </para>
191 </listitem>
192 </itemizedlist>
193 </listitem>
194 </varlistentry>
195 <varlistentry>
196 <term>d = eigs(A, B, k)</term>
197 <listitem>
198 <para>
199 は,<literal>k</literal>個の固有値をベクトル<literal>d</literal>に返します.
200 </para>
201 </listitem>
202 </varlistentry>
203 <varlistentry>
204 <term>d = eigs(A, B, k, sigma)</term>
205 <listitem>
206 <para>
207 は,<literal>sigma</literal>で定義された<literal>k</literal>個の固有値を
208 ベクトル<literal>d</literal>に返します.
209 <literal>sigma</literal> は,0を含む実数または複素数,または文字列
210 とすることができます.
211 sigma が長さ2の文字列の場合, 以下の値のどれかとします :
212 </para>
213 <itemizedlist>
214 <listitem>
215 <para>
216 <literal>'LM'</literal> は,大きさが最大の<varname>k</varname>個の
217 固有値を計算します(デフォルト).
218 </para>
219 </listitem>
220 <listitem>
221 <para>
222 <literal>'SM'</literal> は,大きさが最小の<varname>k</varname>個の
223 固有値を計算します(sigma = 0 と同じ).
224 </para>
225 </listitem>
226 <listitem>
227 <para>
228 <literal>'LA'</literal> は,実対称問題のみに適用され,
229 <varname>k</varname>個の代数的最大固有値を計算します.
230 </para>
231 </listitem>
232 <listitem>
233 <para>
234 <literal>'SA'</literal> は,実対称問題のみに適用され,
235 <varname>k</varname>個の代数的最小固有値を計算します.
236 </para>
237 </listitem>
238 <listitem>
239 <para>
240 <literal>'BE'</literal> は,実対称問題のみに適用され,
241 スペクトラムの各端から半分づつ,<varname>k</varname>個の固有値を計算します.
242 </para>
243 </listitem>
244 <listitem>
245 <para>
246 <literal>'LR'</literal> は,実非対称または複素問題のみに適用され,
247 <varname>k</varname>個の実部最大の固有値を計算します.
248 </para>
249 </listitem>
250 <listitem>
251 <para>
252 <literal>'SR'</literal> は,実非対称または複素問題のみに適用され,
253 <varname>k</varname>個の実部最小の固有値を計算します.
254 </para>
255 </listitem>
256 <listitem>
257 <para>
258 <literal>'LI'</literal> は,実非対称または複素問題のみに適用され,
259 <varname>k</varname>個の虚部最大の固有値を計算します.
260 </para>
261 </listitem>
262 <listitem>
263 <para>
264 <literal>'SI'</literal> は,実非対称または複素問題のみに適用され,
265 <varname>k</varname>個の虚部最小の固有値を計算します.
266 </para>
267 </listitem>
268 </itemizedlist>
269 </listitem>
270 </varlistentry>
271 <varlistentry>
272 <term>d = eigs(A, B, k, sigma, opts)</term>
273 <listitem>
274 <para>
275 <literal> opts </literal> 構造体が指定された場合,
276 <literal>k</literal> 個の固有値を計算する際に
277 異なるオプションを使用できます:
278 </para>
279 <itemizedlist>
280 <listitem>
281 <para>
282 <term>tol</term>
283 <para>
284 所要の収束閾値. デフォルトで, <literal>tol = %eps</literal>.
285 </para>
286 </para>
287 </listitem>
288 <listitem>
289 <para>
290 <term>maxiter</term>
291 <para>
292 最大反復回数. デフォルトで, <literal>maxiter = 300</literal>.
293 </para>
294 </para>
295 </listitem>
296 <listitem>
297 <para>
298 <term>ncv</term>
299 <para>
300 使用するLanzcos基底ベクトルの数.
301 実非対称問題の場合, <literal>ncv</literal>の値は
302 <literal>2 * k + 1 </literal>以上とする必要があり,
303 デフォルトで <literal>ncv = min(max(2 * k + 1, 20), nA) </literal>です.
304 実対称または複素数問題の場合,<literal>ncv</literal>は
305 <literal>2 * k </literal>以上とする必要があり,
306 デフォルトで<literal> ncv = min(max(2 * k, 20), nA) </literal>
307 です.ただし,<literal> nA = size(A, 2) </literal>.
308 </para>
309 </para>
310 </listitem>
311 <listitem>
312 <para>
313 <term>resid</term>
314 <para>
315 初期残差ベクトルを有する開始ベクトルで,
316 前回実行時の値を使用することもできます.
317 デフォルトで,<literal>resid</literal> はランダムな
318 初期値ベクトルです.
319 </para>
320 </para>
321 </listitem>
322 <listitem>
323 <para>
324 <term>cholB</term>
325 <para>
326 <literal>B</literal>ではなく
327 <literal>chol(B)</literal>を指定します.
328 デフォルトで
329 , <literal>cholB</literal> は %f です.
330 </para>
331 </para>
332 </listitem>
333 <listitem>
334 <para>
335 <term>isreal</term>
336 <para>
337 <literal>Af</literal> が指定された場合,
338 <literal>isreal</literal> を定義できます.
339 デフォルトで, <literal>isreal</literal> は %t です.
340 この引数は,<literal>A</literal>が行列の場合,
341 指定する必要がありません.
342 </para>
343 </para>
344 </listitem>
345 <listitem>
346 <para>
347 <term>issym</term>
348 <para>
349 <literal>Af</literal> が指定された場合,
350 <literal>issym</literal> を定義できます.
351 デフォルトで <literal>issym</literal> は %f です.
352 この引数は,<literal>A</literal>が行列の場合,
353 指定する必要がありません.
354 </para>
355 </para>
356 </listitem>
357 </itemizedlist>
358 </listitem>
359 </varlistentry>
360 </variablelist>
361 </refsection>
362 <refsection>
363 <title>参考文献</title>
364 <para>
365 この関数はR. Lehoucq, K. Maschhoff, D. Sorensen, および C. Yang.により書かれた
366 ARPACKパッケージに基づいています.
367 </para>
368 <itemizedlist>
369 <listitem>
370 <para>実対称問題用のDSAUPD および DSEUPD ルーチン,</para>
371 </listitem>
372 <listitem>
373 <para>実非対称行列用のDNAUPD および DNEUPD ルーチン.</para>
374 </listitem>
375 <listitem>
376 <para>複素問題用のZNAUPD および ZNEUPD.</para>
377 </listitem>
378 </itemizedlist>
379 </refsection>
380 <refsection>
381 <title>実対称問題の例</title>
382 <programlisting role="example">
383 <![CDATA[
384clear opts
385A = diag(10*ones(10,1));
386A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(9,1));
387A(2:$,1:$-1) = A(2:$,1:$-1) + diag(6*ones(9,1));
388B = eye(10,10);
389k = 8;
390sigma = 'SM';
391opts.cholB = %t;
392d = eigs(A)
393[d, v] = eigs(A)
394d = eigs(A, B, k, sigma)
395[d, v] = eigs(A, B, k, sigma)
396d = eigs(A, B, k, sigma, opts)
397[d, v] = eigs(A, B, k, sigma, opts)
398// 疎行列
399AS = sparse(A);
400BS = sparse(B);
401d = eigs(AS)
402[d, v] = eigs(AS)
403d = eigs(AS, BS, k, sigma)
404[d, v] = eigs(AS, BS, k, sigma)
405d = eigs(AS, BS, k, sigma, opts)
406[d, v] = eigs(AS, BS, k, sigma, opts)
407// 関数
408clear opts
409function y = fn(x)
410 y = A * x;
411endfunction
412opts.isreal = %t;
413opts.issym = %t;
414d = eigs(fn, 10, [], k, 'LM', opts)
415function y = fn(x)
416 y = A \ x;
417endfunction
418d = eigs(fn, 10, [], k, 'SM', opts)
419function y = fn(x)
420 y = (A - 4 * eye(10,10)) \ x;
421endfunction
422d = eigs(fn, 10, [], k, 4, opts)
423 ]]>
424 </programlisting>
425 </refsection>
426 <refsection>
427 <title>実非対称問題の例</title>
428 <programlisting role="example">
429 <![CDATA[
430 clear opts
431 A = diag(10*ones(10,1));
432 A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(9,1));
433 A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(9,1));
434 B = eye(10,10);
435 k = 8;
436 sigma = 'SM';
437 opts.cholB = %t;
438 d = eigs(A)
439[d, v] = eigs(A)
440 d = eigs(A, B, k, sigma)
441 [d, v] = eigs(A, B, k, sigma)
442 d = eigs(A, B, k, sigma, opts)
443 [d, v] = eigs(A, B, k, sigma, opts)
444// 疎行列
445 AS = sparse(A);
446 BS = sparse(B);
447d = eigs(AS)
448[d, v] = eigs(AS)
449 d = eigs(AS, BS, k, sigma)
450 [d, v] = eigs(AS, BS, k, sigma)
451 d = eigs(AS, BS, k, sigma, opts)
452 [d, v] = eigs(AS, BS, k, sigma, opts)
453 // 関数
454clear opts
455function y = fn(x)
456 y = A * x;
457endfunction
458opts.isreal = %t;
459opts.issym = %f;
460d = eigs(fn, 10, [], k, 'LM', opts)
461function y = fn(x)
462 y = A \ x;
463endfunction
464d = eigs(fn, 10, [], k, 'SM', opts)
465function y = fn(x)
466 y = (A - 4 * eye(10,10)) \ x;
467endfunction
468d = eigs(fn, 10, [], k, 4, opts)
469 ]]>
470 </programlisting>
471 </refsection>
472 <refsection>
473 <title>複素問題の例</title>
474 <programlisting role="example">
475 <![CDATA[
476 clear opts
477 A = diag(10*ones(10,1) + %i * ones(10,1));
478 A(1:$-1,2:$) = A(1:$-1,2:$) + diag(6*ones(9,1));
479 A(2:$,1:$-1) = A(2:$,1:$-1) + diag(-6*ones(9,1));
480 B = eye(10,10);
481 k = 8;
482 sigma = 'LM';
483 opts.cholB = %t;
484 d = eigs(A)
485[d, v] = eigs(A)
486 d = eigs(A, B, k, sigma)
487 [d, v] = eigs(A, B, k, sigma)
488 d = eigs(A, B, k, sigma, opts)
489 [d, v] = eigs(A, B, k, sigma, opts)
490 // 疎行列
491 AS = sparse(A);
492 BS = sparse(B);
493 d = eigs(AS)
494[d, v] = eigs(AS)
495 d = eigs(AS, BS, k, sigma)
496 [d, v] = eigs(AS, BS, k, sigma)
497 d = eigs(AS, BS, k, sigma, opts)
498 [d, v] = eigs(AS, BS, k, sigma, opts)
499 // 関数
500clear opts
501function y = fn(x)
502 y = A * x;
503endfunction
504opts.isreal = %f;
505opts.issym = %f;
506d = eigs(fn, 10, [], k, 'LM', opts)
507function y = fn(x)
508 y = A \ x;
509endfunction
510d = eigs(fn, 10, [], k, 'SM', opts)
511function y = fn(x)
512 y = (A - 4 * eye(10,10)) \ x;
513endfunction
514d = eigs(fn, 10, [], k, 4, opts)
515 ]]>
516 </programlisting>
517 </refsection>
518 <refsection role="see also">
519 <title>参照</title>
520 <simplelist type="inline">
521 <member>
522 <link linkend="spec">spec</link>
523 </member>
524 </simplelist>
525 </refsection>
526 <refsection>
527 <title>履歴</title>
528 <revhistory>
529 <revision>
530 <revnumber>5.4.0</revnumber>
531 <revremark>
532 関数が導入されました.
533 </revremark>
534 </revision>
535 <revision>
536 <revnumber>6.1.1</revnumber>
537 <revremark>
538 dnaupd, dneupd, dsaupd, dseupd, znaupd and zneupd become internal.
539 </revremark>
540 </revision>
541 </revhistory>
542 </refsection>
543</refentry>
diff --git a/scilab/modules/linear_algebra/help/ja_JP/linear/chol.xml b/scilab/modules/linear_algebra/help/ja_JP/factorization/chol.xml
index a116fc9..a116fc9 100644
--- a/scilab/modules/linear_algebra/help/ja_JP/linear/chol.xml
+++ b/scilab/modules/linear_algebra/help/ja_JP/factorization/chol.xml
diff --git a/scilab/modules/linear_algebra/help/ja_JP/kernel/fullrf.xml b/scilab/modules/linear_algebra/help/ja_JP/factorization/fullrf.xml
index b9d194a..b9d194a 100644
--- a/scilab/modules/linear_algebra/help/ja_JP/kernel/fullrf.xml
+++ b/scilab/modules/linear_algebra/help/ja_JP/factorization/fullrf.xml
diff --git a/scilab/modules/linear_algebra/help/ja_JP/kernel/fullrfk.xml b/scilab/modules/linear_algebra/help/ja_JP/factorization/fullrfk.xml
index cdbfacd..cdbfacd 100644
--- a/scilab/modules/linear_algebra/help/ja_JP/kernel/fullrfk.xml
+++ b/scilab/modules/linear_algebra/help/ja_JP/factorization/fullrfk.xml
diff --git a/scilab/modules/linear_algebra/help/ja_JP/eigen/hess.xml b/scilab/modules/linear_algebra/help/ja_JP/factorization/hess.xml
index aa0d0e6..aa0d0e6 100644
--- a/scilab/modules/linear_algebra/help/ja_JP/eigen/hess.xml
+++ b/scilab/modules/linear_algebra/help/ja_JP/factorization/hess.xml
diff --git a/scilab/modules/linear_algebra/help/ja_JP/linear/lu.xml b/scilab/modules/linear_algebra/help/ja_JP/factorization/lu.xml
index 139acf9..139acf9 100644
--- a/scilab/modules/linear_algebra/help/ja_JP/linear/lu.xml
+++ b/scilab/modules/linear_algebra/help/ja_JP/factorization/lu.xml
diff --git a/scilab/modules/linear_algebra/help/ja_JP/linear/qr.xml b/scilab/modules/linear_algebra/help/ja_JP/factorization/qr.xml
index 3a03e56..3a03e56 100644
--- a/scilab/modules/linear_algebra/help/ja_JP/linear/qr.xml
+++ b/scilab/modules/linear_algebra/help/ja_JP/factorization/qr.xml
diff --git a/scilab/modules/linear_algebra/help/ja_JP/linear/rankqr.xml b/scilab/modules/linear_algebra/help/ja_JP/factorization/rankqr.xml
index 1c1773e..1c1773e 100644
--- a/scilab/modules/linear_algebra/help/ja_JP/linear/rankqr.xml
+++ b/scilab/modules/linear_algebra/help/ja_JP/factorization/rankqr.xml
diff --git a/scilab/modules/linear_algebra/help/ja_JP/eigen/schur.xml b/scilab/modules/linear_algebra/help/ja_JP/factorization/schur.xml
index c379fe9..c379fe9 100644
--- a/scilab/modules/linear_algebra/help/ja_JP/eigen/schur.xml
+++ b/scilab/modules/linear_algebra/help/ja_JP/factorization/schur.xml
diff --git a/scilab/modules/linear_algebra/help/ja_JP/factorization/givens.xml b/scilab/modules/linear_algebra/help/ja_JP/givens.xml
index 11eebc6..11eebc6 100644
--- a/scilab/modules/linear_algebra/help/ja_JP/factorization/givens.xml
+++ b/scilab/modules/linear_algebra/help/ja_JP/givens.xml
diff --git a/scilab/modules/linear_algebra/help/ja_JP/matrix/det.xml b/scilab/modules/linear_algebra/help/ja_JP/matrix/det.xml
deleted file mode 100644
index f651842..0000000
--- a/scilab/modules/linear_algebra/help/ja_JP/matrix/det.xml
+++ /dev/null
@@ -1,215 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2
3<!--
4 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
5 * Copyright (C) 2008 - INRIA
6 *
7 * Copyright (C) 2012 - 2016 - Scilab Enterprises
8 *
9 * This file is hereby licensed under the terms of the GNU GPL v2.0,
10 * pursuant to article 5.3.4 of the CeCILL v.2.1.
11 * This file was originally licensed under the terms of the CeCILL v2.1,
12 * and continues to be available under such terms.
13 * For more information, see the COPYING file which you should have received
14 * along with this program.
15 *
16 -->
17
18<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="det">
19
20 <refnamediv>
21
22 <refname>det</refname>
23
24 <refpurpose>行列式</refpurpose>
25
26 </refnamediv>
27
28 <refsynopsisdiv>
29
30 <title>呼出し手順</title>
31
32 <synopsis>det(X)
33
34 [e,m]=det(X)
35
36 </synopsis>
37
38 </refsynopsisdiv>
39
40 <refsection>
41
42 <title>引数</title>
43
44 <variablelist>
45
46 <varlistentry>
47
48 <term>X</term>
49
50 <listitem>
51
52 <para>実数または複素正方行列, 多項式または有理行列.</para>
53
54 </listitem>
55
56 </varlistentry>
57
58 <varlistentry>
59
60 <term>m</term>
61
62 <listitem>
63
64 <para>実数または複素数, 行列式の 10 を基底とする仮数</para>
65
66 </listitem>
67
68 </varlistentry>
69
70 <varlistentry>
71
72 <term>e</term>
73
74 <listitem>
75
76 <para>整数, 行列式の 10 を基底とする指数</para>
77
78 </listitem>
79
80 </varlistentry>
81
82 </variablelist>
83
84 </refsection>
85
86 <refsection>
87
88 <title>説明</title>
89
90 <para>
91
92 <literal>det(X)</literal> (<literal>m*10^e</literal>)は,
93
94 正方行列<literal>X</literal>の行列式です.
95
96 </para>
97
98 <para>
99
100 多項式行列の場合,<literal>det(X)</literal> は
101
102 <literal>determ(X)</literal>と等しくなります.
103
104 </para>
105
106 <para>
107
108 有理数行列の場合, <literal>det(X)</literal> は
109
110 <literal>detr(X)</literal>と等しくなります.
111
112 </para>
113
114 <para>
115
116 <important>
117
118 <literal>det</literal> および <literal>detr</literal> 関数は
119
120 同じアルゴリズムを使用しません.
121
122 有理数関数の場合, <literal>det(X)</literal> は
123
124 <literal>determ</literal>関数に基づく
125
126 <literal>%r_det(X)</literal> でオーバーロードされます.
127
128 <literal>detr()</literal> は, Leverrier法を使用します.
129
130 </important>
131
132 <warning>
133
134 時々,
135
136 <literal>det</literal> および <literal>detr</literal> 関数は
137
138 有理数関数と異なる値を返す可能性があります.
139
140 このような場合,同じ結果を得るために,
141
142 有理数は<code>simp_mode(%f)</code>を使用することにより
143
144 有理数を簡単化するモードを無効にする必要があります.
145
146 </warning>
147
148 </para>
149
150 </refsection>
151
152 <refsection role="see also">
153
154 <title>参照</title>
155
156 <para>
157
158 det の計算は Lapack ルーチン DGETRF (実数行列の場合) および
159
160 ZGETRF (複素数の場合)に基づいています.
161
162 </para>
163
164 <para>
165
166 疎行列の場合, 行列式は umfpack ライブラリのLU分解により得られます.
167
168 </para>
169
170 </refsection>
171
172 <refsection>
173
174 <title>例</title>
175
176 <programlisting role="example"><![CDATA[
177x=poly(0,'x');
178det([x,1+x;2-x,x^2])
179w=ssrand(2,2,4);roots(det(systmat(w))),trzeros(w) //線形システムのゼロ
180A=rand(3,3);
181det(A), prod(spec(A))
182 ]]></programlisting>
183
184 </refsection>
185
186 <refsection>
187
188 <title>参照</title>
189
190 <simplelist type="inline">
191
192 <member>
193
194 <link linkend="detr">detr</link>
195
196 </member>
197
198 <member>
199
200 <link linkend="determ">determ</link>
201
202 </member>
203
204 <member>
205
206 <link linkend="simp_mode">simp_mode</link>
207
208 </member>
209
210 </simplelist>
211
212 </refsection>
213
214</refentry>
215
diff --git a/scilab/modules/linear_algebra/help/pt_BR/eigen/bdiag.xml b/scilab/modules/linear_algebra/help/pt_BR/eigen/bdiag.xml
index 7aff17d..dd2e668 100644
--- a/scilab/modules/linear_algebra/help/pt_BR/eigen/bdiag.xml
+++ b/scilab/modules/linear_algebra/help/pt_BR/eigen/bdiag.xml
@@ -13,7 +13,10 @@
13 * along with this program. 13 * along with this program.
14 * 14 *
15 --> 15 -->
16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="bdiag" xml:lang="pt"> 16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml"
18 xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
19 xml:id="bdiag" xml:lang="pt">
17 <refnamediv> 20 <refnamediv>
18 <refname>bdiag</refname> 21 <refname>bdiag</refname>
19 <refpurpose>diagonalização em blocos, autovetores 22 <refpurpose>diagonalização em blocos, autovetores
@@ -22,7 +25,10 @@
22 </refnamediv> 25 </refnamediv>
23 <refsynopsisdiv> 26 <refsynopsisdiv>
24 <title> Seqüência de Chamamento </title> 27 <title> Seqüência de Chamamento </title>
25 <synopsis>[Ab [,X [,bs]]]=bdiag(A [,rmax])</synopsis> 28 <synopsis>
29 [Ab, X, bs] = bdiag(A)
30 [Ab, X, bs] = bdiag(A, rmax)
31 </synopsis>
26 </refsynopsisdiv> 32 </refsynopsisdiv>
27 <refsection> 33 <refsection>
28 <title>Parâmetros</title> 34 <title>Parâmetros</title>
@@ -61,38 +67,45 @@
61 </refsection> 67 </refsection>
62 <refsection> 68 <refsection>
63 <title>Descrição</title> 69 <title>Descrição</title>
64 <programlisting role=""><![CDATA[
65[Ab [,X [,bs]]]=bdiag(A [,rmax])
66 ]]></programlisting>
67 <para> 70 <para>
68 realiza a diagonalização em blocos da matriz <literal>A</literal>. 71 <emphasis role="bold">[Ab, X, bs] = bdiag(A, rmax)</emphasis>
69 bs fornece a estrutura dos blocos (respectivos tamanhos dos blocos). 72 realiza a diagonalização em blocos da matriz <varname>A</varname>.
70 <literal>X</literal> é a matriz mudança de base i.e <literal>Ab = 73 <varname>bs</varname> fornece a estrutura dos blocos (respectivos tamanhos dos blocos).
71 inv(X)*A*X 74 <varname>X</varname> é a matriz mudança de base i.e <literal>Ab = inv(X)*A*X</literal>
72 </literal>
73 édiagonal em blocos. 75 édiagonal em blocos.
74 </para> 76 </para>
75 <para> 77 <para>
76 <literal>rmax</literal> controla o condicionamento de 78 <varname>rmax</varname> controla o condicionamento de <varname>X</varname>.
77 <literal>X</literal>; o valor padrão é a norma L1 de 79 O valor padrão é a norma L1 de <varname>A</varname>.
78 <literal>A</literal>.
79 </para> 80 </para>
80 <para>Para encontrar a forma diagonal (se existir) escolha um valor 81 <para>
81 suficientemente grande para <literal>rmax</literal> 82 Para encontrar a forma diagonal (se existir) escolha um valor
83 suficientemente grande para <varname>rmax</varname>
82 (<literal>rmax=1/%eps</literal> , por exemplo). Genericamente, (para uma 84 (<literal>rmax=1/%eps</literal> , por exemplo). Genericamente, (para uma
83 matriz A de reais aleatória) os blocos são (1x1) e (2x2) e 85 matriz A de reais aleatória) os blocos são (1x1) e (2x2) e
84 <literal>X</literal> é a matriz de autovetores. 86 <varname>X</varname> é a matriz de autovetores.
85 </para> 87 </para>
86 </refsection> 88 </refsection>
87 <refsection> 89 <refsection>
88 <title>Exemplos</title> 90 <title>Exemplos</title>
89 <programlisting role="example"><![CDATA[ 91 <programlisting role="example"><![CDATA[
90//No caso de reais: blocos 1x1 e 2x2 92// No caso de reais: blocos 1x1 e 2x2
91a=rand(5,5);[ab,x,bs]=bdiag(a);ab 93a = rand(5,5);
92 94[ab, x, bs] = bdiag(a);ab
93//No caso de complexos: blocos 1x1 complexos 95 ]]></programlisting>
94[ab,x,bs]=bdiag(a+%i*0);ab 96 <screen><![CDATA[
95 ]]></programlisting> 97--> [ab, x, bs] = bdiag(a);ab
98 ab =
99 2.4777836 0. 0. 0. 0.
100 0. 0.0757087 0.4869251 0. 0.
101 0. -0.5777956 -0.1248605 0. 0.
102 0. 0. 0. 0.069654 0.
103 0. 0. 0. 0. 0.5341598
104]]></screen>
105 <programlisting role="example"><![CDATA[
106// No caso de complexos: blocos 1x1 complexos
107[ab, x, bs] = bdiag(a+%i*0); ab
108 ]]></programlisting>
96 </refsection> 109 </refsection>
97 <refsection> 110 <refsection>
98 <title> Ver Também </title> 111 <title> Ver Também </title>
@@ -109,6 +122,9 @@ a=rand(5,5);[ab,x,bs]=bdiag(a);ab
109 <member> 122 <member>
110 <link linkend="blockdiag">blockdiag</link> 123 <link linkend="blockdiag">blockdiag</link>
111 </member> 124 </member>
125 <member>
126 <link linkend="lcmdiag">lcmdiag</link>
127 </member>
112 </simplelist> 128 </simplelist>
113 </refsection> 129 </refsection>
114</refentry> 130</refentry>
diff --git a/scilab/modules/linear_algebra/help/pt_BR/linear/chol.xml b/scilab/modules/linear_algebra/help/pt_BR/factorization/chol.xml
index d1af012..d1af012 100644
--- a/scilab/modules/linear_algebra/help/pt_BR/linear/chol.xml
+++ b/scilab/modules/linear_algebra/help/pt_BR/factorization/chol.xml
diff --git a/scilab/modules/linear_algebra/help/pt_BR/kernel/fullrf.xml b/scilab/modules/linear_algebra/help/pt_BR/factorization/fullrf.xml
index f302fa3..f302fa3 100644
--- a/scilab/modules/linear_algebra/help/pt_BR/kernel/fullrf.xml
+++ b/scilab/modules/linear_algebra/help/pt_BR/factorization/fullrf.xml
diff --git a/scilab/modules/linear_algebra/help/pt_BR/kernel/fullrfk.xml b/scilab/modules/linear_algebra/help/pt_BR/factorization/fullrfk.xml
index a802f6a..a802f6a 100644
--- a/scilab/modules/linear_algebra/help/pt_BR/kernel/fullrfk.xml
+++ b/scilab/modules/linear_algebra/help/pt_BR/factorization/fullrfk.xml
diff --git a/scilab/modules/linear_algebra/help/pt_BR/eigen/hess.xml b/scilab/modules/linear_algebra/help/pt_BR/factorization/hess.xml
index 1cff315..1cff315 100644
--- a/scilab/modules/linear_algebra/help/pt_BR/eigen/hess.xml
+++ b/scilab/modules/linear_algebra/help/pt_BR/factorization/hess.xml
diff --git a/scilab/modules/linear_algebra/help/pt_BR/linear/lu.xml b/scilab/modules/linear_algebra/help/pt_BR/factorization/lu.xml
index b9f3a54..b9f3a54 100644
--- a/scilab/modules/linear_algebra/help/pt_BR/linear/lu.xml
+++ b/scilab/modules/linear_algebra/help/pt_BR/factorization/lu.xml
diff --git a/scilab/modules/linear_algebra/help/pt_BR/linear/qr.xml b/scilab/modules/linear_algebra/help/pt_BR/factorization/qr.xml
index 870426b..870426b 100644
--- a/scilab/modules/linear_algebra/help/pt_BR/linear/qr.xml
+++ b/scilab/modules/linear_algebra/help/pt_BR/factorization/qr.xml
diff --git a/scilab/modules/linear_algebra/help/pt_BR/linear/rankqr.xml b/scilab/modules/linear_algebra/help/pt_BR/factorization/rankqr.xml
index 9bec489..9bec489 100644
--- a/scilab/modules/linear_algebra/help/pt_BR/linear/rankqr.xml
+++ b/scilab/modules/linear_algebra/help/pt_BR/factorization/rankqr.xml
diff --git a/scilab/modules/linear_algebra/help/pt_BR/eigen/schur.xml b/scilab/modules/linear_algebra/help/pt_BR/factorization/schur.xml
index 89788ca..89788ca 100644
--- a/scilab/modules/linear_algebra/help/pt_BR/eigen/schur.xml
+++ b/scilab/modules/linear_algebra/help/pt_BR/factorization/schur.xml
diff --git a/scilab/modules/linear_algebra/help/pt_BR/factorization/givens.xml b/scilab/modules/linear_algebra/help/pt_BR/givens.xml
index 650365e..650365e 100644
--- a/scilab/modules/linear_algebra/help/pt_BR/factorization/givens.xml
+++ b/scilab/modules/linear_algebra/help/pt_BR/givens.xml
diff --git a/scilab/modules/linear_algebra/help/pt_BR/matrix/det.xml b/scilab/modules/linear_algebra/help/pt_BR/matrix/det.xml
deleted file mode 100644
index cea4772..0000000
--- a/scilab/modules/linear_algebra/help/pt_BR/matrix/det.xml
+++ /dev/null
@@ -1,97 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2008 - INRIA
5 *
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises
7 *
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
14 *
15 -->
16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="det" xml:lang="pt">
17 <refnamediv>
18 <refname>det</refname>
19 <refpurpose>determinante</refpurpose>
20 </refnamediv>
21 <refsynopsisdiv>
22 <title>Seqüência de Chamamento</title>
23 <synopsis>det(X)
24 [e,m]=det(X)
25 </synopsis>
26 </refsynopsisdiv>
27 <refsection>
28 <title>Parâmetros</title>
29 <variablelist>
30 <varlistentry>
31 <term>X</term>
32 <listitem>
33 <para>matriz quadrada de reais ou complexos, matriz de polinômios ou
34 de razões de polinômios
35 </para>
36 </listitem>
37 </varlistentry>
38 <varlistentry>
39 <term>m</term>
40 <listitem>
41 <para>número real ou complexo, a mantissa de base 10 do
42 determinante
43 </para>
44 </listitem>
45 </varlistentry>
46 <varlistentry>
47 <term>e</term>
48 <listitem>
49 <para>inteiro, o expoente de base 10 do determinante</para>
50 </listitem>
51 </varlistentry>
52 </variablelist>
53 </refsection>
54 <refsection>
55 <title>Descrição</title>
56 <para>
57 <literal>det(X)</literal> ( <literal>m*10^e</literal> é o
58 determinante da matriz quadrada <literal>X)</literal>.
59 </para>
60 <para>
61 Para uma matriz de polinômios, <literal>det(X)</literal> é
62 equivalente a <literal>determ(X)</literal>.
63 </para>
64 <para>
65 Para matrizes de razões de polinômios <literal>det(X)</literal> é
66 equivalente a <literal>detr(X)</literal>.
67 </para>
68 </refsection>
69 <refsection>
70 <title>Referências</title>
71 <para>As computações da função det são baseadas nas rotinas do LAPACK
72 DGETRF para matrizes de reais e ZGETRF para o caso de matrizes de
73 complexos.
74 </para>
75 </refsection>
76 <refsection>
77 <title>Exemplos</title>
78 <programlisting role="example"><![CDATA[
79x=poly(0,'x');
80det([x,1+x;2-x,x^2])
81w=ssrand(2,2,4);roots(det(systmat(w))),trzeros(w) //zeros do sistema linear
82A=rand(3,3);
83det(A), prod(spec(A))
84 ]]></programlisting>
85 </refsection>
86 <refsection>
87 <title> Ver Também</title>
88 <simplelist type="inline">
89 <member>
90 <link linkend="detr">detr</link>
91 </member>
92 <member>
93 <link linkend="determ">determ</link>
94 </member>
95 </simplelist>
96 </refsection>
97</refentry>
diff --git a/scilab/modules/linear_algebra/help/ru_RU/eigen/bdiag.xml b/scilab/modules/linear_algebra/help/ru_RU/eigen/bdiag.xml
new file mode 100644
index 0000000..9750dbc
--- /dev/null
+++ b/scilab/modules/linear_algebra/help/ru_RU/eigen/bdiag.xml
@@ -0,0 +1,126 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2008 - INRIA
5 *
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises
7 *
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
14 *
15 -->
16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
18 xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="bdiag">
19 <refnamediv>
20 <refname>bdiag</refname>
21 <refpurpose>блоковая диагонализация, обобщённые собственные векторы</refpurpose>
22 </refnamediv>
23 <refsynopsisdiv>
24 <title>Синтаксис</title>
25 <synopsis>
26 [Ab, X, bs] = bdiag(A)
27 [Ab, X, bs] = bdiag(A, rmax)
28 </synopsis>
29 </refsynopsisdiv>
30 <refsection>
31 <title>Аргументы</title>
32 <variablelist>
33 <varlistentry>
34 <term>A</term>
35 <listitem>
36 <para>вещественная или комплексная квадратная матрица</para>
37 </listitem>
38 </varlistentry>
39 <varlistentry>
40 <term>rmax</term>
41 <listitem>
42 <para>вещественное число</para>
43 </listitem>
44 </varlistentry>
45 <varlistentry>
46 <term>Ab</term>
47 <listitem>
48 <para>вещественная или комплексная квадратная матрица</para>
49 </listitem>
50 </varlistentry>
51 <varlistentry>
52 <term>X</term>
53 <listitem>
54 <para>вещественная или комплексная невырожденная матрица</para>
55 </listitem>
56 </varlistentry>
57 <varlistentry>
58 <term>bs</term>
59 <listitem>
60 <para>вектор целых чисел</para>
61 </listitem>
62 </varlistentry>
63 </variablelist>
64 </refsection>
65 <refsection>
66 <title>Описание</title>
67 <para>
68 <emphasis role="bold">[Ab, X, bs] = bdiag(A, rmax)</emphasis> выполняет
69 блоковую диагонализацию матрицы <varname>A</varname>. <varname>bs</varname>
70 даёт структуру блоков (соответствующие размеры блоков).
71 <varname>X</varname> - это изменение базиса, то есть <literal>Ab = inv(X)*A*X</literal>
72 является блоковой диагональю.
73 </para>
74 <para>
75 <varname>rmax</varname> управляет обусловленностью <varname>X</varname>.
76 Значение по умолчанию - это L1-норма матрицы <varname>A</varname>.
77 </para>
78 <para>
79 Чтобы получить диагональную форму (если она существует), выберите большое
80 значение для<varname>rmax</varname> (например <literal>rmax=1/%eps</literal>).
81 В общем случае (для вещественной случайной <varname>A</varname>), блоки
82 равны (1x1) и (2x2), а <varname>X</varname> является матрицей собственных векторов.
83 </para>
84 </refsection>
85 <refsection>
86 <title>Примеры</title>
87 <programlisting role="example"><![CDATA[
88// случай вещественных чисел: блоки 1x1 и 2x2
89a = rand(5,5);
90[ab, x, bs] = bdiag(a);ab
91 ]]></programlisting>
92 <screen><![CDATA[
93--> [ab, x, bs] = bdiag(a);ab
94 ab =
95 2.4777836 0. 0. 0. 0.
96 0. 0.0757087 0.4869251 0. 0.
97 0. -0.5777956 -0.1248605 0. 0.
98 0. 0. 0. 0.069654 0.
99 0. 0. 0. 0. 0.5341598
100]]></screen>
101 <programlisting role="example"><![CDATA[
102// случай комплексных чисел: комплексные блоки 1x1
103[ab, x, bs] = bdiag(a+%i*0); ab
104 ]]></programlisting>
105 </refsection>
106 <refsection role="see also">
107 <title>Смотрите также</title>
108 <simplelist type="inline">
109 <member>
110 <link linkend="schur">schur</link>
111 </member>
112 <member>
113 <link linkend="sylv">sylv</link>
114 </member>
115 <member>
116 <link linkend="spec">spec</link>
117 </member>
118 <member>
119 <link linkend="blockdiag">blockdiag</link>
120 </member>
121 <member>
122 <link linkend="lcmdiag">lcmdiag</link>
123 </member>
124 </simplelist>
125 </refsection>
126</refentry>
diff --git a/scilab/modules/linear_algebra/help/ru_RU/matrix/det.xml b/scilab/modules/linear_algebra/help/ru_RU/matrix/det.xml
new file mode 100644
index 0000000..fd6fc26
--- /dev/null
+++ b/scilab/modules/linear_algebra/help/ru_RU/matrix/det.xml
@@ -0,0 +1,264 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2008 - INRIA
5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
6 * Copyright (C) 2021 - Samuel GOUGEON - Le Mans Université
7 *
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
14 *
15 -->
16<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
18 xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
19 xml:lang="ru" xml:id="det">
20 <refnamediv>
21 <refname>det</refname>
22 <refpurpose>определитель квадратной матрицы</refpurpose>
23 </refnamediv>
24 <refsynopsisdiv>
25 <title>Синтаксис</title>
26 <synopsis>
27 d = det(X)
28 [e,m] = det(X)
29 </synopsis>
30 </refsynopsisdiv>
31 <refsection>
32 <title>Аргументы</title>
33 <variablelist>
34 <varlistentry>
35 <term>X</term>
36 <listitem>
37 квадратная матрица вещественных или комплексных чисел, полиномов или
38 дробно-рациональных выражений. Принимаются разрежённо-кодированные
39 матрицы.
40 <para/>
41 </listitem>
42 </varlistentry>
43 <varlistentry>
44 <term>d</term>
45 <listitem>
46 Скаляр типа <varname>X</varname>: определитель <varname>X</varname>.
47 Если <varname>X</varname> является разрежённо-кодированной, то
48 <varname>d</varname> является плотной.
49 <para/>
50 </listitem>
51 </varlistentry>
52 <varlistentry>
53 <term>m</term>
54 <listitem>
55 вещественное или комплексное число: определитель мантиссы по основанию 10
56 <literal>abs(m) ∈ [1,10)</literal>. Не поддерживается для полиномиального
57 или дробно-рационального <varname>X</varname>.
58 <para/>
59 </listitem>
60 </varlistentry>
61 <varlistentry>
62 <term>e</term>
63 <listitem>
64 целое: определитель экспоненты по основанию 10, такой, что
65 <literal>d = m * 10<superscript>e</superscript></literal>.
66 Не поддерживается для полиномиального или дробно-рационального
67 <varname>X</varname>.
68 <para/>
69 </listitem>
70 </varlistentry>
71 </variablelist>
72 </refsection>
73 <refsection>
74 <title>Описание</title>
75 <para>
76 <emphasis role="bold">d = det(X)</emphasis> выдаёт определитель матрицы
77 <varname>X</varname>.
78 </para>
79 <para>
80 Для полиномиальной или дробно-рациональной матрицы <literal>d=det(X)</literal>
81 использует <literal>determ(..)</literal>, чей алгоритм основан на БПФ.
82 Альтернативно может использоваться <literal>d=detr(X)</literal>, основанный
83 на алгоритме Леверье. Оба метода выдают одинаковые результаты. Для
84 дробно-рациональных матриц может потребоваться отключение <code>simp_mode(%f)</code>
85 для получения идентичных результатов.
86 </para>
87 <para>
88 <emphasis role="bold">[e, m] = det(X)</emphasis> может использоваться только
89 для матрицы чисел. Этот синтаксис позволяет преодолеть переполнение снизу
90 или сверху, когда <literal>abs(d)</literal> меньше, чем
91 <literal>number_properties("tiny")</literal> ≈ 2,23 10<superscript>-308</superscript>
92 либо больше, чем
93 <literal>number_properties("huge")</literal> ≈ 1,80 10<superscript>308</superscript>.
94 </para>
95 <para>
96 Для плотных матриц <literal>det(..)</literal> основан на процедуре из Lapack
97 DGETRF для вещественных матриц и ZGETRF для комплексных.
98 </para>
99 <para>
100 Для разрежённых матриц определитель получается из LU-разложения, благодаря
101 библиотеке umfpack.
102 </para>
103 </refsection>
104 <refsection>
105 <title>Примеры</title>
106 <programlisting role="example"><![CDATA[
107A = rand(3,3)*5;
108det(A)
109[e, m] = det(A)
110
111// Матрица комплексных чисел:
112// A = grand(3,3,"uin",0,10) + grand(3,3,"uin",0,10)*%i
113A = [3+%i, 9+%i*3, 9+%i ; 8+%i*8, 4+%i*3, 7+%i*7 ; 4, 6+%i*2, 6+%i*9]
114det(A)
115[e, m] = det(A)
116abs(m) // in [1, 10)
117 ]]></programlisting>
118 <screen><![CDATA[
119--> A = rand(3,3)*5;
120--> det(A)
121 ans =
122 -10.805163
123
124--> [e, m] = det(A)
125 e =
126 1.
127 m =
128 -1.0805163
129
130--> // Matrix of complex numbers:
131--> A = [3+%i, 9+%i*3, 9+%i ; 8+%i*8, 4+%i*3, 7+%i*7 ; 4, 6+%i*2, 6+%i*9]
132 A =
133 3. + i 9. + 3.i 9. + i
134 8. + 8.i 4. + 3.i 7. + 7.i
135 4. + 0.i 6. + 2.i 6. + 9.i
136
137--> det(A)
138 ans =
139 745. - 225.i
140
141--> [e, m] = det(A)
142 e =
143 2.
144 m =
145 7.45 - 2.25i
146
147--> abs(m) // in [1, 10)
148 ans =
149 7.7823518
150]]></screen>
151 <para/>
152 <para>
153 Очень большой или маленький определители: обработка переполнения снизу и сверху:
154 </para>
155 <programlisting role="example"><![CDATA[
156// Очень большой определитель:
157n = 1000;
158A = rand(n, n);
159det(A)
160[e, m] = det(A)
161
162// Очень маленький определитель (разрежённой кодированной матрицы):
163A = (triu(sprand(n,n,1)) + diag(rand(1,n)))/1.5;
164det(A)
165prod(diag(A))
166[e, m] = det(A)
167A = A/2;
168det(A)
169[e, m] = det(A)
170 ]]></programlisting>
171 <screen><![CDATA[
172--> // Very big determinant:
173--> A = rand(n, n);
174--> det(A)
175 ans =
176 -Inf
177
178--> [e, m] = det(A) // -3.1199e743
179 e =
180 743.
181 m =
182 -3.1198687
183
184--> // Very small determinant (of a sparse-encoded matrix):
185--> n = 1000;
186--> A = (triu(sprand(n,n,1)) + diag(rand(1,n)))/1.5;
187--> det(A)
188 ans =
189 5.21D-236
190
191--> prod(diag(A))
192 ans =
193 5.21D-236
194
195--> [e, m] = det(A)
196 e =
197 -236.
198 m =
199 5.2119757
200
201--> A = A/2;
202--> det(A)
203 ans =
204 0.
205
206--> [e, m] = det(A)
207 e =
208 -537.
209 m =
210 4.8641473
211]]></screen>
212 <para/>
213 <para>
214 Определитель полиномиальной матрицы:
215 </para>
216 <programlisting role="example"><![CDATA[
217s = %s;
218det([s, 1+s ; 2-s, s^2])
219
220w = ssrand(2,2,4);
221roots(det(systmat(w))),trzeros(w) //нули линейной системы
222 ]]></programlisting>
223 <screen><![CDATA[
224--> det([s, 1+s ; 2-s, s^2])
225 ans =
226 -2 -s +s² +s³
227
228--> w = ssrand(2,2,4);
229--> roots(det(systmat(w))),trzeros(w)
230 ans =
231 -3.1907522 + 0.i
232 2.3596502 + 0.i
233
234 ans =
235 2.3596502 + 0.i
236 -3.1907522 + 0.i
237]]></screen>
238 </refsection>
239 <refsection role="see also">
240 <title>Смотрите также</title>
241 <simplelist type="inline">
242 <member>
243 <link linkend="detr">detr</link>
244 </member>
245 <member>
246 <link linkend="determ">determ</link>
247 </member>
248 <member>
249 <link linkend="simp_mode">simp_mode</link>
250 </member>
251 </simplelist>
252 </refsection>
253 <refsection role="history">
254 <title>История</title>
255 <revhistory>
256 <revision>
257 <revnumber>6.1.1</revnumber>
258 <revdescription>
259 Синтаксис [e,m]=det(X) расширен до разрежённых матриц.
260 </revdescription>
261 </revision>
262 </revhistory>
263 </refsection>
264</refentry>
diff --git a/scilab/modules/linear_algebra/macros/eigs.sci b/scilab/modules/linear_algebra/macros/eigs.sci
new file mode 100644
index 0000000..1120633
--- /dev/null
+++ b/scilab/modules/linear_algebra/macros/eigs.sci
@@ -0,0 +1,1135 @@
1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) 2012 - Scilab Enterprises - Adeline CARNIS
3//
4// Copyright (C) 2012 - 2016 - Scilab Enterprises
5//
6// This file is hereby licensed under the terms of the GNU GPL v2.0,
7// pursuant to article 5.3.4 of the CeCILL v.2.1.
8// This file was originally licensed under the terms of the CeCILL v2.1,
9// and continues to be available under such terms.
10// For more information, see the COPYING file which you should have received
11// along with this program.
12
13function [d, v] = eigs(varargin)
14 lhs = argn(1);
15 rhs = argn(2);
16 if(rhs == 0 | rhs > 6)
17 error(msprintf(gettext("%s : Wrong number of input arguments : %d to %d expected.\n"), "eigs", 1, 6));
18 end
19
20 if(rhs >= 1)
21 if((typeof(varargin(1)) <> "constant") & typeof(varargin(1)) <> "function" & (typeof(varargin(1)) <> "sparse") | varargin(1) == [])
22 error(msprintf(gettext("%s: Wrong type for input argument #%d: A full or sparse square matrix or a function expected"), "eigs", 1));
23 end
24 end
25
26 if(rhs >= 1 & typeof(varargin(1)) <> "function")
27 if(isreal(varargin(1)))
28 resid = rand(size(varargin(1), "r"), 1);
29 else
30 resid = complex(rand(size(varargin(1), "r"), 1), rand(size(varargin(1), "r"), 1));
31 end
32 A = varargin(1);
33 end
34
35 if(rhs > 1 & typeof(varargin(1)) == "function")
36 if(size(varargin(2)) <> 1)
37 error(msprintf(gettext("%s: Wrong type for input argument #%d: A positive integer expected if the first input argument is a function."), "eigs",2));
38 end
39 a_real = 1;
40 a_sym = 0;
41 resid = rand(varargin(2),1);
42 info = 0;
43 Af = varargin(1);
44 Asize = varargin(2);
45 end
46
47 maxiter = 300;
48 tol = %eps;
49 ncv = [];
50 cholB = 0;
51 info = 0;
52 B = [];
53 sigma = "LM";
54 if(rhs == 1)
55 if ~issparse(varargin(1))
56 info = int32(0);
57 end
58 else
59 if ~issparse(varargin(1)) & ~issparse(varargin(2))
60 info = int32(0);
61 end
62 end
63
64 if (typeof(varargin(1)) <> "function")
65 if isequal(A, A') // A is real symmetric
66 nev = min(size(A, "r") - 1, 6);
67 else
68 nev = min(size(A, "r") - 2, 6);
69 end
70
71 select rhs
72 case 1
73 case 2
74 B = varargin(2);
75 case 3
76 B = varargin(2);
77 nev = varargin(3);
78 case 4
79 B = varargin(2);
80 nev = varargin(3);
81 sigma = varargin(4);
82 case 5
83 B = varargin(2);
84 nev = varargin(3);
85 sigma = varargin(4);
86 opts = varargin(5);
87 if(~isstruct(opts))
88 error(msprintf(gettext("%s: Wrong type for input argument #%d: A structure expected"), "eigs", 5));
89 end
90 if(size(intersect(fieldnames(opts), ["tol", "maxiter", "ncv", "resid", "cholB"]), "*") < size(fieldnames(opts),"*"))
91 error(msprintf(gettext("%s: Wrong type for input argument: If A is a matrix, use opts with tol, maxiter, ncv, resid, cholB"), "eigs"));
92 end
93 if(isfield(opts, "tol"))
94 tol = opts.tol;
95 end
96 if(isfield(opts, "maxiter"))
97 maxiter = opts.maxiter;
98 end
99 if(isfield(opts, "ncv"))
100 ncv = opts.ncv;
101 end
102 if(isfield(opts, "resid"))
103 resid = opts.resid;
104 if issparse(varargin(1)) | issparse(varargin(2))
105 info = 1;
106 else
107 info = int32(1);
108 end
109 if(and(resid==0))
110 if issparse(varargin(1)) | issparse(varargin(2))
111 info = 0;
112 else
113 info = int32(0);
114 end
115 end
116 end
117 if(isfield(opts,"cholB"))
118 cholB = opts.cholB;
119 end
120 end
121
122 select lhs
123 case 1
124 if issparse(A) | issparse(B)
125 d = speigs(A, B, nev, sigma, maxiter, tol, ncv, cholB, resid, info);
126 else
127 d = %_eigs(A, B, nev, sigma, maxiter, tol, ncv, cholB, resid, info);
128 end
129 case 2
130 if issparse(A) | issparse(B)
131 [d, v] = speigs(A, B, nev, sigma, maxiter, tol, ncv, cholB, resid, info);
132 else
133 [d, v] = %_eigs(A, B, nev, sigma, maxiter, tol, ncv, cholB, resid, info);
134 end
135 end
136 else
137 select rhs
138 case 2
139 nev = min(Asize, 6)
140
141 case 3
142 nev = min(Asize, 6);
143 B = varargin(3);
144
145 case 4
146 B = varargin(3);
147 nev = varargin(4);
148
149 case 5
150 B = varargin(3);
151 nev = varargin(4);
152 sigma = varargin(5);
153
154 case 6
155 B = varargin(3);
156 nev = varargin(4);
157 sigma = varargin(5);
158 opts = varargin(6);
159 if(~isstruct(opts)) then
160 error(msprintf(gettext("%s: Wrong type for input argument #%d: A structure expected"), "eigs",5));
161 end
162 if(size(intersect(fieldnames(opts), ["tol", "maxiter", "ncv", "resid", "cholB", "issym", "isreal"]), "*") < size(fieldnames(opts),"*"))
163 error(msprintf(gettext("%s: Wrong type for input argument: If A is a function, use opts with tol, maxiter, ncv, resid, cholB, issym", "isreal"), "eigs"));
164 end
165 if(isfield(opts,"tol"))
166 tol = opts.tol;
167 end
168 if(isfield(opts,"maxiter"))
169 maxiter = opts.maxiter;
170 end
171 if(isfield(opts, "ncv"))
172 ncv = opts.ncv;
173 end
174 if(isfield(opts,"resid"))
175 resid = opts.resid;
176 info = 1;
177 if(and(resid==0))
178 info = 0;
179 end
180 end
181 if(isfield(opts,"cholB"))
182 cholB = opts.cholB;
183 end
184 if(isfield(opts,"issym"))
185 a_sym = opts.issym;
186 end
187 if(isfield(opts,"isreal"))
188 a_real = opts.isreal;
189 if(~a_real & ~isfield(opts,"resid"))
190 resid = complex(rand(Asize, 1), rand(Asize, 1));
191 end
192 end
193 end
194 select lhs
195 case 1
196 d = feigs(Af, Asize, B, nev, sigma, maxiter, tol, ncv, cholB, resid, info, a_real, a_sym);
197 case 2
198 [d, v] = feigs(Af, Asize, B, nev, sigma, maxiter, tol, ncv, cholB, resid, info, a_real, a_sym);
199 end
200 end
201endfunction
202
203function [res_d, res_v] = speigs(A, %_B, nev, which, maxiter, tol, ncv, cholB, resid, info)
204 lhs = argn(1);
205 rvec = 0;
206 if(lhs > 1)
207 rvec = 1;
208 end
209
210 //**************************
211 //First variable A :
212 //**************************
213 [mA, nA] = size(A);
214
215 //check if A is a square matrix
216 if(mA * nA < 2 | mA <> nA)
217 error(msprintf(gettext("%s: Wrong type for input argument #%d: A square matrix expected.\n"), "eigs", 1));
218 end
219
220 //check if A is complex
221 Areal = isreal(A);
222
223 //check if A is symetric
224 Asym = norm(A-A') == 0;
225
226 //*************************
227 //Second variable B :
228 //*************************
229 if((typeof(%_B) <> "constant") & (typeof(%_B) <> "sparse"))
230 error(msprintf(gettext("%s: Wrong type for input argument #%d: An empty matrix or full or sparse square matrix expected.\n"), "eigs", 2));
231 end
232 [mB, nB] = size(%_B);
233
234 //Check if B is a square matrix
235 if(mB * nB <> 0 & (mB <> mA | nB <> nA))
236 error(msprintf(gettext("%s: Wrong dimension for input argument #%d: B must have the same size as A.\n"), "eigs", 2));
237 end
238
239 //check if B is complex
240 Breal = isreal(%_B);
241 matB = mB * nB;
242
243 //*************************
244 //NEV :
245 //*************************
246 //verification du type de nev
247 //check if nev is complex?
248 if(typeof(nev) <> "constant") | (~isreal(nev)) | (size(nev,"*") <> 1)
249 error(msprintf(gettext("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 3));
250 end
251
252 if(nev <> floor(nev) | (nev<=0))
253 error(msprintf(gettext("%s: Wrong type for input argument #%d: k must be a positive integer.\n"), "eigs", 3));
254 end
255
256 if(Asym & Areal & Breal)
257 if(nev >= nA)
258 error(msprintf(gettext("%s: Wrong value for input argument #%d: For real symmetric problems, k must be an integer in the range 1 to N - 1.\n"), "eigs", 3));
259 end
260 else
261 if(nev >= nA - 1)
262 error(msprintf(gettext("%s: Wrong value for input argument #%d: For real non symmetric or complex problems, k must be an integer in the range 1 to N - 2.\n"), "eigs", 3));
263 end
264 end
265
266 //*************************
267 //SIGMA AND WHICH :
268 //*************************
269 //Check type
270 select type(which)
271 case 1 then
272 if(typeof(which) <> "constant" | which == [] | isnan(which))
273 error(msprintf(gettext("%s: Wrong type for input argument #%d: A scalar expected.\n"), "eigs", 4));
274 end
275 sigma = which;
276 which = "LM";
277
278 case 10 then
279 [mWHICH, nWHICH] = size(which);
280 if(mWHICH * nWHICH <> 1)
281 error(msprintf(gettext("%s: Wrong type for input argument #%d: string expected.\n"), "eigs", 4));
282 end
283 if(strcmp(which,"LM") ~= 0 & strcmp(which,"SM") ~= 0 & strcmp(which,"LR") ~= 0 & strcmp(which,"SR") ~= 0 & strcmp(which,"LI") ~= 0 & strcmp(which,"SI") ~= 0 & strcmp(which,"LA") ~= 0 & strcmp(which,"SA") ~= 0 & strcmp(which,"BE") ~= 0)
284 if(Areal & Breal & Asym)
285 error(msprintf(gettext("%s: Wrong value for input argument #%d: Unrecognized sigma value.\n Sigma must be one of ''%s'', ''%s'', ''%s'', ''%s'' or ''%s''.\n"), "eigs", 4, "LM", "SM", "LA", "SA", "BE"));
286 else
287 error(msprintf(gettext("%s: Wrong value for input argument #%d: Unrecognized sigma value.\n Sigma must be one of ''%s'', ''%s'', ''%s'', ''%s'', ''%s'' or ''%s''.\n"), "eigs", 4, "LM", "SM", "LR", "SR", "LI", "SI"));
288 end
289 end
290 if((~Areal | ~Breal | ~Asym) & (strcmp(which,"LA") == 0 | strcmp(which,"SA") == 0 | strcmp(which,"BE") == 0))
291 error(msprintf(gettext("%s: Invalid sigma value for complex or non symmetric problem.\n"), "eigs"));
292 end
293 if(Areal & Breal & Asym & (strcmp(which,"LR") == 0 | strcmp(which,"SR") == 0 | strcmp(which,"LI") == 0 | strcmp(which,"SI") == 0))
294 error(msprintf(gettext("%s: Invalid sigma value for real symmetric problem.\n"), "eigs"));
295 end
296 sigma = 0;
297
298 else
299 error(msprintf(gettext("%s: Wrong type for input argument #%d: a real scalar or a string expected.\n"), "eigs", 4));
300 end
301
302 if(~Areal | ~Breal)
303 sigma = complex(sigma);
304 end
305
306 //*************************
307 //MAXITER :
308 //*************************
309 if(typeof(maxiter) <> "constant" | ~isreal(maxiter) | size(maxiter, "*") <> 1)
310 error(msprintf(gettext("%s: Wrong type for input argument #%d: %s must be a scalar.\n"), "eigs", 5, "opts.maxiter"));
311 end
312
313 if((maxiter <> floor(maxiter)) | (maxiter <= 0) )
314 error(msprintf(gettext("%s: Wrong type for input argument #%d: %s must be an integer positive value.\n"), "eigs", 5, "opts.maxiter"));
315 end
316
317 //*************************
318 //TOL :
319 //*************************
320 if(typeof(tol) <> "constant" | ~isreal(tol) | isnan(tol))
321 error(msprintf(gettext("%s: Wrong type for input argument #%d: %s must be a real scalar.\n"), "eigs", 6, "opts.tol"));
322 end
323
324 if(size(tol, "*") <> 1)
325 error(msprintf(gettext("%s: Wrong dimension for input argument #%d: %s must be 1 by 1 size.\n"), "eigs", 6, "opts.tol"));
326 end
327
328 //*************************
329 //NCV :
330 //*************************
331 if(typeof(ncv) <> "constant" | ~isreal(ncv))
332 error(msprintf(gettext("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv"));
333 end
334
335 if(size(ncv, "*") > 1 | ncv <> floor(ncv) | (ncv <> [] & ncv <= 0))
336 error(msprintf(gettext("%s: Wrong type for input argument #%d: %s must be an integer scalar.\n"), "eigs", 7, "opts.ncv"));
337 end
338
339 if(isempty(ncv))
340 if(~Asym & Areal & Breal)
341 ncv = min(max(2*nev+1, 20), nA);
342 else
343 ncv = min(max(2*nev, 20), nA);
344 end
345 else
346 if(ncv <= nev | ncv > nA)
347 if(Asym & Areal & Breal)
348 error(msprintf(gettext("%s: Wrong value for input argument #%d: For real symmetric problems, NCV must be k < NCV <= N.\n"), "eigs", 7));
349 elseif(~Asym & Areal & Breal)
350 error(msprintf(gettext("%s: Wrong value for input argument #%d: For real non symmetric problems, NCV must be k + 2 < NCV < N.\n"), "eigs", 7));
351 else
352 error(msprintf(gettext("%s: Wrong value for input argument #%d: For complex problems, NCV must be k + 1 < NCV <= N.\n"), "eigs", 7));
353 end
354 end
355 end
356
357 //*************************
358 //CHOL :
359 //*************************
360 select typeof(cholB)
361 case "boolean"
362 if and(opts.cholB <> [%f %t]) then
363 error(msprintf(gettext("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB","%f", "%t"));
364 end
365 case "constant"
366 //check if chol is complex?
367 if(~isreal(cholB) | size(cholB, "*") <> 1)
368 error(msprintf(gettext("%s: Wrong type for input argument #%d: %s must be an integer scalar or a boolean.\n"), "eigs", 8, "opts.cholB"));
369 end
370
371 if(and(cholB <> [0 1]))
372 error(msprintf(gettext("%s: Wrong value for input argument #%d: %s must be %s or %s.\n"), "eigs", 8, "opts.cholB","%f", "%t"));
373 end
374 else
375 error(msprintf(gettext("%s: Wrong type for input argument #%d: %s must be an integer scalar or a boolean.\n"), "eigs", 8, "opts.cholB"));
376 end
377
378 //*************************
379 //RESID :
380 //*************************
381 if(typeof(resid) <> "constant")
382 error(msprintf(gettext("%s: Wrong type for input argument #%d: A real or complex matrix expected.\n"), "eigs", 9));
383 end
384
385 if(size(resid, "*") ~= nA)
386 error(msprintf(gettext("%s: Wrong dimension for input argument #%d: Start vector %s must be N by 1.\n"), "eigs", 9, "opts.resid"));
387 end
388
389 if(Areal & Breal)
390 //resid complexe ?
391 if(~isreal(resid))
392 error(msprintf(gettext("%s: Wrong type for input argument #%d: Start vector %s must be real for real problems.\n"), "eigs", 9, "opts.resid"));
393 end
394 else
395 if(isreal(resid))
396 error(msprintf(gettext("%s: Wrong type for input argument #%d: Start vector %s must be complex for complex problems.\n"), "eigs", 9, "opts.resid"));
397 end
398 end
399
400 iparam = zeros(11,1);
401 iparam(1) = 1;
402 iparam(3) = maxiter;
403 iparam(7) = 1;
404
405 ipntr = zeros(14,1);
406
407 //MODE 1, 2, 3, 4, 5
408 if(~strcmp(which,"SM") | sigma <> 0)
409 iparam(7) = 3;
410 which = "LM";
411 end
412
413 //bmat initialization
414 if(matB == 0 | iparam(7) == 1)
415 bmat = "I";
416 else
417 bmat = "G";
418 end
419
420 if(cholB)
421 if(or(triu(%_B) <> %_B))
422 error(msprintf(gettext("%s: Wrong type for input argument #%d: if opts.cholB is true, B must be upper triangular.\n"), "eigs", 2));
423 end
424 if issparse(%_B) //sparse cholesky decomposition is reversed...
425 Rprime = %_B;
426 R = Rprime';
427 else
428 R = %_B;
429 Rprime = R';
430 end
431 end
432
433 if(~cholB & matB & iparam(7) == 1)
434 if issparse(%_B) & ~Breal
435 error(msprintf(gettext("%s: Impossible to use the Cholesky factorization with complex sparse matrices.\n"), "eigs"));
436 else
437 if issparse(%_B)
438 [R, P] = spchol(%_B);
439 perm = spget(P);
440 perm = perm(:,2);
441 iperm = spget(P');
442 iperm = iperm(:,2);
443 else
444 R = chol(%_B);
445 Rprime = R';
446 end
447 end
448 end
449 if matB & issparse(%_B) & iparam(7) ==1
450 Rfact = umf_lufact(R);
451 Rprimefact = umf_lufact(R');
452 end
453
454 //Main
455 howmny = "A";
456 ido = 0;
457 info_eupd = 0;
458 _select = zeros(ncv,1);
459 if(iparam(7) == 3)
460 if(matB == 0)
461 AMSB = A - sigma * speye(nA, nA);
462 else
463 if(cholB)
464 AMSB = A - (sigma * Rprime * R);
465 else
466 AMSB = A - sigma * %_B;
467 end
468 end
469 Lup = umf_lufact(AMSB);
470 end
471
472 if(Areal)
473 if(Asym)
474 lworkl = ncv * ncv + 8 * ncv;
475 v = zeros(nA, ncv);
476 workl = zeros(lworkl, 1);
477 workd = zeros(3 * nA, 1);
478 d = zeros(nev, 1);
479 z = zeros(nA, nev);