FAUST compiler  0.9.9.6b8
Public Member Functions | List of all members
LogPrim Class Reference
Inheritance diagram for LogPrim:
Inheritance graph
[legend]
Collaboration diagram for LogPrim:
Collaboration graph
[legend]

Public Member Functions

 LogPrim ()
 
virtual unsigned int arity ()
 
virtual bool needCache ()
 
virtual Type infereSigType (const vector< Type > &args)
 
virtual void sigVisit (Tree sig, sigvisitor *visitor)
 
virtual int infereSigOrder (const vector< int > &args)
 
virtual Tree computeSigOutput (const vector< Tree > &args)
 
virtual string generateCode (Klass *klass, const vector< string > &args, const vector< Type > &types)
 
virtual string generateLateq (Lateq *lateq, const vector< string > &args, const vector< Type > &types)
 
- Public Member Functions inherited from xtended
 xtended (const char *name)
 
virtual ~xtended ()
 
Sym symbol ()
 
const char * name ()
 
Tree box ()
 
virtual bool isSpecialInfix ()
 generaly false, but true for binary op # such that #(x) == _::x More...
 

Detailed Description

Definition at line 7 of file logprim.cpp.

Constructor & Destructor Documentation

LogPrim::LogPrim ( )
inline

Definition at line 12 of file logprim.cpp.

12 : xtended("log") {}
xtended(const char *name)
Definition: xtended.hh:18

Member Function Documentation

virtual unsigned int LogPrim::arity ( )
inlinevirtual

Implements xtended.

Definition at line 14 of file logprim.cpp.

Referenced by computeSigOutput(), generateCode(), generateLateq(), infereSigOrder(), and infereSigType().

14 { return 1; }

Here is the caller graph for this function:

virtual Tree LogPrim::computeSigOutput ( const vector< Tree > &  args)
inlinevirtual

Implements xtended.

Definition at line 37 of file logprim.cpp.

References arity(), isNum(), xtended::symbol(), and tree().

37  {
38  num n;
39  assert (args.size() == arity());
40  if (isNum(args[0],n)) {
41  return tree(log(double(n)));
42  } else {
43  return tree(symbol(), args[0]);
44  }
45  }
virtual unsigned int arity()
Definition: logprim.cpp:14
Definition: num.hh:58
bool isNum(Tree a)
Definition: signals.hh:187
Sym symbol()
Definition: xtended.hh:24
Tree tree(const Node &n)
Definition: tree.hh:186

Here is the call graph for this function:

virtual string LogPrim::generateCode ( Klass klass,
const vector< string > &  args,
const vector< Type > &  types 
)
inlinevirtual

Implements xtended.

Definition at line 47 of file logprim.cpp.

References arity(), isuffix(), and subst().

48  {
49  assert (args.size() == arity());
50  assert (types.size() == arity());
51 
52  return subst("log$1($0)", args[0], isuffix());
53  }
virtual unsigned int arity()
Definition: logprim.cpp:14
string subst(const string &model, const vector< string > &args)
Text substitution.
Definition: Text.cpp:47
const char * isuffix()
suffix for math functions
Definition: floats.cpp:43

Here is the call graph for this function:

virtual string LogPrim::generateLateq ( Lateq lateq,
const vector< string > &  args,
const vector< Type > &  types 
)
inlinevirtual

Implements xtended.

Definition at line 55 of file logprim.cpp.

References arity(), and subst().

56  {
57  assert (args.size() == arity());
58  assert (types.size() == arity());
59 
60  return subst("\\ln\\left( $0 \\right)", args[0]);
61  }
virtual unsigned int arity()
Definition: logprim.cpp:14
string subst(const string &model, const vector< string > &args)
Text substitution.
Definition: Text.cpp:47

Here is the call graph for this function:

virtual int LogPrim::infereSigOrder ( const vector< int > &  args)
inlinevirtual

Implements xtended.

Definition at line 31 of file logprim.cpp.

References arity().

31  {
32  assert (args.size() == arity());
33  return args[0];
34  }
virtual unsigned int arity()
Definition: logprim.cpp:14

Here is the call graph for this function:

virtual Type LogPrim::infereSigType ( const vector< Type > &  args)
inlinevirtual

Implements xtended.

Definition at line 18 of file logprim.cpp.

References arity(), castInterval(), and floatCast().

19  {
20  assert (args.size() == arity());
21  interval i = args[0]->getInterval();
22  if (i.valid & i.lo>0) {
23  return castInterval(floatCast(args[0]), interval(log(i.lo), log(i.hi)));
24  } else {
25  return floatCast(args[0]);
26  }
27  }
virtual unsigned int arity()
Definition: logprim.cpp:14
Type floatCast(Type t)
Definition: sigtype.hh:270
Type castInterval(Type t, const interval &i)
Definition: sigtype.hh:278

Here is the call graph for this function:

virtual bool LogPrim::needCache ( )
inlinevirtual

Implements xtended.

Definition at line 16 of file logprim.cpp.

16 { return true; }
virtual void LogPrim::sigVisit ( Tree  sig,
sigvisitor visitor 
)
inlinevirtual

Definition at line 29 of file logprim.cpp.

29 {}

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