Back to index

texmacs  1.0.7.15
Public Member Functions | Private Attributes
pw_function_rep Class Reference

#include <function_extra.hpp>

Inheritance diagram for pw_function_rep:
Inheritance graph
[legend]
Collaboration diagram for pw_function_rep:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 pw_function_rep (vector< function< F, T > > v2, bool jump_flag2)
int which (F x)
position (F x)
T apply (F x)
ball< Tapply (ball< F > x)
function< F, Tderive (V var)
tree expression ()

Private Attributes

vector< function< F, T > > v
bool jump_flag

Detailed Description

Definition at line 31 of file function_extra.hpp.


Constructor & Destructor Documentation

pw_function_rep::pw_function_rep ( vector< function< F, T > >  v2,
bool  jump_flag2 
) [inline]

Definition at line 35 of file function_extra.hpp.

                                                                     :
    v (v2), jump_flag (jump_flag2) {}

Member Function Documentation

T pw_function_rep::apply ( x) [inline, virtual]

Implements function_rep< F, T >.

Definition at line 43 of file function_extra.hpp.

{ return v[which (x)] (position (x)); }

Here is the call graph for this function:

ball<T> pw_function_rep::apply ( ball< F >  x) [inline, virtual]

Implements function_rep< F, T >.

Definition at line 44 of file function_extra.hpp.

                            {
    int w1= which (lower (x));
    int w2= which (upper (x));
    if (w1 == w2) return v[w1] (ball<F> (N(v)) * x - ball<F> (w1));
    if (jump_flag) return ball<T> (T(0), MATH_INFINITY);
  }

Here is the call graph for this function:

function<F,T> pw_function_rep::derive ( V  var) [inline, virtual]

Implements function_rep< F, T >.

Definition at line 50 of file function_extra.hpp.

                               {
    function<F,T> dummy;
    vector<function<F,T> > w (dummy, N(v));
    for (int i=0; i<N(v); i++)
      w[i]= function<F,T> (N(v)) * v[i]->derive (var);
    bool flag= jump_flag;
    for (int i=0; i<N(v)-1; i++)
      flag= flag || (v[i](F(1)) != v[i+1](F(0)));
    return pw_function (w, flag);
  }

Here is the call graph for this function:

tree pw_function_rep::expression ( ) [inline, virtual]

Implements function_rep< F, T >.

Definition at line 60 of file function_extra.hpp.

                     {
    int i, n= N(v);
    array<tree> a (n+1);
    for (i=0; i<n; i++)
      a[i]= as_tree (v[i]);
    a[n]= (jump_flag? tree ("true"): tree ("false"));
    return compound ("piecewise", a);
  }

Here is the call graph for this function:

F pw_function_rep::position ( x) [inline]

Definition at line 42 of file function_extra.hpp.

{ return N(v) * x - which (x); }

Here is the call graph for this function:

Here is the caller graph for this function:

int pw_function_rep::which ( x) [inline]

Definition at line 37 of file function_extra.hpp.

                  {
    if (x <= 0) return 0;
    if (x >= 1) return N(v)-1;
    return (int) floor (N(v) * x);
  }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 33 of file function_extra.hpp.

Definition at line 32 of file function_extra.hpp.


The documentation for this class was generated from the following file: