matlab - find root of vectorised function in python -
matlab - find root of vectorised function in python -
i've been porting code matlab python.
part of code finds root of vectorised function, expensive call.
in matlab efficiently achieved using jacobpattern option. using alternative solver aware nth element of returned vector depends on nth element of argument vector.
options = optimset('algorithm','trust-region-reflective','jacobpattern',speye(lengthofargument)); roots = fsolve(@vectorisedfunction, initialguesses, options);
the vectorisation in matlab speeds things factor of 100 , expect similar achieved in python. have been looking @ scipy.optimization cannot find equivalent of jacobpattern.
so ask: best approaches finding root of vectorised function in python?
i'm not sure expensive function talking does, numpy broadcasts functions each element in array (vectorization done free).
so homecoming expensive function if working on 0 element in sparse array.
python matlab optimization scipy vectorization
Comments
Post a Comment