Error in compiling oct file

I am trying to make an oct file from the following code

DEFUN_DLD (svmtrain, prhs, nargout, "[model] = svmtrain(training_labels, training_data, command_line)")
...
if(prhs(1).is_sparse_type())
{...

and I get the following error during compilation:

svmtrain.cc: In function ‘octave_value_list Fsvmtrain(const octave_value_list&, int)’:
svmtrain.cc:414:14: error: ‘const class octave_value’ has no member named ‘is_sparse_type’; did you mean ‘is_single_type’?
414 | if(prhs(1).is_sparse_type())
| ^~~~~~~~~~~~~~
| is_single_type
error: mkoctfile: building exited with failure status

Does anybody know what header am I missing or what is otherwise wrong with the .is_sparse_type() statement?
The headers in the file are the following:
#include <octave/oct.h>
#include <octave/dMatrix.h>
#include <octave/dColVector.h>
#include <octave/dRowVector.h>
#include <octave/ov-base.h>
#include <octave/ov-struct.h>
#include <octave/ov-struct.h>
#include <octave/ov-re-sparse.h>
#include <octave/ov-cx-sparse.h>
#include <octave/ov-bool-sparse.h>
#include <string.h>

I am compiling in Octave 6.2
Thanks

Per the doxygen docs here, I think issparse is what you are looking for instead of is_sparse_type().

Also, I think these types of questions are more suitable for the help category not the maintainers category.

Thanks a lot for the reply and for changing the post to more suitable category.
It must have changed at some version point. I will search through doxygen docs to figure it out.
Thanks again!

Afaict, is_sparse_type was deprecated in favor of issparse in Octave 4.4 and was finally removed for Octave 5.
If you are targeting versions before Octave 4.4, you might want to add configure checks for which function to use.

1 Like

Thanks for the info. I am targeting >=6.1.0, so I am on the safe side.