GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
op-fdm-fdm.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2008-2021 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-flt-re-mat.h"
34 #include "ov-flt-re-diag.h"
35 #include "ov-re-diag.h"
36 #include "ov-typeinfo.h"
37 #include "ops.h"
38 #include "xdiv.h"
39 #include "xpow.h"
40 
41 // matrix unary ops.
42 
43 DEFUNOP_OP (uplus, float_diag_matrix, /* no-op */)
44 DEFUNOP_OP (uminus, float_diag_matrix, -)
45 
46 DEFUNOP (transpose, float_diag_matrix)
47 {
49  = dynamic_cast<const octave_float_diag_matrix&> (a);
51 }
52 
53 // matrix by matrix ops.
54 
55 DEFBINOP_OP (add, float_diag_matrix, float_diag_matrix, +)
56 DEFBINOP_OP (sub, float_diag_matrix, float_diag_matrix, -)
57 DEFBINOP_OP (mul, float_diag_matrix, float_diag_matrix, *)
58 
59 DEFBINOP (div, float_diag_matrix, float_diag_matrix)
60 {
61  const octave_float_diag_matrix& v1
62  = dynamic_cast<const octave_float_diag_matrix&> (a1);
64  = dynamic_cast<const octave_float_diag_matrix&> (a2);
65 
66  return xdiv (v1.float_diag_matrix_value (),
68 }
69 
70 DEFBINOP (ldiv, float_diag_matrix, float_diag_matrix)
71 {
72  const octave_float_diag_matrix& v1
73  = dynamic_cast<const octave_float_diag_matrix&> (a1);
75  = dynamic_cast<const octave_float_diag_matrix&> (a2);
76 
77  return xleftdiv (v1.float_diag_matrix_value (),
79 }
80 
81 CONVDECL (float_diag_matrix_to_float_matrix)
82 {
84  = dynamic_cast<const octave_float_diag_matrix&> (a);
85 
86  return new octave_float_matrix (v.float_matrix_value ());
87 }
88 
89 void
91 {
96 
99  add);
102  sub);
105  mul);
108  div);
111  ldiv);
112 
116  float_diag_matrix_to_float_matrix);
117 }
FloatDiagMatrix transpose(void) const
Definition: fDiagMatrix.h:79
FloatMatrix float_matrix_value(bool=false) const
virtual FloatDiagMatrix float_diag_matrix_value(bool=false) const
Definition: ov-base.cc:662
FloatDiagMatrix float_diag_matrix_value(bool=false) const
void install_fdm_fdm_ops(octave::type_info &ti)
Definition: op-fdm-fdm.cc:90
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:183
#define DEFBINOP(name, t1, t2)
Definition: ops.h:230
#define DEFBINOP_OP(name, t1, t2, op)
Definition: ops.h:235
#define INSTALL_ASSIGNCONV_TI(ti, t1, t2, tr)
Definition: ops.h:73
#define INSTALL_BINOP_TI(ti, op, t1, t2, f)
Definition: ops.h:55
#define INSTALL_WIDENOP_TI(ti, t1, t2, f)
Definition: ops.h:77
#define CONVDECL(name)
Definition: ops.h:168
#define DEFUNOP(name, t)
Definition: ops.h:179
#define INSTALL_UNOP_TI(ti, op, t, f)
Definition: ops.h:47
octave_value op_uplus(const octave_value &a)
Definition: ov.h:1537
octave_value op_add(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1566
octave_value op_uminus(const octave_value &a)
Definition: ov.h:1538
octave_value op_transpose(const octave_value &a)
Definition: ov.h:1540
octave_value op_sub(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1567
octave_value op_mul(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1568
octave_value op_hermitian(const octave_value &a)
Definition: ov.h:1541
octave_value op_ldiv(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1572
octave_value op_div(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1569
Matrix xdiv(const Matrix &a, const SparseMatrix &b, MatrixType &typ)
Definition: sparse-xdiv.cc:135
Matrix xleftdiv(const SparseMatrix &a, const Matrix &b, MatrixType &typ)
Definition: sparse-xdiv.cc:466
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:389