Bug#387137: [Pkg-octave-devel] Bug#387137: spkron(a,
b) not working when arguments are scalar
Rafael Laboissiere
rafael at debian.org
Tue Sep 12 20:02:14 UTC 2006
* John W. Eaton <jwe at bevo.che.wisc.edu> [2006-09-12 11:38]:
> On 12-Sep-2006, Thomas Weber wrote:
>
> | Hi,
> |
> | Am Dienstag, den 12.09.2006, 14:39 +0200 schrieb Nicolas Guilbert:
> | > Package: octave2.9
> | > Version: 2.9.8-1
> | >
> | > Steps to reproduce:
> | > octave-2.9.8:1> spkron(2,3)
> | > error: octave_base_value::sparse_matrix_value(): wrong type argument `scalar'
> | > error: octave_base_value::sparse_matrix_value(): wrong type argument `scalar'
> | >
> | > would expect
> | >
> | > ans = 6
> |
> | Try
> | spkron(sparse(2), sparse(3))
> |
> | I don't consider this a bug. The overhead for sparse-implementations
> | just doesn't make sense for scalars.
>
> Also, why are you using spkron directly? I think it would be better
> to use kron instead. It will handle both
>
> kron (2, 3)
> kron (sparse (2), sparse (3))
>
> Once Octave has proper dispatching, spkron may only be available via
> kron with sparse arguments rather than being directly callable.
I tend to agree with the both of you. However the current on-line help for
spkron is misleading:
########################################################################
octave2.9:1> help spkron
-- Function File: spkron (A, B)
Form the kronecker product of two sparse matrices. This is defined
block by block as
x = [a(i, j) b]
For example,
kron (1:4, ones (3, 1))
=> 1 2 3 4
1 2 3 4
1 2 3 4
########################################################################
Through its example, one may think that spkron(2,3) should be valid.
Notice that in the example, full matrices are used (!:4 and ones(3,1)).
Shouldn't that be fixed?
--
Rafael
More information about the Pkg-octave-devel
mailing list