comparison src/pt-cbinop.cc @ 9661:afcf852256d2

optimize / and '\ for triangular matrices
author Jaroslav Hajek <highegg@gmail.com>
date Wed, 23 Sep 2009 10:00:16 +0200
parents dc6bda6f9994
children 9ecd35a606e3
comparison
equal deleted inserted replaced
9660:0256e187d13b 9661:afcf852256d2
104 } 104 }
105 105
106 return retop; 106 return retop;
107 } 107 }
108 108
109 // Possibly convert left division to trans_ldiv or herm_ldiv.
110
111 static octave_value::compound_binary_op
112 simplify_ldiv_op (tree_expression *&a, tree_expression *&b)
113 {
114 octave_value::compound_binary_op retop;
115 octave_value::unary_op opa = strip_trans_herm (a);
116
117 if (opa == octave_value::op_hermitian)
118 retop = octave_value::op_herm_ldiv;
119 else if (opa == octave_value::op_transpose)
120 retop = octave_value::op_trans_ldiv;
121 else
122 retop = octave_value::unknown_compound_binary_op;
123
124 return retop;
125 }
126
109 // Possibly contract and/or with negation. 127 // Possibly contract and/or with negation.
110 128
111 static octave_value::compound_binary_op 129 static octave_value::compound_binary_op
112 simplify_and_or_op (tree_expression *&a, tree_expression *&b, octave_value::binary_op op) 130 simplify_and_or_op (tree_expression *&a, tree_expression *&b, octave_value::binary_op op)
113 { 131 {
150 { 168 {
151 case octave_value::op_mul: 169 case octave_value::op_mul:
152 ct = simplify_mul_op (ca, cb); 170 ct = simplify_mul_op (ca, cb);
153 break; 171 break;
154 172
173 case octave_value::op_ldiv:
174 ct = simplify_ldiv_op (ca, cb);
175 break;
176
155 case octave_value::op_el_and: 177 case octave_value::op_el_and:
156 case octave_value::op_el_or: 178 case octave_value::op_el_or:
157 ct = simplify_and_or_op (ca, cb, t); 179 ct = simplify_and_or_op (ca, cb, t);
158 break; 180 break;
159 181