annotate main/sparsersb/src/sparsersb.cc @ 12642:a95bee17f7fd octave-forge

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