GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
matrix_type.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2005-2018 David Bateman
4 
5 This file is part of Octave.
6 
7 Octave is free software: you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if defined (HAVE_CONFIG_H)
24 # include "config.h"
25 #endif
26 
27 #include <algorithm>
28 
29 #include "ov.h"
30 #include "defun.h"
31 #include "error.h"
32 #include "ov-re-mat.h"
33 #include "ov-cx-mat.h"
34 #include "ov-re-sparse.h"
35 #include "ov-cx-sparse.h"
36 #include "MatrixType.h"
37 #include "oct-locbuf.h"
38 
39 DEFUN (matrix_type, args, ,
40  doc: /* -*- texinfo -*-
41 @deftypefn {} {@var{type} =} matrix_type (@var{A})
42 @deftypefnx {} {@var{type} =} matrix_type (@var{A}, "nocompute")
43 @deftypefnx {} {@var{A} =} matrix_type (@var{A}, @var{type})
44 @deftypefnx {} {@var{A} =} matrix_type (@var{A}, "upper", @var{perm})
45 @deftypefnx {} {@var{A} =} matrix_type (@var{A}, "lower", @var{perm})
46 @deftypefnx {} {@var{A} =} matrix_type (@var{A}, "banded", @var{nl}, @var{nu})
47 Identify the matrix type or mark a matrix as a particular type.
48 
49 This allows more rapid solutions of linear equations involving @var{A} to be
50 performed.
51 
52 Called with a single argument, @code{matrix_type} returns the type of the
53 matrix and caches it for future use.
54 
55 Called with more than one argument, @code{matrix_type} allows the type of
56 the matrix to be defined.
57 
58 If the option @qcode{"nocompute"} is given, the function will not attempt
59 to guess the type if it is still unknown. This is useful for debugging
60 purposes.
61 
62 The possible matrix types depend on whether the matrix is full or sparse,
63 and can be one of the following
64 
65 @table @asis
66 @item @qcode{"unknown"}
67 Remove any previously cached matrix type, and mark type as unknown.
68 
69 @item @qcode{"full"}
70 Mark the matrix as full.
71 
72 @item @qcode{"positive definite"}
73 Probable full positive definite matrix.
74 
75 @item @qcode{"diagonal"}
76 Diagonal matrix. (Sparse matrices only)
77 
78 @item @qcode{"permuted diagonal"}
79 Permuted Diagonal matrix. The permutation does not need to be specifically
80 indicated, as the structure of the matrix explicitly gives this. (Sparse
81 matrices only)
82 
83 @item @qcode{"upper"}
84 Upper triangular. If the optional third argument @var{perm} is given, the
85 matrix is assumed to be a permuted upper triangular with the permutations
86 defined by the vector @var{perm}.
87 
88 @item @qcode{"lower"}
89 Lower triangular. If the optional third argument @var{perm} is given, the
90 matrix is assumed to be a permuted lower triangular with the permutations
91 defined by the vector @var{perm}.
92 
93 @item @qcode{"banded"}
94 @itemx @qcode{"banded positive definite"}
95 Banded matrix with the band size of @var{nl} below the diagonal and @var{nu}
96 above it. If @var{nl} and @var{nu} are 1, then the matrix is tridiagonal
97 and treated with specialized code. In addition the matrix can be marked as
98 probably a positive definite. (Sparse matrices only)
99 
100 @item @qcode{"singular"}
101 The matrix is assumed to be singular and will be treated with a minimum norm
102 solution.
103 
104 @end table
105 
106 Note that the matrix type will be discovered automatically on the first
107 attempt to solve a linear equation involving @var{A}. Therefore
108 @code{matrix_type} is only useful to give Octave hints of the matrix type.
109 Incorrectly defining the matrix type will result in incorrect results from
110 solutions of linear equations; it is entirely @strong{the responsibility of
111 the user} to correctly identify the matrix type.
112 
113 Also, the test for positive definiteness is a low-cost test for a Hermitian
114 matrix with a real positive diagonal. This does not guarantee that the
115 matrix is positive definite, but only that it is a probable candidate. When
116 such a matrix is factorized, a Cholesky@tie{}factorization is first
117 attempted, and if that fails the matrix is then treated with an
118 LU@tie{}factorization. Once the matrix has been factorized,
119 @code{matrix_type} will return the correct classification of the matrix.
120 @end deftypefn */)
121 {
122  int nargin = args.length ();
123 
124  if (nargin == 0 || nargin > 4)
125  print_usage ();
126 
127  bool autocomp = true;
128  if (nargin == 2 && args(1).is_string ()
129  && args(1).string_value () == "nocompute")
130  {
131  nargin = 1;
132  autocomp = false;
133  }
134 
136 
137  if (args(0).is_scalar_type ())
138  {
139  if (nargin == 1)
140  retval = octave_value ("Diagonal");
141  else
142  retval = args(0);
143  }
144  else if (args(0).issparse ())
145  {
146  if (nargin == 1)
147  {
148  MatrixType mattyp;
149 
150  if (args(0).iscomplex ())
151  {
152  mattyp = args(0).matrix_type ();
153 
154  if (mattyp.is_unknown () && autocomp)
155  {
157  args(0).sparse_complex_matrix_value ();
158 
159  mattyp = MatrixType (m);
160  args(0).matrix_type (mattyp);
161  }
162  }
163  else
164  {
165  mattyp = args(0).matrix_type ();
166 
167  if (mattyp.is_unknown () && autocomp)
168  {
169  SparseMatrix m = args(0).sparse_matrix_value ();
170 
171  mattyp = MatrixType (m);
172  args(0).matrix_type (mattyp);
173  }
174  }
175 
176  int typ = mattyp.type ();
177 
178  if (typ == MatrixType::Diagonal)
179  retval = octave_value ("Diagonal");
180  else if (typ == MatrixType::Permuted_Diagonal)
181  retval = octave_value ("Permuted Diagonal");
182  else if (typ == MatrixType::Upper)
183  retval = octave_value ("Upper");
184  else if (typ == MatrixType::Permuted_Upper)
185  retval = octave_value ("Permuted Upper");
186  else if (typ == MatrixType::Lower)
187  retval = octave_value ("Lower");
188  else if (typ == MatrixType::Permuted_Lower)
189  retval = octave_value ("Permuted Lower");
190  else if (typ == MatrixType::Banded)
191  retval = octave_value ("Banded");
192  else if (typ == MatrixType::Banded_Hermitian)
193  retval = octave_value ("Banded Positive Definite");
194  else if (typ == MatrixType::Tridiagonal)
195  retval = octave_value ("Tridiagonal");
196  else if (typ == MatrixType::Tridiagonal_Hermitian)
197  retval = octave_value ("Tridiagonal Positive Definite");
198  else if (typ == MatrixType::Hermitian)
199  retval = octave_value ("Positive Definite");
200  else if (typ == MatrixType::Rectangular)
201  {
202  if (args(0).rows () == args(0).columns ())
203  retval = octave_value ("Singular");
204  else
205  retval = octave_value ("Rectangular");
206  }
207  else if (typ == MatrixType::Full)
208  retval = octave_value ("Full");
209  else
210  retval = octave_value ("Unknown");
211  }
212  else
213  {
214  // Ok, we're changing the matrix type
215  std::string str_typ = args(1).xstring_value ("matrix_type: TYPE must be a string");
216 
217  // FIXME: why do I have to explicitly call the constructor?
218  MatrixType mattyp = MatrixType ();
219 
220  octave_idx_type nl = 0;
221  octave_idx_type nu = 0;
222 
223  // Use STL function to convert to lower case
224  std::transform (str_typ.begin (), str_typ.end (),
225  str_typ.begin (), tolower);
226 
227  if (str_typ == "diagonal")
228  mattyp.mark_as_diagonal ();
229  if (str_typ == "permuted diagonal")
230  mattyp.mark_as_permuted_diagonal ();
231  else if (str_typ == "upper")
232  mattyp.mark_as_upper_triangular ();
233  else if (str_typ == "lower")
234  mattyp.mark_as_lower_triangular ();
235  else if (str_typ == "banded"
236  || str_typ == "banded positive definite")
237  {
238  if (nargin != 4)
239  error ("matrix_type: banded matrix type requires 4 arguments");
240 
241  nl = args(2).xnint_value ("matrix_type: band size NL, NU must be integers");
242  nu = args(3).xnint_value ("matrix_type: band size NL, NU must be integers");
243 
244  if (nl == 1 && nu == 1)
245  mattyp.mark_as_tridiagonal ();
246  else
247  mattyp.mark_as_banded (nu, nl);
248 
249  if (str_typ == "banded positive definite")
250  mattyp.mark_as_symmetric ();
251  }
252  else if (str_typ == "positive definite")
253  {
254  mattyp.mark_as_full ();
255  mattyp.mark_as_symmetric ();
256  }
257  else if (str_typ == "singular")
258  mattyp.mark_as_rectangular ();
259  else if (str_typ == "full")
260  mattyp.mark_as_full ();
261  else if (str_typ == "unknown")
262  mattyp.invalidate_type ();
263  else
264  error ("matrix_type: Unknown matrix type %s", str_typ.c_str ());
265 
266  if (nargin == 3
267  && (str_typ == "upper" || str_typ == "lower"))
268  {
269  const ColumnVector perm = args(2).vector_value ("matrix_type: Invalid permutation vector PERM");
270 
271  octave_idx_type len = perm.numel ();
272  dim_vector dv = args(0).dims ();
273 
274  if (len != dv(0))
275  error ("matrix_type: Invalid permutation vector PERM");
276 
278 
279  for (octave_idx_type i = 0; i < len; i++)
280  p[i] = static_cast<octave_idx_type> (perm (i)) - 1;
281 
282  mattyp.mark_as_permuted (len, p);
283  }
284  else if (nargin != 2
285  && str_typ != "banded positive definite"
286  && str_typ != "banded")
287  error ("matrix_type: Invalid number of arguments");
288 
289  // Set the matrix type
290  if (args(0).iscomplex ())
292  mattyp);
293  else
295  mattyp);
296  }
297  }
298  else
299  {
300  if (nargin == 1)
301  {
302  MatrixType mattyp;
303 
304  if (args(0).iscomplex ())
305  {
306  mattyp = args(0).matrix_type ();
307 
308  if (mattyp.is_unknown () && autocomp)
309  {
310  if (args(0).is_single_type ())
311  {
313  m = args(0).float_complex_matrix_value ();
314 
315  mattyp = MatrixType (m);
316  args(0).matrix_type (mattyp);
317  }
318  else
319  {
320  ComplexMatrix m = args(0).complex_matrix_value ();
321 
322  mattyp = MatrixType (m);
323  args(0).matrix_type (mattyp);
324  }
325  }
326  }
327  else
328  {
329  mattyp = args(0).matrix_type ();
330 
331  if (mattyp.is_unknown () && autocomp)
332  {
333  if (args(0).is_single_type ())
334  {
335  FloatMatrix m = args(0).float_matrix_value ();
336 
337  mattyp = MatrixType (m);
338  args(0).matrix_type (mattyp);
339  }
340  else
341  {
342  Matrix m = args(0).matrix_value ();
343 
344  mattyp = MatrixType (m);
345  args(0).matrix_type (mattyp);
346  }
347  }
348  }
349 
350  int typ = mattyp.type ();
351 
352  if (typ == MatrixType::Upper)
353  retval = octave_value ("Upper");
354  else if (typ == MatrixType::Permuted_Upper)
355  retval = octave_value ("Permuted Upper");
356  else if (typ == MatrixType::Lower)
357  retval = octave_value ("Lower");
358  else if (typ == MatrixType::Permuted_Lower)
359  retval = octave_value ("Permuted Lower");
360  else if (typ == MatrixType::Hermitian)
361  retval = octave_value ("Positive Definite");
362  else if (typ == MatrixType::Rectangular)
363  {
364  if (args(0).rows () == args(0).columns ())
365  retval = octave_value ("Singular");
366  else
367  retval = octave_value ("Rectangular");
368  }
369  else if (typ == MatrixType::Full)
370  retval = octave_value ("Full");
371  else
372  retval = octave_value ("Unknown");
373  }
374  else
375  {
376  // Ok, we're changing the matrix type
377  std::string str_typ = args(1).xstring_value ("matrix_type: TYPE must be a string");
378 
379  // FIXME: why do I have to explicitly call the constructor?
380  MatrixType mattyp = MatrixType (MatrixType::Unknown, true);
381 
382  // Use STL function to convert to lower case
383  std::transform (str_typ.begin (), str_typ.end (),
384  str_typ.begin (), tolower);
385 
386  if (str_typ == "upper")
387  mattyp.mark_as_upper_triangular ();
388  else if (str_typ == "lower")
389  mattyp.mark_as_lower_triangular ();
390  else if (str_typ == "positive definite")
391  {
392  mattyp.mark_as_full ();
393  mattyp.mark_as_symmetric ();
394  }
395  else if (str_typ == "singular")
396  mattyp.mark_as_rectangular ();
397  else if (str_typ == "full")
398  mattyp.mark_as_full ();
399  else if (str_typ == "unknown")
400  mattyp.invalidate_type ();
401  else
402  error ("matrix_type: Unknown matrix type %s", str_typ.c_str ());
403 
404  if (nargin == 3 && (str_typ == "upper" || str_typ == "lower"))
405  {
406  const ColumnVector perm = args(2).vector_value ("matrix_type: Invalid permutation vector PERM");
407 
408  octave_idx_type len = perm.numel ();
409  dim_vector dv = args(0).dims ();
410 
411  if (len != dv(0))
412  error ("matrix_type: Invalid permutation vector PERM");
413 
415 
416  for (octave_idx_type i = 0; i < len; i++)
417  p[i] = static_cast<octave_idx_type> (perm (i)) - 1;
418 
419  mattyp.mark_as_permuted (len, p);
420  }
421  else if (nargin != 2)
422  error ("matrix_type: Invalid number of arguments");
423 
424  // Set the matrix type
425  if (args(0).is_single_type ())
426  {
427  if (args(0).iscomplex ())
429  mattyp);
430  else
431  retval = octave_value (args(0).float_matrix_value (),
432  mattyp);
433  }
434  else
435  {
436  if (args(0).iscomplex ())
438  mattyp);
439  else
440  retval = octave_value (args(0).matrix_value (), mattyp);
441  }
442  }
443  }
444 
445  return retval;
446 }
447 
448 /*
449 ## FIXME:
450 ## Disable tests for lower under-determined and upper over-determined
451 ## matrices as this detection is disabled in MatrixType due to issues
452 ## of non minimum norm solution being found.
453 
454 %!assert (matrix_type (speye (10,10)), "Diagonal")
455 %!assert (matrix_type (speye (10,10)([2:10,1],:)), "Permuted Diagonal")
456 %!assert (matrix_type ([[speye(10,10);sparse(1,10)],[1;sparse(9,1);1]]), "Upper")
457 %!assert (matrix_type ([[speye(10,10);sparse(1,10)],[1;sparse(9,1);1]](:,[2,1,3:11])), "Permuted Upper")
458 %!assert (matrix_type ([speye(10,10),sparse(10,1);1,sparse(1,9),1]), "Lower")
459 %!assert (matrix_type ([speye(10,10),sparse(10,1);1,sparse(1,9),1]([2,1,3:11],:)), "Permuted Lower")
460 
461 %!test
462 %! bnd = spparms ("bandden");
463 %! spparms ("bandden", 0.5);
464 %! a = spdiags (rand (10,3)-0.5,[-1,0,1],10,10);
465 %! assert (matrix_type (a), "Tridiagonal");
466 %! assert (matrix_type (a'+a+2*speye (10)), "Tridiagonal Positive Definite");
467 %! spparms ("bandden", bnd);
468 %!test
469 %! bnd=spparms ("bandden");
470 %! spparms ("bandden", 0.5);
471 %! a = spdiags (randn (10,4),[-2:1],10,10);
472 %! assert (matrix_type (a), "Banded");
473 %! assert (matrix_type (a'*a), "Banded Positive Definite");
474 %! spparms ("bandden", bnd);
475 %!test
476 %! a = [speye(10,10),[sparse(9,1);1];-1,sparse(1,9),1];
477 %! assert (matrix_type (a), "Full");
478 %! assert (matrix_type (a'*a), "Positive Definite");
479 
480 %!assert (matrix_type (speye (10,11)), "Diagonal")
481 %!assert (matrix_type (speye (10,11)([2:10,1],:)), "Permuted Diagonal")
482 %!assert (matrix_type (speye (11,10)), "Diagonal")
483 %!assert (matrix_type (speye (11,10)([2:11,1],:)), "Permuted Diagonal")
484 %#!assert (matrix_type ([[speye(10,10);sparse(1,10)],[[1,1];sparse(9,2);[1,1]]]), "Upper")
485 %#!assert (matrix_type ([[speye(10,10);sparse(1,10)],[[1,1];sparse(9,2);[1,1]]](:,[2,1,3:12])), "Permuted Upper")
486 %!assert (matrix_type ([speye(11,9),[1;sparse(8,1);1;0]]), "Upper")
487 %!assert (matrix_type ([speye(11,9),[1;sparse(8,1);1;0]](:,[2,1,3:10])), "Permuted Upper")
488 %#!assert (matrix_type ([speye(10,10),sparse(10,1);[1;1],sparse(2,9),[1;1]]), "Lower")
489 %#!assert (matrix_type ([speye(10,10),sparse(10,1);[1;1],sparse(2,9),[1;1]]([2,1,3:12],:)), "Permuted Lower")
490 %!assert (matrix_type ([speye(9,11);[1,sparse(1,8),1,0]]), "Lower")
491 %!assert (matrix_type ([speye(9,11);[1,sparse(1,8),1,0]]([2,1,3:10],:)), "Permuted Lower")
492 %!assert (matrix_type (spdiags (randn (10,4),[-2:1],10,9)), "Rectangular")
493 
494 %!assert (matrix_type (1i*speye (10,10)), "Diagonal")
495 %!assert (matrix_type (1i*speye (10,10)([2:10,1],:)), "Permuted Diagonal")
496 %!assert (matrix_type ([[speye(10,10);sparse(1,10)],[1i;sparse(9,1);1]]), "Upper")
497 %!assert (matrix_type ([[speye(10,10);sparse(1,10)],[1i;sparse(9,1);1]](:,[2,1,3:11])), "Permuted Upper")
498 %!assert (matrix_type ([speye(10,10),sparse(10,1);1i,sparse(1,9),1]), "Lower")
499 %!assert (matrix_type ([speye(10,10),sparse(10,1);1i,sparse(1,9),1]([2,1,3:11],:)), "Permuted Lower")
500 
501 %!test
502 %! bnd = spparms ("bandden");
503 %! spparms ("bandden", 0.5);
504 %! assert (matrix_type (spdiags (1i*randn (10,3),[-1,0,1],10,10)), "Tridiagonal");
505 %! a = 1i*(rand (9,1)-0.5);
506 %! a = [[a;0],ones(10,1),[0;-a]];
507 %! assert (matrix_type (spdiags (a,[-1,0,1],10,10)), "Tridiagonal Positive Definite");
508 %! spparms ("bandden", bnd);
509 %!test
510 %! bnd = spparms ("bandden");
511 %! spparms ("bandden", 0.5);
512 %! assert (matrix_type (spdiags (1i*randn (10,4),[-2:1],10,10)), "Banded");
513 %! a = 1i*(rand (9,2)-0.5);
514 %! a = [[a;[0,0]],ones(10,1),[[0;-a(:,2)],[0;0;-a(1:8,1)]]];
515 %! assert (matrix_type (spdiags (a,[-2:2],10,10)), "Banded Positive Definite");
516 %! spparms ("bandden", bnd);
517 %!test
518 %! a = [speye(10,10),[sparse(9,1);1i];-1,sparse(1,9),1];
519 %! assert (matrix_type (a), "Full");
520 %! assert (matrix_type (a'*a), "Positive Definite");
521 
522 %!assert (matrix_type (1i*speye (10,11)), "Diagonal")
523 %!assert (matrix_type (1i*speye (10,11)([2:10,1],:)), "Permuted Diagonal")
524 %!assert (matrix_type (1i*speye (11,10)), "Diagonal")
525 %!assert (matrix_type (1i*speye (11,10)([2:11,1],:)), "Permuted Diagonal")
526 %#!assert (matrix_type ([[speye(10,10);sparse(1,10)],[[1i,1i];sparse(9,2);[1i,1i]]]), "Upper")
527 %#!assert (matrix_type ([[speye(10,10);sparse(1,10)],[[1i,1i];sparse(9,2);[1i,1i]]](:,[2,1,3:12])), "Permuted Upper")
528 %!assert (matrix_type ([speye(11,9),[1i;sparse(8,1);1i;0]]), "Upper")
529 %!assert (matrix_type ([speye(11,9),[1i;sparse(8,1);1i;0]](:,[2,1,3:10])), "Permuted Upper")
530 %#!assert (matrix_type ([speye(10,10),sparse(10,1);[1i;1i],sparse(2,9),[1i;1i]]), "Lower")
531 %#!assert (matrix_type ([speye(10,10),sparse(10,1);[1i;1i],sparse(2,9),[1i;1i]]([2,1,3:12],:)), "Permuted Lower")
532 %!assert (matrix_type ([speye(9,11);[1i,sparse(1,8),1i,0]]), "Lower")
533 %!assert (matrix_type ([speye(9,11);[1i,sparse(1,8),1i,0]]([2,1,3:10],:)), "Permuted Lower")
534 %!assert (matrix_type (1i*spdiags(randn(10,4),[-2:1],10,9)), "Rectangular")
535 
536 %!test
537 %! a = matrix_type (spdiags (randn (10,3),[-1,0,1],10,10), "Singular");
538 %! assert (matrix_type (a), "Singular");
539 
540 %!assert (matrix_type (triu (ones(10,10))), "Upper")
541 %!assert (matrix_type (triu (ones(10,10),-1)), "Full")
542 %!assert (matrix_type (tril (ones(10,10))), "Lower")
543 %!assert (matrix_type (tril (ones(10,10),1)), "Full")
544 %!assert (matrix_type (10*eye (10,10) + ones (10,10)), "Positive Definite")
545 %!assert (matrix_type (ones (11,10)), "Rectangular")
546 %!test
547 %! a = matrix_type (ones (10,10), "Singular");
548 %! assert (matrix_type (a), "Singular");
549 
550 %!assert (matrix_type (triu (1i*ones (10,10))), "Upper")
551 %!assert (matrix_type (triu (1i*ones (10,10),-1)), "Full")
552 %!assert (matrix_type (tril (1i*ones (10,10))), "Lower")
553 %!assert (matrix_type (tril (1i*ones (10,10),1)), "Full")
554 %!assert (matrix_type (10*eye (10,10) + 1i*triu (ones (10,10),1) -1i*tril (ones (10,10),-1)), "Positive Definite")
555 %!assert (matrix_type (ones (11,10)), "Rectangular")
556 %!test
557 %! a = matrix_type (ones (10,10), "Singular");
558 %! assert (matrix_type (a), "Singular");
559 */
void mark_as_lower_triangular(void)
Definition: MatrixType.h:169
void mark_as_diagonal(void)
Definition: MatrixType.h:163
std::string string_value(bool force=false) const
Definition: ov.h:955
OCTINTERP_API void print_usage(void)
Definition: defun.cc:54
void mark_as_symmetric(void)
Definition: MatrixType.cc:895
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
Definition: defun.h:53
void mark_as_permuted_diagonal(void)
Definition: MatrixType.h:165
void error(const char *fmt,...)
Definition: error.cc:578
bool is_unknown(void) const
Definition: MatrixType.h:155
void mark_as_full(void)
Definition: MatrixType.h:176
FloatMatrix float_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:837
FloatComplexMatrix float_complex_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:856
int type(bool quiet=true)
Definition: MatrixType.cc:650
octave_idx_type columns(void) const
Definition: ov.h:474
bool is_single_type(void) const
Definition: ov.h:651
void mark_as_permuted(const octave_idx_type np, const octave_idx_type *p)
Definition: MatrixType.cc:924
void mark_as_upper_triangular(void)
Definition: MatrixType.h:167
octave_idx_type rows(void) const
Definition: ov.h:472
bool issparse(void) const
Definition: ov.h:730
octave_value retval
Definition: data.cc:6246
Definition: dMatrix.h:36
void mark_as_rectangular(void)
Definition: MatrixType.h:178
void invalidate_type(void)
Definition: MatrixType.h:161
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:885
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
MatrixType matrix_type(void) const
Definition: ov.h:514
p
Definition: lu.cc:138
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:881
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
Definition: oct-locbuf.h:41
args.length() nargin
Definition: file-io.cc:589
ColumnVector transform(const Matrix &m, double x, double y, double z)
Definition: graphics.cc:5410
bool iscomplex(void) const
Definition: ov.h:710
for i
Definition: data.cc:5264
bool is_string(void) const
Definition: ov.h:577
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:852
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:366
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:888
void mark_as_tridiagonal(void)
Definition: MatrixType.h:171
void mark_as_banded(const octave_idx_type ku, const octave_idx_type kl)
Definition: MatrixType.h:173
dim_vector dv
Definition: sub2ind.cc:263
bool is_scalar_type(void) const
Definition: ov.h:717
Matrix matrix_value(bool frc_str_conv=false) const
Definition: ov.h:834