Back to index

texmacs  1.0.7.15
Classes | Defines | Functions
vector.hpp File Reference
#include "properties.hpp"
#include "operators.hpp"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  vector_rep
class  vector
class  unary_properties< vector< T > >
class  binary_properties< vector< T >, vector< U > >
class  binary_properties< T, vector< U > >
class  binary_properties< vector< T >, U >

Defines

#define TMPL   template<typename T>
#define BINARY_TMPL   template<typename T, typename U>
#define R   typename unary_properties<T>::norm_type
#define M   typename binary_properties<T,U>::product_type

Functions

TMPL int N (vector< T > a)
TMPL TA (vector< T > a)
 CONCRETE_TEMPLATE_CODE (vector, typename, T)
TMPL tree as_tree (vector< T > v)
TMPL tm_ostreamoperator<< (tm_ostream &out, vector< T > v)
template<typename T , typename Op >
vector< Tunary (vector< T > v)
template<typename T , typename Op >
vector< Tbinary (vector< T > v, vector< T > w)
TMPL vector< Toperator- (vector< T > v)
TMPL vector< Toperator+ (vector< T > v, vector< T > w)
TMPL vector< Toperator- (vector< T > v, vector< T > w)
TMPL vector< Toperator* (vector< T > v, vector< T > w)
TMPL vector< Toperator/ (vector< T > v, vector< T > w)
TMPL vector< Tsqrt (vector< T > v)
TMPL vector< Texp (vector< T > v)
TMPL vector< Tlog (vector< T > v)
TMPL vector< Tpow (vector< T > v, vector< T > w)
TMPL vector< Tcos (vector< T > v)
TMPL vector< Tsin (vector< T > v)
TMPL vector< Ttan (vector< T > v)
TMPL vector< Toperator+ (T c, vector< T > v)
TMPL vector< Toperator+ (vector< T > v, T c)
TMPL vector< Toperator- (T c, vector< T > v)
TMPL vector< Toperator- (vector< T > v, T c)
TMPL vector< Toperator* (T c, vector< T > v)
TMPL vector< Toperator* (vector< T > v, T c)
TMPL vector< Toperator/ (T c, vector< T > v)
TMPL vector< Toperator/ (vector< T > v, T c)
TMPL R square_norm (vector< T > v)
TMPL R norm (vector< T > v)
TMPL vector< Tderive (vector< T > v)

Define Documentation

#define BINARY_TMPL   template<typename T, typename U>

Definition at line 17 of file vector.hpp.

#define M   typename binary_properties<T,U>::product_type

Definition at line 19 of file vector.hpp.

#define R   typename unary_properties<T>::norm_type

Definition at line 18 of file vector.hpp.

#define TMPL   template<typename T>

Definition at line 16 of file vector.hpp.


Function Documentation

TMPL T * A ( vector< T a) [inline]

Definition at line 100 of file vector.hpp.

{ return v->a; }
TMPL tree as_tree ( vector< T v)

Definition at line 103 of file vector.hpp.

                      {
  int i, n= N(v);
  T* a= A(v);
  tree t (TUPLE, n);
  for (i=0; i<n; i++)
    t[i]= as_tree (a[i]);
  return t;
}

Here is the call graph for this function:

template<typename T , typename Op >
vector<T> binary ( vector< T v,
vector< T w 
)

Definition at line 132 of file vector.hpp.

                                  {
  int i, n= N(v);
  ASSERT (N(w) == n, "vector lengths don't match");
  T* a= A(v);
  T* b= A(w);
  T* r= tm_new_array<T> (n);
  for (i=0; i<n; i++)
    r[i]= Op::eval (a[i], b[i]);
  return vector<T> (r, n);
}

Here is the call graph for this function:

CONCRETE_TEMPLATE_CODE ( vector  ,
typename  ,
T   
)
TMPL vector<T> cos ( vector< T v) [inline]

Definition at line 184 of file vector.hpp.

                  {
  return unary<T,cos_op> (v); }
TMPL vector<T> derive ( vector< T v) [inline]

Definition at line 251 of file vector.hpp.

                     {
  return unary<T,derive_op> (v); }
TMPL vector<T> exp ( vector< T v) [inline]

Definition at line 172 of file vector.hpp.

                  {
  return unary<T,exp_op> (v); }
TMPL vector<T> log ( vector< T v) [inline]

Definition at line 176 of file vector.hpp.

                  {
  return unary<T,log_op> (v); }
TMPL int N ( vector< T a) [inline]

