1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
/*
VASP modular - vector assembling signal processor / objects for Max/MSP and PD
Copyright (c) 2002 Thomas Grill (xovo@gmx.net)
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_cmp.h"
#include "opdefs.h"
#include "util.h"
#include <math.h>
// --------------------------------------------------------------
// --------------------------------------------------------------
/*! \class vasp_qmin
\remark \b vasp.min?
\brief Get minimum sample value
\since 0.0.2
\param inlet vasp - is stored and output triggered
\param inlet bang - triggers output
\param inlet set - vasp to be stored
\retval outlet float - minimum sample value
\remark Returns 0 for a vasp with 0 frames
*/
class vasp_qmin:
public vasp_op
{
FLEXT_HEADER(vasp_qmin,vasp_op)
public:
vasp_qmin() {
AddInAnything();
AddOutList();
}
virtual F do_opt(OpParam &p,CVasp &v)
{
p.norm.minmax = BIG;
Vasp *ret = VaspOp::m_qmin(p,v);
delete ret;
return p.norm.minmax == BIG?0:p.norm.minmax;
}
virtual V m_bang()
{
if(!ref.Ok()) return;
AtomList ret(ref.Vectors());
OpParam p(thisName(),0);
for(I i = 0; i < ret.Count(); ++i) {
Vasp vasp(ref.Frames(),ref.Vector(i));
CVasp ref(vasp);
F v = do_opt(p,ref);
SetFloat(ret[i],v);
}
ToOutList(0,ret);
}
virtual V m_help() { post("%s - Get a vasp's minimum sample value",thisName()); }
};
FLEXT_LIB("vasp, vasp.min?",vasp_qmin)
/*! \class vasp_qamin
\remark \b vasp.amin?
\brief Get minimum absolute sample value
\since 0.0.2
\param inlet vasp - is stored and output triggered
\param inlet bang - triggers output
\param inlet set - vasp to be stored
\retval outlet float - minimum absolute sample value
\todo Should we provide a cmdln default vasp?
\todo Should we inhibit output for invalid vasps?
\remark Returns 0 for a vasp with 0 frames
*/
class vasp_qamin:
public vasp_qmin
{
FLEXT_HEADER(vasp_qamin,vasp_qmin)
public:
virtual F do_opt(OpParam &p,CVasp &v)
{
p.norm.minmax = BIG;
Vasp *ret = VaspOp::m_qmin(p,v);
delete ret;
return p.norm.minmax == BIG?0:p.norm.minmax;
}
virtual V m_help() { post("%s - Get a vasp's minimum absolute sample value",thisName()); }
};
FLEXT_LIB("vasp, vasp.amin?",vasp_qamin)
/*! \class vasp_qmax
\remark \b vasp.max?
\brief Get maximum sample value
\since 0.0.2
\param inlet vasp - is stored and output triggered
\param inlet bang - triggers output
\param inlet set - vasp to be stored
\retval outlet float - maximum sample value
\todo Should we provide a cmdln default vasp?
\todo Should we inhibit output for invalid vasps?
\remark Returns 0 for a vasp with 0 frames
*/
class vasp_qmax:
public vasp_qmin
{
FLEXT_HEADER(vasp_qmax,vasp_qmin)
public:
virtual F do_opt(OpParam &p,CVasp &v)
{
p.norm.minmax = -BIG;
Vasp *ret = VaspOp::m_qmax(p,v);
delete ret;
return p.norm.minmax == -BIG?0:p.norm.minmax;
}
virtual V m_help() { post("%s - Get a vasp's maximum sample value",thisName()); }
};
FLEXT_LIB("vasp, vasp.max?",vasp_qmax)
/*! \class vasp_qamax
\remark \b vasp.amax?
\brief Get minimum absolute sample value
\since 0.0.2
\param inlet vasp - is stored and output triggered
\param inlet bang - triggers output
\param inlet set - vasp to be stored
\retval outlet float - maximum absolute sample value
\todo Should we provide a cmdln default vasp?
\todo Should we inhibit output for invalid vasps?
\remark Returns 0 for a vasp with 0 frames
*/
class vasp_qamax:
public vasp_qmax
{
FLEXT_HEADER(vasp_qamax,vasp_qmax)
public:
virtual F do_opt(OpParam &p,CVasp &v)
{
p.norm.minmax = 0;
Vasp *ret = VaspOp::m_qamax(p,v);
delete ret;
return p.norm.minmax;
}
virtual V m_help() { post("%s - Get a vasp's maximum absolute sample value",thisName()); }
};
FLEXT_LIB("vasp, vasp.amax?",vasp_qamax)
/*! \class vasp_qrmin
\remark \b vasp.rmin?
\brief Get minimum complex radius of samples
\since 0.0.2
\param inlet vasp - is stored and output triggered
\param inlet bang - triggers output
\param inlet set - vasp to be stored
\retval outlet list - minimum radius value per complex vector pair
\todo Should we provide a cmdln default vasp?
\todo Should we inhibit output for invalid vasps?
\remark Returns 0 for a vasp with 0 frames
*/
class vasp_qrmin:
public vasp_op
{
FLEXT_HEADER(vasp_qrmin,vasp_op)
public:
vasp_qrmin() {
AddInAnything();
AddOutList();
}
virtual F do_opt(OpParam &p,CVasp &v)
{
p.norm.minmax = BIG;
Vasp *ret = VaspOp::m_qrmin(p,v);
delete ret;
return sqrt(p.norm.minmax == BIG?0:p.norm.minmax);
}
virtual V m_bang()
{
if(!ref.Ok()) return;
AtomList ret(ref.Vectors()/2);
OpParam p(thisName(),0);
for(I i = 0; i < ret.Count(); ++i) {
Vasp vasp(ref.Frames(),ref.Vector(i*2));
vasp.AddVector(ref.Vector(i*2+1));
CVasp ref(vasp);
F v = do_opt(p,ref);
SetFloat(ret[i],v);
}
if(ref.Vectors()%2) {
post("%s - omitting dangling vector of complex pairs",thisName());
}
ToOutList(0,ret);
}
virtual V m_help() { post("%s - Get a vasp's minimum complex radius",thisName()); }
};
FLEXT_LIB("vasp, vasp.rmin?",vasp_qrmin)
/*! \class vasp_qrmax
\remark \b vasp.rmax?
\brief Get maximum complex radius of samples
\since 0.0.2
\param inlet vasp - is stored and output triggered
\param inlet bang - triggers output
\param inlet set - vasp to be stored
\retval outlet float - maximum radius value per complex vector pair
\todo Should we provide a cmdln default vasp?
\todo Should we inhibit output for invalid vasps?
\remark Returns 0 for a vasp with 0 frames
*/
class vasp_qrmax:
public vasp_qrmin
{
FLEXT_HEADER(vasp_qrmax,vasp_qrmin)
public:
virtual F do_opt(OpParam &p,CVasp &v)
{
p.norm.minmax = 0;
Vasp *ret = VaspOp::m_qrmax(p,v);
delete ret;
return sqrt(p.norm.minmax);
}
virtual V m_help() { post("%s - Get a vasp's maximum complex radius",thisName()); }
};
FLEXT_LIB("vasp, vasp.rmax?",vasp_qrmax)
|