annotate main/sparsersb/src/sparsersb.cc @ 12620:40ee970a56c3 octave-forge

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