error in function passing a matrix as argument

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

error in function passing a matrix as argument

Guido Giuntoli
why this do not work ? :

main.m
...
[du, tol, its] = solver(jac, res, du, min_tol, max_its);
...

solver.m
function [du, tol, its] = solver(A, b, du, min_tol, max_its);
      du = -A\b; tol = 0.0 ; its = 0;
endfunction

gives:
error: sparse matrix type invalid as index value
error: run_lin.m: subscript indices must be either positive integers less than 2^31 or logicals
error: called from: main.c

if I put
du = -jac\res; tol = 0.0 ; its = 0;

It works ! why ? Thank you, Guido.



-----------------------------------------
Join us March 12-15 at CERN near Geneva
Switzerland for OctConf 2018.  More info:
https://wiki.octave.org/OctConf_2018
-----------------------------------------