1function nu = stoich_net(a, species, rxns)
2% STOICH_NET  Get the net stoichiometric coefficients.
3% nu = stoich_net(a,species,rxns)
4%
5% See also: :mat:func:`stoich_r`, :mat:func:`stoich_p`
6%
7% :param a:
8%     Instance of class :mat:func:`Kinetics` (or another
9%     object deriving from Kinetics)
10%     for which the net stoichiometric coefficients are desired.
11% :param species:
12%     Species indices for which net stoichiometric coefficients
13%     should be retrieved. Optional argument; if specified, ``rxns``
14%     must be specified as well.
15% :param rxns:
16%     Reaction indices for which net stoichiometric coefficients
17%     should be retrieved. Optional argument; if specified, ``species``
18%     must be specified as well.
19% :return:
20%     Returns a sparse matrix of all net stoichiometric
21%     coefficients. The matrix element ``nu(k,i)`` is the
22%     stoichiometric coefficient of species k as a net in
23%     reaction i. If ``species`` and ``rxns`` are specified, the matrix
24%     will contain only entries for the specified species and
25%     reactions. For example, ``stoich_p(a,3,[1 3 5 7])`` returns a
26%     sparse matrix containing only the coefficients for species 3
27%     in reactions 1, 3, 5, and 7.
28%
29
30if nargin == 1
31    nu = stoich_p(a) - stoich_r(a);
32elseif nargin == 3
33    nu = stoich_p(a, species, rxns) - stoich_r(a, species, rxns);
34else
35    error(['stoich_net requires 1 or 3 arguments.'])
36end
37