Mercurial > forge
annotate main/sparsersb/src/sparsersb.cc @ 12610:b5925d668a3a octave-forge
as it was this code did not compile with 4.0.0-rc4.
now it does, and also does with 3.6.2 (just as previously).
author | michelemartone |
---|---|
date | Mon, 04 May 2015 17:18:06 +0000 |
parents | 76d554668a8f |
children | 224e57d04d01 |
rev | line source |
---|---|
8849 | 1 /* |
12395
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
2 Copyright (C) 2011-2014 Michele Martone <michelemartone _AT_ users.sourceforge.net> |
8849 | 3 |
4 This program is free software; you can redistribute it and/or modify | |
5 it under the terms of the GNU General Public License as published by | |
6 the Free Software Foundation; either version 3 of the License, or | |
7 (at your option) any later version. | |
8 | |
9 This program is distributed in the hope that it will be useful, | |
10 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 GNU General Public License for more details. | |
13 | |
14 You should have received a copy of the GNU General Public License | |
15 along with this program; if not, see <http://www.gnu.org/licenses/>. | |
16 */ | |
17 | |
18 /* | |
12533 | 19 * TODO wishlist (patches are welcome!): |
12395
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
20 * adapt to when octave_idx_type is 64 bit long |
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
21 * rsb_file_vec_save (1.1) |
11878
ffd8edaaa76f
packaging oriented notes and suggestions from carandraug.
michelemartone
parents:
11847
diff
changeset
|
22 * all *.m files shall go to inst/ |
ffd8edaaa76f
packaging oriented notes and suggestions from carandraug.
michelemartone
parents:
11847
diff
changeset
|
23 * switch to using bootstrap.sh (instead autogen.sh) and configure.ac with environment variables, so it can be called from pkg install sparsersb-1.0.0.tar.gz |
ffd8edaaa76f
packaging oriented notes and suggestions from carandraug.
michelemartone
parents:
11847
diff
changeset
|
24 * produce ../doc/sparsersb.txi; can use get_help_text |
ffd8edaaa76f
packaging oriented notes and suggestions from carandraug.
michelemartone
parents:
11847
diff
changeset
|
25 * put to ./devel/ what is not to be distributed |
ffd8edaaa76f
packaging oriented notes and suggestions from carandraug.
michelemartone
parents:
11847
diff
changeset
|
26 * make or configure should fail on missing library (actually it does not) |
ffd8edaaa76f
packaging oriented notes and suggestions from carandraug.
michelemartone
parents:
11847
diff
changeset
|
27 * spfind in order to update easily and quickly nonzeroes |
ffd8edaaa76f
packaging oriented notes and suggestions from carandraug.
michelemartone
parents:
11847
diff
changeset
|
28 * need A(IA,JA,VA)=nVA |
11847
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
29 * shall add "load"; implicit filename based is confusing |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
30 * shall rename "load"/"save" to "loadMatrixMarket"/... or something explicit |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
31 * save/load capability (in own, rsb format) |
11733
cd2a1979a6c2
bugfix: rsb_spmm was being invoked incorrectly.
michelemartone
parents:
11731
diff
changeset
|
32 * should not rely on string_value().c_str() --- stack corruption danger! |
11587
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
33 * ("get","RSB_IO_WANT_...") is not yet available |
11581 | 34 * (.) is incomplete. it is needed by trace() |
35 * (:,:) , (:,p) ... do not work, test with octave's bicg, bicgstab, cgs, ... | |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
36 * hints about how to influence caching blocking policy |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
37 * compound_binary_op |
8849 | 38 * for thorough testing, see Octave's test/build_sparse_tests.sh |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
39 * introspection functionality (bytes/nnz, or sparsersb(rsbmat,"inquire: subm") ) |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
40 * sparsersb(rsbmat,"benchmark") |
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
41 * sparsersb(rsbmat,"test") |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
42 * minimize data copies |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
43 * subsref, dotref, subsasgn are incomplete: need error messages there |
9030
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
44 * in full_value(), bool arg is ignored |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
45 * symmetry support is incomplete (scarcely defined) |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
46 * document the semantics of the update and access operators |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
47 * define more operators (e.g.: scaling) for 'complex' |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
48 * create a single standard error macro for constructors |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
49 * test sistematically all constructors |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
50 * often missing array lenghts/type checks |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
51 * may define as map (see is_map) so that "a.type = ..." can work |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
52 * is_struct, find_nonzero_elem_idx are undefined |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
53 * are octave_triangular_conv, default_numeric_conversion_function ok ? |
9192
c1459ddfa0bf
sparsersb: changed order of statements in the main benchmark script (slowest first); more info dumped out in lsbench.m (the linear solver benchmark script).
michelemartone
parents:
9186
diff
changeset
|
54 * error reporting is insufficient |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
55 * update to symmetric be forbidden or rather trigger a conversion ? |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
56 * after file read, return various structural info |
11322
208a1a9bd97f
discontinued use of rsb_assign rsb_transpose rsb_htranspose in favour of rsb_clone_transformed.
michelemartone
parents:
11321
diff
changeset
|
57 * norm computation |
12536 | 58 * reformat code for readability |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
59 * warnings about incomplete complex implementation may be overzealous. |
12533 | 60 * Note: although librsb has been optimized for performance, sparsersb is not. |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
61 |
9092
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
62 * Developer notes: |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
63 http://www.gnu.org/software/octave/doc/interpreter/index.html |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
64 http://www.gnu.org/software/octave/doc/interpreter/Oct_002dFiles.html#Oct_002dFiles |
9092
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
65 http://octave.sourceforge.net/developers.html |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
66 */ |
8849 | 67 |
11450
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
68 #define RSBOI_WANT_PRINT_PCT_OCTAVE_STYLE 1 |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
69 |
8849 | 70 #include <octave/oct.h> |
71 #include <octave/ov-re-mat.h> | |
72 #include <octave/ov-re-sparse.h> | |
73 #include <octave/ov-scalar.h> | |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
74 #include <octave/ov-complex.h> |
8849 | 75 #include <octave/ops.h> |
76 #include <octave/ov-typeinfo.h> | |
12610
b5925d668a3a
as it was this code did not compile with 4.0.0-rc4.
michelemartone
parents:
12538
diff
changeset
|
77 #include <octave/oct-alloc.h> /* DECLARE_OCTAVE_ALLOCATOR */ |
11450
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
78 #if RSBOI_WANT_PRINT_PCT_OCTAVE_STYLE |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
79 #include <iomanip> // std::setprecision |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
80 #endif |
8849 | 81 #include <rsb.h> |
82 | |
12533 | 83 //#define RSBOI_VERBOSE_CONFIG 1 /* poor man's trace facility */ |
12531
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
84 #ifdef RSBOI_VERBOSE_CONFIG /* poor man's trace facility */ |
8923
ba575291987f
sparsersb: added the --with-verbosity-level configure switch, to activate sparsersb (debug) verbosity at build time.
michelemartone
parents:
8886
diff
changeset
|
85 #if (RSBOI_VERBOSE_CONFIG>0) |
ba575291987f
sparsersb: added the --with-verbosity-level configure switch, to activate sparsersb (debug) verbosity at build time.
michelemartone
parents:
8886
diff
changeset
|
86 #define RSBOI_VERBOSE RSBOI_VERBOSE_CONFIG |
ba575291987f
sparsersb: added the --with-verbosity-level configure switch, to activate sparsersb (debug) verbosity at build time.
michelemartone
parents:
8886
diff
changeset
|
87 #endif |
ba575291987f
sparsersb: added the --with-verbosity-level configure switch, to activate sparsersb (debug) verbosity at build time.
michelemartone
parents:
8886
diff
changeset
|
88 #endif |
8849 | 89 |
9006
6b47ccf97a29
sparsersb: turned off excess warnings, added an extra check to diag(), added some more complex tests.
michelemartone
parents:
9005
diff
changeset
|
90 #if 0 |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
91 #define RSBOI_WARN( MSG ) \ |
8988
59cc28163e80
sparsersb: the warning macro will print out now file/line/function info. more functions print out their name in verbose mode. support for conversion to octave_sparse_complex_matrix. complex scaling function in.
michelemartone
parents:
8986
diff
changeset
|
92 octave_stdout << "Warning in "<<__func__<<"(), in file "<<__FILE__<<" at line "<<__LINE__<<":\n" << MSG; |
9213
b7223aab0ddf
sparsersb: typo fix from previous commit, and introducing a rather flimsy RSBOI_FIXME macro.
michelemartone
parents:
9211
diff
changeset
|
93 #define RSBOI_FIXME( MSG ) RSBOI_WARN( MSG )/* new */ |
9006
6b47ccf97a29
sparsersb: turned off excess warnings, added an extra check to diag(), added some more complex tests.
michelemartone
parents:
9005
diff
changeset
|
94 #else |
6b47ccf97a29
sparsersb: turned off excess warnings, added an extra check to diag(), added some more complex tests.
michelemartone
parents:
9005
diff
changeset
|
95 #define RSBOI_WARN( MSG ) |
6b47ccf97a29
sparsersb: turned off excess warnings, added an extra check to diag(), added some more complex tests.
michelemartone
parents:
9005
diff
changeset
|
96 #endif |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
97 #define RSBOI_TODO( MSG ) RSBOI_WARN( MSG )/* new */ |
9213
b7223aab0ddf
sparsersb: typo fix from previous commit, and introducing a rather flimsy RSBOI_FIXME macro.
michelemartone
parents:
9211
diff
changeset
|
98 #define RSBOI_FIXME( MSG ) RSBOI_WARN( "FIXME: "MSG )/* new */ |
9006
6b47ccf97a29
sparsersb: turned off excess warnings, added an extra check to diag(), added some more complex tests.
michelemartone
parents:
9005
diff
changeset
|
99 |
8849 | 100 #define RSBOI_PRINTF( ... ) printf( __VA_ARGS__ ) |
101 #if RSBOI_VERBOSE | |
102 //printf("In file %20s (in %s) at line %10d:\n",__FILE__,__func__,__LINE__), | |
103 #define RSBOI_DEBUG_NOTICE( ... ) \ | |
104 printf("In %s(), in file %s at line %10d:\n",__func__,__FILE__,__LINE__), \ | |
105 printf( __VA_ARGS__ ) | |
8962
720e7558b388
sparsersb: redirecting to octave_stdout all the output from RSBOI_ERROR.
michelemartone
parents:
8961
diff
changeset
|
106 //#define RSBOI_ERROR( ... ) \ |
8849 | 107 printf("In %s(), in file %s at line %10d:\n",__func__,__FILE__,__LINE__), \ |
108 printf( __VA_ARGS__ ) | |
8962
720e7558b388
sparsersb: redirecting to octave_stdout all the output from RSBOI_ERROR.
michelemartone
parents:
8961
diff
changeset
|
109 #define RSBOI_ERROR( MSG ) \ |
9023
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
110 octave_stdout << "In "<<__func__<<"(), in file "<<__FILE__<<" at line "<<__LINE__<<":\n"<<MSG |
8849 | 111 #define RSBOI_DUMP RSBOI_PRINTF |
112 #else | |
113 #define RSBOI_DUMP( ... ) | |
114 #define RSBOI_DEBUG_NOTICE( ... ) | |
115 #define RSBOI_ERROR( ... ) | |
116 #endif | |
9024
b668ce3f155d
sparsersb: typo fix for the previous commit.
michelemartone
parents:
9023
diff
changeset
|
117 #define RSBOI_EERROR( MSG ) \ |
b668ce3f155d
sparsersb: typo fix for the previous commit.
michelemartone
parents:
9023
diff
changeset
|
118 octave_stdout << "In "<<__func__<<"(), in file "<<__FILE__<<" at line "<<__LINE__<<":\n" |
8849 | 119 #define RSBOI_TYPECODE RSB_NUMERICAL_TYPE_DOUBLE |
120 #define RSBOI_RB RSB_DEFAULT_ROW_BLOCKING | |
121 #define RSBOI_CB RSB_DEFAULT_COL_BLOCKING | |
122 //#define RSBOI_RF RSB_FLAG_DEFAULT_STORAGE_FLAGS | |
123 #define RSBOI_RF RSB_FLAG_DEFAULT_RSB_MATRIX_FLAGS | |
9023
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
124 #define RSBOI_DCF RSB_FLAG_DUPLICATES_SUM |
8849 | 125 #define RSBOI_NF RSB_FLAG_NOFLAGS |
11322
208a1a9bd97f
discontinued use of rsb_assign rsb_transpose rsb_htranspose in favour of rsb_clone_transformed.
michelemartone
parents:
11321
diff
changeset
|
126 //#define RSBOI_EXPF RSB_FLAG_NOFLAGS |
208a1a9bd97f
discontinued use of rsb_assign rsb_transpose rsb_htranspose in favour of rsb_clone_transformed.
michelemartone
parents:
11321
diff
changeset
|
127 #define RSBOI_EXPF RSB_FLAG_IDENTICAL_FLAGS |
8849 | 128 #define RSBOI_T double |
129 #undef RSB_FULLY_IMPLEMENTED | |
11330 | 130 #define RSBOI_DESTROY(OM) {rsb_mtx_free(OM);(OM)=NULL;} |
8849 | 131 #define RSBOI_SOME_ERROR(ERRVAL) (ERRVAL)!=RSB_ERR_NO_ERROR |
8925
dce256cb1b31
sparsersb: invoking Octave's error() on critical errors (like when dealing with NULL librsb matrix pointers): in this way octave does not crash on librsb's allocation failures.
michelemartone
parents:
8923
diff
changeset
|
132 #define RSBOI_0_ERROR error |
9023
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
133 #define RSBOI_0_BADINVOERRMSG "invoking this function in the wrong way!\n" |
8925
dce256cb1b31
sparsersb: invoking Octave's error() on critical errors (like when dealing with NULL librsb matrix pointers): in this way octave does not crash on librsb's allocation failures.
michelemartone
parents:
8923
diff
changeset
|
134 #define RSBOI_0_ALLERRMSG "error allocating matrix!\n" |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
135 #define RSBOI_0_NOCOERRMSG "compiled without complex type support!\n" |
9258
9aa231398246
sparsersb: added a script for solving systems from university of florida's collection.
michelemartone
parents:
9241
diff
changeset
|
136 #define RSBOI_0_NOTERRMSG "matrix is not triangular!\n" |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
137 #define RSBOI_0_ICSERRMSG "compiled with incomplete complex type support!\n" |
8925
dce256cb1b31
sparsersb: invoking Octave's error() on critical errors (like when dealing with NULL librsb matrix pointers): in this way octave does not crash on librsb's allocation failures.
michelemartone
parents:
8923
diff
changeset
|
138 #define RSBOI_0_EMERRMSG "data structure is corrupt (unexpected NULL matrix pointer)!\n" |
8985
fb068e31e2d0
sparsersb: fixes to the complex matrix printing method; smaller fixes related to complex.
michelemartone
parents:
8984
diff
changeset
|
139 #define RSBOI_0_UNFFEMSG "unfinished feature\n" |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
140 #define RSBOI_0_INCFERRMSG "incomplete function!\n" |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
141 #define RSBOI_0_INMISMMSG "Index sizes of Octave differs from that of RSB:" " a conversion is needed, but yet unsupported in this version." |
8985
fb068e31e2d0
sparsersb: fixes to the complex matrix printing method; smaller fixes related to complex.
michelemartone
parents:
8984
diff
changeset
|
142 #define RSBOI_0_UNCFEMSG "complex support is yet incomplete\n" |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
143 #define RSBOI_0_NEEDERR "an error condition needs to be handled, here!\n" |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
144 #define RSBOI_0_UNCBERR "matrix NOT correctly built!\n" |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
145 #define RSBOI_0_ALERRMSG "error allocating an rsb matrix!\n" |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
146 #define RSBOI_0_FATALNBMSG "fatal error! matrix NOT built!\n" |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
147 #define RSBOI_0_ASSERRMSG "assignment is still unsupported on 'sparse_rsb' matrices" |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
148 #define RSBOI_0_NSQERRMSG "matrix is not square" |
11847
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
149 #define RSBOI_0_NIYERRMSG "not implemented yet in sparsersb" |
9258
9aa231398246
sparsersb: added a script for solving systems from university of florida's collection.
michelemartone
parents:
9241
diff
changeset
|
150 #define RSBOI_D_EMPTY_MSG "" |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
151 #define RSBOI_O_MISSIMPERRMSG "implementation missing here\n" |
9023
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
152 #define RSBOI_O_NPMSERR "providing non positive matrix size is not allowed!" |
8925
dce256cb1b31
sparsersb: invoking Octave's error() on critical errors (like when dealing with NULL librsb matrix pointers): in this way octave does not crash on librsb's allocation failures.
michelemartone
parents:
8923
diff
changeset
|
153 #define RSBOI_0_EMCHECK(M) if(!(M))RSBOI_0_ERROR(RSBOI_0_EMERRMSG); |
8849 | 154 #define RSBOI_FNSS(S) #S |
155 //#define RSBOI_FNS RSBOI_FNSS(RSB_SPARSERSB_LABEL) | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
156 #define RSBOI_FSTR "Recursive Sparse Blocks" |
8849 | 157 #define RSBOI_FNS "sparsersb" |
9005
6dcaf211c5e4
sparsersb: added a first librsb introspection feature (sparsersb("?")).
michelemartone
parents:
8999
diff
changeset
|
158 #define RSBOI_LIS "?" |
8849 | 159 |
160 #define RSBIO_DEFAULT_CORE_MATRIX Matrix (0,0) | |
11333 | 161 /* FIXME : octave_idx_type vs rsb_coo_idx_t */ |
8849 | 162 #define RSBIO_NULL_STATEMENT_FOR_COMPILER_HAPPINESS {1;} |
163 #define RSBOI_OV_STRIDE 1 | |
164 #define RSBOI_ZERO 0.0 | |
165 //#define RSB_OI_DMTXORDER RSB_FLAG_WANT_ROW_MAJOR_ORDER | |
166 #define RSB_OI_DMTXORDER RSB_FLAG_WANT_COLUMN_MAJOR_ORDER /* for dense matrices (multivectors) */ | |
167 #define RSB_OI_TYPEINFO_STRING "rsb sparse matrix" | |
168 #define RSB_OI_TYPEINFO_TYPE "double" | |
169 | |
170 #ifdef RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX | |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
171 #define RSBOI_WANT_DOUBLE_COMPLEX 1 |
8849 | 172 #define ORSB_RSB_TYPE_FLAG(OBJ) (((OBJ).is_complex_type())?RSB_NUMERICAL_TYPE_DOUBLE:RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX) |
173 #else | |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
174 #define RSBOI_WANT_DOUBLE_COMPLEX 0 |
8849 | 175 #define ORSB_RSB_TYPE_FLAG(OBJ) RSB_NUMERICAL_TYPE_DOUBLE |
176 #endif | |
177 | |
9282
fdc1d84494e8
sparsersb: using the temporary RSB_PRINTF_MATRIX_SUMMARY_ARGS macro to have some extra matrix info printed out.
michelemartone
parents:
9281
diff
changeset
|
178 #define RSBOI_INFOBUF 256 |
9283
32afeae4c953
sparsersb: in the previous commit, symmetry support was enabled by mistake.
michelemartone
parents:
9282
diff
changeset
|
179 #define RSBOI_WANT_SYMMETRY 0 |
11450
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
180 #define RSBOI_WANT_PRINT_DETAIL 0 |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
181 #define RSBOI_WANT_PRINT_COMPLEX_OR_REAL 0 |
8849 | 182 #define RSBOI_WANT_SUBSREF 1 |
183 #define RSBOI_WANT_HEAVY_DEBUG 0 | |
11598
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
184 #define RSBOI_WANT_VECLOAD_INSTEAD_MTX 1 |
11734
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
185 #define RSBOI_WANT_MTX_LOAD 1 |
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
186 #define RSBOI_WANT_MTX_SAVE 1 |
8961
04e915f35fcb
sparsersb: using RSBOI_PERROR instead rsb_perror to warn the user of librsb errors.
michelemartone
parents:
8939
diff
changeset
|
187 //#define RSBOI_PERROR(E) rsb_perror(E) |
11297
cfee6f40e377
bugfix: declared double constants were passed as complex, now no more.
michelemartone
parents:
9614
diff
changeset
|
188 #define RSBOI_PERROR(E) if(RSBOI_SOME_ERROR(E)) rsboi_strerr(E) |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
189 #ifdef RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX |
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
190 #include <octave/ov-cx-mat.h> |
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
191 #include <octave/ov-cx-sparse.h> |
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
192 #endif |
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
193 |
9258
9aa231398246
sparsersb: added a script for solving systems from university of florida's collection.
michelemartone
parents:
9241
diff
changeset
|
194 #ifndef RSBOI_RSB_MATRIX_SOLVE |
9aa231398246
sparsersb: added a script for solving systems from university of florida's collection.
michelemartone
parents:
9241
diff
changeset
|
195 #define RSBOI_RSB_MATRIX_SOLVE(V1,V2) RSBOI_0_ERROR(RSBOI_0_NOTERRMSG) /* any solution routine shall attached here */ |
9aa231398246
sparsersb: added a script for solving systems from university of florida's collection.
michelemartone
parents:
9241
diff
changeset
|
196 #endif |
9aa231398246
sparsersb: added a script for solving systems from university of florida's collection.
michelemartone
parents:
9241
diff
changeset
|
197 |
11691
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
198 #if 1 |
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
199 extern "C" { rsb_err_t rsb_dump_postscript_from_mtx_t(const struct rsb_mtx_t*mtxAp, rsb_blk_idx_t br, rsb_blk_idx_t bc, int width, int height, rsb_bool_t all_nnz); } |
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
200 extern "C" { |
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
201 rsb_err_t rsb_dump_postscript_recursion_from_mtx_t(const struct rsb_mtx_t*mtxAp, rsb_blk_idx_t br, rsb_blk_idx_t bc, int width, int height, rsb_flags_t flags, rsb_bool_t want_blocks, rsb_bool_t z_dump , rsb_bool_t want_nonzeros ); } |
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
202 #endif |
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
203 |
8849 | 204 #if RSBOI_WANT_HEAVY_DEBUG |
205 extern "C" { | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
206 rsb_bool_t rsb_is_correctly_built_rcsr_matrix(const struct rsb_mtx_t *mtxAp); // forward declaration |
8849 | 207 } |
208 #endif | |
11581 | 209 #if defined(RSB_LIBRSB_VER) && (RSB_LIBRSB_VER>=10100) |
210 extern "C" { | |
211 int rsb_do_get_nnz_element(struct rsb_mtx_t*,void*,void*,void*,int); | |
212 } | |
213 #endif | |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
214 #if RSBOI_WANT_DOUBLE_COMPLEX |
9276
8dd56fcc06da
sparsersb: fix to the previous commit, in which I forgot to use is_complex_type().
michelemartone
parents:
9275
diff
changeset
|
215 #define RSBOI_BINOP_PREVAILING_TYPE(V1,V2) (((V1).is_complex_type()||(V2).is_complex_type())?RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX:RSB_NUMERICAL_TYPE_DOUBLE) |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
216 #else |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
217 #define RSBOI_BINOP_PREVAILING_TYPE(V1,V2) RSBOI_TYPECODE |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
218 #endif |
12395
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
219 #if defined(RSB_LIBRSB_VER) && (RSB_LIBRSB_VER>=10100) |
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
220 #define RSBOI_10100_DOC \ |
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
221 "@deftypefnx {Loadable Function} {@var{s} =} "RSBOI_FNS" (@var{A},\"render\", @var{filename}[, @var{rWidth}, @var{rHeight}])\n"\ |
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
222 "If @var{A} is a "RSBOI_FNS" matrix and @var{filename} is a string, @var{A} will be rendered as an Encapsulated Postcript file @var{filename}. Optionally, width and height can be specified. Defaults are 512.\n"\ |
12538
76d554668a8f
the autotune case will accept an optional output argument (to be used for the tuned matrix).
michelemartone
parents:
12537
diff
changeset
|
223 "@deftypefnx {Loadable Function} {[@var{O} =]} "RSBOI_FNS" (@var{A},\"autotune\"[, @var{transA}, @var{nrhs}, @var{maxr}, @var{tmax}, @var{tn}, @var{sf}])\n"\ |
76d554668a8f
the autotune case will accept an optional output argument (to be used for the tuned matrix).
michelemartone
parents:
12537
diff
changeset
|
224 "If @var{A} is a "RSBOI_FNS" matrix, autotuning of the matrix will take place, with SpMV and autotuning parameters. After the \"autotune\" string, the remaining parameters are optional. If giving an output argument @var{O}, that will be assigned to the autotuned matrix, and the input one @var{A} will remain unchanged.\n" |
12395
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
225 #else |
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
226 #define RSBOI_10100_DOC "" |
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
227 #endif |
8849 | 228 |
11297
cfee6f40e377
bugfix: declared double constants were passed as complex, now no more.
michelemartone
parents:
9614
diff
changeset
|
229 void rsboi_strerr(rsb_err_t errval) |
cfee6f40e377
bugfix: declared double constants were passed as complex, now no more.
michelemartone
parents:
9614
diff
changeset
|
230 { |
cfee6f40e377
bugfix: declared double constants were passed as complex, now no more.
michelemartone
parents:
9614
diff
changeset
|
231 const int errstrlen=128; |
cfee6f40e377
bugfix: declared double constants were passed as complex, now no more.
michelemartone
parents:
9614
diff
changeset
|
232 char errstr[errstrlen]; |
cfee6f40e377
bugfix: declared double constants were passed as complex, now no more.
michelemartone
parents:
9614
diff
changeset
|
233 rsb_strerror_r(errval,errstr,errstrlen); |
cfee6f40e377
bugfix: declared double constants were passed as complex, now no more.
michelemartone
parents:
9614
diff
changeset
|
234 octave_stdout<<"librsb error:"<<errstr<<"\n"; |
cfee6f40e377
bugfix: declared double constants were passed as complex, now no more.
michelemartone
parents:
9614
diff
changeset
|
235 } |
cfee6f40e377
bugfix: declared double constants were passed as complex, now no more.
michelemartone
parents:
9614
diff
changeset
|
236 |
9211
fb22d6bcb312
sparsersb: code cleanup: removing some now obsolete code; renaming properly some methods and a struct.
michelemartone
parents:
9192
diff
changeset
|
237 struct rsboi_coo_matrix_t |
8849 | 238 { |
239 octave_idx_type * IA, * JA; /** row and columns indices */ | |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
240 octave_idx_type nrA,ncA; /** matrix (declared) nonzeros */ |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
241 octave_idx_type nnzA; /** matrix rows, columns */ |
9211
fb22d6bcb312
sparsersb: code cleanup: removing some now obsolete code; renaming properly some methods and a struct.
michelemartone
parents:
9192
diff
changeset
|
242 void * VA; /** values of data elements */ |
8849 | 243 rsb_type_t typecode; /** as specified in the RSB_NUMERICAL_TYPE_* preprocessor symbols in types.h */ |
244 }; | |
245 | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
246 static const RSBOI_T rsboi_pone[]={+1.0,0.0}; |
11297
cfee6f40e377
bugfix: declared double constants were passed as complex, now no more.
michelemartone
parents:
9614
diff
changeset
|
247 static const RSBOI_T rsboi_mone[]={-1.0,0.0}; |
cfee6f40e377
bugfix: declared double constants were passed as complex, now no more.
michelemartone
parents:
9614
diff
changeset
|
248 static const RSBOI_T rsboi_zero[]={ 0.0,0.0}; /* two elements, as shall work also with complex */ |
8849 | 249 |
250 static octave_base_value * default_numeric_conversion_function (const octave_base_value& a); | |
251 | |
9030
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
252 static bool sparsersb_tester(void) |
8849 | 253 { |
11333 | 254 if(sizeof(octave_idx_type)!=sizeof(rsb_coo_idx_t)) |
8849 | 255 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
256 RSBOI_ERROR(RSBOI_0_INMISMMSG); |
8849 | 257 goto err; |
258 } | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
259 RSBOI_WARN(RSBOI_0_INCFERRMSG); |
8849 | 260 return true; |
261 err: | |
262 return false; | |
263 } | |
264 | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
265 static bool rsboi_sparse_rsb_loaded = false; |
8849 | 266 |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
267 class octave_sparsersb_mtx : public octave_sparse_matrix |
8849 | 268 { |
269 private: | |
270 public: | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
271 struct rsb_mtx_t * mtxAp; |
8849 | 272 public: |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
273 octave_sparsersb_mtx (void) : octave_sparse_matrix(RSBIO_DEFAULT_CORE_MATRIX) |
8849 | 274 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
275 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
276 this->mtxAp = NULL; |
8988
59cc28163e80
sparsersb: the warning macro will print out now file/line/function info. more functions print out their name in verbose mode. support for conversion to octave_sparse_complex_matrix. complex scaling function in.
michelemartone
parents:
8986
diff
changeset
|
277 } |
8849 | 278 |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
279 octave_sparsersb_mtx (const octave_sparse_matrix &sm) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) |
8849 | 280 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
281 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8849 | 282 } |
283 | |
11734
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
284 #if RSBOI_WANT_MTX_LOAD |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
285 octave_sparsersb_mtx (const std::string &mtxfilename, rsb_type_t typecode = RSBOI_TYPECODE) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) |
8849 | 286 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
287 rsb_err_t errval = RSB_ERR_NO_ERROR; |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
288 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
289 if(!(this->mtxAp = rsb_file_mtx_load(mtxfilename.c_str(),RSBOI_RF,typecode,&errval))) |
11598
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
290 #if RSBOI_WANT_VECLOAD_INSTEAD_MTX |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
291 /* no problem */; |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
292 #else |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
293 RSBOI_ERROR(RSBOI_0_ALERRMSG); |
8961
04e915f35fcb
sparsersb: using RSBOI_PERROR instead rsb_perror to warn the user of librsb errors.
michelemartone
parents:
8939
diff
changeset
|
294 RSBOI_PERROR(errval); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
295 if(!this->mtxAp) |
8925
dce256cb1b31
sparsersb: invoking Octave's error() on critical errors (like when dealing with NULL librsb matrix pointers): in this way octave does not crash on librsb's allocation failures.
michelemartone
parents:
8923
diff
changeset
|
296 RSBOI_0_ERROR(RSBOI_0_ALLERRMSG); |
11598
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
297 #endif |
8849 | 298 } |
11734
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
299 #endif |
8849 | 300 |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
301 //void alloc_rsb_mtx_from_coo_copy(const idx_vector &IM, const idx_vector &JM, const void * SMp, octave_idx_type nrA, octave_idx_type ncA, bool iscomplex=false, rsb_flags_t eflags=RSBOI_DCF) |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
302 void alloc_rsb_mtx_from_coo_copy(idx_vector & IM, idx_vector & JM, const void * SMp, octave_idx_type nrA, octave_idx_type ncA, bool iscomplex=false, rsb_flags_t eflags=RSBOI_DCF) |
8849 | 303 { |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
304 octave_idx_type nnzA=IM.length(); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
305 rsb_err_t errval = RSB_ERR_NO_ERROR; |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
306 #if RSBOI_WANT_DOUBLE_COMPLEX |
9213
b7223aab0ddf
sparsersb: typo fix from previous commit, and introducing a rather flimsy RSBOI_FIXME macro.
michelemartone
parents:
9211
diff
changeset
|
307 rsb_type_t typecode=iscomplex?RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX:RSB_NUMERICAL_TYPE_DOUBLE; |
12533 | 308 #else /* RSBOI_WANT_DOUBLE_COMPLEX */ |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
309 rsb_type_t typecode = RSBOI_TYPECODE; |
12533 | 310 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
311 const rsb_coo_idx_t *IA = NULL,*JA = NULL; |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
312 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
313 #if RSBOI_WANT_SYMMETRY |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
314 /* shall verify if any symmetry is present */ |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
315 #endif |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
316 IA = (const rsb_coo_idx_t*)IM.raw(); |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
317 JA = (const rsb_coo_idx_t*)JM.raw(); |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
318 //RSB_DO_FLAG_ADD(eflags,rsb_util_determine_uplo_flags(IA,JA,nnzA)); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
319 if(!(this->mtxAp = rsb_mtx_alloc_from_coo_const(SMp,IA,JA,nnzA,typecode,nrA,ncA,RSBOI_RB,RSBOI_CB,RSBOI_RF|eflags ,&errval))) |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
320 RSBOI_ERROR(RSBOI_0_ALERRMSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
321 //RSBOI_MP(this->mtxAp); |
8961
04e915f35fcb
sparsersb: using RSBOI_PERROR instead rsb_perror to warn the user of librsb errors.
michelemartone
parents:
8939
diff
changeset
|
322 RSBOI_PERROR(errval); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
323 if(!this->mtxAp) |
8925
dce256cb1b31
sparsersb: invoking Octave's error() on critical errors (like when dealing with NULL librsb matrix pointers): in this way octave does not crash on librsb's allocation failures.
michelemartone
parents:
8923
diff
changeset
|
324 RSBOI_0_ERROR(RSBOI_0_ALLERRMSG); |
8849 | 325 } |
326 | |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
327 #if RSBOI_WANT_DOUBLE_COMPLEX |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
328 octave_sparsersb_mtx (idx_vector &IM, idx_vector &JM, const ComplexMatrix &SM, |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
329 octave_idx_type nrA, octave_idx_type ncA, rsb_flags_t eflags) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) |
9135
9b1a1cbd7c46
sparsersb: using to-idx_vector conversion for indices, gaining some 20% gain in find-to-librsb constructor speed.
michelemartone
parents:
9130
diff
changeset
|
330 { |
9b1a1cbd7c46
sparsersb: using to-idx_vector conversion for indices, gaining some 20% gain in find-to-librsb constructor speed.
michelemartone
parents:
9130
diff
changeset
|
331 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
332 this->alloc_rsb_mtx_from_coo_copy(IM,JM,SM.data(),nrA,ncA,true,eflags); |
9135
9b1a1cbd7c46
sparsersb: using to-idx_vector conversion for indices, gaining some 20% gain in find-to-librsb constructor speed.
michelemartone
parents:
9130
diff
changeset
|
333 } |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
334 #endif |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
335 |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
336 octave_sparsersb_mtx (idx_vector &IM, idx_vector &JM, const Matrix &SM, |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
337 octave_idx_type nrA, octave_idx_type ncA, rsb_flags_t eflags) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) |
9135
9b1a1cbd7c46
sparsersb: using to-idx_vector conversion for indices, gaining some 20% gain in find-to-librsb constructor speed.
michelemartone
parents:
9130
diff
changeset
|
338 { |
9b1a1cbd7c46
sparsersb: using to-idx_vector conversion for indices, gaining some 20% gain in find-to-librsb constructor speed.
michelemartone
parents:
9130
diff
changeset
|
339 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
340 this->alloc_rsb_mtx_from_coo_copy(IM,JM,SM.data(),nrA,ncA,false,eflags); |
9135
9b1a1cbd7c46
sparsersb: using to-idx_vector conversion for indices, gaining some 20% gain in find-to-librsb constructor speed.
michelemartone
parents:
9130
diff
changeset
|
341 } |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
342 |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
343 void alloc_rsb_mtx_from_csc_copy(const SparseMatrix &sm) |
8849 | 344 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
345 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
346 rsb_nnz_idx_t nnzA = 0; |
11333 | 347 Array<rsb_coo_idx_t> IA( dim_vector(1,sm.nnz()) ); |
348 Array<rsb_coo_idx_t> JA( dim_vector(1,sm.nnz()) ); | |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
349 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
350 /* bool islowtri=sm.is_lower_triangular(),isupptri=sm.is_upper_triangular(); */ |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
351 rsb_flags_t eflags = RSBOI_RF; |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
352 rsb_type_t typecode = RSB_NUMERICAL_TYPE_DOUBLE; |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
353 octave_idx_type nrA = sm.rows (), ncA = sm.cols (); |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
354 #if RSBOI_WANT_SYMMETRY |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
355 if(sm.is_symmetric()) |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
356 RSB_DO_FLAG_ADD(eflags,RSB_FLAG_LOWER_SYMMETRIC|RSB_FLAG_TRIANGULAR); |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
357 #endif |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
358 if(!(this->mtxAp = rsb_mtx_alloc_from_csc_const(sm.data(),sm.ridx(),sm.cidx(), nnzA=sm.nnz(),typecode, nrA, ncA, RSBOI_RB, RSBOI_CB, eflags,&errval))) |
9129
cb81eb17973b
sparsersb: transition towards using the from-csc constructor for rsb.
michelemartone
parents:
9127
diff
changeset
|
359 RSBOI_ERROR(RSBOI_0_ALLERRMSG); |
8961
04e915f35fcb
sparsersb: using RSBOI_PERROR instead rsb_perror to warn the user of librsb errors.
michelemartone
parents:
8939
diff
changeset
|
360 RSBOI_PERROR(errval); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
361 if(!this->mtxAp) |
8925
dce256cb1b31
sparsersb: invoking Octave's error() on critical errors (like when dealing with NULL librsb matrix pointers): in this way octave does not crash on librsb's allocation failures.
michelemartone
parents:
8923
diff
changeset
|
362 RSBOI_0_ERROR(RSBOI_0_ALLERRMSG); |
8849 | 363 } |
364 | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
365 octave_sparsersb_mtx (const Matrix &m) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
366 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
367 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
368 SparseMatrix sm(m); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
369 this->alloc_rsb_mtx_from_csc_copy(sm); |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
370 } |
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
371 |
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
372 #if RSBOI_WANT_DOUBLE_COMPLEX |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
373 void alloc_rsb_mtx_from_csc_copy(const SparseComplexMatrix &sm) |
8849 | 374 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
375 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
376 octave_idx_type nrA = sm.rows (); |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
377 octave_idx_type ncA = sm.cols (); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
378 octave_idx_type nnzA = 0; |
11333 | 379 Array<rsb_coo_idx_t> IA( dim_vector(1,sm.nnz()) ); |
380 Array<rsb_coo_idx_t> JA( dim_vector(1,sm.nnz()) ); | |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
381 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
382 /* bool islowtri=sm.is_lower_triangular(),isupptri=sm.is_upper_triangular(); */ |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
383 rsb_flags_t eflags = RSBOI_RF; |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
384 rsb_type_t typecode = RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX; |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
385 #if RSBOI_WANT_SYMMETRY |
9280
4603db7be80a
sparsersb: adapting to the new rsb_clone_transformed interface. symmetry fixes (still inactive though).
michelemartone
parents:
9276
diff
changeset
|
386 if(sm.is_hermitian()) |
4603db7be80a
sparsersb: adapting to the new rsb_clone_transformed interface. symmetry fixes (still inactive though).
michelemartone
parents:
9276
diff
changeset
|
387 RSB_DO_FLAG_ADD(eflags,RSB_FLAG_LOWER_HERMITIAN|RSB_FLAG_TRIANGULAR); |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
388 #endif |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
389 if(!(this->mtxAp = rsb_mtx_alloc_from_csc_const(sm.data(),sm.ridx(),sm.cidx(), nnzA=sm.nnz(),typecode, nrA, ncA, RSBOI_RB, RSBOI_CB, eflags,&errval))) |
9130
e08ecf65de9f
sparsersb: using librsb's from-csc constructor by default.
michelemartone
parents:
9129
diff
changeset
|
390 RSBOI_ERROR(RSBOI_0_ALLERRMSG); |
8961
04e915f35fcb
sparsersb: using RSBOI_PERROR instead rsb_perror to warn the user of librsb errors.
michelemartone
parents:
8939
diff
changeset
|
391 RSBOI_PERROR(errval); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
392 if(!this->mtxAp) |
8925
dce256cb1b31
sparsersb: invoking Octave's error() on critical errors (like when dealing with NULL librsb matrix pointers): in this way octave does not crash on librsb's allocation failures.
michelemartone
parents:
8923
diff
changeset
|
393 RSBOI_0_ERROR(RSBOI_0_ALLERRMSG); |
8849 | 394 } |
395 | |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
396 octave_sparsersb_mtx (const ComplexMatrix &cm) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
397 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
398 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
399 this->alloc_rsb_mtx_from_csc_copy(SparseComplexMatrix(cm)); |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
400 } |
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
401 |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
402 octave_sparsersb_mtx (const SparseComplexMatrix &sm, rsb_type_t typecode = RSBOI_TYPECODE) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
403 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
404 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
405 this->alloc_rsb_mtx_from_csc_copy(sm); |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
406 } |
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
407 #endif |
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
408 |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
409 octave_sparsersb_mtx (const SparseMatrix &sm, rsb_type_t typecode = RSBOI_TYPECODE) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX) |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
410 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
411 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
412 this->alloc_rsb_mtx_from_csc_copy(sm); |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
413 } |
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
414 |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
415 octave_sparsersb_mtx (struct rsb_mtx_t * mtxBp) : octave_sparse_matrix (RSBIO_DEFAULT_CORE_MATRIX), mtxAp(mtxBp) |
9092
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
416 { |
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
417 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
418 if(!this->mtxAp) |
9092
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
419 RSBOI_0_ERROR(RSBOI_0_ALLERRMSG); |
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
420 } |
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
421 |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
422 octave_sparsersb_mtx (const octave_sparsersb_mtx& T) : |
11322
208a1a9bd97f
discontinued use of rsb_assign rsb_transpose rsb_htranspose in favour of rsb_clone_transformed.
michelemartone
parents:
11321
diff
changeset
|
423 octave_sparse_matrix (T) { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
424 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
425 struct rsb_mtx_t*mtxBp=NULL; |
11322
208a1a9bd97f
discontinued use of rsb_assign rsb_transpose rsb_htranspose in favour of rsb_clone_transformed.
michelemartone
parents:
11321
diff
changeset
|
426 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
427 errval = rsb_mtx_clone(&mtxBp,RSB_NUMERICAL_TYPE_SAME_TYPE,RSB_TRANSPOSITION_N,NULL,T.mtxAp,RSBOI_EXPF); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
428 this->mtxAp=mtxBp; |
11322
208a1a9bd97f
discontinued use of rsb_assign rsb_transpose rsb_htranspose in favour of rsb_clone_transformed.
michelemartone
parents:
11321
diff
changeset
|
429 }; |
8849 | 430 octave_idx_type length (void) const { return this->nnz(); } |
431 octave_idx_type nelem (void) const { return this->nnz(); } | |
432 octave_idx_type numel (void) const { return this->nnz(); } | |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
433 octave_idx_type nnz (void) const { rsb_nnz_idx_t nnzA = 0; RSBOI_0_EMCHECK(this->mtxAp); rsb_mtx_get_info(this->mtxAp,RSB_MIF_MATRIX_NNZ__TO__RSB_NNZ_INDEX_T,&nnzA); return nnzA;} |
8849 | 434 dim_vector dims (void) const { return (dim_vector(this->rows(),this->cols())); } |
435 octave_idx_type dim1 (void) const { return this->rows(); } | |
436 octave_idx_type dim2 (void) const { return this->cols(); } | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
437 octave_idx_type rows (void) const { rsb_coo_idx_t Anr=0; RSBOI_0_EMCHECK(this->mtxAp); rsb_mtx_get_info(this->mtxAp,RSB_MIF_MATRIX_ROWS__TO__RSB_COO_INDEX_T,&Anr); return Anr;} |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
438 octave_idx_type cols (void) const { rsb_coo_idx_t Anc=0; RSBOI_0_EMCHECK(this->mtxAp); rsb_mtx_get_info(this->mtxAp,RSB_MIF_MATRIX_COLS__TO__RSB_COO_INDEX_T,&Anc); return Anc;} |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
439 rsb_flags_t rsbflags(void) const { rsb_flags_t Aflags=0; RSBOI_0_EMCHECK(this->mtxAp); rsb_mtx_get_info(this->mtxAp,RSB_MIF_MATRIX_FLAGS__TO__RSB_FLAGS_T,&Aflags); return Aflags;} |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
440 rsb_type_t rsbtype(void) const { rsb_type_t Atype=0; RSBOI_0_EMCHECK(this->mtxAp); rsb_mtx_get_info(this->mtxAp,RSB_MIF_MATRIX_TYPECODE__TO__RSB_TYPE_T,&Atype); return Atype;} |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
441 //octave_idx_type rows (void) const { RSBOI_0_EMCHECK(this->mtxAp);return this->mtxAp->nrA; } |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
442 //octave_idx_type cols (void) const { RSBOI_0_EMCHECK(this->mtxAp);return this->mtxAp->ncA; } |
8849 | 443 octave_idx_type columns (void) const { return this->cols(); } |
444 octave_idx_type nzmax (void) const { return this->nnz(); } | |
445 octave_idx_type capacity (void) const { return this->nnz(); } | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
446 size_t byte_size (void) const { RSBOI_0_EMCHECK(this->mtxAp);size_t so=0;rsb_mtx_get_info(this->mtxAp,RSB_MIF_TOTAL_SIZE__TO__SIZE_T,&so);return so; } |
8849 | 447 |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
448 virtual ~octave_sparsersb_mtx (void) |
8849 | 449 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
450 RSBOI_DEBUG_NOTICE("destroying librsb matrix %p\n",this->mtxAp); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
451 RSBOI_DESTROY(this->mtxAp); |
9211
fb22d6bcb312
sparsersb: code cleanup: removing some now obsolete code; renaming properly some methods and a struct.
michelemartone
parents:
9192
diff
changeset
|
452 } |
8849 | 453 |
454 virtual octave_base_value *clone (void) const | |
455 { | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
456 RSBOI_DEBUG_NOTICE("cloning librsb matrix %p\n",this->mtxAp); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
457 return new octave_sparsersb_mtx (*this); |
8849 | 458 } |
459 | |
460 virtual octave_base_value *empty_clone (void) const | |
461 { | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
462 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
463 return new octave_sparsersb_mtx (); |
8849 | 464 } |
465 | |
466 #if 0 | |
467 octave_value do_index_op(const octave_value_list& idx, bool resize_ok) | |
468 { | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
469 ... |
9211
fb22d6bcb312
sparsersb: code cleanup: removing some now obsolete code; renaming properly some methods and a struct.
michelemartone
parents:
9192
diff
changeset
|
470 } |
8849 | 471 #endif |
472 | |
473 virtual SparseMatrix sparse_matrix_value(bool = false)const | |
474 { | |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
475 struct rsboi_coo_matrix_t rcm; |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
476 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
477 rsb_nnz_idx_t nnzA,nzi; |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
478 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
479 RSBOI_0_EMCHECK(this->mtxAp); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
480 nnzA = this->nnz(); |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
481 Array<octave_idx_type> IA( dim_vector(1,nnzA) ); |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
482 Array<octave_idx_type> JA( dim_vector(1,nnzA) ); |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
483 Array<RSBOI_T> VA( dim_vector(1,nnzA) ); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
484 rcm.IA = (rsb_coo_idx_t*)IA.data(),rcm.JA = (rsb_coo_idx_t*)JA.data(); |
9008
4bf7484b77eb
sparsersb: sparse_complex_matrix_value for double rsb matrix, sparse_matrix_value for complex rsb matrix
michelemartone
parents:
9006
diff
changeset
|
485 if(!this->is_real_type()) |
4bf7484b77eb
sparsersb: sparse_complex_matrix_value for double rsb matrix, sparse_matrix_value for complex rsb matrix
michelemartone
parents:
9006
diff
changeset
|
486 { |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
487 Array<Complex> VAC( dim_vector(1,nnzA) ); |
9338
79d71af23811
sparsersb: caching the result of some accessor function in a variable for reuse in a loop (trivial optimization).
michelemartone
parents:
9283
diff
changeset
|
488 RSBOI_T* VAp=((RSBOI_T*)VA.data()); |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
489 rcm.VA=(RSBOI_T*)VAC.data(); |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
490 #if RSBOI_WANT_SYMMETRY |
11602 | 491 /* FIXME: and now ? shall we expand symmetry or not ? */ |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
492 #endif |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
493 /* FIXME: shall use some librsb's dedicated call for this */ |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
494 errval = rsb_mtx_get_coo(this->mtxAp,rcm.VA,rcm.IA,rcm.JA,RSB_FLAG_C_INDICES_INTERFACE); |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
495 for(nzi=0;nzi<nnzA;++nzi) |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
496 VAp[nzi]=((RSBOI_T*)rcm.VA)[2*nzi]; |
9008
4bf7484b77eb
sparsersb: sparse_complex_matrix_value for double rsb matrix, sparse_matrix_value for complex rsb matrix
michelemartone
parents:
9006
diff
changeset
|
497 } |
4bf7484b77eb
sparsersb: sparse_complex_matrix_value for double rsb matrix, sparse_matrix_value for complex rsb matrix
michelemartone
parents:
9006
diff
changeset
|
498 else |
4bf7484b77eb
sparsersb: sparse_complex_matrix_value for double rsb matrix, sparse_matrix_value for complex rsb matrix
michelemartone
parents:
9006
diff
changeset
|
499 { |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
500 rcm.VA=(RSBOI_T*)VA.data(); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
501 errval = rsb_mtx_get_coo(this->mtxAp,rcm.VA,rcm.IA,rcm.JA,RSB_FLAG_C_INDICES_INTERFACE); |
9008
4bf7484b77eb
sparsersb: sparse_complex_matrix_value for double rsb matrix, sparse_matrix_value for complex rsb matrix
michelemartone
parents:
9006
diff
changeset
|
502 } |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
503 rcm.nrA = this->rows(); |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
504 rcm.ncA = this->cols(); |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
505 return SparseMatrix(VA,IA,JA,rcm.nrA,rcm.ncA); |
8985
fb068e31e2d0
sparsersb: fixes to the complex matrix printing method; smaller fixes related to complex.
michelemartone
parents:
8984
diff
changeset
|
506 } |
fb068e31e2d0
sparsersb: fixes to the complex matrix printing method; smaller fixes related to complex.
michelemartone
parents:
8984
diff
changeset
|
507 |
9030
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
508 virtual Matrix matrix_value(bool = false)const |
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
509 { |
9213
b7223aab0ddf
sparsersb: typo fix from previous commit, and introducing a rather flimsy RSBOI_FIXME macro.
michelemartone
parents:
9211
diff
changeset
|
510 RSBOI_FIXME("inefficient!"); |
9030
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
511 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
512 Matrix cm = this->sparse_matrix_value().matrix_value(); |
9030
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
513 return cm; |
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
514 } |
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
515 |
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
516 virtual octave_value full_value(void)const |
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
517 { |
9213
b7223aab0ddf
sparsersb: typo fix from previous commit, and introducing a rather flimsy RSBOI_FIXME macro.
michelemartone
parents:
9211
diff
changeset
|
518 RSBOI_FIXME("inefficient!"); |
9030
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
519 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
520 if(this->is_real_type()) |
9211
fb22d6bcb312
sparsersb: code cleanup: removing some now obsolete code; renaming properly some methods and a struct.
michelemartone
parents:
9192
diff
changeset
|
521 return this->matrix_value(); |
9030
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
522 else |
9211
fb22d6bcb312
sparsersb: code cleanup: removing some now obsolete code; renaming properly some methods and a struct.
michelemartone
parents:
9192
diff
changeset
|
523 return this->complex_matrix_value(); |
9030
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
524 } |
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
525 |
8999
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
526 #if RSBOI_WANT_DOUBLE_COMPLEX |
9030
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
527 virtual ComplexMatrix complex_matrix_value(bool = false)const |
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
528 { |
9213
b7223aab0ddf
sparsersb: typo fix from previous commit, and introducing a rather flimsy RSBOI_FIXME macro.
michelemartone
parents:
9211
diff
changeset
|
529 RSBOI_FIXME("inefficient!"); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
530 octave_sparse_complex_matrix ocm = this->sparse_complex_matrix_value(); |
9030
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
531 ComplexMatrix cm=ocm.complex_matrix_value(); |
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
532 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
533 return cm; |
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
534 } |
d4578bbc9fce
sparsersb: interfaced to-full conversion; more operations in the tester.
michelemartone
parents:
9024
diff
changeset
|
535 |
8985
fb068e31e2d0
sparsersb: fixes to the complex matrix printing method; smaller fixes related to complex.
michelemartone
parents:
8984
diff
changeset
|
536 virtual SparseComplexMatrix sparse_complex_matrix_value(bool = false)const |
fb068e31e2d0
sparsersb: fixes to the complex matrix printing method; smaller fixes related to complex.
michelemartone
parents:
8984
diff
changeset
|
537 { |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
538 struct rsboi_coo_matrix_t rcm; |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
539 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
540 rsb_nnz_idx_t nnzA,nzi; |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
541 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
542 RSBOI_0_EMCHECK(this->mtxAp); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
543 nnzA = this->nnz(); |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
544 Array<octave_idx_type> IA( dim_vector(1,nnzA) ); |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
545 Array<octave_idx_type> JA( dim_vector(1,nnzA) ); |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
546 Array<Complex> VA( dim_vector(1,nnzA) ); |
9338
79d71af23811
sparsersb: caching the result of some accessor function in a variable for reuse in a loop (trivial optimization).
michelemartone
parents:
9283
diff
changeset
|
547 RSBOI_T* VAp=((RSBOI_T*)VA.data()); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
548 rcm.IA = (rsb_coo_idx_t*)IA.data(),rcm.JA = (rsb_coo_idx_t*)JA.data(); |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
549 rcm.VA=VAp; |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
550 errval = rsb_mtx_get_coo(this->mtxAp,rcm.VA,rcm.IA,rcm.JA,RSB_FLAG_C_INDICES_INTERFACE); |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
551 #if RSBOI_WANT_SYMMETRY |
11602 | 552 /* FIXME: and now ? shall we expand symmetry or not ? */ |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
553 #endif |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
554 /* FIXME: shall use some librsb's dedicated call for this */ |
9008
4bf7484b77eb
sparsersb: sparse_complex_matrix_value for double rsb matrix, sparse_matrix_value for complex rsb matrix
michelemartone
parents:
9006
diff
changeset
|
555 if(this->is_real_type()) |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
556 for(nzi=0;nzi<nnzA;++nzi) |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
557 VAp[2*(nnzA-1-nzi)+0]=VAp[(nnzA-1-nzi)+0], |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
558 VAp[2*(nnzA-1-nzi)+1]=0; |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
559 rcm.nrA = this->rows(); |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
560 rcm.ncA = this->cols(); |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
561 return SparseComplexMatrix(VA,IA,JA,rcm.nrA,rcm.ncA); |
8849 | 562 } |
12533 | 563 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
8849 | 564 |
11649
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
565 //octave_value::assign_op, int, int, octave_value (&)(const octave_base_value&, const octave_base_value&) |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
566 //octave_value::assign_op, int, int, octave_value (&) |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
567 //octave_value assign_op (const octave_base_value&, const octave_base_value&) {} |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
568 // octave_value::assign_op octave_value::binary_op_to_assign_op (binary_op op) { assign_op retval; return retval; } |
8849 | 569 #if RSBOI_WANT_SUBSREF |
570 octave_value subsref (const std::string &type, const std::list<octave_value_list>& idx) | |
571 { | |
572 octave_value retval; | |
573 int skip = 1; | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
574 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
575 rsb_err_t errval = RSB_ERR_NO_ERROR; |
8849 | 576 |
577 switch (type[0]) | |
578 { | |
579 case '(': | |
580 if (type.length () == 1) | |
581 { | |
582 octave_idx_type n_idx = idx.front().length (); | |
11581 | 583 if (n_idx == 1 ) |
584 { | |
585 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); | |
586 idx_vector i = idx.front() (0).index_vector (); | |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
587 #if defined(RSB_LIBRSB_VER) && (RSB_LIBRSB_VER< 10100) |
11581 | 588 octave_idx_type ii=i(0); |
589 RSBOI_ERROR(""); | |
590 #elif defined(RSB_LIBRSB_VER) && (RSB_LIBRSB_VER>=10100) | |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
591 octave_idx_type ii=i(0); |
11581 | 592 RSBOI_DEBUG_NOTICE("get_element (%d)\n",ii); |
593 if(is_real_type()) | |
594 { | |
595 RSBOI_T rv; | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
596 errval = rsb_do_get_nnz_element(this->mtxAp,&rv,NULL,NULL,ii); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
597 retval = rv; |
11581 | 598 } |
599 else | |
600 { | |
601 Complex rv; | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
602 errval = rsb_do_get_nnz_element(this->mtxAp,&rv,NULL,NULL,ii); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
603 retval = rv; |
11581 | 604 } |
605 if(RSBOI_SOME_ERROR(errval)) | |
606 { | |
607 if(ii>=this->nnz() || ii<0) | |
608 error ("trying accessing element %d: index out of bounds !",ii+1); | |
609 else | |
610 error ("trying accessing element %d: this seems bug!",ii+1); | |
611 } | |
612 #endif | |
613 } | |
614 else | |
8849 | 615 if (n_idx == 2 ) |
616 { | |
617 idx_vector i = idx.front() (0).index_vector (); | |
618 if (! error_state) | |
619 { | |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
620 #if RSBOI_WANT_SYMMETRY |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
621 /* FIXME: and now ? */ |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
622 #endif |
8999
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
623 if(is_real_type()) |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
624 { |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
625 idx_vector j = idx.front() (1).index_vector (); |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
626 RSBOI_T rv; |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
627 octave_idx_type ii=-1,jj=-1; |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
628 ii=i(0); jj=j(0); |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
629 RSBOI_DEBUG_NOTICE("get_elements (%d %d)\n",ii,jj); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
630 errval = rsb_mtx_get_values(this->mtxAp,&rv,&ii,&jj,1,RSBOI_NF); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
631 retval = rv; |
8999
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
632 if (! error_state) |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
633 ; |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
634 } |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
635 else |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
636 { |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
637 idx_vector j = idx.front() (1).index_vector (); |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
638 Complex rv; |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
639 octave_idx_type ii=-1,jj=-1; |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
640 ii=i(0); jj=j(0); |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
641 RSBOI_DEBUG_NOTICE("get_elements (%d %d) complex\n",ii,jj); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
642 errval = rsb_mtx_get_values(this->mtxAp,&rv,&ii,&jj,1,RSBOI_NF); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
643 retval = rv; |
8999
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
644 if (! error_state) |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
645 ; |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
646 } |
8849 | 647 } |
648 } | |
649 } | |
650 break; | |
651 case '.': | |
652 RSBOI_DEBUG_NOTICE("UNFINISHED\n"); | |
653 break; | |
654 | |
655 case '{': | |
656 error ("%s cannot be indexed with %c", type_name().c_str(), type[0]); | |
657 break; | |
658 | |
659 default: | |
660 panic_impossible (); | |
661 } | |
662 if (! error_state) | |
663 retval = retval.next_subsref (type, idx, skip); | |
664 return retval; | |
665 } | |
12533 | 666 #else /* RSBOI_WANT_SUBSREF */ |
8849 | 667 /* FIXME: need an alternative, bogus implementation of subsref */ |
12533 | 668 #endif /* RSBOI_WANT_SUBSREF */ |
8849 | 669 |
670 octave_value_list dotref (const octave_value_list& idx) | |
671 { | |
672 octave_value_list retval; | |
673 | |
674 std::string nm = idx(0).string_value (); | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
675 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8849 | 676 |
677 /* if (nm == "type") | |
678 if (isupper ()) | |
679 retval = octave_value ("Upper"); | |
680 else | |
681 retval = octave_value ("Lower"); | |
682 else*/ | |
683 error ("%s can indexed with .%s", | |
684 type_name().c_str(), nm.c_str()); | |
685 | |
686 return retval; | |
687 } | |
688 | |
689 bool is_map (void) const { return true; } | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
690 bool is_sparse_type (void) const { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG);return true; } |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
691 bool is_real_type (void) const { RSBOI_0_EMCHECK(this->mtxAp); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG);return this->rsbtype()==RSB_NUMERICAL_TYPE_DOUBLE?true:false; } |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
692 bool is_diagonal (void) const { RSBOI_0_EMCHECK(this->mtxAp); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG);return RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_DIAGONAL)?true:false; }/* FIXME: new: not sure whether this is ever called */ |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
693 bool is_lower_triangular (void) const { RSBOI_0_EMCHECK(this->mtxAp); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG);return RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_LOWER_TRIANGULAR)?true:false; }/* FIXME: new: not sure whether this is ever called */ |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
694 bool is_upper_triangular (void) const { RSBOI_0_EMCHECK(this->mtxAp); RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG);return RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_UPPER_TRIANGULAR)?true:false; }/* FIXME: new: not sure whether this is ever called */ |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
695 bool is_complex_type (void) const { RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); return !is_real_type(); } |
8849 | 696 bool is_bool_type (void) const { return false; } |
697 bool is_integer_type (void) const { return false; } | |
698 bool is_square (void) const { return this->rows()==this->cols(); } | |
699 bool is_empty (void) const { return false; } | |
11602 | 700 /* bool is__symmetric (void) const { if(RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_SYMMETRIC))return true; return false; }*/ /* new */ |
701 /* bool is__hermitian (void) const { if(RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_HERMITIAN))return true; return false; }*/ /* new */ | |
11584 | 702 std::string get_symmetry (void) const { return (RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_SYMMETRIC)?"S": (RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_HERMITIAN)?"H":"U")); } |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
703 bool is__triangular (void) const |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
704 { |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
705 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
706 if(this->mtxAp |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
707 #if RSBOI_WANT_SYMMETRY |
11335
a9cdb3c433f4
adapting sparsersb to cope without rsb_mtx_t definition, but only via (the new) rsb_mtx_get_info_str.
michelemartone
parents:
11334
diff
changeset
|
708 && ((!RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_SYMMETRIC)) || RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_DIAGONAL)) |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
709 #endif |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
710 ) |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
711 { |
11335
a9cdb3c433f4
adapting sparsersb to cope without rsb_mtx_t definition, but only via (the new) rsb_mtx_get_info_str.
michelemartone
parents:
11334
diff
changeset
|
712 return RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_TRIANGULAR)?RSB_BOOL_TRUE:RSB_BOOL_FALSE; |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
713 } |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
714 else |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
715 return RSB_BOOL_FALSE; |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
716 } |
8849 | 717 // int is_struct (void) const { return false; } |
718 | |
11847
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
719 bool save_ascii (std::ostream& os) |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
720 { |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
721 error("save_ascii() "RSBOI_0_NIYERRMSG); |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
722 return false; |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
723 } |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
724 bool load_ascii (std::istream& is) |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
725 { |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
726 error("load_ascii() "RSBOI_0_NIYERRMSG); |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
727 return false; |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
728 } |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
729 bool save_binary (std::ostream& os, bool& save_as_floats) |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
730 { |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
731 error("save_binary() "RSBOI_0_NIYERRMSG); |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
732 return false; |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
733 } |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
734 bool load_binary (std::istream& is, bool swap, oct_mach_info::float_format fmt) |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
735 { |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
736 error("load_binary() "RSBOI_0_NIYERRMSG); |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
737 return false; |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
738 } |
8849 | 739 octave_value subsasgn (const std::string& type, const std::list<octave_value_list>& idx, const octave_value& rhs) |
740 { | |
741 octave_value retval; | |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
742 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11649
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
743 |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
744 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8849 | 745 switch (type[0]) |
746 { | |
747 case '(': | |
748 { | |
749 if (type.length () == 1) | |
750 { | |
751 //retval = numeric_assign (type, idx, rhs); | |
752 //RSBOI_DEBUG_NOTICE("UNFINISHED\n"); | |
753 octave_idx_type n_idx = idx.front().length (); | |
754 switch (n_idx) | |
755 { | |
756 case 0: | |
757 retval = matrix; | |
758 RSBOI_DEBUG_NOTICE("UNFINISHED\n"); | |
759 break; | |
760 case 1: | |
761 { | |
762 RSBOI_DEBUG_NOTICE("UNFINISHED\n"); | |
763 idx_vector i = idx.front()(0).index_vector (); | |
764 if (! error_state) | |
765 ;//retval = octave_value (matrix.index (i, resize_ok)); | |
766 } | |
767 break; | |
768 default: | |
769 { | |
770 if (n_idx == 2 ) | |
771 { | |
772 idx_vector i = idx.front() (0).index_vector (); | |
11649
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
773 idx_vector j = idx.front() (1).index_vector (); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
774 #if 0 |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
775 // for op_el_div_eq and op_el_mul_eq |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
776 std :: cout << "ic2 " << i.is_colon() << "\n" ; |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
777 if( i.is_colon() && !j.is_colon() ) |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
778 { |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
779 ComplexMatrix cm=rhs.complex_matrix_value(); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
780 std :: cout << " : , .\n"; |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
781 errval=rsb_mtx_upd_values(this->mtxAp,RSB_ELOPF_SCALE_ROWS,cm.data()); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
782 } |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
783 if(!i.is_colon() && j.is_colon() ) |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
784 { |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
785 std :: cout << " . , :\n"; |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
786 } |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
787 if( i.is_colon() && j.is_colon() ) |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
788 { |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
789 std :: cout << " : , :\n"; |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
790 } |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
791 #endif |
8849 | 792 if (! error_state) |
793 { | |
8999
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
794 if(is_real_type()) |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
795 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
796 rsb_err_t errval = RSB_ERR_NO_ERROR; |
8999
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
797 octave_idx_type ii=-1,jj=-1; |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
798 RSBOI_T rv=rhs.double_value(); |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
799 ii=i(0); jj=j(0); |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
800 RSBOI_DEBUG_NOTICE("update elements (%d %d)\n",ii,jj); |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
801 #if RSBOI_WANT_SYMMETRY |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
802 /* FIXME: and now ? */ |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
803 #endif |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
804 errval = rsb_mtx_set_values(this->mtxAp,&rv,&ii,&jj,1,RSBOI_NF); |
8999
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
805 RSBOI_PERROR(errval); |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
806 /* FIXME: I am unsure, here */ |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
807 //retval=rhs.double_value(); // this does not match octavej |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
808 //retval=octave_value(this); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
809 retval = octave_value(this->clone()); // matches but .. heavy ?! |
8999
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
810 if (! error_state) |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
811 ;//retval = octave_value (matrix.index (i, j, resize_ok)); |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
812 } |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
813 else |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
814 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
815 rsb_err_t errval = RSB_ERR_NO_ERROR; |
8999
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
816 octave_idx_type ii=-1,jj=-1; |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
817 Complex rv=rhs.complex_value(); |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
818 ii=i(0); jj=j(0); |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
819 RSBOI_DEBUG_NOTICE("update elements (%d %d) complex\n",ii,jj); |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
820 #if RSBOI_WANT_SYMMETRY |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
821 /* FIXME: and now ? */ |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
822 #endif |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
823 errval = rsb_mtx_set_values(this->mtxAp,&rv,&ii,&jj,1,RSBOI_NF); |
8999
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
824 RSBOI_PERROR(errval); |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
825 /* FIXME: I am unsure, here */ |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
826 //retval=rhs.double_value(); // this does not match octavej |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
827 //retval=octave_value(this); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
828 retval = octave_value(this->clone()); // matches but .. heavy ?! |
8999
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
829 if (! error_state) |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
830 ;//retval = octave_value (matrix.index (i, j, resize_ok)); |
64f9b0c200d5
sparsersb: extending support for complex librsb functionality, mainly in conversions.
michelemartone
parents:
8989
diff
changeset
|
831 } |
12023
58aea11a6002
refer to octave_map instead of deprecated Octave_map class in comment
jwe
parents:
11878
diff
changeset
|
832 // class octave_map; |
58aea11a6002
refer to octave_map instead of deprecated Octave_map class in comment
jwe
parents:
11878
diff
changeset
|
833 // retval = octave_map(); |
8849 | 834 // RSBOI_DEBUG_NOTICE("UNFINISHED: set %d %d <- %lg\n",ii,jj,rhs.double_value()); |
835 } | |
836 } | |
837 } | |
838 break; | |
839 } | |
840 } | |
841 else if (type.length () == 2) | |
842 { | |
843 std::list<octave_value_list>::const_iterator p = | |
844 idx.begin (); | |
845 octave_value_list key_idx = *++p; | |
846 | |
847 std::string key = key_idx(0).string_value (); | |
848 RSBOI_DEBUG_NOTICE("UNFINISHED\n"); | |
849 | |
850 if (key == "type") | |
851 error ("use 'sparse_rsb' to set type"); | |
852 else | |
853 error ("%s can indexed with .%s", | |
854 type_name().c_str(), key.c_str()); | |
855 } | |
856 else | |
857 error ("in indexed assignment of %s, illegal assignment", | |
858 type_name().c_str ()); | |
859 } | |
860 break; | |
861 case '.': | |
862 { | |
863 octave_value_list key_idx = idx.front (); | |
864 std::string key = key_idx(0).string_value (); | |
865 RSBOI_DEBUG_NOTICE("UNFINISHED\n"); | |
866 | |
867 if (key == "type") | |
868 error ("use 'sparse_rsb' to set matrix type"); | |
869 else | |
870 error ("%s can indexed with .%s", | |
871 type_name().c_str(), key.c_str()); | |
872 } | |
873 break; | |
874 | |
875 case '{': | |
876 RSBOI_DEBUG_NOTICE("UNFINISHED\n"); | |
877 error ("%s cannot be indexed with %c", | |
878 type_name().c_str (), type[0]); | |
879 break; | |
880 | |
881 default: | |
882 panic_impossible (); | |
883 } | |
884 return retval; | |
885 } | |
886 | |
887 octave_base_value *try_narrowing_conversion (void) | |
888 { | |
889 octave_base_value *retval = 0; | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
890 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
891 RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); |
8849 | 892 return retval; |
893 } | |
894 | |
11602 | 895 /* |
896 type_conv_fcn numeric_conversion_function (void) const | |
897 { | |
898 } | |
899 */ | |
900 | |
8849 | 901 type_conv_info numeric_conversion_function (void) const |
902 { | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
903 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8849 | 904 return default_numeric_conversion_function; |
905 } | |
906 | |
11584 | 907 std::string get_info_string() |
908 { | |
909 char ss[RSBOI_INFOBUF]; | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
910 rsb_mtx_get_info_str(this->mtxAp,"RSB_MIF_MATRIX_INFO__TO__CHAR_P",ss,RSBOI_INFOBUF); |
11584 | 911 return ss; |
912 } | |
913 | |
8849 | 914 void print (std::ostream& os, bool pr_as_read_syntax = false) const |
915 { | |
9213
b7223aab0ddf
sparsersb: typo fix from previous commit, and introducing a rather flimsy RSBOI_FIXME macro.
michelemartone
parents:
9211
diff
changeset
|
916 RSBOI_FIXME("what to do with pr_as_read_syntax ?"); |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
917 struct rsboi_coo_matrix_t rcm; |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
918 rsb_err_t errval = RSB_ERR_NO_ERROR; |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
919 rsb_nnz_idx_t nnzA = this->nnz(),nzi; |
8986
9d610884e142
sparsersb.cc: working on the integration of the complex support.
michelemartone
parents:
8985
diff
changeset
|
920 bool ic=this->is_real_type()?false:true; |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
921 Array<octave_idx_type> IA( dim_vector(1,nnzA) ); |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
922 Array<octave_idx_type> JA( dim_vector(1,nnzA) ); |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
923 Array<RSBOI_T> VA( dim_vector(1,(ic?2:1)*nnzA) ); |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
924 std::string c=ic?"complex":"real"; |
11450
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
925 #if RSBOI_WANT_PRINT_DETAIL |
9282
fdc1d84494e8
sparsersb: using the temporary RSB_PRINTF_MATRIX_SUMMARY_ARGS macro to have some extra matrix info printed out.
michelemartone
parents:
9281
diff
changeset
|
926 char ss[RSBOI_INFOBUF]; |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
927 rsb_mtx_get_info_str(this->mtxAp,"RSB_MIF_MATRIX_INFO__TO__CHAR_P",ss,RSBOI_INFOBUF); |
11450
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
928 #endif |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
929 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
930 rcm.VA=(RSBOI_T*)VA.data(),rcm.IA = (rsb_coo_idx_t*)IA.data(),rcm.JA = (rsb_coo_idx_t*)JA.data(); |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
931 #if RSBOI_WANT_SYMMETRY |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
932 /* FIXME: and now ? */ |
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
933 #endif |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
934 if(rcm.VA==NULL) |
12395
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
935 nnzA = 0; |
8931
2cfa7351afc1
sparsersb: using octave_stdout to display the matrix in the octave console or output device.
michelemartone
parents:
8926
diff
changeset
|
936 else |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
937 errval = rsb_mtx_get_coo(this->mtxAp,rcm.VA,rcm.IA,rcm.JA,RSB_FLAG_C_INDICES_INTERFACE); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
938 rcm.nrA = this->rows(); |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
939 rcm.ncA = this->cols(); |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
940 double pct = 100.0*(((RSBOI_T)nnzA)/((RSBOI_T)rcm.nrA))/rcm.ncA; |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
941 octave_stdout<<RSBOI_FSTR<< " (rows = "<<rcm.nrA<< |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
942 ", cols = "<<rcm.ncA<< |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
943 ", nnz = "<<nnzA |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
944 #if RSBOI_WANT_SYMMETRY |
11450
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
945 << ", symm = "<< |
11335
a9cdb3c433f4
adapting sparsersb to cope without rsb_mtx_t definition, but only via (the new) rsb_mtx_get_info_str.
michelemartone
parents:
11334
diff
changeset
|
946 (RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_SYMMETRIC)?"S": |
a9cdb3c433f4
adapting sparsersb to cope without rsb_mtx_t definition, but only via (the new) rsb_mtx_get_info_str.
michelemartone
parents:
11334
diff
changeset
|
947 (RSB_DO_FLAG_HAS(this->rsbflags(),RSB_FLAG_SYMMETRIC)?"H":"U")) |
9280
4603db7be80a
sparsersb: adapting to the new rsb_clone_transformed interface. symmetry fixes (still inactive though).
michelemartone
parents:
9276
diff
changeset
|
948 << // FIXME: need a mechanism to print out these flags from rsb itself |
9275
092bf8915d61
sparsersb: adapted the sparse sum and multiplication interface to the latest one; put placeholders for symmetry-handling code.
michelemartone
parents:
9258
diff
changeset
|
949 #endif |
11450
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
950 ; |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
951 #if RSBOI_WANT_PRINT_PCT_OCTAVE_STYLE |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
952 /* straight from Octave's src/ov-base-sparse.cc */ |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
953 if (nnzA > 0) |
11450
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
954 { |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
955 int prec = 2; |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
956 if (pct == 100) prec = 3; else { if (pct > 99.9) prec = 4; else if (pct > 99) prec = 3; if (pct > 99.99) pct = 99.99; } |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
957 octave_stdout << " [" << std::setprecision (prec) << pct << "%]"; |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
958 } |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
959 #else |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
960 octave_stdout << " ["<<pct<< "%]"; |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
961 #endif |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
962 |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
963 octave_stdout << |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
964 #if RSBOI_WANT_PRINT_COMPLEX_OR_REAL |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
965 ", "<<c<< |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
966 #endif |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
967 ")\n"; |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
968 #if RSBOI_WANT_PRINT_DETAIL |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
969 octave_stdout<< "{{"<< ss <<"}}\n"; |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
970 #else |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
971 octave_stdout<< "\n"; |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
972 #endif |
8985
fb068e31e2d0
sparsersb: fixes to the complex matrix printing method; smaller fixes related to complex.
michelemartone
parents:
8984
diff
changeset
|
973 if(ic) |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
974 for(nzi=0;nzi<nnzA;++nzi) |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
975 octave_stdout<<" ("<<1+IA(nzi)<<", "<<1+JA(nzi)<<") -> "<<((RSBOI_T*)rcm.VA)[2*nzi+0]<<" + " <<((RSBOI_T*)rcm.VA)[2*nzi+1]<<"i\n"; |
8985
fb068e31e2d0
sparsersb: fixes to the complex matrix printing method; smaller fixes related to complex.
michelemartone
parents:
8984
diff
changeset
|
976 else |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
977 for(nzi=0;nzi<nnzA;++nzi) |
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
978 octave_stdout<<" ("<<1+IA(nzi)<<", "<<1+JA(nzi)<<") -> "<<((RSBOI_T*)rcm.VA)[nzi]<<"\n"; |
8849 | 979 newline(os); |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
980 RSBIO_NULL_STATEMENT_FOR_COMPILER_HAPPINESS |
8849 | 981 } |
982 | |
983 octave_value diag (octave_idx_type k) const | |
984 { | |
985 octave_value retval; | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
986 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
987 RSBOI_0_EMCHECK(this->mtxAp); |
9006
6b47ccf97a29
sparsersb: turned off excess warnings, added an extra check to diag(), added some more complex tests.
michelemartone
parents:
9005
diff
changeset
|
988 if(k!=0) |
6b47ccf97a29
sparsersb: turned off excess warnings, added an extra check to diag(), added some more complex tests.
michelemartone
parents:
9005
diff
changeset
|
989 { |
6b47ccf97a29
sparsersb: turned off excess warnings, added an extra check to diag(), added some more complex tests.
michelemartone
parents:
9005
diff
changeset
|
990 error("only main diagonal extraction is supported !"); |
6b47ccf97a29
sparsersb: turned off excess warnings, added an extra check to diag(), added some more complex tests.
michelemartone
parents:
9005
diff
changeset
|
991 } |
8849 | 992 if(this->is_square()) |
993 { | |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
994 rsb_err_t errval = RSB_ERR_NO_ERROR; |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
995 //RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8986
9d610884e142
sparsersb.cc: working on the integration of the complex support.
michelemartone
parents:
8985
diff
changeset
|
996 if(this->is_real_type()) |
9d610884e142
sparsersb.cc: working on the integration of the complex support.
michelemartone
parents:
8985
diff
changeset
|
997 { |
9d610884e142
sparsersb.cc: working on the integration of the complex support.
michelemartone
parents:
8985
diff
changeset
|
998 Matrix DA(this->rows(),1); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
999 errval = rsb_mtx_get_vec(this->mtxAp,(RSBOI_T*)DA.data(),RSB_EXTF_DIAG); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1000 retval = (DA); |
8986
9d610884e142
sparsersb.cc: working on the integration of the complex support.
michelemartone
parents:
8985
diff
changeset
|
1001 } |
9d610884e142
sparsersb.cc: working on the integration of the complex support.
michelemartone
parents:
8985
diff
changeset
|
1002 else |
9d610884e142
sparsersb.cc: working on the integration of the complex support.
michelemartone
parents:
8985
diff
changeset
|
1003 { |
9d610884e142
sparsersb.cc: working on the integration of the complex support.
michelemartone
parents:
8985
diff
changeset
|
1004 ComplexMatrix DA(this->rows(),1); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1005 errval = rsb_mtx_get_vec(this->mtxAp,(RSBOI_T*)DA.data(),RSB_EXTF_DIAG); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1006 retval = (DA); |
8986
9d610884e142
sparsersb.cc: working on the integration of the complex support.
michelemartone
parents:
8985
diff
changeset
|
1007 } |
8849 | 1008 } |
1009 else | |
1010 { | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1011 error(RSBOI_0_NSQERRMSG); |
8849 | 1012 } |
1013 return retval; | |
1014 } | |
1015 | |
1016 octave_value rsboi_get_scaled_copy_inv(const RSBOI_T alpha)const | |
1017 { | |
9217
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1018 RSBOI_T one=1.0; |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1019 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
9217
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1020 return rsboi_get_scaled_copy(one/alpha);/* FIXME: is this correct ? */ |
8849 | 1021 } |
1022 | |
9237
a34e8d5994af
sparsersb: adapted order of arguments to rsb_clone_transformed according to the new style.
michelemartone
parents:
9219
diff
changeset
|
1023 #if RSBOI_WANT_DOUBLE_COMPLEX |
9216
2c9612b9d40e
sparsersb: abandoning the calls to rsb_elemental_scale_inv, rsb_elemental_scale in favor to rsb_elemental_op.
michelemartone
parents:
9214
diff
changeset
|
1024 octave_value rsboi_get_scaled_copy_inv(const Complex alpha)const |
2c9612b9d40e
sparsersb: abandoning the calls to rsb_elemental_scale_inv, rsb_elemental_scale in favor to rsb_elemental_op.
michelemartone
parents:
9214
diff
changeset
|
1025 { |
9217
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1026 Complex one=1.0; |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1027 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
9217
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1028 return rsboi_get_scaled_copy(one/alpha);/* FIXME: is this correct ? */ |
8849 | 1029 } |
12533 | 1030 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
8849 | 1031 |
12533 | 1032 octave_value rsboi_get_scaled_copy(const RSBOI_T alpha, rsb_trans_t transA=RSB_TRANSPOSITION_N)const |
8849 | 1033 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1034 rsb_err_t errval = RSB_ERR_NO_ERROR; |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1035 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1036 struct rsb_mtx_t*mtxBp=NULL; |
9092
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1037 if(is_real_type()) |
11322
208a1a9bd97f
discontinued use of rsb_assign rsb_transpose rsb_htranspose in favour of rsb_clone_transformed.
michelemartone
parents:
11321
diff
changeset
|
1038 { |
12533 | 1039 errval = rsb_mtx_clone(&mtxBp,RSB_NUMERICAL_TYPE_SAME_TYPE,transA, &alpha,this->mtxAp,RSBOI_EXPF); |
11322
208a1a9bd97f
discontinued use of rsb_assign rsb_transpose rsb_htranspose in favour of rsb_clone_transformed.
michelemartone
parents:
11321
diff
changeset
|
1040 } |
9092
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1041 else |
9127
35d3e4d190ac
sparsersb: compile fixes for the no-complex-librsb case.
michelemartone
parents:
9092
diff
changeset
|
1042 #if RSBOI_WANT_DOUBLE_COMPLEX |
11322
208a1a9bd97f
discontinued use of rsb_assign rsb_transpose rsb_htranspose in favour of rsb_clone_transformed.
michelemartone
parents:
11321
diff
changeset
|
1043 { |
208a1a9bd97f
discontinued use of rsb_assign rsb_transpose rsb_htranspose in favour of rsb_clone_transformed.
michelemartone
parents:
11321
diff
changeset
|
1044 Complex calpha;calpha+=alpha; |
12533 | 1045 errval = rsb_mtx_clone(&mtxBp,RSB_NUMERICAL_TYPE_SAME_TYPE,transA,&calpha,this->mtxAp,RSBOI_EXPF); |
9092
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1046 } |
12533 | 1047 #else /* RSBOI_WANT_DOUBLE_COMPLEX */ |
9127
35d3e4d190ac
sparsersb: compile fixes for the no-complex-librsb case.
michelemartone
parents:
9092
diff
changeset
|
1048 {RSBOI_0_ERROR(RSBOI_0_NOCOERRMSG);} |
12533 | 1049 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
1050 return new octave_sparsersb_mtx( mtxBp ); |
8988
59cc28163e80
sparsersb: the warning macro will print out now file/line/function info. more functions print out their name in verbose mode. support for conversion to octave_sparse_complex_matrix. complex scaling function in.
michelemartone
parents:
8986
diff
changeset
|
1051 } |
59cc28163e80
sparsersb: the warning macro will print out now file/line/function info. more functions print out their name in verbose mode. support for conversion to octave_sparse_complex_matrix. complex scaling function in.
michelemartone
parents:
8986
diff
changeset
|
1052 |
9127
35d3e4d190ac
sparsersb: compile fixes for the no-complex-librsb case.
michelemartone
parents:
9092
diff
changeset
|
1053 #if RSBOI_WANT_DOUBLE_COMPLEX |
8988
59cc28163e80
sparsersb: the warning macro will print out now file/line/function info. more functions print out their name in verbose mode. support for conversion to octave_sparse_complex_matrix. complex scaling function in.
michelemartone
parents:
8986
diff
changeset
|
1054 octave_value rsboi_get_scaled_copy(const Complex alpha)const |
59cc28163e80
sparsersb: the warning macro will print out now file/line/function info. more functions print out their name in verbose mode. support for conversion to octave_sparse_complex_matrix. complex scaling function in.
michelemartone
parents:
8986
diff
changeset
|
1055 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1056 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1057 octave_sparsersb_mtx * m = NULL; |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1058 struct rsb_mtx_t*mtxBp=NULL; |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1059 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1060 errval = rsb_mtx_clone(&mtxBp,RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX,RSB_TRANSPOSITION_N,&alpha,this->mtxAp,RSBOI_EXPF); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1061 m = new octave_sparsersb_mtx( mtxBp ); |
8849 | 1062 return m; |
1063 } | |
12533 | 1064 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
8849 | 1065 |
11649
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1066 octave_value scale_rows(const octave_matrix&v2, bool want_div=false) |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1067 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1068 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11649
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1069 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1070 if(this->is_real_type()) |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1071 { |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1072 const Matrix rm = want_div?1.0/v2.matrix_value ():v2.matrix_value (); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1073 octave_idx_type b_nc = rm.cols (); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1074 octave_idx_type b_nr = rm.rows (); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1075 octave_idx_type ldb=b_nr; |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1076 octave_idx_type ldc=this->columns(); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1077 octave_idx_type nrhs=b_nc; |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1078 Matrix retval(ldc,nrhs,RSBOI_ZERO); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1079 if(this->rows()!=b_nr) { error("matrices dimensions do not match!\n"); return Matrix(); } |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1080 errval=rsb_mtx_upd_values(this->mtxAp,RSB_ELOPF_SCALE_ROWS,rm.data()); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1081 RSBOI_PERROR(errval); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1082 return retval; |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1083 } |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1084 else |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1085 { |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1086 const ComplexMatrix cm = want_div?1.0/v2.complex_matrix_value ():v2.complex_matrix_value (); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1087 octave_idx_type b_nc = cm.cols (); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1088 octave_idx_type b_nr = cm.rows (); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1089 octave_idx_type ldb=b_nr; |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1090 octave_idx_type ldc=this->columns(); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1091 octave_idx_type nrhs=b_nc; |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1092 ComplexMatrix retval(ldc,nrhs,RSBOI_ZERO); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1093 if(this->rows()!=b_nr) { error("matrices dimensions do not match!\n"); return ComplexMatrix(); } |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1094 errval=rsb_mtx_upd_values(this->mtxAp,RSB_ELOPF_SCALE_ROWS,cm.data()); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1095 RSBOI_PERROR(errval); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1096 return retval; |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1097 } |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1098 } |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1099 |
12533 | 1100 octave_value rsboi_spmm(const octave_matrix&v2, bool do_trans=false)const |
11650
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1101 { |
12533 | 1102 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11650
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1103 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
12533 | 1104 rsb_trans_t transA = do_trans ? RSB_TRANSPOSITION_T : RSB_TRANSPOSITION_N; |
11650
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1105 |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1106 if(this->is_real_type()) |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1107 { |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1108 const Matrix b = v2.matrix_value (); |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1109 octave_idx_type b_nc = b.cols (); |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1110 octave_idx_type b_nr = b.rows (); |
12533 | 1111 octave_idx_type ldb = b_nr; |
1112 octave_idx_type ldc = do_trans?this->columns():this->rows(); | |
1113 octave_idx_type nrhs = b_nc; | |
11650
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1114 Matrix retval(ldc,nrhs,RSBOI_ZERO); |
12533 | 1115 |
11733
cd2a1979a6c2
bugfix: rsb_spmm was being invoked incorrectly.
michelemartone
parents:
11731
diff
changeset
|
1116 // if(this->columns()!=b_nr) { error("matrices dimensions do not match!\n"); return Matrix(); } |
cd2a1979a6c2
bugfix: rsb_spmm was being invoked incorrectly.
michelemartone
parents:
11731
diff
changeset
|
1117 if(( do_trans)&&(this->rows() !=b_nr)) { error("matrix rows count does not match operand rows!\n"); return Matrix(); } |
cd2a1979a6c2
bugfix: rsb_spmm was being invoked incorrectly.
michelemartone
parents:
11731
diff
changeset
|
1118 if((!do_trans)&&(this->columns()!=b_nr)) { error("matrix columns count does not match operand rows!\n"); return Matrix(); } |
12533 | 1119 errval = rsb_spmm(transA,&rsboi_pone,this->mtxAp,nrhs,RSB_OI_DMTXORDER,(RSBOI_T*)b.data(),ldb,&rsboi_zero,(RSBOI_T*)retval.data(),ldc); |
11650
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1120 RSBOI_PERROR(errval); |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1121 return retval; |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1122 } |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1123 else |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1124 { |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1125 const ComplexMatrix b = v2.complex_matrix_value (); |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1126 octave_idx_type b_nc = b.cols (); |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1127 octave_idx_type b_nr = b.rows (); |
12533 | 1128 octave_idx_type ldb = b_nr; |
1129 octave_idx_type ldc = do_trans?this->columns():this->rows(); | |
1130 octave_idx_type nrhs = b_nc; | |
11650
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1131 ComplexMatrix retval(ldc,nrhs,RSBOI_ZERO); |
12533 | 1132 |
11733
cd2a1979a6c2
bugfix: rsb_spmm was being invoked incorrectly.
michelemartone
parents:
11731
diff
changeset
|
1133 if(( do_trans)&&(this->rows() !=b_nr)) { error("matrix rows count does not match operand rows!\n"); return Matrix(); } |
cd2a1979a6c2
bugfix: rsb_spmm was being invoked incorrectly.
michelemartone
parents:
11731
diff
changeset
|
1134 if((!do_trans)&&(this->columns()!=b_nr)) { error("matrix columns count does not match operand rows!\n"); return Matrix(); } |
12533 | 1135 errval=rsb_spmm(transA,&rsboi_pone,this->mtxAp,nrhs,RSB_OI_DMTXORDER,(RSBOI_T*)b.data(),ldb,&rsboi_zero,(RSBOI_T*)retval.data(),ldc); |
11650
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1136 RSBOI_PERROR(errval); |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1137 return retval; |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1138 } |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1139 } |
782ff6bb04a9
moving implementation of spmv from operator to method.
michelemartone
parents:
11649
diff
changeset
|
1140 |
12530
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1141 #if RSBOI_WANT_DOUBLE_COMPLEX |
12533 | 1142 octave_value rsboi_spmm(const octave_complex_matrix&v2, bool do_trans=false)const |
12530
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1143 { |
12531
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1144 /* |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1145 TODO: to avoid e.g. v2.complex_matrix_value, one may use: dim_vector dv = v2.dims(); ... dv(ndims) ... |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1146 */ |
12533 | 1147 rsb_err_t errval = RSB_ERR_NO_ERROR; |
12530
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1148 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
12533 | 1149 rsb_trans_t transA = do_trans == true ? RSB_TRANSPOSITION_T : RSB_TRANSPOSITION_N; |
12531
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1150 struct rsb_mtx_t *mtxCp = NULL; |
12530
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1151 const ComplexMatrix b = v2.complex_matrix_value (); |
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1152 octave_idx_type b_nc = b.cols (); |
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1153 octave_idx_type b_nr = b.rows (); |
12533 | 1154 octave_idx_type ldb = b_nr; |
1155 octave_idx_type ldc = do_trans?this->columns():this->rows(); | |
1156 octave_idx_type nrhs = b_nc; | |
12532
4d5e57cdfce8
fix to a last commit's bug: the following used to give at random incorrect results:
michelemartone
parents:
12531
diff
changeset
|
1157 ComplexMatrix retval(ldc,nrhs,RSBOI_ZERO); /* zeroing is in principle unnecessary (we zero in rsb_spmm), but otherwise data may not be allocated. */ |
12531
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1158 RSBOI_T* Cp =(RSBOI_T*)retval.data(); |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1159 RSBOI_T* Bp =(RSBOI_T*)b.data(); |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1160 |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1161 if(this->is_real_type()) |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1162 errval = rsb_mtx_clone(&mtxCp,RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX,RSB_TRANSPOSITION_N,NULL,this->mtxAp,RSBOI_EXPF); |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1163 else |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1164 mtxCp = this->mtxAp; |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1165 if(RSBOI_SOME_ERROR(errval)) |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1166 goto err; |
12530
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1167 |
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1168 if(( do_trans)&&(this->rows() !=b_nr)) { error("matrix rows count does not match operand rows!\n"); return Matrix(); } |
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1169 if((!do_trans)&&(this->columns()!=b_nr)) { error("matrix columns count does not match operand rows!\n"); return Matrix(); } |
12531
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1170 |
12533 | 1171 errval=rsb_spmm(transA,&rsboi_pone,mtxCp,nrhs,RSB_OI_DMTXORDER,Bp,ldb,&rsboi_zero,Cp,ldc); |
12531
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1172 |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1173 if(this->is_real_type()) |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1174 RSBOI_DESTROY(mtxCp); |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1175 err: |
12530
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1176 RSBOI_PERROR(errval); |
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1177 return retval; |
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1178 } |
12533 | 1179 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
12530
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1180 |
12533 | 1181 octave_value rsboi_spmsp(const octave_sparsersb_mtx&v2)const |
11652
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1182 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1183 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11652
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1184 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1185 octave_sparsersb_mtx*sm = new octave_sparsersb_mtx(); |
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1186 octave_value retval = sm; |
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1187 #if RSBOI_WANT_SYMMETRY |
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1188 /* FIXME: and now ? */ |
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1189 #endif |
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1190 /* FIXME: what if they are not both of the same type ? it would be nice to have a conversion.. */ |
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1191 sm->mtxAp = rsb_spmsp(RSBOI_BINOP_PREVAILING_TYPE(*this,v2),RSB_TRANSPOSITION_N,&rsboi_pone,this->mtxAp,RSB_TRANSPOSITION_N,&rsboi_pone,v2.mtxAp,&errval); |
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1192 RSBOI_PERROR(errval); |
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1193 if(!sm->mtxAp) |
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1194 RSBOI_0_ERROR(RSBOI_0_ALLERRMSG); |
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1195 return retval; |
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1196 } |
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1197 |
12533 | 1198 octave_value rsboi_sppsp(const RSBOI_T*betap, const octave_sparsersb_mtx&v2)const |
11653 | 1199 { |
1200 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); | |
1201 octave_sparsersb_mtx*sm = new octave_sparsersb_mtx(); | |
1202 octave_value retval = sm; | |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1203 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11653 | 1204 RSBOI_FIXME(""); |
1205 #if RSBOI_WANT_SYMMETRY | |
1206 /* FIXME: and now ? */ | |
1207 #endif | |
1208 sm->mtxAp = rsb_sppsp(RSBOI_BINOP_PREVAILING_TYPE(*this,v2),RSB_TRANSPOSITION_N,&rsboi_pone,this->mtxAp,RSB_TRANSPOSITION_N,betap,v2.mtxAp,&errval); | |
1209 RSBOI_PERROR(errval); | |
1210 if(!sm->mtxAp) | |
1211 RSBOI_0_ERROR(RSBOI_0_ALLERRMSG); | |
1212 return retval; | |
1213 } | |
1214 | |
11654
53c5d7e812d4
compacting the implementations of transpose, htranspose, uminus.
michelemartone
parents:
11653
diff
changeset
|
1215 octave_value cp_ubop(enum rsb_elopf_t opf, void*alphap=NULL)const |
53c5d7e812d4
compacting the implementations of transpose, htranspose, uminus.
michelemartone
parents:
11653
diff
changeset
|
1216 { |
53c5d7e812d4
compacting the implementations of transpose, htranspose, uminus.
michelemartone
parents:
11653
diff
changeset
|
1217 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1218 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11654
53c5d7e812d4
compacting the implementations of transpose, htranspose, uminus.
michelemartone
parents:
11653
diff
changeset
|
1219 octave_sparsersb_mtx * m = new octave_sparsersb_mtx(*this); |
53c5d7e812d4
compacting the implementations of transpose, htranspose, uminus.
michelemartone
parents:
11653
diff
changeset
|
1220 if(!m)return m; |
53c5d7e812d4
compacting the implementations of transpose, htranspose, uminus.
michelemartone
parents:
11653
diff
changeset
|
1221 errval = rsb_mtx_upd_values(m->mtxAp,opf,alphap); |
53c5d7e812d4
compacting the implementations of transpose, htranspose, uminus.
michelemartone
parents:
11653
diff
changeset
|
1222 RSBOI_PERROR(errval); |
53c5d7e812d4
compacting the implementations of transpose, htranspose, uminus.
michelemartone
parents:
11653
diff
changeset
|
1223 return m; |
53c5d7e812d4
compacting the implementations of transpose, htranspose, uminus.
michelemartone
parents:
11653
diff
changeset
|
1224 } |
53c5d7e812d4
compacting the implementations of transpose, htranspose, uminus.
michelemartone
parents:
11653
diff
changeset
|
1225 |
8849 | 1226 private: |
12610
b5925d668a3a
as it was this code did not compile with 4.0.0-rc4.
michelemartone
parents:
12538
diff
changeset
|
1227 public: |
8849 | 1228 DECLARE_OCTAVE_ALLOCATOR |
1229 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1230 };/* end of class octave_sparsersb_mtx definition */ |
8849 | 1231 |
1232 #if 0 | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1233 octave_value_list find_nonzero_elem_idx (const class octave_sparsersb_mtx & nda, int nargout, octave_idx_type n_to_find, int direction) |
8849 | 1234 { |
1235 // useless | |
1236 octave_value retval; | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1237 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8849 | 1238 return retval; |
1239 } | |
1240 #endif | |
1241 | |
1242 static octave_base_value * default_numeric_conversion_function (const octave_base_value& a) | |
1243 { | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1244 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1245 CAST_CONV_ARG (const octave_sparsersb_mtx&); |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1246 RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); |
8985
fb068e31e2d0
sparsersb: fixes to the complex matrix printing method; smaller fixes related to complex.
michelemartone
parents:
8984
diff
changeset
|
1247 RSBOI_WARN(RSBOI_0_UNFFEMSG); |
8988
59cc28163e80
sparsersb: the warning macro will print out now file/line/function info. more functions print out their name in verbose mode. support for conversion to octave_sparse_complex_matrix. complex scaling function in.
michelemartone
parents:
8986
diff
changeset
|
1248 if(v.is_real_type()) |
59cc28163e80
sparsersb: the warning macro will print out now file/line/function info. more functions print out their name in verbose mode. support for conversion to octave_sparse_complex_matrix. complex scaling function in.
michelemartone
parents:
8986
diff
changeset
|
1249 return new octave_sparse_matrix (v.sparse_matrix_value()); |
59cc28163e80
sparsersb: the warning macro will print out now file/line/function info. more functions print out their name in verbose mode. support for conversion to octave_sparse_complex_matrix. complex scaling function in.
michelemartone
parents:
8986
diff
changeset
|
1250 else |
59cc28163e80
sparsersb: the warning macro will print out now file/line/function info. more functions print out their name in verbose mode. support for conversion to octave_sparse_complex_matrix. complex scaling function in.
michelemartone
parents:
8986
diff
changeset
|
1251 return new octave_sparse_complex_matrix (v.sparse_complex_matrix_value()); |
8849 | 1252 } |
1253 | |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
1254 DEFINE_OCTAVE_ALLOCATOR (octave_sparsersb_mtx) |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1255 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_sparsersb_mtx, |
8849 | 1256 RSB_OI_TYPEINFO_STRING, |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
1257 RSB_OI_TYPEINFO_TYPE) |
8849 | 1258 |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1259 DEFCONV (octave_triangular_conv, octave_sparsersb_mtx, matrix) |
8849 | 1260 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1261 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1262 RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1263 CAST_CONV_ARG (const octave_sparsersb_mtx &); |
8849 | 1264 return new octave_sparse_matrix (v.matrix_value ()); |
1265 } | |
1266 | |
1267 #if 0 | |
11330 | 1268 DEFCONV (octave_sparse_rsb_to_octave_sparse_conv, sparse_rsb_mtx, sparse_matrix) |
8849 | 1269 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1270 RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1271 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1272 CAST_CONV_ARG (const octave_sparsersb_mtx &); |
8849 | 1273 return new octave_sparse_matrix (v.matrix_value ()); |
1274 } | |
1275 #endif | |
1276 | |
11330 | 1277 DEFUNOP (uplus, sparse_rsb_mtx) |
8849 | 1278 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1279 RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1280 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1281 CAST_UNOP_ARG (const octave_sparsersb_mtx&); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1282 return new octave_sparsersb_mtx (v); |
8849 | 1283 } |
1284 | |
1285 #if 0 | |
11330 | 1286 DEFUNOP (op_incr, sparse_rsb_mtx) |
8849 | 1287 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1288 RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1289 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1290 CAST_UNOP_ARG (const octave_sparsersb_mtx&); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1291 const octave_idx_type rn=v.mtxAp->nrA,cn=v.mtxAp->ncA; |
8849 | 1292 Matrix v2(rn,cn); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1293 octave_value retval = v2; |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1294 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1295 errval|=rsb_mtx_add_to_dense(&rsboi_pone,v.mtxAp,rn,rn,cn,RSB_BOOL_TRUE,(RSBOI_T*)v2.data()); |
8849 | 1296 //v=octave_ma(idx, v2.matrix_value()); |
1297 return v2; | |
1298 } | |
1299 | |
11330 | 1300 DEFUNOP (op_decr, sparse_rsb_mtx) |
8849 | 1301 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1302 RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1303 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1304 CAST_UNOP_ARG (const octave_sparsersb_mtx&); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1305 const octave_idx_type rn=v.mtxAp->nrA,cn=v.mtxAp->ncA; |
8849 | 1306 Matrix v2(rn,cn); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1307 octave_value retval = v2; |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1308 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1309 errval|=rsb_mtx_add_to_dense(&rsboi_pone,v.mtxAp,rn,rn,cn,RSB_BOOL_TRUE,(RSBOI_T*)v2.data()); |
8849 | 1310 //v=octave_ma(idx, v2.matrix_value()); |
1311 return v2; | |
1312 } | |
1313 #endif | |
1314 | |
11330 | 1315 DEFUNOP (uminus, sparse_rsb_mtx) |
8849 | 1316 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1317 RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1318 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1319 CAST_UNOP_ARG (const octave_sparsersb_mtx&); |
11654
53c5d7e812d4
compacting the implementations of transpose, htranspose, uminus.
michelemartone
parents:
11653
diff
changeset
|
1320 return v.cp_ubop(RSB_ELOPF_NEG); |
8849 | 1321 } |
1322 | |
11330 | 1323 DEFUNOP (transpose, sparse_rsb_mtx) |
8849 | 1324 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1325 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1326 CAST_UNOP_ARG (const octave_sparsersb_mtx&); |
11654
53c5d7e812d4
compacting the implementations of transpose, htranspose, uminus.
michelemartone
parents:
11653
diff
changeset
|
1327 return v.rsboi_get_scaled_copy(rsboi_pone[0],RSB_TRANSPOSITION_T); |
8849 | 1328 } |
1329 | |
11330 | 1330 DEFUNOP (htranspose, sparse_rsb_mtx) |
8849 | 1331 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1332 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1333 CAST_UNOP_ARG (const octave_sparsersb_mtx&); |
11654
53c5d7e812d4
compacting the implementations of transpose, htranspose, uminus.
michelemartone
parents:
11653
diff
changeset
|
1334 return v.rsboi_get_scaled_copy(rsboi_pone[0],RSB_TRANSPOSITION_C); |
8849 | 1335 } |
1336 | |
12533 | 1337 octave_value rsboi_spsm(const octave_sparsersb_mtx&v1, const octave_matrix&v2, rsb_trans_t transA) |
8849 | 1338 { |
12533 | 1339 rsb_err_t errval = RSB_ERR_NO_ERROR; |
9092
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1340 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1341 |
9092
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1342 if(v1.is_complex_type()) |
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1343 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1344 ComplexMatrix retval= v2.complex_matrix_value(); |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1345 octave_idx_type b_nc = retval.cols (); |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1346 octave_idx_type b_nr = retval.rows (); |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1347 octave_idx_type ldb = b_nr; |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1348 octave_idx_type ldc = v1.rows(); |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1349 octave_idx_type nrhs = b_nc; |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1350 octave_idx_type nels = retval.rows()*retval.cols(); |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1351 errval = rsb_spsm(transA,&rsboi_pone,v1.mtxAp,nrhs,RSB_OI_DMTXORDER,&rsboi_zero,(const RSBOI_T*)retval.data(),ldb,(RSBOI_T*)retval.data(),ldc); |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1352 if(RSBOI_SOME_ERROR(errval)) |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
1353 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1354 if(errval==RSB_ERR_INVALID_NUMERICAL_DATA) |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1355 { |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1356 RSBOI_PERROR(errval);// FIXME: need a specific error message here |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1357 } |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1358 else |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1359 { |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1360 RSBOI_PERROR(errval);// FIXME: generic case, here |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1361 } |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1362 for(octave_idx_type i=0;i<nels;++i) |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1363 retval(i)=octave_NaN; |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
1364 } |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1365 return retval; |
9092
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1366 } |
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1367 else |
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1368 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1369 Matrix retval = v2.matrix_value(); |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1370 octave_idx_type b_nc = retval.cols (); |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1371 octave_idx_type b_nr = retval.rows (); |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1372 octave_idx_type ldb = b_nr; |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1373 octave_idx_type ldc = v1.rows(); |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1374 octave_idx_type nrhs = b_nc; |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1375 octave_idx_type nels = retval.rows()*retval.cols(); |
12536 | 1376 |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1377 errval = rsb_spsm(transA,&rsboi_pone,v1.mtxAp,nrhs,RSB_OI_DMTXORDER,&rsboi_zero,(const RSBOI_T*)retval.data(),ldb,(RSBOI_T*)retval.data(),ldc); |
12536 | 1378 |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1379 if(RSBOI_SOME_ERROR(errval)) |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
1380 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1381 if(errval==RSB_ERR_INVALID_NUMERICAL_DATA) |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1382 { |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1383 RSBOI_PERROR(errval);// FIXME: need a specific error message here |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1384 } |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1385 else |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1386 { |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1387 RSBOI_PERROR(errval);// FIXME: generic case, here |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1388 } |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1389 for(octave_idx_type i=0;i<nels;++i) |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1390 retval(i)=octave_NaN; |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
1391 } |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1392 return retval; |
9092
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1393 } |
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1394 } |
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1395 |
12534
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1396 #if RSBOI_WANT_DOUBLE_COMPLEX |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1397 octave_value rsboi_spsm(const octave_sparsersb_mtx&v1, const octave_complex_matrix&v2, rsb_trans_t transA) |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1398 { |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1399 rsb_err_t errval = RSB_ERR_NO_ERROR; |
12535
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1400 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1401 ComplexMatrix retval= v2.complex_matrix_value(); |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1402 octave_idx_type b_nc = retval.cols (); |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1403 octave_idx_type b_nr = retval.rows (); |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1404 octave_idx_type ldb = b_nr; |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1405 octave_idx_type ldc = v1.rows(); |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1406 octave_idx_type nrhs = b_nc; |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1407 octave_idx_type nels = retval.rows()*retval.cols(); |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1408 struct rsb_mtx_t *mtxCp = NULL; |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1409 |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1410 if(v1.is_real_type()) |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1411 errval = rsb_mtx_clone(&mtxCp,RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX,RSB_TRANSPOSITION_N,NULL,v1.mtxAp,RSBOI_EXPF); |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1412 else |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1413 mtxCp = v1.mtxAp; |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1414 if(RSBOI_SOME_ERROR(errval)) |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1415 goto err; |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1416 |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1417 errval = rsb_spsm(transA,&rsboi_pone,mtxCp,nrhs,RSB_OI_DMTXORDER,&rsboi_zero,(const RSBOI_T*)retval.data(),ldb,(RSBOI_T*)retval.data(),ldc); |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1418 |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1419 if(RSBOI_SOME_ERROR(errval)) |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1420 { |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1421 if(errval==RSB_ERR_INVALID_NUMERICAL_DATA) |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1422 { |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1423 RSBOI_PERROR(errval);// FIXME: need a specific error message here |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1424 } |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1425 else |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1426 { |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1427 RSBOI_PERROR(errval);// FIXME: generic case, here |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1428 } |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1429 for(octave_idx_type i=0;i<nels;++i) |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1430 retval(i)=octave_NaN; |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1431 } |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1432 if(v1.is_real_type()) |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1433 RSBOI_DESTROY(mtxCp); |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1434 err: |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1435 RSBOI_PERROR(errval); |
1c5a3153ba3a
giving substance to the complex spsm case; this seems to pass: octave --eval "A=sparse([1,2,3],[1,2,3],[2,2,2]) ; C=complex(A); x=[10,100;20,200;30,300]*i; A,C,x,(sparse(C)\x),(sparsersb(C)\x), sparse(C)'\x,sparsersb(C)'\x"
michelemartone
parents:
12534
diff
changeset
|
1436 return retval; |
12534
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1437 } |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1438 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1439 |
11330 | 1440 DEFBINOP(ldiv, sparse_rsb_mtx, matrix) |
9092
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1441 { |
9258
9aa231398246
sparsersb: added a script for solving systems from university of florida's collection.
michelemartone
parents:
9241
diff
changeset
|
1442 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1443 CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_matrix&); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1444 |
9258
9aa231398246
sparsersb: added a script for solving systems from university of florida's collection.
michelemartone
parents:
9241
diff
changeset
|
1445 if(v1.is__triangular()) |
12533 | 1446 return rsboi_spsm(v1,v2,RSB_TRANSPOSITION_N); |
11599
d9371f8da6f6
the backslash operator will convert to octave's sparse format on non triangular sparse matrices.
michelemartone
parents:
11598
diff
changeset
|
1447 |
d9371f8da6f6
the backslash operator will convert to octave's sparse format on non triangular sparse matrices.
michelemartone
parents:
11598
diff
changeset
|
1448 if(v1.is_complex_type() || v2.is_complex_type()) |
d9371f8da6f6
the backslash operator will convert to octave's sparse format on non triangular sparse matrices.
michelemartone
parents:
11598
diff
changeset
|
1449 return (v1.sparse_complex_matrix_value()).solve(v2.sparse_complex_matrix_value()); |
9258
9aa231398246
sparsersb: added a script for solving systems from university of florida's collection.
michelemartone
parents:
9241
diff
changeset
|
1450 else |
11599
d9371f8da6f6
the backslash operator will convert to octave's sparse format on non triangular sparse matrices.
michelemartone
parents:
11598
diff
changeset
|
1451 return (v1.sparse_matrix_value()).solve(v2.matrix_value()); |
d9371f8da6f6
the backslash operator will convert to octave's sparse format on non triangular sparse matrices.
michelemartone
parents:
11598
diff
changeset
|
1452 //RSBOI_RSB_MATRIX_SOLVE(v1,v2); |
9092
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1453 } |
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1454 |
11330 | 1455 DEFBINOP(trans_ldiv, sparse_rsb_mtx, matrix) |
9092
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1456 { |
9258
9aa231398246
sparsersb: added a script for solving systems from university of florida's collection.
michelemartone
parents:
9241
diff
changeset
|
1457 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1458 CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_matrix&); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1459 |
9258
9aa231398246
sparsersb: added a script for solving systems from university of florida's collection.
michelemartone
parents:
9241
diff
changeset
|
1460 if(v1.is__triangular()) |
12533 | 1461 return rsboi_spsm(v1,v2,RSB_TRANSPOSITION_T); |
11599
d9371f8da6f6
the backslash operator will convert to octave's sparse format on non triangular sparse matrices.
michelemartone
parents:
11598
diff
changeset
|
1462 |
d9371f8da6f6
the backslash operator will convert to octave's sparse format on non triangular sparse matrices.
michelemartone
parents:
11598
diff
changeset
|
1463 if(v1.is_complex_type() || v2.is_complex_type()) |
d9371f8da6f6
the backslash operator will convert to octave's sparse format on non triangular sparse matrices.
michelemartone
parents:
11598
diff
changeset
|
1464 return (v1.sparse_complex_matrix_value().transpose()).solve(v2.sparse_complex_matrix_value()); |
9258
9aa231398246
sparsersb: added a script for solving systems from university of florida's collection.
michelemartone
parents:
9241
diff
changeset
|
1465 else |
11599
d9371f8da6f6
the backslash operator will convert to octave's sparse format on non triangular sparse matrices.
michelemartone
parents:
11598
diff
changeset
|
1466 return (v1.sparse_matrix_value().transpose()).solve(v2.matrix_value()); |
d9371f8da6f6
the backslash operator will convert to octave's sparse format on non triangular sparse matrices.
michelemartone
parents:
11598
diff
changeset
|
1467 //RSBOI_RSB_MATRIX_SOLVE(v1,v2); |
8849 | 1468 } |
1469 | |
12534
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1470 #if RSBOI_WANT_DOUBLE_COMPLEX |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1471 DEFBINOP(c_ldiv, sparse_rsb_mtx, matrix) |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1472 { |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1473 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1474 CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_complex_matrix&); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1475 |
12534
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1476 if(v1.is__triangular()) |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1477 return rsboi_spsm(v1,v2,RSB_TRANSPOSITION_N); |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1478 |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1479 if(v1.is_complex_type() || v2.is_complex_type()) |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1480 return (v1.sparse_complex_matrix_value()).solve(v2.sparse_complex_matrix_value()); |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1481 else |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1482 return (v1.sparse_matrix_value()).solve(v2.matrix_value()); |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1483 //RSBOI_RSB_MATRIX_SOLVE(v1,v2); |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1484 } |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1485 |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1486 DEFBINOP(trans_c_ldiv, sparse_rsb_mtx, matrix) |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1487 { |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1488 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1489 CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_complex_matrix&); |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1490 if(v1.is__triangular()) |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1491 return rsboi_spsm(v1,v2,RSB_TRANSPOSITION_T); |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1492 |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1493 if(v1.is_complex_type() || v2.is_complex_type()) |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1494 return (v1.sparse_complex_matrix_value().transpose()).solve(v2.sparse_complex_matrix_value()); |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1495 else |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1496 return (v1.sparse_matrix_value().transpose()).solve(v2.matrix_value()); |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1497 //RSBOI_RSB_MATRIX_SOLVE(v1,v2); |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1498 } |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1499 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1500 |
11330 | 1501 DEFBINOP(el_div, sparse_rsb_mtx, matrix) |
8849 | 1502 { |
1503 Matrix retval; | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1504 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1505 RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); |
8849 | 1506 return retval; |
1507 } | |
1508 | |
11330 | 1509 DEFBINOP(el_ldiv, sparse_rsb_mtx, matrix) |
8849 | 1510 { |
1511 Matrix retval; | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1512 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1513 RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); |
8849 | 1514 return retval; |
1515 } | |
1516 | |
11330 | 1517 DEFBINOP(div, sparse_rsb_mtx, matrix) |
8849 | 1518 { |
1519 Matrix retval; | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1520 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1521 RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); |
8849 | 1522 return retval; |
1523 } | |
1524 | |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1525 #if RSBOI_WANT_DOUBLE_COMPLEX |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1526 DEFBINOP(rsb_c_div, sparse_rsb_mtx, complex) |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1527 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1528 CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_complex&); |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1529 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1530 return v1.rsboi_get_scaled_copy_inv(v2.complex_value()); |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1531 } |
12533 | 1532 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1533 |
11330 | 1534 DEFBINOP(rsb_s_div, sparse_rsb_mtx, scalar) |
8849 | 1535 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1536 CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_scalar&); |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1537 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8849 | 1538 return v1.rsboi_get_scaled_copy_inv(v2.scalar_value()); |
1539 } | |
1540 | |
11330 | 1541 DEFBINOP(rsb_s_mul, sparse_rsb_mtx, scalar) |
8849 | 1542 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1543 CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_scalar&); |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1544 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8849 | 1545 return v1.rsboi_get_scaled_copy(v2.scalar_value()); |
1546 } | |
1547 | |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1548 #if RSBOI_WANT_DOUBLE_COMPLEX |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1549 DEFBINOP(rsb_c_mul, sparse_rsb_mtx, complex) |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1550 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1551 CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_complex&); |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1552 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1553 return v1.rsboi_get_scaled_copy(v2.complex_value()); |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1554 } |
12533 | 1555 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1556 |
8849 | 1557 #if 0 |
11330 | 1558 DEFBINOP(rsb_s_pow, sparse_rsb_mtx, scalar) |
8849 | 1559 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1560 CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_scalar&); |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1561 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8849 | 1562 return v1.rsboi_get_power_copy(v2.scalar_value()); |
1563 } | |
1564 #endif | |
1565 | |
11330 | 1566 DEFASSIGNOP (assign, sparse_rsb_mtx, sparse_rsb_mtx) |
8849 | 1567 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1568 rsb_err_t errval = RSB_ERR_NO_ERROR; |
9213
b7223aab0ddf
sparsersb: typo fix from previous commit, and introducing a rather flimsy RSBOI_FIXME macro.
michelemartone
parents:
9211
diff
changeset
|
1569 RSBOI_FIXME("I dunno how to trigger this!"); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1570 CAST_BINOP_ARGS (octave_sparsersb_mtx &, const octave_sparsersb_mtx&); |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1571 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1572 //rsb_assign(v1.mtxAp, v2.mtxAp); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1573 errval = rsb_mtx_clone(&v1.mtxAp,RSB_NUMERICAL_TYPE_SAME_TYPE,RSB_TRANSPOSITION_N,NULL,v2.mtxAp,RSBOI_EXPF); |
8849 | 1574 return octave_value(); |
1575 } | |
1576 | |
11330 | 1577 DEFASSIGNOP (assignm, sparse_rsb_mtx, matrix) |
8849 | 1578 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1579 CAST_BINOP_ARGS (octave_sparsersb_mtx &, const octave_matrix&); |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1580 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1581 RSBOI_DESTROY(v1.mtxAp); |
8849 | 1582 octave_value retval; |
1583 //v1.assign(idx, v2.matrix_value()); | |
1584 v1=(idx, v2.matrix_value()); | |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1585 //retval = v1; |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1586 retval = v2.matrix_value(); |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1587 RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); |
8849 | 1588 return retval; |
1589 } | |
1590 | |
1591 #if 0 | |
11330 | 1592 DEFASSIGNOP(rsb_op_mul_eq_s, sparse_rsb_mtx, scalar) |
8849 | 1593 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1594 CAST_BINOP_ARGS (octave_sparsersb_mtx &, const octave_scalar&); |
8849 | 1595 octave_value retval; |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1596 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8961
04e915f35fcb
sparsersb: using RSBOI_PERROR instead rsb_perror to warn the user of librsb errors.
michelemartone
parents:
8939
diff
changeset
|
1597 RSBOI_PERROR(v1.rsboi_scale(v2.scalar_value())); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1598 retval = v1.matrix_value(); |
8849 | 1599 return retval; |
1600 } | |
1601 | |
9217
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1602 rsb_err_t rsboi_scale(RSBOI_T alpha) |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1603 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1604 rsb_err_t errval = RSB_ERR_NO_ERROR; |
9217
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1605 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1606 //errval=rsb_elemental_scale(this->mtxAp,&alpha); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1607 errval=rsb_elemental_op(this->mtxAp,RSB_ELOPF_MUL,&alpha); |
9217
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1608 RSBOI_PERROR(errval); |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1609 return errval; |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1610 } |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1611 |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1612 rsb_err_t rsboi_scale(Complex alpha) |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1613 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1614 rsb_err_t errval = RSB_ERR_NO_ERROR; |
9217
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1615 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1616 //errval=rsb_elemental_scale(this->mtxAp,&alpha); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1617 errval=rsb_elemental_op(this->mtxAp,RSB_ELOPF_MUL,&alpha); |
9217
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1618 RSBOI_PERROR(errval); |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1619 return errval; |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1620 } |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1621 |
11330 | 1622 DEFASSIGNOP(rsb_op_div_eq_s, sparse_rsb_mtx, scalar) |
8849 | 1623 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1624 CAST_BINOP_ARGS (octave_sparsersb_mtx &, const octave_scalar&); |
8849 | 1625 octave_value retval; |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1626 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8961
04e915f35fcb
sparsersb: using RSBOI_PERROR instead rsb_perror to warn the user of librsb errors.
michelemartone
parents:
8939
diff
changeset
|
1627 RSBOI_PERROR(v1.rsboi_scale_inv(v2.scalar_value())); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1628 retval = v1.matrix_value(); |
8849 | 1629 return retval; |
1630 } | |
9217
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1631 |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1632 rsb_err_t rsboi_scale_inv(RSBOI_T alpha) |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1633 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1634 rsb_err_t errval = RSB_ERR_NO_ERROR; |
9217
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1635 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1636 //errval=rsb_elemental_scale_inv(this->mtxAp,&alpha); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1637 errval=rsb_elemental_op(this->mtxAp,RSB_ELOPF_DIV,&alpha); |
9217
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1638 RSBOI_PERROR(errval); |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1639 return errval; |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1640 } |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1641 |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1642 rsb_err_t rsboi_scale_inv(Complex alpha) |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1643 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1644 rsb_err_t errval = RSB_ERR_NO_ERROR; |
9217
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1645 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1646 //errval=rsb_elemental_scale_inv(this->mtxAp,&alpha); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1647 errval=rsb_elemental_op(this->mtxAp,RSB_ELOPF_DIV,&alpha); |
9217
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1648 RSBOI_PERROR(errval); |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1649 return errval; |
10ea2b6c8965
sparsersb: moved the rsb_elemental_op-calling code to a commented-out section (for now, this code does not get called).
michelemartone
parents:
9216
diff
changeset
|
1650 } |
8849 | 1651 #endif |
1652 | |
11330 | 1653 DEFBINOP(rsb_el_mul_s, sparse_rsb_mtx, scalar) |
8849 | 1654 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1655 CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_scalar&); |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1656 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8849 | 1657 return v1.rsboi_get_scaled_copy(v2.scalar_value()); |
1658 } | |
1659 | |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1660 #if RSBOI_WANT_DOUBLE_COMPLEX |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1661 DEFBINOP(rsb_el_mul_c, sparse_rsb_mtx, complex) |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1662 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1663 CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_complex&); |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1664 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1665 return v1.rsboi_get_scaled_copy(v2.complex_value()); |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1666 } |
12533 | 1667 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1668 |
11330 | 1669 DEFBINOP(rsb_el_div_s, sparse_rsb_mtx, scalar) |
8849 | 1670 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1671 CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_scalar&); |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1672 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8849 | 1673 return v1.rsboi_get_scaled_copy_inv(v2.scalar_value()); |
1674 } | |
1675 | |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1676 #if RSBOI_WANT_DOUBLE_COMPLEX |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1677 DEFBINOP(rsb_el_div_c, sparse_rsb_mtx, complex) |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1678 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1679 CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_complex&); |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1680 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1681 return v1.rsboi_get_scaled_copy_inv(v2.complex_value()); |
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1682 } |
12533 | 1683 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1684 |
11649
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1685 #if RSBOI_WANT_DOUBLE_COMPLEX |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1686 #if 0 |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1687 DEFASSIGNOP(rsb_op_el_div_eq, sparse_rsb_mtx, scalar) |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1688 { |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1689 CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_scalar&); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1690 std::cout << "rsb_op_el_div_eq!\n"; |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1691 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1692 return v1.rsboi_get_scaled_copy_inv(v2.complex_value()); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1693 } |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1694 #endif |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1695 |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1696 DEFASSIGNOP(rsb_op_el_mul_eq_sc, sparse_rsb_mtx, matrix) |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1697 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1698 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11649
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1699 CAST_BINOP_ARGS (octave_sparsersb_mtx &, const octave_matrix&); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1700 return v1.scale_rows(v2,false); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1701 } |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1702 |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1703 DEFASSIGNOP(rsb_op_el_div_eq_sc, sparse_rsb_mtx, matrix) |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1704 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1705 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11649
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1706 CAST_BINOP_ARGS (octave_sparsersb_mtx &, const octave_matrix&); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1707 return v1.scale_rows(v2,true); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1708 } |
12533 | 1709 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
11649
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1710 |
11330 | 1711 DEFBINOP(el_pow, sparse_rsb_mtx, scalar) |
8849 | 1712 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1713 CAST_BINOP_ARGS (const octave_sparsersb_mtx &, const octave_scalar&); |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1714 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8849 | 1715 RSBOI_T alpha=v2.scalar_value(); |
11654
53c5d7e812d4
compacting the implementations of transpose, htranspose, uminus.
michelemartone
parents:
11653
diff
changeset
|
1716 return v1.cp_ubop(RSB_ELOPF_POW,&alpha); |
8849 | 1717 } |
1718 | |
1719 #ifdef RSB_FULLY_IMPLEMENTED | |
11330 | 1720 DEFASSIGNOP (assigns, sparse_rsb_mtx, scalar) |
8849 | 1721 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1722 CAST_BINOP_ARGS (octave_sparsersb_mtx &, const octave_scalar&); |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1723 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8849 | 1724 v1.assign(idx, v2.matrix_value()); |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1725 RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); |
8849 | 1726 return octave_value(); |
1727 } | |
1728 #endif | |
1729 | |
11330 | 1730 DEFBINOP(op_sub, sparse_rsb_mtx, sparse_rsb_mtx) |
8849 | 1731 { |
11653 | 1732 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1733 CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_sparsersb_mtx&); |
12533 | 1734 return v1.rsboi_sppsp(&rsboi_mone[0],v2); |
8849 | 1735 } |
1736 | |
11330 | 1737 DEFBINOP(op_add, sparse_rsb_mtx, sparse_rsb_mtx) |
8849 | 1738 { |
11652
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1739 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1740 CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_sparsersb_mtx&); |
12533 | 1741 return v1.rsboi_sppsp(&rsboi_pone[0],v2); |
8849 | 1742 } |
1743 | |
11330 | 1744 DEFBINOP(op_spmul, sparse_rsb_mtx, sparse_rsb_mtx) |
8849 | 1745 { |
11652
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1746 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1747 CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_sparsersb_mtx&); |
12533 | 1748 return v1.rsboi_spmsp(v2); |
8849 | 1749 } |
1750 | |
11330 | 1751 DEFBINOP(op_mul, sparse_rsb_mtx, matrix) |
8849 | 1752 { |
11652
7546d8797855
encapsulated op_spmul operator in method spmsp.
michelemartone
parents:
11651
diff
changeset
|
1753 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1754 CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_matrix&); |
12533 | 1755 return v1.rsboi_spmm(v2, false); |
8849 | 1756 } |
1757 | |
11330 | 1758 DEFBINOP(op_trans_mul, sparse_rsb_mtx, matrix) |
8849 | 1759 { |
1760 // ".'*" operator | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1761 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1762 CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_matrix&); |
12533 | 1763 return v1.rsboi_spmm(v2, true); |
8849 | 1764 } |
1765 | |
12530
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1766 #if RSBOI_WANT_DOUBLE_COMPLEX |
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1767 DEFBINOP(op_c_mul, sparse_rsb_mtx, matrix) |
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1768 { |
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1769 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1770 CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_complex_matrix&); |
12533 | 1771 return v1.rsboi_spmm(v2, false); |
12530
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1772 } |
12531
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1773 |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1774 DEFBINOP(op_c_trans_mul, sparse_rsb_mtx, matrix) |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1775 { |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1776 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1777 CAST_BINOP_ARGS (const octave_sparsersb_mtx&, const octave_complex_matrix&); |
12533 | 1778 return v1.rsboi_spmm(v2, true); |
12531
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1779 } |
12533 | 1780 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
12530
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1781 |
8849 | 1782 static void install_sparsersb_ops (void) |
1783 { | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1784 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
8849 | 1785 #ifdef RSB_FULLY_IMPLEMENTED |
1786 /* boolean pattern-based not */ | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1787 INSTALL_UNOP (op_not, octave_sparsersb_mtx, op_not); |
8849 | 1788 /* to-dense operations */ |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1789 INSTALL_ASSIGNOP (op_asn_eq, octave_sparsersb_mtx, octave_scalar, assigns); |
8849 | 1790 /* ? */ |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1791 INSTALL_UNOP (op_uplus, octave_sparsersb_mtx, uplus); |
8849 | 1792 /* elemental comparison, evaluate to sparse or dense boolean matrices */ |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1793 INSTALL_BINOP (op_eq, octave_sparsersb_mtx, , ); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1794 INSTALL_BINOP (op_le, octave_sparsersb_mtx, , ); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1795 INSTALL_BINOP (op_lt, octave_sparsersb_mtx, , ); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1796 INSTALL_BINOP (op_ge, octave_sparsersb_mtx, , ); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1797 INSTALL_BINOP (op_gt, octave_sparsersb_mtx, , ); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1798 INSTALL_BINOP (op_ne, octave_sparsersb_mtx, , ); |
8849 | 1799 /* pure elemental; scalar and sparse arguments ?! */ |
1800 // ? | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1801 INSTALL_BINOP (op_el_ldiv, octave_sparsersb_mtx, , ); |
11649
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1802 INSTALL_BINOP (op_el_ldiv_eq, octave_sparsersb_mtx, , ); // errval=rsb_mtx_upd_values(this->mtxAp,RSB_ELOPF_SCALE_ROWS,cm.data()); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1803 INSTALL_BINOP (op_el_mul_eq, octave_sparsersb_mtx, , ); // diagonal subst ?? |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1804 INSTALL_BINOP (op_el_and, octave_sparsersb_mtx, , ); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1805 INSTALL_BINOP (op_el_or, octave_sparsersb_mtx, , ); |
8849 | 1806 /* shift operations: they may be left out from the implementation */ |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1807 INSTALL_BINOP (op_lshift, octave_sparsersb_mtx, , ); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1808 INSTALL_BINOP (op_rshift, octave_sparsersb_mtx, , ); |
8849 | 1809 #endif |
11649
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1810 // INSTALL_ASSIGNOP (op_el_div_eq, octave_sparsersb_mtx, octave_matrix, rsb_op_el_div_eq_sc); // errval=rsb_mtx_upd_values(this->mtxAp,RSB_ELOPF_SCALE_ROWS,cm.data()); |
0240a1a0928d
the tester will handle the case with no UMFPACK installed.
michelemartone
parents:
11614
diff
changeset
|
1811 // INSTALL_ASSIGNOP (op_el_mul_eq, octave_sparsersb_mtx, octave_matrix, rsb_op_el_mul_eq_sc); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1812 //INSTALL_WIDENOP (octave_sparsersb_mtx, octave_sparse_matrix,octave_sparse_rsb_to_octave_sparse_conv);/* a DEFCONV .. */ |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1813 //INSTALL_ASSIGNCONV (octave_sparsersb_mtx, octave_sparse_matrix,octave_sparse_matrix);/* .. */ |
8849 | 1814 // no need for the following: need a good conversion function, though |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1815 //INSTALL_UNOP (op_incr, octave_sparsersb_mtx, op_incr); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1816 //INSTALL_UNOP (op_decr, octave_sparsersb_mtx, op_decr); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1817 INSTALL_BINOP (op_el_mul, octave_sparsersb_mtx, octave_scalar, rsb_el_mul_s); |
11581 | 1818 #if RSBOI_WANT_DOUBLE_COMPLEX |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1819 INSTALL_BINOP (op_el_mul, octave_sparsersb_mtx, octave_complex, rsb_el_mul_c); |
12533 | 1820 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1821 // INSTALL_ASSIGNOP (op_mul_eq, octave_sparsersb_mtx, octave_scalar, rsb_op_mul_eq_s); // 20110313 not effective |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1822 // INSTALL_ASSIGNOP (op_div_eq, octave_sparsersb_mtx, octave_scalar, rsb_op_div_eq_s); // 20110313 not effective |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1823 INSTALL_BINOP (op_el_div, octave_sparsersb_mtx, octave_scalar, rsb_el_div_s); |
11581 | 1824 #if RSBOI_WANT_DOUBLE_COMPLEX |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1825 INSTALL_BINOP (op_el_div, octave_sparsersb_mtx, octave_complex, rsb_el_div_c); |
12533 | 1826 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1827 INSTALL_BINOP (op_el_pow, octave_sparsersb_mtx, octave_scalar, el_pow); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1828 INSTALL_UNOP (op_uminus, octave_sparsersb_mtx, uminus); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1829 INSTALL_BINOP (op_ldiv, octave_sparsersb_mtx, octave_matrix, ldiv); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1830 INSTALL_BINOP (op_el_ldiv, octave_sparsersb_mtx, octave_matrix, el_ldiv); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1831 INSTALL_BINOP (op_div, octave_sparsersb_mtx, octave_matrix, div); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1832 INSTALL_BINOP (op_div, octave_sparsersb_mtx, octave_scalar, rsb_s_div); |
11581 | 1833 #if RSBOI_WANT_DOUBLE_COMPLEX |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1834 INSTALL_BINOP (op_div, octave_sparsersb_mtx, octave_complex, rsb_c_div); |
12533 | 1835 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1836 INSTALL_BINOP (op_mul, octave_sparsersb_mtx, octave_scalar, rsb_s_mul); |
11581 | 1837 #if RSBOI_WANT_DOUBLE_COMPLEX |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1838 INSTALL_BINOP (op_mul, octave_sparsersb_mtx, octave_complex, rsb_c_mul); |
12530
a39300467722
spmm operation against octave_complex_matrix was missing. this is a contributed patch to introduce it. more cases to come.
michelemartone
parents:
12395
diff
changeset
|
1839 INSTALL_BINOP (op_mul, octave_sparsersb_mtx, octave_complex_matrix, op_c_mul); |
12531
f39400293307
extended the complex spmm to handle the case with transparent conversion from real (p.s.: credits to Daryl Van Vorst who noticed the broken complex interface and triggered the last commit).
michelemartone
parents:
12530
diff
changeset
|
1840 INSTALL_BINOP (op_trans_mul, octave_sparsersb_mtx, octave_complex_matrix, op_c_trans_mul); |
12534
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1841 INSTALL_BINOP (op_ldiv, octave_sparsersb_mtx, octave_complex_matrix, c_ldiv); |
1b88d712f0fc
in a skeletal implementation of rsboi_spsm for complex.
michelemartone
parents:
12533
diff
changeset
|
1842 INSTALL_BINOP (op_trans_ldiv, octave_sparsersb_mtx, octave_complex_matrix, trans_c_ldiv); |
12533 | 1843 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1844 //INSTALL_BINOP (op_pow, octave_sparsersb_mtx, octave_scalar, rsb_s_pow); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1845 INSTALL_BINOP (op_el_div, octave_sparsersb_mtx, octave_matrix, el_div); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1846 INSTALL_UNOP (op_transpose, octave_sparsersb_mtx, transpose); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1847 INSTALL_UNOP (op_hermitian, octave_sparsersb_mtx, htranspose); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1848 INSTALL_ASSIGNOP (op_asn_eq, octave_sparsersb_mtx, octave_sparse_matrix, assign); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1849 INSTALL_ASSIGNOP (op_asn_eq, octave_sparsersb_mtx, octave_matrix, assignm); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1850 INSTALL_BINOP (op_mul, octave_sparsersb_mtx, octave_matrix, op_mul); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1851 //INSTALL_BINOP (op_pow, octave_sparsersb_mtx, octave_matrix, op_pow); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1852 INSTALL_BINOP (op_sub, octave_sparsersb_mtx, octave_sparsersb_mtx, op_sub); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1853 INSTALL_BINOP (op_add, octave_sparsersb_mtx, octave_sparsersb_mtx, op_add); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1854 //INSTALL_BINOP (op_trans_add, octave_sparsersb_mtx, octave_sparsersb_mtx, op_trans_add); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1855 INSTALL_BINOP (op_mul, octave_sparsersb_mtx, octave_sparsersb_mtx, op_spmul); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1856 INSTALL_BINOP (op_trans_mul, octave_sparsersb_mtx, octave_matrix, op_trans_mul); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1857 INSTALL_BINOP (op_trans_ldiv, octave_sparsersb_mtx, octave_matrix, trans_ldiv); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1858 //INSTALL_BINOP (op_mul_trans, octave_sparsersb_mtx, octave_matrix, op_mul_trans); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1859 //INSTALL_BINOP (op_mul_trans, octave_sparsersb_mtx, octave_matrix, op_mul_trans); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1860 //INSTALL_BINOP (op_herm_mul, octave_sparsersb_mtx, octave_matrix, op_herm_mul); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1861 //INSTALL_BINOP (op_mul_herm, octave_sparsersb_mtx, octave_matrix, op_mul_herm); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1862 //INSTALL_BINOP (op_el_not_and, octave_sparsersb_mtx, octave_matrix, op_el_not_and); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1863 //INSTALL_BINOP (op_el_not_or , octave_sparsersb_mtx, octave_matrix, op_el_not_or ); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1864 //INSTALL_BINOP (op_el_and_not, octave_sparsersb_mtx, octave_matrix, op_el_and_not); |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1865 //INSTALL_BINOP (op_el_or _not, octave_sparsersb_mtx, octave_matrix, op_el_or _not); |
8849 | 1866 } |
1867 | |
1868 static void install_sparse_rsb (void) | |
1869 { | |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1870 static bool rsboi_initialized = false; |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1871 |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1872 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1873 |
8849 | 1874 if(!rsboi_initialized) |
1875 { | |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1876 rsb_err_t errval = RSB_ERR_NO_ERROR; |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1877 |
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1878 if(sparsersb_tester() == false) |
8849 | 1879 { |
1880 RSBOI_ERROR(""); | |
1881 goto err; | |
1882 } | |
11330 | 1883 if(RSBOI_SOME_ERROR(errval = rsb_lib_init(RSB_NULL_INIT_OPTIONS))) |
8849 | 1884 { |
9213
b7223aab0ddf
sparsersb: typo fix from previous commit, and introducing a rather flimsy RSBOI_FIXME macro.
michelemartone
parents:
9211
diff
changeset
|
1885 RSBOI_FIXME("temporary style of error handling"); |
b7223aab0ddf
sparsersb: typo fix from previous commit, and introducing a rather flimsy RSBOI_FIXME macro.
michelemartone
parents:
9211
diff
changeset
|
1886 RSBOI_PERROR(errval); |
8849 | 1887 RSBOI_ERROR(""); |
1888 goto err; | |
1889 } | |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1890 rsboi_initialized = true; |
8849 | 1891 } |
1892 else | |
1893 ;/* already initialized */ | |
1894 | |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1895 if (!rsboi_sparse_rsb_loaded) |
8849 | 1896 { |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1897 octave_sparsersb_mtx::register_type (); |
8849 | 1898 install_sparsersb_ops (); |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1899 rsboi_sparse_rsb_loaded = true; |
8883
bbe46b42f8e6
sparsersb: a nicer error message on missing librsb-config, and using mlock() in the oct-file.
michelemartone
parents:
8849
diff
changeset
|
1900 mlock(); |
8849 | 1901 } |
1902 return; | |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1903 err: |
8849 | 1904 RSBIO_NULL_STATEMENT_FOR_COMPILER_HAPPINESS |
1905 } | |
1906 | |
11584 | 1907 DEFUN_DLD (RSB_SPARSERSB_LABEL, args, nargout, |
8849 | 1908 "-*- texinfo -*-\n\ |
1909 @deftypefn {Loadable Function} {@var{s} =} "RSBOI_FNS" (@var{a})\n\ | |
1910 Create a sparse RSB matrix from the full matrix @var{a}.\n"\ | |
1911 /*is forced back to a full matrix if resulting matrix is sparse\n*/\ | |
1912 "\n\ | |
11597
b3a2cfb1a0c1
fixed a bug (calling sparsersb with 1 arg caused segfault).
michelemartone
parents:
11596
diff
changeset
|
1913 @deftypefnx {Loadable Function} {[@var{s}, @var{nrows}, @var{ncols}, @var{nnz}, @var{repinfo}, @var{field}, @var{symmetry}] =} "RSBOI_FNS" (@var{mtxfilename}, @var{mtxtypestring})\n\ |
11878
ffd8edaaa76f
packaging oriented notes and suggestions from carandraug.
michelemartone
parents:
11847
diff
changeset
|
1914 Create a sparse RSB matrix by loading the Matrix Market matrix file named @var{mtxfilename}. The optional argument @var{mtxtypestring} can specify either real (\"D\") or complex (\"Z\") type. Default is real.\n"\ |
11598
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
1915 "In the case @var{mtxfilename} is \""RSBOI_LIS"\", a string listing the available numerical types with BLAS-style characters will be returned. If the file turns out to contain a Matrix Market vector, this will be loaded as such.\n"\ |
11734
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
1916 |
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
1917 |
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
1918 "\n\ |
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
1919 @deftypefnx {Loadable Function} "RSBOI_FNS" (@var{a},\"save\",@var{mtxfilename})\n\ |
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
1920 Saves a sparse RSB matrix as a Matrix Market matrix file named @var{mtxfilename}.\n"\ |
8849 | 1921 "\n\ |
1922 @deftypefnx {Loadable Function} {@var{s} =} "RSBOI_FNS" (@var{i}, @var{j}, @var{sv}, @var{m}, @var{n}, @var{nzmax})\n\ | |
1923 Create a sparse RSB matrix given integer index vectors @var{i} and @var{j},\n\ | |
1924 a 1-by-@code{nnz} vector of real of complex values @var{sv}, overall\n\ | |
1925 dimensions @var{m} and @var{n} of the sparse matrix. The argument\n\ | |
1926 @code{nzmax} is ignored but accepted for compatibility with @sc{Matlab}.\n\ | |
1927 \n\ | |
1928 @strong{Note}: if multiple values are specified with the same\n\ | |
1929 @var{i}, @var{j} indices, the corresponding values in @var{s} will\n\ | |
1930 be added.\n\ | |
1931 \n\ | |
1932 The following are all equivalent:\n\ | |
1933 \n\ | |
1934 @example\n\ | |
1935 @group\n\ | |
1936 s = "RSBOI_FNS" (i, j, s, m, n)\n\ | |
1937 s = "RSBOI_FNS" (i, j, s, m, n, \"summation\")\n\ | |
9023
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
1938 s = "RSBOI_FNS" (i, j, s, m, n, \"sum\")\n"\ |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
1939 /*"s = "RSBOI_FNS" (i, j, s, \"summation\")\n"*/\ |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
1940 /*"s = "RSBOI_FNS" (i, j, s, \"sum\")\n"*/\ |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
1941 "@end group\n\ |
8849 | 1942 @end example\n\ |
1943 \n\ | |
1944 @deftypefnx {Loadable Function} {@var{s} =} "RSBOI_FNS" (@var{i}, @var{j}, @var{s}, @var{m}, @var{n}, \"unique\")\n\ | |
1945 Same as above, except that if more than two values are specified for the\n\ | |
1946 same @var{i}, @var{j} indices, the last specified value will be used.\n\ | |
1947 \n\ | |
1948 @deftypefnx {Loadable Function} {@var{s} =} "RSBOI_FNS" (@var{i}, @var{j}, @var{sv})\n\ | |
1949 Uses @code{@var{m} = max (@var{i})}, @code{@var{n} = max (@var{j})}\n\ | |
1950 \n\ | |
1951 @deftypefnx {Loadable Function} {@var{s} =} "RSBOI_FNS" (@var{m}, @var{n})\n\ | |
9491
3bcd2fb18f34
sparsersb: a prototypal implementation of the matrix info inquiry code.
michelemartone
parents:
9338
diff
changeset
|
1952 If @var{m} and @var{n} are integers, equivalent to @code{"RSBOI_FNS" ([], [], [], @var{m}, @var{n}, 0)}\n\ |
3bcd2fb18f34
sparsersb: a prototypal implementation of the matrix info inquiry code.
michelemartone
parents:
9338
diff
changeset
|
1953 \n\ |
9563
11d06cf2fb94
sparsersb: interface to rsb_set_initopt_as_string; the sparsersbbench.m will print out the evaluated command before its speedup; doc update.
michelemartone
parents:
9491
diff
changeset
|
1954 @deftypefnx {Loadable Function} {@var{s} =} "RSBOI_FNS" (\"set\", @var{opn}, @var{opv})\n\ |
9604
88b9ad90dba5
sparsersb: added an interface to rsb_get_matrix_info_from_string().
michelemartone
parents:
9563
diff
changeset
|
1955 If @var{opn} is a string representing a valid librsb option name and @var{opv} is a string representing a valid librsb option value, the correspondent librsb option will be set to that value.\n\ |
88b9ad90dba5
sparsersb: added an interface to rsb_get_matrix_info_from_string().
michelemartone
parents:
9563
diff
changeset
|
1956 \n\ |
88b9ad90dba5
sparsersb: added an interface to rsb_get_matrix_info_from_string().
michelemartone
parents:
9563
diff
changeset
|
1957 @deftypefnx {Loadable Function} {@var{s} =} "RSBOI_FNS" (@var{A}, \"get\", @var{mif})\n\ |
11548
2be420b66478
implemented op_el_mul,op_el_div,op_div,op_mul with 'complex'.
michelemartone
parents:
11482
diff
changeset
|
1958 If @var{mif} is a string specifying a valid librsb matrix info string (valid for librsb's rsb_mtx_get_info_from_string()), then the correspondent value will be returned for matrix @var{A}. If @var{mif} is the an empty string (\"\"), matrix structure information will be returned.\n\ |
9563
11d06cf2fb94
sparsersb: interface to rsb_set_initopt_as_string; the sparsersbbench.m will print out the evaluated command before its speedup; doc update.
michelemartone
parents:
9491
diff
changeset
|
1959 \n\ |
9491
3bcd2fb18f34
sparsersb: a prototypal implementation of the matrix info inquiry code.
michelemartone
parents:
9338
diff
changeset
|
1960 @deftypefnx {Loadable Function} {@var{s} =} "RSBOI_FNS" (@var{A}, @var{S})\n\ |
3bcd2fb18f34
sparsersb: a prototypal implementation of the matrix info inquiry code.
michelemartone
parents:
9338
diff
changeset
|
1961 If @var{A} is a "RSBOI_FNS" matrix and @var{S} is a string, @var{S} will be interpreted as a query string about matrix @var{A}.\n\ |
8849 | 1962 \n"\ |
1963 /*If any of @var{sv}, @var{i} or @var{j} are scalars, they are expanded\n\ | |
1964 to have a common size.\n*/ | |
12395
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
1965 RSBOI_10100_DOC""\ |
9092
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1966 "\n\ |
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1967 Please note that on @code{"RSBOI_FNS"} type variables are available most, but not all of the operators available for @code{full} or @code{sparse} typed variables.\n\ |
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1968 \n\ |
23300632e8d1
sparsersb: complex interface for triangular solve and transposed triangular solve; interface to the new rsb_clone_transformed function.
michelemartone
parents:
9030
diff
changeset
|
1969 @seealso{full, sparse}\n\ |
8849 | 1970 @end deftypefn") |
1971 { | |
1972 int nargin = args.length (); | |
1973 octave_value_list retval; | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
1974 octave_sparsersb_mtx*osmp=NULL; |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
1975 bool ic0=nargin>0?(args(0).is_complex_type()):false; |
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
1976 bool ic3=nargin>2?(args(2).is_complex_type()):false; |
11597
b3a2cfb1a0c1
fixed a bug (calling sparsersb with 1 arg caused segfault).
michelemartone
parents:
11596
diff
changeset
|
1977 bool isr=(nargin>0 && args(0).type_name()==RSB_OI_TYPEINFO_STRING); |
8849 | 1978 |
1979 RSBOI_DEBUG_NOTICE("in sparsersb()\n"); | |
1980 | |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
1981 //if(ic3 || ic0) |
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
1982 if(ic0) |
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
1983 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
1984 RSBOI_WARN(RSBOI_O_MISSIMPERRMSG); |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
1985 } |
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
1986 |
11603 | 1987 if(isr) |
1988 osmp=((octave_sparsersb_mtx*)(args(0).internal_rep())); | |
1989 | |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
1990 if(ic3 || ic0) |
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
1991 #if RSBOI_WANT_DOUBLE_COMPLEX |
8985
fb068e31e2d0
sparsersb: fixes to the complex matrix printing method; smaller fixes related to complex.
michelemartone
parents:
8984
diff
changeset
|
1992 RSBOI_WARN(RSBOI_0_UNCFEMSG); |
12533 | 1993 #else /* RSBOI_WANT_DOUBLE_COMPLEX */ |
8985
fb068e31e2d0
sparsersb: fixes to the complex matrix printing method; smaller fixes related to complex.
michelemartone
parents:
8984
diff
changeset
|
1994 RSBOI_0_ERROR(RSBOI_0_NOCOERRMSG); |
12533 | 1995 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
8849 | 1996 install_sparse_rsb(); |
9604
88b9ad90dba5
sparsersb: added an interface to rsb_get_matrix_info_from_string().
michelemartone
parents:
9563
diff
changeset
|
1997 if( nargin == 3 && args(0).is_string() && args(0).string_value()=="set" && args(1).is_string() && args(2).is_string()) |
9563
11d06cf2fb94
sparsersb: interface to rsb_set_initopt_as_string; the sparsersbbench.m will print out the evaluated command before its speedup; doc update.
michelemartone
parents:
9491
diff
changeset
|
1998 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
1999 rsb_err_t errval = RSB_ERR_NO_ERROR; |
9563
11d06cf2fb94
sparsersb: interface to rsb_set_initopt_as_string; the sparsersbbench.m will print out the evaluated command before its speedup; doc update.
michelemartone
parents:
9491
diff
changeset
|
2000 const char *os=args(1).string_value().c_str(); |
11d06cf2fb94
sparsersb: interface to rsb_set_initopt_as_string; the sparsersbbench.m will print out the evaluated command before its speedup; doc update.
michelemartone
parents:
9491
diff
changeset
|
2001 const char *ov=args(2).string_value().c_str(); |
11587
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2002 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
11330 | 2003 errval = rsb_lib_set_opt_str(os,ov); |
11587
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2004 if(RSBOI_SOME_ERROR(errval)) |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2005 { |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2006 error("failed setting option %s to %s (error %d)!",os,ov,errval); |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2007 goto err; |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2008 } |
9563
11d06cf2fb94
sparsersb: interface to rsb_set_initopt_as_string; the sparsersbbench.m will print out the evaluated command before its speedup; doc update.
michelemartone
parents:
9491
diff
changeset
|
2009 goto ret; |
11d06cf2fb94
sparsersb: interface to rsb_set_initopt_as_string; the sparsersbbench.m will print out the evaluated command before its speedup; doc update.
michelemartone
parents:
9491
diff
changeset
|
2010 } |
11d06cf2fb94
sparsersb: interface to rsb_set_initopt_as_string; the sparsersbbench.m will print out the evaluated command before its speedup; doc update.
michelemartone
parents:
9491
diff
changeset
|
2011 |
11587
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2012 if( nargin >= 2 && args(0).is_string() && args(0).string_value()=="set" /* && args(1).is_string() */ ) |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2013 { |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2014 error("did you intend to set librsb options ? use the correct syntax then !"); goto errp; |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2015 } |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2016 |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2017 if( nargin == 2 && args(0).is_string() && args(0).string_value()=="get" && args(1).is_string() ) |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2018 { |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2019 /* FIXME: unfinished feature ! */ |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2020 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2021 error("getting library options still unimplemented!"); |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2022 goto errp; |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2023 } |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2024 |
11691
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
2025 #if defined(RSB_LIBRSB_VER) && (RSB_LIBRSB_VER>=10100) |
11692
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2026 if (nargin >= 2 && isr && args(1).is_string() && args(1).string_value()=="autotune") |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2027 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
2028 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11692
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2029 /* these are user settable */ |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2030 rsb_coo_idx_t nrhs=0; |
12395
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
2031 rsb_int_t maxr=1; |
11692
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2032 rsb_time_t tmax=2.0; |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2033 rsb_int_t tn=0; |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2034 rsb_real_t sf=1.0; |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2035 rsb_trans_t transA=RSB_TRANSPOSITION_N; |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2036 /* TODO: these shall also be user settable */ |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2037 const void * alphap=NULL; |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2038 const void * betap=NULL; |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2039 /* these not */ |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2040 rsb_flags_t order=RSB_OI_DMTXORDER; |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2041 const void * Bp=NULL; |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2042 rsb_nnz_idx_t ldB=0; |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2043 rsb_nnz_idx_t ldC=0; |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2044 void * Cp=NULL; |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2045 |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2046 if (nargin > 2) transA = RSB_CHAR_AS_TRANSPOSITION(args(2).string_value()[0]); |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2047 if (nargin > 3) nrhs=args(3).scalar_value(); |
12395
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
2048 if (nargin > 4) maxr=args(4).scalar_value(); |
11692
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2049 if (nargin > 5) tmax=args(5).scalar_value(); |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2050 if (nargin > 6) tn=args(6).scalar_value(); |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2051 if (nargin > 7) sf=args(7).scalar_value(); |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2052 |
12395
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
2053 // ... |
11692
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2054 if(!osmp || !osmp->mtxAp) |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2055 goto ret;/* FIXME: error handling missing here */ |
12538
76d554668a8f
the autotune case will accept an optional output argument (to be used for the tuned matrix).
michelemartone
parents:
12537
diff
changeset
|
2056 if(nargout) |
76d554668a8f
the autotune case will accept an optional output argument (to be used for the tuned matrix).
michelemartone
parents:
12537
diff
changeset
|
2057 { |
76d554668a8f
the autotune case will accept an optional output argument (to be used for the tuned matrix).
michelemartone
parents:
12537
diff
changeset
|
2058 struct rsb_mtx_t*mtxAp = NULL; |
76d554668a8f
the autotune case will accept an optional output argument (to be used for the tuned matrix).
michelemartone
parents:
12537
diff
changeset
|
2059 errval = rsb_mtx_clone(&mtxAp,RSB_NUMERICAL_TYPE_SAME_TYPE,RSB_TRANSPOSITION_N,NULL,osmp->mtxAp,RSBOI_EXPF); |
76d554668a8f
the autotune case will accept an optional output argument (to be used for the tuned matrix).
michelemartone
parents:
12537
diff
changeset
|
2060 errval = rsb_tune_spmm(&mtxAp,&sf,&tn,maxr,tmax,transA,alphap,NULL,nrhs,order,Bp,ldB,betap,Cp,ldC); |
76d554668a8f
the autotune case will accept an optional output argument (to be used for the tuned matrix).
michelemartone
parents:
12537
diff
changeset
|
2061 retval.append(new octave_sparsersb_mtx(mtxAp)); |
76d554668a8f
the autotune case will accept an optional output argument (to be used for the tuned matrix).
michelemartone
parents:
12537
diff
changeset
|
2062 } |
76d554668a8f
the autotune case will accept an optional output argument (to be used for the tuned matrix).
michelemartone
parents:
12537
diff
changeset
|
2063 else |
76d554668a8f
the autotune case will accept an optional output argument (to be used for the tuned matrix).
michelemartone
parents:
12537
diff
changeset
|
2064 errval = rsb_tune_spmm(&osmp->mtxAp,&sf,&tn,maxr,tmax,transA,alphap,NULL/*osmp->mtxAp*/,nrhs,order,Bp,ldB,betap,Cp,ldC); |
11692
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2065 /* FIXME: serious error handling missing here */ |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2066 goto ret; |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2067 } |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2068 #endif |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2069 |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2070 |
4f0ae470d973
interfacing rsb_tune_spmm through the "autotune" keyword parameter.
michelemartone
parents:
11691
diff
changeset
|
2071 #if defined(RSB_LIBRSB_VER) && (RSB_LIBRSB_VER>=10100) |
12395
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
2072 if (nargin >= 3 && isr |
11847
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
2073 && args(1).is_string() && args(1).string_value().substr(0,6)=="render" |
11691
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
2074 && args(2).is_string()) |
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
2075 { |
12395
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
2076 rsb_err_t errval = RSB_ERR_NO_ERROR; |
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
2077 std::string rmf = args(2).string_value(); |
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
2078 rsb_coo_idx_t pmWidth = 512, pmHeight = 512; |
11847
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
2079 rsb_flags_t marf = RSB_MARF_EPS; |
12395
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
2080 /* may tell the user to supply a sparsersb matrix in case input is not 'sparse' */ |
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
2081 |
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
2082 if (nargin > 2) pmWidth = args(3).scalar_value(); |
ae50074dd6ff
activated and documented the autotuning and plot features available with librsb-1.1.
michelemartone
parents:
12191
diff
changeset
|
2083 if (nargin > 3) pmHeight = args(4).scalar_value(); |
11691
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
2084 |
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
2085 if(!osmp || !osmp->mtxAp) |
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
2086 goto ret;/* FIXME: error handling missing here */ |
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
2087 |
11847
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
2088 if( args(1).string_value() == "renders") |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
2089 marf = RSB_MARF_EPS_S; |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
2090 if( args(1).string_value() == "renderb") |
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
2091 marf = RSB_MARF_EPS_B; |
12191
5e6efe0b22cb
adapting call of rsb_mtx_render to rsb_mtx_rndr (rsb update).
michelemartone
parents:
12187
diff
changeset
|
2092 errval = rsb_mtx_rndr(rmf.c_str(),osmp->mtxAp,pmWidth,pmHeight,marf); |
11691
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
2093 |
11847
b1ee791ddd76
enriched/updated the postscript render interface.
michelemartone
parents:
11734
diff
changeset
|
2094 /* FIXME: serious error handling still missing here */ |
11691
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
2095 if(RSBOI_SOME_ERROR(errval)) |
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
2096 retval.append(std::string("Error returned from rsb_file_mtx_render()")); |
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
2097 goto ret; |
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
2098 } |
6e3240fcadb4
interfacing the postscript rendering function through the "render" keyword.
michelemartone
parents:
11654
diff
changeset
|
2099 #endif |
11734
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
2100 #if RSBOI_WANT_MTX_SAVE |
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
2101 if (nargin == 3 && isr |
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
2102 && args(1).is_string() && args(1).string_value()=="save" |
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
2103 && args(2).is_string()) |
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
2104 { |
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
2105 rsb_file_mtx_save(osmp->mtxAp,args(2).string_value().c_str()); /* TODO: error handling */ |
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
2106 goto ret; |
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
2107 } |
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
2108 #endif |
11587
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2109 if (nargin == 3 && isr |
9604
88b9ad90dba5
sparsersb: added an interface to rsb_get_matrix_info_from_string().
michelemartone
parents:
9563
diff
changeset
|
2110 && args(1).is_string() && args(1).string_value()=="get" |
88b9ad90dba5
sparsersb: added an interface to rsb_get_matrix_info_from_string().
michelemartone
parents:
9563
diff
changeset
|
2111 && args(2).is_string()) |
88b9ad90dba5
sparsersb: added an interface to rsb_get_matrix_info_from_string().
michelemartone
parents:
9563
diff
changeset
|
2112 { |
88b9ad90dba5
sparsersb: added an interface to rsb_get_matrix_info_from_string().
michelemartone
parents:
9563
diff
changeset
|
2113 /* FIXME: undocumented feature */ |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
2114 rsb_err_t errval = RSB_ERR_NO_ERROR; |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
2115 /* rsb_real_t miv=RSBOI_ZERO;*/ /* FIXME: this is extreme danger! */ |
11731
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2116 char is[RSBOI_INFOBUF]; |
11587
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2117 char ss[RSBOI_INFOBUF]; |
11731
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2118 |
11614
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
2119 if(!osmp || !osmp->mtxAp) |
672c998c6620
in a mini example / test of pcr usage in the tester.
michelemartone
parents:
11603
diff
changeset
|
2120 goto ret;/* FIXME: error handling missing here */ |
11731
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2121 |
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2122 if(strlen(args(2).string_value().c_str())==0) |
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2123 strncpy(is,"RSB_MIF_MATRIX_INFO__TO__CHAR_P",sizeof(is)); |
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2124 else |
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2125 strncpy(is,args(2).string_value().c_str(),sizeof(is)); |
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2126 errval = rsb_mtx_get_info_str(osmp->mtxAp,is,ss,RSBOI_INFOBUF); |
11587
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2127 |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2128 if(!RSBOI_SOME_ERROR(errval)) |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2129 { |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2130 retval.append(octave_value(ss)); |
11450
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
2131 goto ret; |
d415854d4f7c
the matrix info printout is now in Octave's style.
michelemartone
parents:
11335
diff
changeset
|
2132 } |
9604
88b9ad90dba5
sparsersb: added an interface to rsb_get_matrix_info_from_string().
michelemartone
parents:
9563
diff
changeset
|
2133 /* FIXME: serious error handling missing here */ |
88b9ad90dba5
sparsersb: added an interface to rsb_get_matrix_info_from_string().
michelemartone
parents:
9563
diff
changeset
|
2134 if(RSBOI_SOME_ERROR(errval)) |
11330 | 2135 retval.append(std::string("Error returned from rsb_mtx_get_info_from_string()")); |
11587
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2136 /* else |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2137 retval.append(octave_value(miv));*/ |
9604
88b9ad90dba5
sparsersb: added an interface to rsb_get_matrix_info_from_string().
michelemartone
parents:
9563
diff
changeset
|
2138 goto ret; |
88b9ad90dba5
sparsersb: added an interface to rsb_get_matrix_info_from_string().
michelemartone
parents:
9563
diff
changeset
|
2139 } |
88b9ad90dba5
sparsersb: added an interface to rsb_get_matrix_info_from_string().
michelemartone
parents:
9563
diff
changeset
|
2140 |
11587
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2141 if ( nargin >= 3 && isr && args(1).is_string() && args(1).string_value()=="get" /* && args(1).is_string() */ ) |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2142 { |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2143 error("did you intend to get matrices information ? use the correct syntax then !"); goto errp; |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2144 } |
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2145 |
9563
11d06cf2fb94
sparsersb: interface to rsb_set_initopt_as_string; the sparsersbbench.m will print out the evaluated command before its speedup; doc update.
michelemartone
parents:
9491
diff
changeset
|
2146 if ( nargin == 1 || nargin == 2 ) |
8849 | 2147 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
2148 rsb_type_t typecode = RSBOI_TYPECODE; |
9563
11d06cf2fb94
sparsersb: interface to rsb_set_initopt_as_string; the sparsersbbench.m will print out the evaluated command before its speedup; doc update.
michelemartone
parents:
9491
diff
changeset
|
2149 if (nargin >= 2)/* FIXME: this is weird ! */ |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
2150 #if RSBOI_WANT_DOUBLE_COMPLEX |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
2151 typecode = RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX; |
12533 | 2152 #else /* RSBOI_WANT_DOUBLE_COMPLEX */ |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
2153 RSBOI_0_ERROR(RSBOI_0_NOCOERRMSG); |
12533 | 2154 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
9604
88b9ad90dba5
sparsersb: added an interface to rsb_get_matrix_info_from_string().
michelemartone
parents:
9563
diff
changeset
|
2155 |
11587
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2156 if (nargin == 2 && isr && args(1).is_string()) |
9491
3bcd2fb18f34
sparsersb: a prototypal implementation of the matrix info inquiry code.
michelemartone
parents:
9338
diff
changeset
|
2157 { |
3bcd2fb18f34
sparsersb: a prototypal implementation of the matrix info inquiry code.
michelemartone
parents:
9338
diff
changeset
|
2158 char ss[RSBOI_INFOBUF]; |
11603 | 2159 if(!osmp || !osmp->mtxAp)goto ret;/* FIXME: error handling missing here */ |
2160 rsb_mtx_get_info_str(osmp->mtxAp,"RSB_MIF_MATRIX_INFO__TO__CHAR_P",ss,RSBOI_INFOBUF); | |
9491
3bcd2fb18f34
sparsersb: a prototypal implementation of the matrix info inquiry code.
michelemartone
parents:
9338
diff
changeset
|
2161 /* FIXME: to add interpretation */ |
3bcd2fb18f34
sparsersb: a prototypal implementation of the matrix info inquiry code.
michelemartone
parents:
9338
diff
changeset
|
2162 RSBOI_WARN(RSBOI_0_UNFFEMSG);/* FIXME: this is yet unfinished */ |
11731
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2163 // octave_stdout << "Matrix information (in the future, supplementary information may be returned, as more inquiry functionality will be implemented):\n" << ss << "\n"; |
9491
3bcd2fb18f34
sparsersb: a prototypal implementation of the matrix info inquiry code.
michelemartone
parents:
9338
diff
changeset
|
2164 /* FIXME: shall not print out, but rather return the info as a string*/ |
3bcd2fb18f34
sparsersb: a prototypal implementation of the matrix info inquiry code.
michelemartone
parents:
9338
diff
changeset
|
2165 //retval.append("place info string here !\n"); |
3bcd2fb18f34
sparsersb: a prototypal implementation of the matrix info inquiry code.
michelemartone
parents:
9338
diff
changeset
|
2166 goto ret; |
3bcd2fb18f34
sparsersb: a prototypal implementation of the matrix info inquiry code.
michelemartone
parents:
9338
diff
changeset
|
2167 } |
3bcd2fb18f34
sparsersb: a prototypal implementation of the matrix info inquiry code.
michelemartone
parents:
9338
diff
changeset
|
2168 else |
8849 | 2169 if(args(0).is_sparse_type()) |
2170 { | |
11587
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2171 if( isr ) |
8849 | 2172 { |
8985
fb068e31e2d0
sparsersb: fixes to the complex matrix printing method; smaller fixes related to complex.
michelemartone
parents:
8984
diff
changeset
|
2173 RSBOI_WARN(RSBOI_0_UNFFEMSG); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2174 retval.append(osmp=(octave_sparsersb_mtx*)(args(0).get_rep()).clone()); |
8849 | 2175 } |
2176 else | |
2177 { | |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
2178 if(!ic0) |
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
2179 { |
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
2180 const SparseMatrix m = args(0).sparse_matrix_value(); |
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
2181 if (error_state) goto err; |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2182 retval.append(osmp=new octave_sparsersb_mtx(m,typecode)); |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
2183 } |
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
2184 #if RSBOI_WANT_DOUBLE_COMPLEX |
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
2185 else |
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
2186 { |
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
2187 const SparseComplexMatrix m = args(0).sparse_complex_matrix_value(); |
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
2188 if (error_state) goto err; |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2189 retval.append(osmp=new octave_sparsersb_mtx(m,typecode)); |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
2190 } |
12533 | 2191 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
8849 | 2192 } |
2193 } | |
2194 else | |
2195 if(args(0).is_string()) | |
2196 { | |
11597
b3a2cfb1a0c1
fixed a bug (calling sparsersb with 1 arg caused segfault).
michelemartone
parents:
11596
diff
changeset
|
2197 const std::string mtxfilename = args(0).string_value(); |
8849 | 2198 if (error_state) goto err; |
11597
b3a2cfb1a0c1
fixed a bug (calling sparsersb with 1 arg caused segfault).
michelemartone
parents:
11596
diff
changeset
|
2199 if(mtxfilename==RSBOI_LIS) |
9005
6dcaf211c5e4
sparsersb: added a first librsb introspection feature (sparsersb("?")).
michelemartone
parents:
8999
diff
changeset
|
2200 { |
11596
493ef9d1c25d
implemented a way to specify the type of a matrix, when loading from file.
michelemartone
parents:
11587
diff
changeset
|
2201 //retval.append(RSB_NUMERICAL_TYPE_PREPROCESSOR_SYMBOLS); |
493ef9d1c25d
implemented a way to specify the type of a matrix, when loading from file.
michelemartone
parents:
11587
diff
changeset
|
2202 #if RSBOI_WANT_DOUBLE_COMPLEX |
493ef9d1c25d
implemented a way to specify the type of a matrix, when loading from file.
michelemartone
parents:
11587
diff
changeset
|
2203 retval.append("D Z"); |
12533 | 2204 #else /* RSBOI_WANT_DOUBLE_COMPLEX */ |
11596
493ef9d1c25d
implemented a way to specify the type of a matrix, when loading from file.
michelemartone
parents:
11587
diff
changeset
|
2205 retval.append("D"); |
12533 | 2206 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
9005
6dcaf211c5e4
sparsersb: added a first librsb introspection feature (sparsersb("?")).
michelemartone
parents:
8999
diff
changeset
|
2207 goto ret; |
6dcaf211c5e4
sparsersb: added a first librsb introspection feature (sparsersb("?")).
michelemartone
parents:
8999
diff
changeset
|
2208 } |
6dcaf211c5e4
sparsersb: added a first librsb introspection feature (sparsersb("?")).
michelemartone
parents:
8999
diff
changeset
|
2209 else |
6dcaf211c5e4
sparsersb: added a first librsb introspection feature (sparsersb("?")).
michelemartone
parents:
8999
diff
changeset
|
2210 { |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
2211 rsb_type_t typecode = RSBOI_TYPECODE; |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
2212 RSBOI_WARN(RSBOI_0_UNFFEMSG); |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
2213 RSBOI_WARN("shall set the type, here"); |
11596
493ef9d1c25d
implemented a way to specify the type of a matrix, when loading from file.
michelemartone
parents:
11587
diff
changeset
|
2214 if(nargin>1 && args(1).is_string()) |
493ef9d1c25d
implemented a way to specify the type of a matrix, when loading from file.
michelemartone
parents:
11587
diff
changeset
|
2215 { |
11597
b3a2cfb1a0c1
fixed a bug (calling sparsersb with 1 arg caused segfault).
michelemartone
parents:
11596
diff
changeset
|
2216 const std::string mtxtypestring = args(1).string_value(); |
b3a2cfb1a0c1
fixed a bug (calling sparsersb with 1 arg caused segfault).
michelemartone
parents:
11596
diff
changeset
|
2217 if(mtxtypestring=="complex" || mtxtypestring=="Z") |
11596
493ef9d1c25d
implemented a way to specify the type of a matrix, when loading from file.
michelemartone
parents:
11587
diff
changeset
|
2218 #if RSBOI_WANT_DOUBLE_COMPLEX |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
2219 typecode = RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX; |
11596
493ef9d1c25d
implemented a way to specify the type of a matrix, when loading from file.
michelemartone
parents:
11587
diff
changeset
|
2220 #else |
11598
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2221 RSBOI_0_ERROR(RSBOI_0_NOCOERRMSG); |
12533 | 2222 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
11597
b3a2cfb1a0c1
fixed a bug (calling sparsersb with 1 arg caused segfault).
michelemartone
parents:
11596
diff
changeset
|
2223 if(mtxtypestring=="real" || mtxtypestring=="D") |
12537
b644dc25de64
readability formatting (mainly spacings) changes.
michelemartone
parents:
12536
diff
changeset
|
2224 typecode = RSB_NUMERICAL_TYPE_DOUBLE; |
11596
493ef9d1c25d
implemented a way to specify the type of a matrix, when loading from file.
michelemartone
parents:
11587
diff
changeset
|
2225 } |
11734
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
2226 #if RSBOI_WANT_MTX_LOAD |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2227 osmp=new octave_sparsersb_mtx(mtxfilename,typecode); |
12533 | 2228 #else /* RSBOI_WANT_DOUBLE_COMPLEX */ |
11734
4de83ed9df13
added a "save" function, and using preprocessor conditinoals to enable/disable save/load functions.
michelemartone
parents:
11733
diff
changeset
|
2229 goto ret; /* TODO: need error message here */ |
12533 | 2230 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2231 if(osmp->mtxAp) |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2232 retval.append(osmp); |
11598
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2233 else |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2234 delete osmp; |
11598
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2235 #if RSBOI_WANT_VECLOAD_INSTEAD_MTX |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2236 if(!osmp->mtxAp) |
11598
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2237 { |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2238 rsb_nnz_idx_t n=0; |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2239 rsb_file_vec_load(mtxfilename.c_str(),typecode,NULL,&n); |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2240 if(n<1) |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2241 { |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2242 /* FIXME: message needed here */ |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2243 goto err; |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2244 } |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2245 |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2246 if(typecode==RSB_NUMERICAL_TYPE_DOUBLE) |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2247 { |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2248 Matrix retvec(n,1,RSBOI_ZERO); |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2249 rsb_file_vec_load(mtxfilename.c_str(),typecode,(RSBOI_T*)retvec.data(),&n); |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2250 retval.append(retvec); |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2251 } |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2252 #if RSBOI_WANT_DOUBLE_COMPLEX |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2253 else |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2254 if(typecode==RSB_NUMERICAL_TYPE_DOUBLE_COMPLEX) |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2255 { |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2256 ComplexMatrix retvec(n,1,RSBOI_ZERO); |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2257 rsb_file_vec_load(mtxfilename.c_str(),typecode,(RSBOI_T*)retvec.data(),&n); |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2258 retval.append(retvec); |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2259 } |
12533 | 2260 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
11598
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2261 goto ret; |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2262 } |
e07519024b37
extendend matrix market reading support to unidimensional vectors as well.
michelemartone
parents:
11597
diff
changeset
|
2263 #endif |
11584 | 2264 if(nargout) nargout--; |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2265 if(nargout) retval.append(osmp->rows()),--nargout; |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2266 if(nargout) retval.append(osmp->cols()),--nargout; |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2267 if(nargout) retval.append(osmp->nnz()),--nargout; |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2268 if(nargout) retval.append(osmp->get_info_string()),--nargout; |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2269 if(nargout) retval.append((!osmp->is_complex_type())?"real":"complex"),--nargout; |
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2270 if(nargout) retval.append(osmp->get_symmetry()),--nargout; |
9005
6dcaf211c5e4
sparsersb: added a first librsb introspection feature (sparsersb("?")).
michelemartone
parents:
8999
diff
changeset
|
2271 } |
8849 | 2272 } |
2273 else | |
2274 { | |
12187
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2275 if (nargin == 2 && args(0).is_scalar_type() && args(1).is_scalar_type() ) |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
2276 { |
12187
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2277 const SparseMatrix m = args(0).sparse_matrix_value(); |
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2278 retval.append(osmp=new octave_sparsersb_mtx(SparseMatrix(args(0).scalar_value(),args(1).scalar_value()))); |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
2279 } |
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
2280 else |
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
2281 { |
12187
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2282 if(!ic0) |
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2283 { |
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2284 Matrix m = args(0).matrix_value(); |
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2285 if (error_state) goto err; |
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2286 retval.append(osmp=new octave_sparsersb_mtx(m)); |
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2287 } |
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2288 #if RSBOI_WANT_DOUBLE_COMPLEX |
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2289 else |
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2290 { |
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2291 ComplexMatrix m = args(0).complex_matrix_value(); |
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2292 if (error_state) goto err; |
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2293 retval.append(osmp=new octave_sparsersb_mtx(m)); |
ad4b31d03859
bugfix for 'sparsersb(nrows,ncols)' invocation case.
michelemartone
parents:
12059
diff
changeset
|
2294 } |
12533 | 2295 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
2296 } |
8849 | 2297 } |
2298 } | |
2299 else | |
11587
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2300 if (nargin >= 3 && nargin <= 6 && !(args(0).is_string() || args(1).is_string() || args(2).is_string() ) ) |
8849 | 2301 { |
9023
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2302 rsb_flags_t eflags=RSBOI_DCF; |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
2303 octave_idx_type nrA=0,ncA=0; |
11731
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2304 int sai=0; |
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2305 |
9023
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2306 if (nargin > 3) |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2307 { |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2308 if ( nargin < 5) |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2309 { |
11731
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2310 if(nargin==4 && args(3).is_string()) |
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2311 goto checked; |
9023
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2312 RSBOI_EERROR(RSBOI_0_BADINVOERRMSG); |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2313 goto errp; |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2314 } |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2315 /* FIXME: integer_type should be also supported here: shouldn't it ?*/ |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2316 if( (!args(3).is_scalar_type()) || (!args(4).is_scalar_type())) |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2317 { |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2318 RSBOI_EERROR(RSBOI_0_BADINVOERRMSG); |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2319 goto errp; |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2320 } |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2321 if( nargin > 5 && ((!args(5).is_string()) && (!args(5).is_scalar_type()))) |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2322 { |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2323 RSBOI_EERROR(RSBOI_0_BADINVOERRMSG); |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2324 goto errp; |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2325 } |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2326 } |
11731
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2327 checked: |
9023
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2328 if (nargin >= 5 ) |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2329 { |
11731
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2330 nrA = args(3).scalar_value();/* FIXME: need index value here! */ |
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2331 ncA = args(4).scalar_value(); |
11600
c11869319776
relabeled identifiers in a more meaningful way.
michelemartone
parents:
11599
diff
changeset
|
2332 if(nrA<=0 || ncA<=0) |
9023
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2333 { |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2334 RSBOI_EERROR(RSBOI_O_NPMSERR); |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2335 goto errp; |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2336 } |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2337 } |
11731
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2338 |
9023
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2339 if (nargin >= 6 && args(5).is_string()) |
11731
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2340 sai=5; |
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2341 else |
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2342 if (nargin == 4 && args(3).is_string()) |
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2343 sai=3; |
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2344 if(sai) |
9023
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2345 { |
11731
17720bba2fb5
fixing a documentation case which was not working.
michelemartone
parents:
11692
diff
changeset
|
2346 std::string vv= args(sai).string_value(); |
9023
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2347 if ( vv == "summation" || vv == "sum" ) |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2348 eflags=RSB_FLAG_DUPLICATES_SUM; |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2349 else |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2350 if ( vv == "unique" ) |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2351 eflags=RSB_FLAG_DUPLICATES_KEEP_LAST; |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2352 else |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2353 goto errp; |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2354 } |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2355 if (nargin >= 6 && args(5).is_integer_type()) |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2356 { |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2357 /* we ignore this value for MATLAB compatibility */ |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2358 } |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2359 if (error_state) goto ret; |
f340a448c7f7
sparsersb: constructors interface shall now be the same as octave's sparse(); new test cases for sparsersb constructor; doc update;
michelemartone
parents:
9011
diff
changeset
|
2360 |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
2361 if(!ic3) |
9135
9b1a1cbd7c46
sparsersb: using to-idx_vector conversion for indices, gaining some 20% gain in find-to-librsb constructor speed.
michelemartone
parents:
9130
diff
changeset
|
2362 { |
11587
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2363 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
9135
9b1a1cbd7c46
sparsersb: using to-idx_vector conversion for indices, gaining some 20% gain in find-to-librsb constructor speed.
michelemartone
parents:
9130
diff
changeset
|
2364 idx_vector iv=args(0).index_vector (); |
9b1a1cbd7c46
sparsersb: using to-idx_vector conversion for indices, gaining some 20% gain in find-to-librsb constructor speed.
michelemartone
parents:
9130
diff
changeset
|
2365 idx_vector jv=args(1).index_vector (); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2366 retval.append(osmp=new octave_sparsersb_mtx( iv, jv, args(2).matrix_value(),nrA,ncA,eflags )); |
9135
9b1a1cbd7c46
sparsersb: using to-idx_vector conversion for indices, gaining some 20% gain in find-to-librsb constructor speed.
michelemartone
parents:
9130
diff
changeset
|
2367 } |
9b1a1cbd7c46
sparsersb: using to-idx_vector conversion for indices, gaining some 20% gain in find-to-librsb constructor speed.
michelemartone
parents:
9130
diff
changeset
|
2368 |
8984
3a371ebb1cd7
sparsersb: implementing additional complex constructors.
michelemartone
parents:
8983
diff
changeset
|
2369 #if RSBOI_WANT_DOUBLE_COMPLEX |
8983
8a894c905e7b
sparsersb: introducing experimental support for complex matrices.
michelemartone
parents:
8962
diff
changeset
|
2370 else |
9135
9b1a1cbd7c46
sparsersb: using to-idx_vector conversion for indices, gaining some 20% gain in find-to-librsb constructor speed.
michelemartone
parents:
9130
diff
changeset
|
2371 { |
11587
b0dc1a40bf8a
error messages on invalid attempts of using library/matrix get/set options.
michelemartone
parents:
11584
diff
changeset
|
2372 RSBOI_DEBUG_NOTICE(RSBOI_D_EMPTY_MSG); |
9135
9b1a1cbd7c46
sparsersb: using to-idx_vector conversion for indices, gaining some 20% gain in find-to-librsb constructor speed.
michelemartone
parents:
9130
diff
changeset
|
2373 idx_vector iv=args(0).index_vector (); |
9b1a1cbd7c46
sparsersb: using to-idx_vector conversion for indices, gaining some 20% gain in find-to-librsb constructor speed.
michelemartone
parents:
9130
diff
changeset
|
2374 idx_vector jv=args(1).index_vector (); |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2375 retval.append(osmp=new octave_sparsersb_mtx( iv, jv, args(2).complex_matrix_value(),nrA,ncA,eflags )); |
9135
9b1a1cbd7c46
sparsersb: using to-idx_vector conversion for indices, gaining some 20% gain in find-to-librsb constructor speed.
michelemartone
parents:
9130
diff
changeset
|
2376 } |
12533 | 2377 #endif /* RSBOI_WANT_DOUBLE_COMPLEX */ |
8849 | 2378 } |
2379 else | |
2380 goto errp; | |
11601
09a24cce7d31
relabeled even more identifiers in a meaningful way.
michelemartone
parents:
11600
diff
changeset
|
2381 if(!osmp) |
8849 | 2382 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
2383 RSBOI_WARN(RSBOI_0_NEEDERR); |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
2384 RSBOI_DEBUG_NOTICE(RSBOI_0_FATALNBMSG); |
8849 | 2385 } |
2386 #if RSBOI_WANT_HEAVY_DEBUG | |
11603 | 2387 if(!rsb_is_correctly_built_rcsr_matrix(osmp->mtxAp)) // function non in rsb.h's API |
8849 | 2388 { |
9011
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
2389 RSBOI_WARN(RSBOI_0_NEEDERR); |
2cea44b5007e
sparsersb: cleaning up the code: deleting old comments or summarizing them at the beginning of the source code listing, introducing error codes and using more and more error reporting preprocessor macros.
michelemartone
parents:
9010
diff
changeset
|
2390 RSBOI_DEBUG_NOTICE(RSBOI_0_UNCBERR); |
8849 | 2391 } |
2392 #endif | |
2393 goto err; | |
2394 errp: | |
2395 print_usage (); | |
2396 err: | |
2397 ret: | |
2398 return retval; | |
2399 } | |
12059
59213565ceff
forgot a couple of things in the last commit.
michelemartone
parents:
12023
diff
changeset
|
2400 /* |
59213565ceff
forgot a couple of things in the last commit.
michelemartone
parents:
12023
diff
changeset
|
2401 %!test |
59213565ceff
forgot a couple of things in the last commit.
michelemartone
parents:
12023
diff
changeset
|
2402 %! #help sparsersb |
59213565ceff
forgot a couple of things in the last commit.
michelemartone
parents:
12023
diff
changeset
|
2403 %! sparsersb([1]) |
59213565ceff
forgot a couple of things in the last commit.
michelemartone
parents:
12023
diff
changeset
|
2404 */ |