rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
matrix_reaction.m
1 function res = matrix_reaction(x, model, df_info, i, j)
2 %function res = matrix_reaction(x, model, df_info, i, j)
3 
4 % IM 12.04.2013
5 
6 
7 hat_phi_i = evaluate_basis_function(df_info, x, i);
8 hat_phi_j = evaluate_basis_function(df_info, x, j);
9 
10 r = cache_function(@(xarg, xmodel)xmodel.reaction(df_info.grid, 1: ...
11  df_info.grid.nelements, ...
12  xarg, xmodel), x, model);
13 
14 if ~iscell(r)
15 
16  res = hat_phi_i' * hat_phi_j * r;
17 else
18 
19  res = cell(1, length(r));
20  for q = 1:length(r)
21 
22  res{q} = hat_phi_i' * hat_phi_j * r{q};
23  end
24 end
25 
26 end
function varargout = cache_function(func_ptr, varargin)
simple caching of function call inputs are cached too!