#include "spice.h"
#include "ftedefs.h"
Go to the source code of this file.
|
static void | dimxpand () |
|
static bool | cmp_values () |
|
static bool | cmp_parse () |
|
static bool | cmp_linsweep () |
|
static bool | cmp_logsweep () |
|
static bool | cmp_random () |
|
static bool | cmp_gauss () |
|
void | com_compose (wordlist *wl) |
|
static void | dimxpand (struct dvec *v, int *newdims, double *data) |
|
static bool | cmp_values (wordlist *wl, int *length, double **datap, complex **cdatap, bool *realflag) |
|
static bool | cmp_parse (wordlist *wl, struct sCompose *sc) |
|
static bool | cmp_linsweep (struct sCompose *sc, int *length, double **datap) |
|
static bool | cmp_logsweep (struct sCompose *sc, int *length, double **datap) |
|
static bool | cmp_random (struct sCompose *sc, int *length, double **datap) |
|
static bool | cmp_gauss (struct sCompose *sc, int *length, double **datap) |
|
double | xrandom () |
|
double | xgauss () |
|
static bool cmp_gauss |
( |
| ) |
|
|
static |
static bool cmp_gauss |
( |
struct sCompose * |
sc, |
|
|
int * |
length, |
|
|
double ** |
datap |
|
) |
| |
|
static |
static bool cmp_linsweep |
( |
| ) |
|
|
static |
static bool cmp_linsweep |
( |
struct sCompose * |
sc, |
|
|
int * |
length, |
|
|
double ** |
datap |
|
) |
| |
|
static |
Definition at line 509 of file compose.c.
520 data = (
double *)
tmalloc(
sizeof (
double) * sc->
lin);
525 fprintf(
cp_err,
"Warning: bad step -- should be %lg\n",
553 for (i = 0, tt = sc->
stop; i < sc->lin; i++, tt -= sc->
step)
556 for (i = 0, tt = sc->
start; i < sc->lin; i++, tt += sc->
step)
static bool cmp_logsweep |
( |
| ) |
|
|
static |
static bool cmp_logsweep |
( |
struct sCompose * |
sc, |
|
|
int * |
length, |
|
|
double ** |
datap |
|
) |
| |
|
static |
static bool cmp_parse |
( |
| ) |
|
|
static |
Definition at line 352 of file compose.c.
362 if ((s = strchr(wl->
wl_word,
'=')) && s[1]) {
369 else if (strchr(wl->
wl_word,
'=')) {
379 fprintf(
cp_err,
"Error: bad syntax\n");
390 fprintf(
cp_err,
"Error: bad syntax\n");
400 fprintf(
cp_err,
"Error: bad syntax\n");
407 fprintf(
cp_err,
"Error: bad syntax\n");
412 if (
cieq(var,
"start")) {
419 else if (
cieq(var,
"stop")) {
426 else if (
cieq(var,
"step")) {
433 else if (
cieq(var,
"center")) {
440 else if (
cieq(var,
"span")) {
447 else if (
cieq(var,
"mean")) {
454 else if (
cieq(var,
"sd")) {
461 else if (
cieq(var,
"lin")) {
468 else if (
cieq(var,
"log")) {
475 else if (
cieq(var,
"dec")) {
482 else if (
cieq(var,
"gauss")) {
489 else if (
cieq(var,
"random")) {
496 else if (
cieq(var,
"pool")) {
503 fprintf(
cp_err,
"Error: bad parm %s = %s\n", var, val);
struct wordlist * wl_next
static bool cmp_random |
( |
| ) |
|
|
static |
static bool cmp_random |
( |
struct sCompose * |
sc, |
|
|
int * |
length, |
|
|
double ** |
datap |
|
) |
| |
|
static |
static bool cmp_values |
( |
| ) |
|
|
static |
Definition at line 241 of file compose.c.
250 struct dvec *vec, *v;
251 int i, j, len, dim, blocksize, dims[
MAXDIMS];
269 fprintf(
cp_err,
"Error: max dimensionality is %d\n",
MAXDIMS);
288 "Error: all vectors must be of the same dimensionality\n");
295 for (i = 0; i < dim; i++) {
299 if (v->
v_dims[i] > dims[i])
305 for (i = 0, blocksize = 1; i < dim - 1; i++)
306 blocksize *= dims[i];
308 data = (
double *)
tmalloc(
sizeof (
double) * len * blocksize);
315 for (i = 0, dl = dl0; dl; dl = dl->
dl_next) {
335 dimxpand(v, dims, (rflg ? (data + i * blocksize) :
336 (
double *) (cdata + i * blocksize)));
struct dvlist * ft_dvlist()
struct pnode * ft_getpnames()
Definition at line 90 of file compose.c.
100 bool realflag =
true;
120 if (sc.stepgiven && (sc.step == 0.0)) {
121 fprintf(
cp_err,
"Error: step cannot = 0.0\n");
124 if (sc.startgiven && sc.stopgiven && (sc.start > sc.stop)) {
130 if (sc.lingiven + sc.loggiven + sc.decgiven +
131 sc.randmgiven + sc.gaussgiven > 1) {
133 "Error: can have at most one of (lin, log, dec, random, gauss)\n");
136 else if (sc.lingiven + sc.loggiven + sc.decgiven + sc.randmgiven +
137 sc.gaussgiven == 0) {
139 if (sc.startgiven && sc.stopgiven && sc.stepgiven) {
141 sc.lin = (sc.stop - sc.start) / sc.step + 1;
142 sc.stepgiven =
false;
146 "Error: either one of (lin, log, dec, random, gauss) must be given, or all\n");
148 "\tof (start, stop, and step) must be given.\n");
157 else if (sc.loggiven || sc.decgiven) {
161 else if (sc.randmgiven) {
165 else if (sc.gaussgiven) {
int bzero(char *ptr, int num)
static bool cmp_linsweep()
struct wordlist * wl_next
static bool cmp_logsweep()
static void dimxpand |
( |
struct dvec * |
v, |
|
|
int * |
newdims, |
|
|
double * |
data |
|
) |
| |
|
static |
Definition at line 186 of file compose.c.
194 bool realflag =
isreal(v);
195 int i, j,
o, n,
t, u;
204 ncount[i] = ocount[i] = 0;
207 for (o = n = i = 0; i < dims; i++) {
208 for (j = i, t = u = 1; j < dims; j++) {
224 for (i = dims - 1; i >= 0; i--) {
225 if ((ocount[i] < v->
v_dims[i] - 1) &&
226 (ncount[i] < newdims[i] - 1)) {
232 ocount[i] = ncount[i] = 0;
Definition at line 643 of file compose.c.
652 double fac,
r, v1, v2;
661 fac = sqrt(-2.0*log(r)/r);
Definition at line 634 of file compose.c.
638 return ((random() & 0x7fffffff)/(0x7fffffff + 1.0));