示例#1
0
文件: ops_carith.cpp 项目: EQ4/vasp
VASP modular - vector assembling signal processor / objects for Max and Pure Data

Copyright (c)2002-2015 Thomas Grill ([email protected])
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.  

*/

#include "main.h"
#include "ops_carith.h"
#include "ops_assign.h"
#include "opdefs.h"
#include "util.h"


VASP_BINARY("vasp.c+",cadd,true,VASP_ARG_R(0),"adds a complex value or vasp")
VASP_BINARY("vasp.c-",csub,true,VASP_ARG_R(0),"subtracts a complex value or vasp")
VASP_BINARY("vasp.c!-",csubr,true,VASP_ARG_R(0),"reverse subtracts a complex value or vasp")
VASP_BINARY("vasp.c*",cmul,true,VASP_ARG_R(1),"multiplies by a complex value or vasp")
VASP_BINARY("vasp.c/",cdiv,true,VASP_ARG_R(1),"divides by a complex value or vasp")
VASP_BINARY("vasp.c!/",cdivr,true,VASP_ARG_R(1),"reverse divides by a complex value or vasp")


// -----------------------------------------------------


VASP_UNARY("vasp.csqr",csqr,true,"complex square") 

// -----------------------------------------------------

Vasp *VaspOp::m_cpowi(OpParam &p,CVasp &src,const Argument &arg,CVasp *dst) 
示例#2
0
文件: ops_assign.cpp 项目: EQ4/vasp
/*

VASP modular - vector assembling signal processor / objects for Max and Pure Data

Copyright (c)2002-2015 Thomas Grill ([email protected])
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.  

*/

#include "main.h"
#include "ops_assign.h"
#include "opdefs.h"


VASP_BINARY("vasp.set vasp.=",set,false,VASP_ARG_R(0),"Assigns a value, envelope or vasp")
VASP_BINARY("vasp.cset vasp.c=",cset,false,VASP_ARG_R(0),"Assigns a complex value, real envelope or vasp")



Vasp *VaspOp::m_copy(OpParam &p,CVasp &src,CVasp &arg) 
{ 
	Vasp *s = NULL,*d = NULL;
	RVecBlock *vecs = GetRVecs(p.opname,src,&arg);
	if(vecs) {
		d = DoOp(vecs,VecOp::d_copy,p);
		s = vecs->SrcVasp();
		if(d) arg = *d; else { arg.Clear(); delete d; }
		delete vecs;
	}
	return s;
示例#3
0
文件: ops_cplx.cpp 项目: Angeldude/pd
{ 
	Vasp *ret = NULL;
	CVecBlock *vecs = GetCVecs(p.opname,src,dst);
	if(vecs) {
		if(arg.IsList() && arg.GetList().Count() >= 1 && flext::CanbeFloat(arg.GetList()[0]))
			p.cbin.rarg = flext::GetAFloat(arg.GetList()[0]);
		else {
			post("%s - argument is invalid -> set to 0",p.opname);
			p.cbin.rarg = 0;
		}
		p.cbin.iarg = 0; // not used anyway

		ret = DoOp(vecs,VecOp::d_radd,p);
		delete vecs;
	}
	return ret;
}


VASP_ANYOP("vasp.r+",radd,0,true,VASP_ARG_R(0),"add offset to complex radius (of complex vector pair)") 


// -----------------------------------------------------

VASP_UNARY("vasp.cnorm",cnorm,true,"normalize complex radius to 1 (but preserve angle)")

// -----------------------------------------------------

//VASP_UNARY("vasp.cconj",cconj,true,"complex conjugate: multiply imaginary part with -1")  // should be replaced by an abstraction