BUG DESCRIPTION:
----------------
Please extend kron() and .*. to booleans and sparse booleans.
Presently,
// BETWEEN BOOLEANS:
// ~~~~~~~~~~~~~~~~
--> b = [%F %T %T];
--> spb = sparse(b);
--> b .*. b
Undefined operation for the given operands.
check or define function %b_k_b for overloading.
--> b .*. spb
Undefined operation for the given operands.
check or define function %b_k_spb for overloading.
--> spb .*. b
Undefined operation for the given operands.
check or define function %spb_k_b for overloading.
--> spb .*. spb
Undefined operation for the given operands.
check or define function %spb_k_spb for overloading.
--> kron(b,b)
in builtin kron
Function not defined for given argument type(s),
check arguments or define function %b_kron for overloading.
--> kron(b,spb)
in builtin kron
Function not defined for given argument type(s),
check arguments or define function %b_kron for overloading.
--> kron(spb,b)
in builtin kron
Function not defined for given argument type(s),
check arguments or define function %spb_kron for overloading.
--> kron(spb,spb)
in builtin kron
Function not defined for given argument type(s),
check arguments or define function %spb_kron for overloading.
// BETWEEN BOOLEAN AND NUMERIC
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
--> m = 0:2;
--> sp = sparse(m);
--> b .*. m
Undefined operation for the given operands.
check or define function %b_k_s for overloading.
--> m .*. b
Undefined operation for the given operands.
check or define function %s_k_b for overloading.
--> m .*. spb
Undefined operation for the given operands.
check or define function %s_k_spb for overloading.
--> spb .*. m
Undefined operation for the given operands.
check or define function %spb_k_s for overloading.
--> sp .*. b
Undefined operation for the given operands.
check or define function %sp_k_b for overloading.
--> b .*. sp
Undefined operation for the given operands.
check or define function %b_k_sp for overloading.
--> m .*. spb
Undefined operation for the given operands.
check or define function %s_k_spb for overloading.
--> spb .*. m
Undefined operation for the given operands.
check or define function %spb_k_s for overloading.
--> spb .*. sp
Undefined operation for the given operands.
check or define function %spb_k_sp for overloading.
--> sp .*. spb
Undefined operation for the given operands.
check or define function %sp_k_spb for overloading.
--> spb .*. spb
Undefined operation for the given operands.
check or define function %spb_k_spb for overloading.
Same series with kron() instead of .*.:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--> kron(b,b)
in builtin kron
Function not defined for given argument type(s),
check arguments or define function %b_kron for overloading.
--> kron(spb,b)
in builtin kron
Function not defined for given argument type(s),
check arguments or define function %spb_kron for overloading.
etc...
ERROR LOG:
----------
See above
HOW TO REPRODUCE THE BUG:
-------------------------
b = [%F %T %T]; spb = sparse(b);
b .*. b
b .*. spb
spb .*. b
spb .*. spb
kron(b,b)
kron(b,spb)
kron(spb,b)
kron(spb,spb)
m = 0:2; sp = sparse(m);
b .*. m
m .*. b
m .*. spb
spb .*. m
sp .*. b
b .*. sp
m .*. spb
spb .*. m
spb .*. sp
sp .*. spb
spb .*. spb
kron(b,b)
kron(spb,b)
OTHER INFORMATION:
------------------
Mixed boolean .*. numeric or numeric .*. boolean operations must yield some numerical results, not boolean ones.
It is then always possible to get a boolean equivalent with "result<>0", while reversing a boolean result into
a numerical one is obviously impossible.
Special cases:
* %inf * %f : could yield 0 (%f being a cancellation) or Nan (Octave yields Nan)
* %nan * %f : could yield 0 or Nan (Octave yields Nan)
IMHO, yielding 0 would be clearer, to use *booleans as a "numerical mask" instead of a numerical multiplication.
For the time being, we propose to implement .*. consistently wrt .*, but this topic should be discussed for *, .* and .*. together:
--> [4 3 %inf] .* [T F F]
ans =
4. 0. Nan