annotate main/sparsersb/src/sparsersb.cc @ 12610:b5925d668a3a octave-forge

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