ppval_yp

PURPOSE ^

SYNOPSIS ^

function [y] = ppval_yp(pp,x)

DESCRIPTION ^

 Non vectorial polynomial piecewise calculation for testing the C language
 implementation in the ray-tracing

 INPUT
    - pp: piecewise polynomial structure
    - x: values on which y function calculated [1,n]

 OUTPUT

    - y: function calculated from piecewise polynomials (m dimensions if pp.dim > 1) if [m,n] 

 By Yves Peysson (CEA-DRFC, yves.peysson@cea.fr) and Joan Decker (CEA-DRFC, joan.decker@cea.fr)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [y] = ppval_yp(pp,x)
0002 %
0003 % Non vectorial polynomial piecewise calculation for testing the C language
0004 % implementation in the ray-tracing
0005 %
0006 % INPUT
0007 %    - pp: piecewise polynomial structure
0008 %    - x: values on which y function calculated [1,n]
0009 %
0010 % OUTPUT
0011 %
0012 %    - y: function calculated from piecewise polynomials (m dimensions if pp.dim > 1) if [m,n]
0013 %
0014 % By Yves Peysson (CEA-DRFC, yves.peysson@cea.fr) and Joan Decker (CEA-DRFC, joan.decker@cea.fr)
0015 %
0016 x = x(:);
0017 y = zeros(length(x),pp.dim);
0018 %
0019 for i = 1:length(x),
0020     for j = 1:pp.pieces;
0021         if x(i)>=pp.breaks(j) & x(i)<=pp.breaks(j+1),
0022             for k = 1:pp.dim,
0023                 if pp.order == 2,
0024                     y(i,k) = pp.coefs(k+(j-1)*pp.dim,1)*(x(i) - pp.breaks(j))^1 + pp.coefs(k+(j-1)*pp.dim,2);
0025                 elseif pp.order == 3,
0026                     y(i,k) = pp.coefs(k+(j-1)*pp.dim,1)*(x(i) - pp.breaks(j))^2 + pp.coefs(k+(j-1)*pp.dim,2)*(x(i) - pp.breaks(j)) + pp.coefs(k+(j-1)*pp.dim,3);
0027                 elseif pp.order == 4,
0028                     y(i,k) = pp.coefs(k+(j-1)*pp.dim,1)*(x(i) - pp.breaks(j))^3 + pp.coefs(k+(j-1)*pp.dim,2)*(x(i) - pp.breaks(j))^2 + pp.coefs(k+(j-1)*pp.dim,3)*(x(i) - pp.breaks(j)) + pp.coefs(k+(j-1)*pp.dim,4);
0029                 end
0030             end
0031         end
0032     end
0033 end
0034 %
0035 
0036 
0037 
0038 
0039 
0040

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.