GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
op-pm-scm.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2009-2013 Jason Riedy
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 the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 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 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include "gripes.h"
28 #include "oct-obj.h"
29 #include "ov.h"
30 #include "ov-typeinfo.h"
31 #include "ops.h"
32 
33 #include "ov-perm.h"
34 #include "ov-cx-sparse.h"
35 
36 // permutation matrix by sparse matrix ops
37 
38 DEFBINOP (mul_pm_scm, perm_matrix, sparse_complex_matrix)
39 {
42 
43  if (v2.rows () == 1 && v2.columns () == 1)
44  {
45  std::complex<double> d = v2.complex_value ();
46 
47  return octave_value (v1.sparse_matrix_value () * d);
48  }
49  else if (v1.rows () == 1 && v1.columns () == 1)
51  else
53 }
54 
55 DEFBINOP (ldiv_pm_scm, perm_matrix, sparse_complex_matrix)
56 {
59 
61 }
62 
63 // sparse matrix by diagonal matrix ops
64 
65 DEFBINOP (mul_scm_pm, sparse_complex_matrix, perm_matrix)
66 {
68  const octave_perm_matrix&);
69 
70  if (v1.rows () == 1 && v1.columns () == 1)
71  {
72  std::complex<double> d = v1.scalar_value ();
73 
74  return octave_value (d * v2.sparse_matrix_value ());
75  }
76  else if (v2.rows () == 1 && v2.columns () == 1)
78  else
80 }
81 
82 DEFBINOP (div_scm_pm, sparse_complex_matrix, perm_matrix)
83 {
85  const octave_perm_matrix&);
86 
88 }
89 
90 void
92 {
94  mul_pm_scm);
96  ldiv_pm_scm);
98  mul_scm_pm);
100  div_scm_pm);
101 }