Mercurial > hg > octave-nkf
diff libinterp/parse-tree/pt-cbinop.cc @ 19857:bf88eab464b8
Detect binary operations with a transposed matrix and forward to BLAS (bug #42716).
* pt-cbinop.cc (tree_compound_binary_expression::rvalue,
tree_compound_binary_expression::rvalue1): New functions.
::rvalue validates input and calls ::rvalue1.
rvalue1 calls do_binary_op with the correct transpose flag.
* pt-cbinop.h: Add new functions to header file.
author | David Bateman <dbateman@free.fr> |
---|---|
date | Tue, 03 Feb 2015 12:27:58 -0800 |
parents | 6a71e5030df5 |
children | 4197fc428c7d |
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-cbinop.cc +++ b/libinterp/parse-tree/pt-cbinop.cc @@ -32,6 +32,49 @@ #include "pt-unop.h" #include "pt-walk.h" +octave_value_list +tree_compound_binary_expression::rvalue (int nargout) +{ + octave_value_list retval; + + if (nargout > 1) + error ("binary operator '%s': invalid number of output arguments", + oper () . c_str ()); + else + retval = rvalue1 (nargout); + + return retval; +} + +octave_value +tree_compound_binary_expression::rvalue1 (int) +{ + octave_value retval; + + if (error_state) + return retval; + + if (op_lhs) + { + octave_value a = op_lhs->rvalue1 (); + + if (! error_state && a.is_defined () && op_rhs) + { + octave_value b = op_rhs->rvalue1 (); + + if (! error_state && b.is_defined ()) + { + retval = ::do_binary_op (etype, a, b); + + if (error_state) + retval = octave_value (); + } + } + } + + return retval; +} + // If a tree expression is a transpose or hermitian transpose, return // the argument and corresponding operator.