#include <stdio.h>
#include <stdlib.h>
#include <err.h>
Go to the source code of this file.
◆ average_power()
Definition at line 11 of file average_power.c.
16 for (th=0; th<Nth; th++) {
18 for (rg=0; rg<Nrg; rg++) {
19 for (v=0; v<Nv; v++) {
20 PP += ptrin[th][rg][v].
re *ptrin[th][rg][v].
re
21 +ptrin[th][rg][v].
im *ptrin[th][rg][v].
im;
24 Pow[th].
re= (float)(PP/((
float)(Nv*Nrg)));
Referenced by main().
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
only print with bad precision for validation
Definition at line 29 of file average_power.c.
35 Cplfloat (*in)[th][rg][v], (*pow)[th];
38 err(1,
"in = malloc(%zu)", th *rg*v*
sizeof(
Cplfloat));
39 for (i=0; i<th; i++) {
40 for (j=0; j<rg; j++) {
42 (*in)[i][j][k].re = i*j*k;
43 (*in)[i][j][k].re = i*j+k;
49 err(1,
"malloc(%zu)", th *
sizeof(
Cplfloat));
53 printf(
"-%d-%d-\n", ((
int)(*pow)[i].re)/10, ((
int)(*pow)[i].im)/10);
void average_power(int Nth, int Nrg, int Nv, Cplfloat ptrin[Nth][Nrg][Nv], Cplfloat Pow[Nth])
References average_power(), malloc(), and printf().