help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libSVM support in Octave


From: David Bateman
Subject: Re: libSVM support in Octave
Date: Mon, 09 Oct 2006 11:52:29 +0200
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Alois Schloegl wrote:
> This allows to use SVMTRAIN. However, at run-time the function 
> SVMPREDICT results in this error.
>
> error: octave_base_value::nzmax (): wrong type argument `matrix'
> panic: Segmentation fault -- stopping myself...
> attempting to save variables to `octave-core'...
> save to `octave-core' complete
> Segmentation fault
>
> After some debugging, the error massage is caused in svm_model_matlab.c 
> (line 6681) by this command
>    [num_samples] = mxGetNzmax(rhs[id]);
>  
> The segmentation fault occures only a few lines later, perhaps because 
> num_samples is -1.
>
> Again, I'd like asking you whether mxGetNzmax is implemented/supported, 
> or not.
>
>   
This is because the nzmax function is DLD-FUNCTIONS/sparse.cc was made a
method of the octave_value class. When it was a function it converted
matrices to sparse matrices prior to calling nzmax (or in fact nnz).
This feature wasn't kept when the code became an octave_value method...
The only logical way to treat this would be

octave_idx_type
octave_matrix::nnz (void) const
{
  return SparseMatrix (matrix).nnz ();
}

octave_idx_type
octave_matrix::nzmax (void) const
{
  return SparseMatrix (matrix).nzmax ();
}

and to the complex class

octave_idx_type
octave_complex_matrix::nnz (void) const
{
  return SparseComplexMatrix (matrix).nnz ();
}

octave_idx_type
octave_complex_matrix::nzmax (void) const
{
  return SparseComplexMatrix (matrix).nzmax ();
}

And similar to the boolean and scalar classes as well. I'm not sure
whether the integer classes should implement something similar of not,
though  nnz(uint8(eye(5)))  works correctly in matlab 2006a and so I
suspect the answer is we should.

That being the case, perhaps it would be better to have nnz and nzmax
methods in the Array<T> class and just call these.

D.


-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

[Prev in Thread] Current Thread [Next in Thread]