annotate libinterp/corefcn/xdiv.cc @ 31605:e88a07dec498 stable

maint: Use macros to begin/end C++ namespaces. * oct-conf-post-public.in.h: Define two macros (OCTAVE_BEGIN_NAMESPACE, OCTAVE_END_NAMESPACE) that can be used to start/end a namespace. * mk-opts.pl, build-env.h, build-env.in.cc, __betainc__.cc, __contourc__.cc, __dsearchn__.cc, __eigs__.cc, __expint__.cc, __ftp__.cc, __gammainc__.cc, __ichol__.cc, __ilu__.cc, __isprimelarge__.cc, __lin_interpn__.cc, __magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, amd.cc, auto-shlib.cc, auto-shlib.h, balance.cc, base-text-renderer.cc, base-text-renderer.h, besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc, defaults.cc, defaults.h, defun-int.h, defun.cc, det.cc, dirfns.cc, display.cc, display.h, dlmread.cc, dmperm.cc, dot.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc, ellipj.cc, environment.cc, environment.h, error.cc, error.h, errwarn.h, event-manager.cc, event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc, ft-text-renderer.cc, ft-text-renderer.h, gcd.cc, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, gl-render.cc, gl-render.h, gl2ps-print.cc, gl2ps-print.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc, help.h, hess.cc, hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h, interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h, inv.cc, jsondecode.cc, jsonencode.cc, kron.cc, latex-text-renderer.cc, latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h, lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-oct-text.cc, ls-utils.cc, ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex-private.h, mex.cc, mgorth.cc, nproc.cc, oct-fstrm.cc, oct-fstrm.h, oct-hdf5-types.cc, oct-hdf5-types.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-process.cc, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, oct-tex-parser.yy, ordqz.cc, ordschur.cc, pager.cc, pager.h, pinv.cc, pow2.cc, pr-flt-fmt.cc, pr-output.cc, procstream.cc, procstream.h, psi.cc, qr.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, settings.cc, settings.h, sighandlers.cc, sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc, sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc, stack-frame.cc, stack-frame.h, stream-euler.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symbfact.cc, syminfo.cc, syminfo.h, symrcm.cc, symrec.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h, text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, time.cc, toplev.cc, tril.cc, tsearch.cc, typecast.cc, url-handle-manager.cc, url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc, variables.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h, __delaunayn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audiodevinfo.cc, audioread.cc, convhulln.cc, fftw.cc, gzip.cc, mk-build-env-features.sh, mk-builtins.pl, cdef-class.cc, cdef-class.h, cdef-fwd.h, cdef-manager.cc, cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h, cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h, cdef-utils.cc, cdef-utils.h, ov-base.cc, ov-base.h, ov-bool-mat.cc, ov-builtin.h, ov-cell.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-complex.cc, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.h, ov-java.cc, ov-java.h, ov-mex-fcn.h, ov-null-mat.cc, ov-oncleanup.cc, ov-struct.cc, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, octave.cc, octave.h, mk-ops.sh, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc, op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-int-concat.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-mi.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc, op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, ops.h, anon-fcn-validator.cc, anon-fcn-validator.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll, oct-lvalue.cc, oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h, pt-anon-scopes.cc, pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h, pt-args-block.cc, pt-args-block.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt-cell.cc, pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc, pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-spmd.cc, pt-spmd.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-vm-eval.cc, pt-walk.cc, pt-walk.h, pt.cc, pt.h, token.cc, token.h, Range.cc, Range.h, idx-vector.cc, idx-vector.h, range-fwd.h, CollocWt.cc, CollocWt.h, aepbalance.cc, aepbalance.h, chol.cc, chol.h, gepbalance.cc, gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h, lo-mappers.cc, lo-mappers.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h, oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h, oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc, randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, child-list.cc, child-list.h, dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc, file-stat.h, lo-sysdep.cc, lo-sysdep.h, lo-sysinfo.cc, lo-sysinfo.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h, oct-password.cc, oct-password.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h, action-container.cc, action-container.h, base-list.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, f77-fcn.h, file-info.cc, file-info.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc, lo-hash.h, lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-utils.cc, lo-utils.h, oct-base64.cc, oct-base64.h, oct-glob.cc, oct-glob.h, oct-inttypes.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h, oct-sparse.cc, oct-sparse.h, oct-string.h, octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, quit.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h : Use new macros to begin/end C++ namespaces.
author Rik <rik@octave.org>
date Thu, 01 Dec 2022 14:23:45 -0800
parents 796f54d4ddbf
children aac27ad79be6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29989
diff changeset
3 // Copyright (C) 1993-2022 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
25
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
26 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21200
diff changeset
27 # include "config.h"
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
28 #endif
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
29
1343
94bedeb289e5 [project @ 1995-09-04 00:29:21 by jwe]
jwe
parents: 1315
diff changeset
30 #include <cassert>
94bedeb289e5 [project @ 1995-09-04 00:29:21 by jwe]
jwe
parents: 1315
diff changeset
31
4669
334a27c8f453 [project @ 2003-11-26 07:02:42 by jwe]
jwe
parents: 4543
diff changeset
32 #include "Array-util.h"
1352
19c10b8657d5 [project @ 1995-09-05 08:11:57 by jwe]
jwe
parents: 1343
diff changeset
33 #include "CMatrix.h"
453
393e95f46b51 [project @ 1994-06-06 00:05:20 by jwe]
jwe
parents: 240
diff changeset
34 #include "dMatrix.h"
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
35 #include "CNDArray.h"
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
36 #include "dNDArray.h"
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
37 #include "fCMatrix.h"
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
38 #include "fMatrix.h"
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
39 #include "fCNDArray.h"
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
40 #include "fNDArray.h"
1651
e846e361a265 [project @ 1995-12-20 06:59:12 by jwe]
jwe
parents: 1488
diff changeset
41 #include "oct-cmplx.h"
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
42 #include "dDiagMatrix.h"
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
43 #include "fDiagMatrix.h"
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
44 #include "CDiagMatrix.h"
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
45 #include "fCDiagMatrix.h"
21100
e39e05d90788 Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents: 21024
diff changeset
46 #include "lo-array-errwarn.h"
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3719
diff changeset
47 #include "quit.h"
1352
19c10b8657d5 [project @ 1995-09-05 08:11:57 by jwe]
jwe
parents: 1343
diff changeset
48
19c10b8657d5 [project @ 1995-09-05 08:11:57 by jwe]
jwe
parents: 1343
diff changeset
49 #include "error.h"
19c10b8657d5 [project @ 1995-09-05 08:11:57 by jwe]
jwe
parents: 1343
diff changeset
50 #include "xdiv.h"
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
51
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
52 OCTAVE_BEGIN_NAMESPACE(octave)
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
53
3480
45742a3b1f7c [project @ 2000-01-26 06:16:41 by jwe]
jwe
parents: 3195
diff changeset
54 static void
45742a3b1f7c [project @ 2000-01-26 06:16:41 by jwe]
jwe
parents: 3195
diff changeset
55 solve_singularity_warning (double rcond)
45742a3b1f7c [project @ 2000-01-26 06:16:41 by jwe]
jwe
parents: 3195
diff changeset
56 {
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
57 octave::warn_singular_matrix (rcond);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
58 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
59
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21112
diff changeset
60 template <typename T1, typename T2>
2364
5eb0af0730d6 [project @ 1996-10-11 22:57:03 by jwe]
jwe
parents: 2305
diff changeset
61 bool
12986
f217edac2c71 fix dimension check for A'\B (bug #33997)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
62 mx_leftdiv_conform (const T1& a, const T2& b, blas_trans_type blas_trans)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
63 {
23450
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23433
diff changeset
64 octave_idx_type a_nr = (blas_trans == blas_no_trans ? a.rows () : a.cols ());
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
65 octave_idx_type b_nr = b.rows ();
2364
5eb0af0730d6 [project @ 1996-10-11 22:57:03 by jwe]
jwe
parents: 2305
diff changeset
66
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
67 if (a_nr != b_nr)
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
68 {
23450
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23433
diff changeset
69 octave_idx_type a_nc = (blas_trans == blas_no_trans ? a.cols ()
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23433
diff changeset
70 : a.rows ());
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
71 octave_idx_type b_nc = b.cols ();
2364
5eb0af0730d6 [project @ 1996-10-11 22:57:03 by jwe]
jwe
parents: 2305
diff changeset
72
23804
8057d3f0673d Use C++11 raw string literals to avoid escaping backslashes in strings.
Rik <rik@octave.org>
parents: 23450
diff changeset
73 octave::err_nonconformant (R"(operator \)", a_nr, a_nc, b_nr, b_nc);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
74 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
75
2364
5eb0af0730d6 [project @ 1996-10-11 22:57:03 by jwe]
jwe
parents: 2305
diff changeset
76 return true;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
77 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
78
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
79 #define INSTANTIATE_MX_LEFTDIV_CONFORM(T1, T2) \
12986
f217edac2c71 fix dimension check for A'\B (bug #33997)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
80 template bool mx_leftdiv_conform (const T1&, const T2&, blas_trans_type)
3195
7a5a5da64756 [project @ 1998-10-28 22:54:04 by jwe]
jwe
parents: 3180
diff changeset
81
7a5a5da64756 [project @ 1998-10-28 22:54:04 by jwe]
jwe
parents: 3180
diff changeset
82 INSTANTIATE_MX_LEFTDIV_CONFORM (Matrix, Matrix);
7a5a5da64756 [project @ 1998-10-28 22:54:04 by jwe]
jwe
parents: 3180
diff changeset
83 INSTANTIATE_MX_LEFTDIV_CONFORM (Matrix, ComplexMatrix);
7a5a5da64756 [project @ 1998-10-28 22:54:04 by jwe]
jwe
parents: 3180
diff changeset
84 INSTANTIATE_MX_LEFTDIV_CONFORM (ComplexMatrix, Matrix);
7a5a5da64756 [project @ 1998-10-28 22:54:04 by jwe]
jwe
parents: 3180
diff changeset
85 INSTANTIATE_MX_LEFTDIV_CONFORM (ComplexMatrix, ComplexMatrix);
2364
5eb0af0730d6 [project @ 1996-10-11 22:57:03 by jwe]
jwe
parents: 2305
diff changeset
86
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21112
diff changeset
87 template <typename T1, typename T2>
2364
5eb0af0730d6 [project @ 1996-10-11 22:57:03 by jwe]
jwe
parents: 2305
diff changeset
88 bool
3195
7a5a5da64756 [project @ 1998-10-28 22:54:04 by jwe]
jwe
parents: 3180
diff changeset
89 mx_div_conform (const T1& a, const T2& b)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
90 {
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
91 octave_idx_type a_nc = a.cols ();
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
92 octave_idx_type b_nc = b.cols ();
2364
5eb0af0730d6 [project @ 1996-10-11 22:57:03 by jwe]
jwe
parents: 2305
diff changeset
93
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
94 if (a_nc != b_nc)
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
95 {
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
96 octave_idx_type a_nr = a.rows ();
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
97 octave_idx_type b_nr = b.rows ();
2364
5eb0af0730d6 [project @ 1996-10-11 22:57:03 by jwe]
jwe
parents: 2305
diff changeset
98
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
99 octave::err_nonconformant ("operator /", a_nr, a_nc, b_nr, b_nc);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
100 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
101
2364
5eb0af0730d6 [project @ 1996-10-11 22:57:03 by jwe]
jwe
parents: 2305
diff changeset
102 return true;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
103 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
104
22197
e43d83253e28 refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
105 #define INSTANTIATE_MX_DIV_CONFORM(T1, T2) \
3195
7a5a5da64756 [project @ 1998-10-28 22:54:04 by jwe]
jwe
parents: 3180
diff changeset
106 template bool mx_div_conform (const T1&, const T2&)
7a5a5da64756 [project @ 1998-10-28 22:54:04 by jwe]
jwe
parents: 3180
diff changeset
107
7a5a5da64756 [project @ 1998-10-28 22:54:04 by jwe]
jwe
parents: 3180
diff changeset
108 INSTANTIATE_MX_DIV_CONFORM (Matrix, Matrix);
7a5a5da64756 [project @ 1998-10-28 22:54:04 by jwe]
jwe
parents: 3180
diff changeset
109 INSTANTIATE_MX_DIV_CONFORM (Matrix, ComplexMatrix);
7a5a5da64756 [project @ 1998-10-28 22:54:04 by jwe]
jwe
parents: 3180
diff changeset
110 INSTANTIATE_MX_DIV_CONFORM (ComplexMatrix, Matrix);
7a5a5da64756 [project @ 1998-10-28 22:54:04 by jwe]
jwe
parents: 3180
diff changeset
111 INSTANTIATE_MX_DIV_CONFORM (ComplexMatrix, ComplexMatrix);
2364
5eb0af0730d6 [project @ 1996-10-11 22:57:03 by jwe]
jwe
parents: 2305
diff changeset
112
767
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
113 // Right division functions.
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
114 //
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
115 // op2 / op1: m cm
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
116 // +-- +---+----+
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
117 // matrix | 1 | 3 |
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
118 // +---+----+
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
119 // complex_matrix | 2 | 4 |
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
120 // +---+----+
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
121
767
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
122 // -*- 1 -*-
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
123 Matrix
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
124 xdiv (const Matrix& a, const Matrix& b, MatrixType& typ)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
125 {
2364
5eb0af0730d6 [project @ 1996-10-11 22:57:03 by jwe]
jwe
parents: 2305
diff changeset
126 if (! mx_div_conform (a, b))
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
127 return Matrix ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
128
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
129 octave_idx_type info;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
130 double rcond = 0.0;
3480
45742a3b1f7c [project @ 2000-01-26 06:16:41 by jwe]
jwe
parents: 3195
diff changeset
131
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
132 Matrix result
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
133 = b.solve (typ, a.transpose (), info, rcond,
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
134 solve_singularity_warning, true, blas_trans);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
135
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
136 return result.transpose ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
137 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
138
767
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
139 // -*- 2 -*-
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
140 ComplexMatrix
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
141 xdiv (const Matrix& a, const ComplexMatrix& b, MatrixType& typ)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
142 {
2364
5eb0af0730d6 [project @ 1996-10-11 22:57:03 by jwe]
jwe
parents: 2305
diff changeset
143 if (! mx_div_conform (a, b))
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
144 return ComplexMatrix ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
145
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
146 octave_idx_type info;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
147 double rcond = 0.0;
3480
45742a3b1f7c [project @ 2000-01-26 06:16:41 by jwe]
jwe
parents: 3195
diff changeset
148
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
149 ComplexMatrix result
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
150 = b.solve (typ, a.transpose (), info, rcond,
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
151 solve_singularity_warning, true, blas_trans);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
152
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
153 return result.transpose ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
154 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
155
767
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
156 // -*- 3 -*-
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
157 ComplexMatrix
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
158 xdiv (const ComplexMatrix& a, const Matrix& b, MatrixType& typ)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
159 {
2364
5eb0af0730d6 [project @ 1996-10-11 22:57:03 by jwe]
jwe
parents: 2305
diff changeset
160 if (! mx_div_conform (a, b))
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
161 return ComplexMatrix ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
162
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
163 octave_idx_type info;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
164 double rcond = 0.0;
3480
45742a3b1f7c [project @ 2000-01-26 06:16:41 by jwe]
jwe
parents: 3195
diff changeset
165
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
166 ComplexMatrix result
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
167 = b.solve (typ, a.transpose (), info, rcond,
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
168 solve_singularity_warning, true, blas_trans);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
169
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
170 return result.transpose ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
171 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
172
767
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
173 // -*- 4 -*-
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
174 ComplexMatrix
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
175 xdiv (const ComplexMatrix& a, const ComplexMatrix& b, MatrixType& typ)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
176 {
2364
5eb0af0730d6 [project @ 1996-10-11 22:57:03 by jwe]
jwe
parents: 2305
diff changeset
177 if (! mx_div_conform (a, b))
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
178 return ComplexMatrix ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
179
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
180 octave_idx_type info;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
181 double rcond = 0.0;
3480
45742a3b1f7c [project @ 2000-01-26 06:16:41 by jwe]
jwe
parents: 3195
diff changeset
182
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
183 ComplexMatrix result
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
184 = b.solve (typ, a.transpose (), info, rcond,
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
185 solve_singularity_warning, true, blas_trans);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
186
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
187 return result.transpose ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
188 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
189
767
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
190 // Funny element by element division operations.
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
191 //
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
192 // op2 \ op1: s cs
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
193 // +-- +---+----+
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
194 // matrix | 1 | 3 |
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
195 // +---+----+
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
196 // complex_matrix | 2 | 4 |
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
197 // +---+----+
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
198
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
199 Matrix
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
200 elem_xdiv (double a, const Matrix& b)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
201 {
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
202 octave_idx_type nr = b.rows ();
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
203 octave_idx_type nc = b.columns ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
204
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
205 Matrix result (nr, nc);
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
206
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
207 for (octave_idx_type j = 0; j < nc; j++)
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
208 for (octave_idx_type i = 0; i < nr; i++)
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3719
diff changeset
209 {
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
210 octave_quit ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
211 result (i, j) = a / b (i, j);
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3719
diff changeset
212 }
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
213
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
214 return result;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
215 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
216
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
217 ComplexMatrix
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
218 elem_xdiv (double a, const ComplexMatrix& b)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
219 {
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
220 octave_idx_type nr = b.rows ();
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
221 octave_idx_type nc = b.columns ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
222
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
223 ComplexMatrix result (nr, nc);
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
224
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
225 for (octave_idx_type j = 0; j < nc; j++)
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
226 for (octave_idx_type i = 0; i < nr; i++)
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3719
diff changeset
227 {
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
228 octave_quit ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
229 result (i, j) = a / b (i, j);
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3719
diff changeset
230 }
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
231
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
232 return result;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
233 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
234
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
235 ComplexMatrix
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
236 elem_xdiv (const Complex a, const Matrix& b)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
237 {
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
238 octave_idx_type nr = b.rows ();
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
239 octave_idx_type nc = b.columns ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
240
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
241 ComplexMatrix result (nr, nc);
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
242
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
243 for (octave_idx_type j = 0; j < nc; j++)
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
244 for (octave_idx_type i = 0; i < nr; i++)
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3719
diff changeset
245 {
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
246 octave_quit ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
247 result (i, j) = a / b (i, j);
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3719
diff changeset
248 }
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
249
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
250 return result;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
251 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
252
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
253 ComplexMatrix
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
254 elem_xdiv (const Complex a, const ComplexMatrix& b)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
255 {
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
256 octave_idx_type nr = b.rows ();
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
257 octave_idx_type nc = b.columns ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
258
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
259 ComplexMatrix result (nr, nc);
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
260
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
261 for (octave_idx_type j = 0; j < nc; j++)
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
262 for (octave_idx_type i = 0; i < nr; i++)
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3719
diff changeset
263 {
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
264 octave_quit ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
265 result (i, j) = a / b (i, j);
4153
6b96ce9f5743 [project @ 2002-11-06 20:38:49 by jwe]
jwe
parents: 3719
diff changeset
266 }
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
267
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
268 return result;
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
269 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
270
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
271 // Funny element by element division operations.
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
272 //
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
273 // op2 \ op1: s cs
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
274 // +-- +---+----+
21014
b9d4c3615e89 maint: Capitalize D for dimension in messages and comments.
Rik <rik@octave.org>
parents: 20232
diff changeset
275 // N-D array | 1 | 3 |
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
276 // +---+----+
21014
b9d4c3615e89 maint: Capitalize D for dimension in messages and comments.
Rik <rik@octave.org>
parents: 20232
diff changeset
277 // complex N-D array | 2 | 4 |
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
278 // +---+----+
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
279
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
280 NDArray
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
281 elem_xdiv (double a, const NDArray& b)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
282 {
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
283 NDArray result (b.dims ());
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
284
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 19697
diff changeset
285 for (octave_idx_type i = 0; i < b.numel (); i++)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
286 {
10142
829e69ec3110 make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents: 9661
diff changeset
287 octave_quit ();
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
288 result (i) = a / b (i);
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
289 }
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
290
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
291 return result;
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
292 }
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
293
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
294 ComplexNDArray
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
295 elem_xdiv (double a, const ComplexNDArray& b)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
296 {
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
297 ComplexNDArray result (b.dims ());
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
298
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 19697
diff changeset
299 for (octave_idx_type i = 0; i < b.numel (); i++)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
300 {
10142
829e69ec3110 make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents: 9661
diff changeset
301 octave_quit ();
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
302 result (i) = a / b (i);
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
303 }
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
304
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
305 return result;
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
306 }
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
307
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
308 ComplexNDArray
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
309 elem_xdiv (const Complex a, const NDArray& b)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
310 {
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
311 ComplexNDArray result (b.dims ());
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
312
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 19697
diff changeset
313 for (octave_idx_type i = 0; i < b.numel (); i++)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
314 {
10142
829e69ec3110 make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents: 9661
diff changeset
315 octave_quit ();
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
316 result (i) = a / b (i);
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
317 }
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
318
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
319 return result;
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
320 }
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
321
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
322 ComplexNDArray
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
323 elem_xdiv (const Complex a, const ComplexNDArray& b)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
324 {
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
325 ComplexNDArray result (b.dims ());
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
326
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 19697
diff changeset
327 for (octave_idx_type i = 0; i < b.numel (); i++)
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
328 {
10142
829e69ec3110 make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents: 9661
diff changeset
329 octave_quit ();
4543
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
330 result (i) = a / b (i);
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
331 }
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
332
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
333 return result;
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
334 }
79df15d4470c [project @ 2003-10-18 03:53:52 by jwe]
jwe
parents: 4153
diff changeset
335
767
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
336 // Left division functions.
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
337 //
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
338 // op2 \ op1: m cm
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
339 // +-- +---+----+
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
340 // matrix | 1 | 3 |
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
341 // +---+----+
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
342 // complex_matrix | 2 | 4 |
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
343 // +---+----+
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
344
767
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
345 // -*- 1 -*-
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
346 Matrix
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
347 xleftdiv (const Matrix& a, const Matrix& b, MatrixType& typ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
348 blas_trans_type transt)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
349 {
12986
f217edac2c71 fix dimension check for A'\B (bug #33997)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
350 if (! mx_leftdiv_conform (a, b, transt))
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
351 return Matrix ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
352
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
353 octave_idx_type info;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
354 double rcond = 0.0;
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
355 return a.solve (typ, b, info, rcond, solve_singularity_warning, true, transt);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
356 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
357
767
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
358 // -*- 2 -*-
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
359 ComplexMatrix
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
360 xleftdiv (const Matrix& a, const ComplexMatrix& b, MatrixType& typ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
361 blas_trans_type transt)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
362 {
12986
f217edac2c71 fix dimension check for A'\B (bug #33997)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
363 if (! mx_leftdiv_conform (a, b, transt))
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
364 return ComplexMatrix ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
365
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
366 octave_idx_type info;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
367 double rcond = 0.0;
3480
45742a3b1f7c [project @ 2000-01-26 06:16:41 by jwe]
jwe
parents: 3195
diff changeset
368
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
369 return a.solve (typ, b, info, rcond, solve_singularity_warning, true, transt);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
370 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
371
767
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
372 // -*- 3 -*-
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
373 ComplexMatrix
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
374 xleftdiv (const ComplexMatrix& a, const Matrix& b, MatrixType& typ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
375 blas_trans_type transt)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
376 {
12986
f217edac2c71 fix dimension check for A'\B (bug #33997)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
377 if (! mx_leftdiv_conform (a, b, transt))
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
378 return ComplexMatrix ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
379
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
380 octave_idx_type info;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
381 double rcond = 0.0;
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
382 return a.solve (typ, b, info, rcond, solve_singularity_warning, true, transt);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
383 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
384
767
42731861ee09 [project @ 1994-10-05 21:26:54 by jwe]
jwe
parents: 453
diff changeset
385 // -*- 4 -*-
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
386 ComplexMatrix
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
387 xleftdiv (const ComplexMatrix& a, const ComplexMatrix& b, MatrixType& typ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
388 blas_trans_type transt)
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
389 {
12986
f217edac2c71 fix dimension check for A'\B (bug #33997)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
390 if (! mx_leftdiv_conform (a, b, transt))
1800
024c75af53f1 [project @ 1996-01-29 05:55:45 by jwe]
jwe
parents: 1742
diff changeset
391 return ComplexMatrix ();
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
392
5275
23b37da9fd5b [project @ 2005-04-08 16:07:35 by jwe]
jwe
parents: 4669
diff changeset
393 octave_idx_type info;
5785
6b9cec830d72 [project @ 2006-05-03 19:32:46 by dbateman]
dbateman
parents: 5307
diff changeset
394 double rcond = 0.0;
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
395 return a.solve (typ, b, info, rcond, solve_singularity_warning, true, transt);
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
396 }
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
397
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
398 static void
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
399 solve_singularity_warning (float rcond)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
400 {
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
401 octave::warn_singular_matrix (rcond);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
402 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
403
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
404 INSTANTIATE_MX_LEFTDIV_CONFORM (FloatMatrix, FloatMatrix);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
405 INSTANTIATE_MX_LEFTDIV_CONFORM (FloatMatrix, FloatComplexMatrix);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
406 INSTANTIATE_MX_LEFTDIV_CONFORM (FloatComplexMatrix, FloatMatrix);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
407 INSTANTIATE_MX_LEFTDIV_CONFORM (FloatComplexMatrix, FloatComplexMatrix);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
408
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
409 INSTANTIATE_MX_DIV_CONFORM (FloatMatrix, FloatMatrix);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
410 INSTANTIATE_MX_DIV_CONFORM (FloatMatrix, FloatComplexMatrix);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
411 INSTANTIATE_MX_DIV_CONFORM (FloatComplexMatrix, FloatMatrix);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
412 INSTANTIATE_MX_DIV_CONFORM (FloatComplexMatrix, FloatComplexMatrix);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
413
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
414 // Right division functions.
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
415 //
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
416 // op2 / op1: m cm
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
417 // +-- +---+----+
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
418 // matrix | 1 | 3 |
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
419 // +---+----+
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
420 // complex_matrix | 2 | 4 |
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
421 // +---+----+
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
422
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
423 // -*- 1 -*-
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
424 FloatMatrix
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
425 xdiv (const FloatMatrix& a, const FloatMatrix& b, MatrixType& typ)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
426 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
427 if (! mx_div_conform (a, b))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
428 return FloatMatrix ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
429
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
430 octave_idx_type info;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
431 float rcond = 0.0;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
432
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
433 FloatMatrix result
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
434 = b.solve (typ, a.transpose (), info, rcond,
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
435 solve_singularity_warning, true, blas_trans);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
436
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
437 return result.transpose ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
438 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
439
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
440 // -*- 2 -*-
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
441 FloatComplexMatrix
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
442 xdiv (const FloatMatrix& a, const FloatComplexMatrix& b, MatrixType& typ)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
443 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
444 if (! mx_div_conform (a, b))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
445 return FloatComplexMatrix ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
446
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
447 octave_idx_type info;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
448 float rcond = 0.0;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
449
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
450 FloatComplexMatrix result
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
451 = b.solve (typ, a.transpose (), info, rcond,
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
452 solve_singularity_warning, true, blas_trans);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
453
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
454 return result.transpose ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
455 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
456
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
457 // -*- 3 -*-
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
458 FloatComplexMatrix
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
459 xdiv (const FloatComplexMatrix& a, const FloatMatrix& b, MatrixType& typ)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
460 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
461 if (! mx_div_conform (a, b))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
462 return FloatComplexMatrix ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
463
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
464 octave_idx_type info;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
465 float rcond = 0.0;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
466
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
467 FloatComplexMatrix result
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
468 = b.solve (typ, a.transpose (), info, rcond,
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
469 solve_singularity_warning, true, blas_trans);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
470
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
471 return result.transpose ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
472 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
473
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
474 // -*- 4 -*-
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
475 FloatComplexMatrix
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
476 xdiv (const FloatComplexMatrix& a, const FloatComplexMatrix& b, MatrixType& typ)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
477 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
478 if (! mx_div_conform (a, b))
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
479 return FloatComplexMatrix ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
480
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
481 octave_idx_type info;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
482 float rcond = 0.0;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
483
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
484 FloatComplexMatrix result
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
485 = b.solve (typ, a.transpose (), info, rcond,
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
486 solve_singularity_warning, true, blas_trans);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
487
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
488 return result.transpose ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
489 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
490
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
491 // Funny element by element division operations.
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
492 //
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
493 // op2 \ op1: s cs
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
494 // +-- +---+----+
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
495 // matrix | 1 | 3 |
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
496 // +---+----+
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
497 // complex_matrix | 2 | 4 |
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
498 // +---+----+
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
499
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
500 FloatMatrix
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
501 elem_xdiv (float a, const FloatMatrix& b)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
502 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
503 octave_idx_type nr = b.rows ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
504 octave_idx_type nc = b.columns ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
505
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
506 FloatMatrix result (nr, nc);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
507
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
508 for (octave_idx_type j = 0; j < nc; j++)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
509 for (octave_idx_type i = 0; i < nr; i++)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
510 {
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
511 octave_quit ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
512 result (i, j) = a / b (i, j);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
513 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
514
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
515 return result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
516 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
517
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
518 FloatComplexMatrix
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
519 elem_xdiv (float a, const FloatComplexMatrix& b)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
520 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
521 octave_idx_type nr = b.rows ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
522 octave_idx_type nc = b.columns ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
523
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
524 FloatComplexMatrix result (nr, nc);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
525
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
526 for (octave_idx_type j = 0; j < nc; j++)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
527 for (octave_idx_type i = 0; i < nr; i++)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
528 {
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
529 octave_quit ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
530 result (i, j) = a / b (i, j);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
531 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
532
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
533 return result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
534 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
535
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
536 FloatComplexMatrix
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
537 elem_xdiv (const FloatComplex a, const FloatMatrix& b)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
538 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
539 octave_idx_type nr = b.rows ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
540 octave_idx_type nc = b.columns ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
541
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
542 FloatComplexMatrix result (nr, nc);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
543
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
544 for (octave_idx_type j = 0; j < nc; j++)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
545 for (octave_idx_type i = 0; i < nr; i++)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
546 {
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
547 octave_quit ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
548 result (i, j) = a / b (i, j);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
549 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
550
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
551 return result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
552 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
553
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
554 FloatComplexMatrix
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
555 elem_xdiv (const FloatComplex a, const FloatComplexMatrix& b)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
556 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
557 octave_idx_type nr = b.rows ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
558 octave_idx_type nc = b.columns ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
559
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
560 FloatComplexMatrix result (nr, nc);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
561
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
562 for (octave_idx_type j = 0; j < nc; j++)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
563 for (octave_idx_type i = 0; i < nr; i++)
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
564 {
10315
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
565 octave_quit ();
57a59eae83cc untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents: 10160
diff changeset
566 result (i, j) = a / b (i, j);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
567 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
568
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
569 return result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
570 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
571
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
572 // Funny element by element division operations.
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
573 //
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
574 // op2 \ op1: s cs
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
575 // +-- +---+----+
21014
b9d4c3615e89 maint: Capitalize D for dimension in messages and comments.
Rik <rik@octave.org>
parents: 20232
diff changeset
576 // N-D array | 1 | 3 |
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
577 // +---+----+
21014
b9d4c3615e89 maint: Capitalize D for dimension in messages and comments.
Rik <rik@octave.org>
parents: 20232
diff changeset
578 // complex N-D array | 2 | 4 |
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
579 // +---+----+
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
580
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
581 FloatNDArray
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
582 elem_xdiv (float a, const FloatNDArray& b)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
583 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
584 FloatNDArray result (b.dims ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
585
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 19697
diff changeset
586 for (octave_idx_type i = 0; i < b.numel (); i++)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
587 {
10142
829e69ec3110 make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents: 9661
diff changeset
588 octave_quit ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
589 result (i) = a / b (i);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
590 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
591
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
592 return result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
593 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
594
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
595 FloatComplexNDArray
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
596 elem_xdiv (float a, const FloatComplexNDArray& b)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
597 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
598 FloatComplexNDArray result (b.dims ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
599
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 19697
diff changeset
600 for (octave_idx_type i = 0; i < b.numel (); i++)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
601 {
10142
829e69ec3110 make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents: 9661
diff changeset
602 octave_quit ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
603 result (i) = a / b (i);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
604 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
605
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
606 return result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
607 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
608
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
609 FloatComplexNDArray
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
610 elem_xdiv (const FloatComplex a, const FloatNDArray& b)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
611 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
612 FloatComplexNDArray result (b.dims ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
613
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 19697
diff changeset
614 for (octave_idx_type i = 0; i < b.numel (); i++)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
615 {
10142
829e69ec3110 make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents: 9661
diff changeset
616 octave_quit ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
617 result (i) = a / b (i);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
618 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
619
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
620 return result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
621 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
622
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
623 FloatComplexNDArray
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
624 elem_xdiv (const FloatComplex a, const FloatComplexNDArray& b)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
625 {
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
626 FloatComplexNDArray result (b.dims ());
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
627
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 19697
diff changeset
628 for (octave_idx_type i = 0; i < b.numel (); i++)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
629 {
10142
829e69ec3110 make OCTAVE_QUIT a function
Jaroslav Hajek <highegg@gmail.com>
parents: 9661
diff changeset
630 octave_quit ();
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
631 result (i) = a / b (i);
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
632 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
633
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
634 return result;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
635 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
636
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
637 // Left division functions.
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
638 //
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
639 // op2 \ op1: m cm
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
640 // +-- +---+----+
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
641 // matrix | 1 | 3 |
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
642 // +---+----+
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
643 // complex_matrix | 2 | 4 |
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
644 // +---+----+
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
645
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
646 // -*- 1 -*-
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
647 FloatMatrix
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
648 xleftdiv (const FloatMatrix& a, const FloatMatrix& b, MatrixType& typ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
649 blas_trans_type transt)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
650 {
12986
f217edac2c71 fix dimension check for A'\B (bug #33997)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
651 if (! mx_leftdiv_conform (a, b, transt))
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
652 return FloatMatrix ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
653
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
654 octave_idx_type info;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
655 float rcond = 0.0;
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
656 return a.solve (typ, b, info, rcond, solve_singularity_warning, true, transt);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
657 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
658
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
659 // -*- 2 -*-
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
660 FloatComplexMatrix
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
661 xleftdiv (const FloatMatrix& a, const FloatComplexMatrix& b, MatrixType& typ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
662 blas_trans_type transt)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
663 {
12986
f217edac2c71 fix dimension check for A'\B (bug #33997)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
664 if (! mx_leftdiv_conform (a, b, transt))
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
665 return FloatComplexMatrix ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
666
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
667 octave_idx_type info;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
668 float rcond = 0.0;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
669
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
670 return a.solve (typ, b, info, rcond, solve_singularity_warning, true, transt);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
671 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
672
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
673 // -*- 3 -*-
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
674 FloatComplexMatrix
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
675 xleftdiv (const FloatComplexMatrix& a, const FloatMatrix& b, MatrixType& typ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
676 blas_trans_type transt)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
677 {
12986
f217edac2c71 fix dimension check for A'\B (bug #33997)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
678 if (! mx_leftdiv_conform (a, b, transt))
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
679 return FloatComplexMatrix ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
680
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
681 octave_idx_type info;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
682 float rcond = 0.0;
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
683 return a.solve (typ, b, info, rcond, solve_singularity_warning, true, transt);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
684 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
685
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
686 // -*- 4 -*-
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
687 FloatComplexMatrix
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
688 xleftdiv (const FloatComplexMatrix& a, const FloatComplexMatrix& b,
23433
c9fab0bc983e maint: Use convention 'int& x' for naming references.
Rik <rik@octave.org>
parents: 23398
diff changeset
689 MatrixType& typ, blas_trans_type transt)
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
690 {
12986
f217edac2c71 fix dimension check for A'\B (bug #33997)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
691 if (! mx_leftdiv_conform (a, b, transt))
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
692 return FloatComplexMatrix ();
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
693
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
694 octave_idx_type info;
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
695 float rcond = 0.0;
9661
afcf852256d2 optimize / and '\ for triangular matrices
Jaroslav Hajek <highegg@gmail.com>
parents: 8931
diff changeset
696 return a.solve (typ, b, info, rcond, solve_singularity_warning, true, transt);
7789
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
697 }
82be108cc558 First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents: 7017
diff changeset
698
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
699 // Diagonal matrix division.
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
700
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21112
diff changeset
701 template <typename MT, typename DMT>
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
702 MT
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
703 mdm_div_impl (const MT& a, const DMT& d)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
704 {
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
705 if (! mx_div_conform (a, d))
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
706 return MT ();
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
707
18100
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
708 octave_idx_type m = a.rows ();
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
709 octave_idx_type n = d.rows ();
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
710 octave_idx_type l = d.length ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
711 MT x (m, n);
8931
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
712 typedef typename DMT::element_type S;
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
713 typedef typename MT::element_type T;
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
714 const T *aa = a.data ();
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
715 const S *dd = d.data ();
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
716 T *xx = x.fortran_vec ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
717
8931
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
718 for (octave_idx_type j = 0; j < l; j++)
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
719 {
8931
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
720 const S del = dd[j];
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
721 if (del != S ())
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
722 for (octave_idx_type i = 0; i < m; i++)
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
723 xx[i] = aa[i] / del;
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
724 else
8931
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
725 for (octave_idx_type i = 0; i < m; i++)
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
726 xx[i] = T ();
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
727 aa += m; xx += m;
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
728 }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
729
8931
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
730 for (octave_idx_type i = l*m; i < n*m; i++)
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
731 xx[i] = T ();
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
732
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
733 return x;
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
734 }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
735
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
736 // Right division functions.
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
737 //
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
738 // op2 / op1: dm cdm
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
739 // +-- +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
740 // matrix | 1 | |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
741 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
742 // complex_matrix | 2 | 3 |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
743 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
744
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
745 // -*- 1 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
746 Matrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
747 xdiv (const Matrix& a, const DiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
748 { return mdm_div_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
749
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
750 // -*- 2 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
751 ComplexMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
752 xdiv (const ComplexMatrix& a, const DiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
753 { return mdm_div_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
754
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
755 // -*- 3 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
756 ComplexMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
757 xdiv (const ComplexMatrix& a, const ComplexDiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
758 { return mdm_div_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
759
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
760 // Right division functions, float type.
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
761 //
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
762 // op2 / op1: dm cdm
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
763 // +-- +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
764 // matrix | 1 | |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
765 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
766 // complex_matrix | 2 | 3 |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
767 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
768
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
769 // -*- 1 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
770 FloatMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
771 xdiv (const FloatMatrix& a, const FloatDiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
772 { return mdm_div_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
773
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
774 // -*- 2 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
775 FloatComplexMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
776 xdiv (const FloatComplexMatrix& a, const FloatDiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
777 { return mdm_div_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
778
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
779 // -*- 3 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
780 FloatComplexMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
781 xdiv (const FloatComplexMatrix& a, const FloatComplexDiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
782 { return mdm_div_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
783
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21112
diff changeset
784 template <typename MT, typename DMT>
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
785 MT
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
786 dmm_leftdiv_impl (const DMT& d, const MT& a)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
787 {
12986
f217edac2c71 fix dimension check for A'\B (bug #33997)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
788 if (! mx_leftdiv_conform (d, a, blas_no_trans))
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
789 return MT ();
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
790
18100
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
791 octave_idx_type m = d.cols ();
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
792 octave_idx_type n = a.cols ();
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
793 octave_idx_type k = a.rows ();
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
794 octave_idx_type l = d.length ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
795 MT x (m, n);
8931
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
796 typedef typename DMT::element_type S;
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
797 typedef typename MT::element_type T;
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
798 const T *aa = a.data ();
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
799 const S *dd = d.data ();
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
800 T *xx = x.fortran_vec ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
801
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
802 for (octave_idx_type j = 0; j < n; j++)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
803 {
8931
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
804 for (octave_idx_type i = 0; i < l; i++)
23450
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23433
diff changeset
805 xx[i] = (dd[i] != S () ? aa[i] / dd[i] : T ());
8931
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
806 for (octave_idx_type i = l; i < m; i++)
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
807 xx[i] = T ();
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
808 aa += k; xx += m;
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
809 }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
810
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
811 return x;
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
812 }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
813
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
814 // Left division functions.
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
815 //
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
816 // op2 \ op1: m cm
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
817 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
818 // diag_matrix | 1 | 2 |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
819 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
820 // complex_diag_matrix | | 3 |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
821 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
822
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
823 // -*- 1 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
824 Matrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
825 xleftdiv (const DiagMatrix& a, const Matrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
826 { return dmm_leftdiv_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
827
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
828 // -*- 2 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
829 ComplexMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
830 xleftdiv (const DiagMatrix& a, const ComplexMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
831 { return dmm_leftdiv_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
832
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
833 // -*- 3 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
834 ComplexMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
835 xleftdiv (const ComplexDiagMatrix& a, const ComplexMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
836 { return dmm_leftdiv_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
837
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
838 // Left division functions, float type.
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
839 //
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
840 // op2 \ op1: m cm
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
841 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
842 // diag_matrix | 1 | 2 |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
843 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
844 // complex_diag_matrix | | 3 |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
845 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
846
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
847 // -*- 1 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
848 FloatMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
849 xleftdiv (const FloatDiagMatrix& a, const FloatMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
850 { return dmm_leftdiv_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
851
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
852 // -*- 2 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
853 FloatComplexMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
854 xleftdiv (const FloatDiagMatrix& a, const FloatComplexMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
855 { return dmm_leftdiv_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
856
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
857 // -*- 3 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
858 FloatComplexMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
859 xleftdiv (const FloatComplexDiagMatrix& a, const FloatComplexMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
860 { return dmm_leftdiv_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
861
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
862 // Diagonal by diagonal matrix division.
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
863
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21112
diff changeset
864 template <typename MT, typename DMT>
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
865 MT
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
866 dmdm_div_impl (const MT& a, const DMT& d)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
867 {
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
868 if (! mx_div_conform (a, d))
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
869 return MT ();
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
870
18100
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
871 octave_idx_type m = a.rows ();
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
872 octave_idx_type n = d.rows ();
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
873 octave_idx_type k = d.cols ();
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
874 octave_idx_type l = std::min (m, n);
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
875 octave_idx_type lk = std::min (l, k);
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
876 MT x (m, n);
8931
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
877 typedef typename DMT::element_type S;
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
878 typedef typename MT::element_type T;
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
879 const T *aa = a.data ();
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
880 const S *dd = d.data ();
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
881 T *xx = x.fortran_vec ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
882
8931
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
883 for (octave_idx_type i = 0; i < lk; i++)
23450
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23433
diff changeset
884 xx[i] = (dd[i] != S () ? aa[i] / dd[i] : T ());
8931
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
885 for (octave_idx_type i = lk; i < l; i++)
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
886 xx[i] = T ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
887
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
888 return x;
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
889 }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
890
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
891 // Right division functions.
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
892 //
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
893 // op2 / op1: dm cdm
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
894 // +-- +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
895 // diag_matrix | 1 | |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
896 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
897 // complex_diag_matrix | 2 | 3 |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
898 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
899
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
900 // -*- 1 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
901 DiagMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
902 xdiv (const DiagMatrix& a, const DiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
903 { return dmdm_div_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
904
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
905 // -*- 2 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
906 ComplexDiagMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
907 xdiv (const ComplexDiagMatrix& a, const DiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
908 { return dmdm_div_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
909
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
910 // -*- 3 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
911 ComplexDiagMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
912 xdiv (const ComplexDiagMatrix& a, const ComplexDiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
913 { return dmdm_div_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
914
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
915 // Right division functions, float type.
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
916 //
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
917 // op2 / op1: dm cdm
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
918 // +-- +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
919 // diag_matrix | 1 | |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
920 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
921 // complex_diag_matrix | 2 | 3 |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
922 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
923
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
924 // -*- 1 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
925 FloatDiagMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
926 xdiv (const FloatDiagMatrix& a, const FloatDiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
927 { return dmdm_div_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
928
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
929 // -*- 2 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
930 FloatComplexDiagMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
931 xdiv (const FloatComplexDiagMatrix& a, const FloatDiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
932 { return dmdm_div_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
933
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
934 // -*- 3 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
935 FloatComplexDiagMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
936 xdiv (const FloatComplexDiagMatrix& a, const FloatComplexDiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
937 { return dmdm_div_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
938
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21112
diff changeset
939 template <typename MT, typename DMT>
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
940 MT
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
941 dmdm_leftdiv_impl (const DMT& d, const MT& a)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
942 {
12986
f217edac2c71 fix dimension check for A'\B (bug #33997)
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
943 if (! mx_leftdiv_conform (d, a, blas_no_trans))
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
944 return MT ();
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
945
18100
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
946 octave_idx_type m = d.cols ();
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
947 octave_idx_type n = a.cols ();
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
948 octave_idx_type k = d.rows ();
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
949 octave_idx_type l = std::min (m, n);
6a71e5030df5 Follow coding convention of defining and initializing only 1 variable per line in liboctinterp.
Rik <rik@octave.org>
parents: 17787
diff changeset
950 octave_idx_type lk = std::min (l, k);
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
951 MT x (m, n);
8931
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
952 typedef typename DMT::element_type S;
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
953 typedef typename MT::element_type T;
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
954 const T *aa = a.data ();
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
955 const S *dd = d.data ();
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
956 T *xx = x.fortran_vec ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
957
8931
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
958 for (octave_idx_type i = 0; i < lk; i++)
23450
855122b993da maint: Wrap tertiary operator in parentheses "(COND ? x : y)".
Rik <rik@octave.org>
parents: 23433
diff changeset
959 xx[i] = (dd[i] != S () ? aa[i] / dd[i] : T ());
8931
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
960 for (octave_idx_type i = lk; i < l; i++)
92dd386f0f13 optimize diag matrix division
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
961 xx[i] = T ();
8366
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
962
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
963 return x;
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
964 }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
965
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
966 // Left division functions.
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
967 //
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
968 // op2 \ op1: dm cdm
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
969 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
970 // diag_matrix | 1 | 2 |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
971 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
972 // complex_diag_matrix | | 3 |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
973 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
974
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
975 // -*- 1 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
976 DiagMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
977 xleftdiv (const DiagMatrix& a, const DiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
978 { return dmdm_leftdiv_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
979
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
980 // -*- 2 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
981 ComplexDiagMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
982 xleftdiv (const DiagMatrix& a, const ComplexDiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
983 { return dmdm_leftdiv_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
984
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
985 // -*- 3 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
986 ComplexDiagMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
987 xleftdiv (const ComplexDiagMatrix& a, const ComplexDiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
988 { return dmdm_leftdiv_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
989
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
990 // Left division functions, float type.
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
991 //
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
992 // op2 \ op1: dm cdm
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
993 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
994 // diag_matrix | 1 | 2 |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
995 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
996 // complex_diag_matrix | | 3 |
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
997 // +---+----+
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
998
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
999 // -*- 1 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
1000 FloatDiagMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
1001 xleftdiv (const FloatDiagMatrix& a, const FloatDiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
1002 { return dmdm_leftdiv_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
1003
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
1004 // -*- 2 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
1005 FloatComplexDiagMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
1006 xleftdiv (const FloatDiagMatrix& a, const FloatComplexDiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
1007 { return dmdm_leftdiv_impl (a, b); }
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
1008
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
1009 // -*- 3 -*-
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
1010 FloatComplexDiagMatrix
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
1011 xleftdiv (const FloatComplexDiagMatrix& a, const FloatComplexDiagMatrix& b)
8b1a2555c4e2 implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents: 7789
diff changeset
1012 { return dmdm_leftdiv_impl (a, b); }
29989
b260322f6730 move xdiv, xnorm, and xpow inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
1013
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30564
diff changeset
1014 OCTAVE_END_NAMESPACE(octave)