GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
op-dm-dm.cc
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2008-2022 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if defined (HAVE_CONFIG_H)
27# include "config.h"
28#endif
29
30#include "errwarn.h"
31#include "ovl.h"
32#include "ov.h"
33#include "ov-re-mat.h"
34#include "ov-re-diag.h"
35#include "ov-flt-re-diag.h"
36#include "ov-typeinfo.h"
37#include "ops.h"
38#include "xdiv.h"
39#include "xpow.h"
40
41OCTAVE_NAMESPACE_BEGIN
42
43// matrix unary ops.
44
45DEFUNOP_OP (uplus, diag_matrix, /* no-op */)
46DEFUNOP_OP (uminus, diag_matrix, -)
47
48DEFUNOP (transpose, diag_matrix)
49{
50 const octave_diag_matrix& v = dynamic_cast<const octave_diag_matrix&> (a);
52}
53
54// matrix by matrix ops.
55
56DEFBINOP_OP (add, diag_matrix, diag_matrix, +)
57DEFBINOP_OP (sub, diag_matrix, diag_matrix, -)
58DEFBINOP_OP (mul, diag_matrix, diag_matrix, *)
59
60DEFBINOP (div, diag_matrix, diag_matrix)
61{
62 const octave_diag_matrix& v1 = dynamic_cast<const octave_diag_matrix&> (a1);
63 const octave_diag_matrix& v2 = dynamic_cast<const octave_diag_matrix&> (a2);
64
65 return xdiv (v1.diag_matrix_value (),
67}
68
69DEFBINOP (ldiv, diag_matrix, diag_matrix)
70{
71 const octave_diag_matrix& v1 = dynamic_cast<const octave_diag_matrix&> (a1);
72 const octave_diag_matrix& v2 = dynamic_cast<const octave_diag_matrix&> (a2);
73
74 return xleftdiv (v1.diag_matrix_value (),
76}
77
78CONVDECL (diag_matrix_to_matrix)
79{
80 const octave_diag_matrix& v = dynamic_cast<const octave_diag_matrix&> (a);
81
82 return new octave_matrix (v.matrix_value ());
83}
84
85void
86install_dm_dm_ops (octave::type_info& ti)
87{
92
98
101 diag_matrix_to_matrix);
102}
103
104OCTAVE_NAMESPACE_END
DiagMatrix transpose(void) const
Definition: dDiagMatrix.h:80
OCTINTERP_API Matrix matrix_value(bool=false) const
virtual DiagMatrix diag_matrix_value(bool=false) const
Definition: ov-base.cc:658
DiagMatrix diag_matrix_value(bool=false) const
Definition: ov-re-diag.cc:140
void install_dm_dm_ops(octave::type_info &ti)
Definition: op-dm-dm.cc:86
const octave_base_value & a2
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
const octave_char_matrix & v2
#define DEFUNOP_OP(name, t, op)
Definition: ops.h:181
#define DEFBINOP(name, t1, t2)
Definition: ops.h:228
#define DEFBINOP_OP(name, t1, t2, op)
Definition: ops.h:233
#define INSTALL_ASSIGNCONV_TI(ti, t1, t2, tr)
Definition: ops.h:71
#define INSTALL_BINOP_TI(ti, op, t1, t2, f)
Definition: ops.h:53
#define INSTALL_WIDENOP_TI(ti, t1, t2, f)
Definition: ops.h:75
#define CONVDECL(name)
Definition: ops.h:166
#define DEFUNOP(name, t)
Definition: ops.h:177
#define INSTALL_UNOP_TI(ti, op, t, f)
Definition: ops.h:45
octave_value op_uplus(const octave_value &a)
Definition: ov.h:1836
octave_value op_add(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1865
octave_value op_uminus(const octave_value &a)
Definition: ov.h:1837
octave_value op_transpose(const octave_value &a)
Definition: ov.h:1839
octave_value op_sub(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1866
octave_value op_mul(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1867
octave_value op_hermitian(const octave_value &a)
Definition: ov.h:1840
octave_value op_ldiv(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1871
octave_value op_div(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1868
Matrix xdiv(const Matrix &a, const SparseMatrix &b, MatrixType &typ)
Definition: sparse-xdiv.cc:137
Matrix xleftdiv(const SparseMatrix &a, const Matrix &b, MatrixType &typ)
Definition: sparse-xdiv.cc:468
static void transpose(octave_idx_type N, const octave_idx_type *ridx, const octave_idx_type *cidx, octave_idx_type *ridx2, octave_idx_type *cidx2)
Definition: symrcm.cc:391