Definition at line 99 of file vector.hpp.

{ return v->n; }
TMPL R norm ( vector< T v) [inline]

Definition at line 246 of file vector.hpp.

                   {
  return sqrt (square_norm (v));
}

Here is the call graph for this function:

TMPL vector<T> operator* ( vector< T v,
vector< T w 
) [inline]

Definition at line 160 of file vector.hpp.

                                      {
  return binary<T,mul_op> (v, w); }
TMPL vector<T> operator* ( T  c,
vector< T v 
) [inline]

Definition at line 216 of file vector.hpp.

                              {
  return vector<T> (c, N(v)) * v; }

Here is the call graph for this function:

TMPL vector<T> operator* ( vector< T v,
T  c 
) [inline]

Definition at line 220 of file vector.hpp.

                              {
  return v * vector<T> (c, N(v)); }

Here is the call graph for this function:

TMPL vector<T> operator+ ( vector< T v,
vector< T w 
) [inline]

Definition at line 152 of file vector.hpp.

                                      {
  return binary<T,add_op> (v, w); }
TMPL vector<T> operator+ ( T  c,
vector< T v 
) [inline]

Definition at line 200 of file vector.hpp.

                              {
  return vector<T> (c, N(v)) + v; }

Here is the call graph for this function:

TMPL vector<T> operator+ ( vector< T v,
T  c 
) [inline]

Definition at line 204 of file vector.hpp.

                              {
  return v + vector<T> (c, N(v)); }

Here is the call graph for this function:

TMPL vector<T> operator- ( vector< T v) [inline]

Definition at line 148 of file vector.hpp.

                         {
  return unary<T,neg_op> (v); }
TMPL vector<T> operator- ( vector< T v,
vector< T w 
) [inline]

Definition at line 156 of file vector.hpp.

                                      {
  return binary<T,sub_op> (v, w); }
TMPL vector<T> operator- ( T  c,
vector< T v 
) [inline]

Definition at line 208 of file vector.hpp.

                              {
  return vector<T> (c, N(v)) - v; }

Here is the call graph for this function:

TMPL vector<T> operator- ( vector< T v,
T  c 
) [inline]

Definition at line 212 of file vector.hpp.

                              {
  return v - vector<T> (c, N(v)); }

Here is the call graph for this function:

TMPL vector<T> operator/ ( vector< T v,
vector< T w 
) [inline]

Definition at line 164 of file vector.hpp.

                                      {
  return binary<T,div_op> (v, w); }
TMPL vector<T> operator/ ( T  c,
vector< T v 
) [inline]

Definition at line 224 of file vector.hpp.

                              {
  return vector<T> (c, N(v)) / v; }

Here is the call graph for this function:

TMPL vector<T> operator/ ( vector< T v,
T  c 
) [inline]

Definition at line 228 of file vector.hpp.

                              {
  return v / vector<T> (c, N(v)); }

Here is the call graph for this function:

TMPL tm_ostream& operator<< ( tm_ostream out,
vector< T v 
) [inline]

Definition at line 113 of file vector.hpp.

                                           {
  return out << as_math_string (as_tree (v));
}

Here is the call graph for this function:

TMPL vector<T> pow ( vector< T v,
vector< T w 
) [inline]

Definition at line 180 of file vector.hpp.

                               {
  return binary<T,pow_op> (v, w); }
TMPL vector<T> sin ( vector< T v) [inline]

Definition at line 188 of file vector.hpp.

                  {
  return unary<T,sin_op> (v); }
TMPL vector<T> sqrt ( vector< T v) [inline]

Definition at line 168 of file vector.hpp.

                   {
  return unary<T,sqrt_op> (v); }
TMPL R square_norm ( vector< T v)

Definition at line 236 of file vector.hpp.

                          {
  R r= 0;
  int i, n= N(v);
  T* a= A(v);
  for (i=0; i<n; i++)
    r += square_norm (a[i]);
  return r;
}

Here is the call graph for this function:

TMPL vector<T> tan ( vector< T v) [inline]

Definition at line 192 of file vector.hpp.

                  {
  return unary<T,tan_op> (v); }
template<typename T , typename Op >
vector<T> unary ( vector< T v)

Definition at line 122 of file vector.hpp.

                    {
  int i, n= N(v);
  T* a= A(v);
  T* r= tm_new_array<T> (n);
  for (i=0; i<n; i++)
    r[i]= Op::eval (a[i]);
  return vector<T> (r, n);
}

Here is the call graph for this function: