FAUST compiler  0.9.9.6b8
Public Member Functions
SqrtPrim Class Reference
Inheritance diagram for SqrtPrim:
Inheritance graph
[legend]
Collaboration diagram for SqrtPrim:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SqrtPrim ()
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)

Detailed Description

Definition at line 8 of file sqrtprim.cpp.


Constructor & Destructor Documentation

SqrtPrim::SqrtPrim ( ) [inline]

Definition at line 13 of file sqrtprim.cpp.

: xtended("sqrt") {}

Member Function Documentation

virtual unsigned int SqrtPrim::arity ( ) [inline, virtual]

Implements xtended.

Definition at line 15 of file sqrtprim.cpp.

Referenced by generateCode(), and generateLateq().

{ return 1; }

Here is the caller graph for this function:

virtual Tree SqrtPrim::computeSigOutput ( const vector< Tree > &  args) [inline, virtual]

Implements xtended.

Definition at line 38 of file sqrtprim.cpp.

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

                                                                {
        // verifier les simplifications
        num n;
        if (isNum(args[0],n)) {
            return tree(sqrt(double(n)));
        } else {
            return tree(symbol(), args[0]);
        }
    }

Here is the call graph for this function:

virtual string SqrtPrim::generateCode ( Klass klass,
const vector< string > &  args,
const vector< Type > &  types 
) [inline, virtual]

Implements xtended.

Definition at line 48 of file sqrtprim.cpp.

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

    {
        assert (args.size() == arity());
        assert (types.size() == arity());
        
        return subst("sqrt$1($0)", args[0], isuffix());
    }

Here is the call graph for this function:

virtual string SqrtPrim::generateLateq ( Lateq lateq,
const vector< string > &  args,
const vector< Type > &  types 
) [inline, virtual]

Implements xtended.

Definition at line 56 of file sqrtprim.cpp.

References arity(), and subst().

    {
        assert (args.size() == arity());
        assert (types.size() == arity());
        
        return subst("\\sqrt{$0}", args[0]);
    }

Here is the call graph for this function:

virtual int SqrtPrim::infereSigOrder ( const vector< int > &  args) [inline, virtual]

Implements xtended.

Definition at line 33 of file sqrtprim.cpp.

                                                         {
        return args[0];
    }
virtual Type SqrtPrim::infereSigType ( const vector< Type > &  args) [inline, virtual]

Implements xtended.

Definition at line 19 of file sqrtprim.cpp.

References castInterval(), floatCast(), interval::hi, interval::lo, and interval::valid.

    {
        assert (args.size() == 1);
        Type        t = args[0];
        interval    i = t->getInterval();
        if (i.valid && i.lo >=0) {
            return castInterval(floatCast(t), interval(sqrt(i.lo), sqrt(i.hi)));
        } else {
            return castInterval(floatCast(t), interval());
        }
    }

Here is the call graph for this function:

virtual bool SqrtPrim::needCache ( ) [inline, virtual]

Implements xtended.

Definition at line 17 of file sqrtprim.cpp.

{ return true; }
virtual void SqrtPrim::sigVisit ( Tree  sig,
sigvisitor visitor 
) [inline, virtual]

Definition at line 31 of file sqrtprim.cpp.

{}  

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