• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef bbs_COMPLEX_H
18 #define bbs_COMPLEX_H
19 
20 /* ---- includes ----------------------------------------------------------- */
21 
22 #include "b_BasicEm/Context.h"
23 #include "b_BasicEm/Basic.h"
24 #include "b_BasicEm/Phase.h"
25 
26 /* ---- related objects  --------------------------------------------------- */
27 
28 struct bbs_APh;
29 
30 /* ---- typedefs ----------------------------------------------------------- */
31 
32 /* ---- constants ---------------------------------------------------------- */
33 
34 /* ---- object definition -------------------------------------------------- */
35 
36 /** Complex object */
37 struct bbs_Complex
38 {
39 
40 	/* ---- private data --------------------------------------------------- */
41 
42 	/* ---- public data ---------------------------------------------------- */
43 
44 	/** real part */
45 	int16 realE;
46 
47 	/** imaginary part */
48 	int16 imagE;
49 
50 };
51 
52 /* ---- associated objects ------------------------------------------------- */
53 
54 /* ---- external functions ------------------------------------------------- */
55 
56 /* ---- \ghd{ constructor/destructor } ------------------------------------- */
57 
58 /* ---- \ghd{ operators } -------------------------------------------------- */
59 
60 /** equal operator */
61 flag bbs_Complex_equal( struct bbs_Complex compl1A, struct bbs_Complex compl2A );
62 
63 /* ---- \ghd{ query functions } -------------------------------------------- */
64 
65 /* ---- \ghd{ modify functions } ------------------------------------------- */
66 
67 /* ---- \ghd{ memory I/O } ------------------------------------------------- */
68 
69 /** size in 16-bit words object needs when written to memory */
70 uint32 bbs_Complex_memSize( struct bbs_Context* cpA,
71 						    struct bbs_Complex complA );
72 
73 /** writes object to memory; returns number of words (16-bit) written */
74 uint32 bbs_Complex_memWrite( struct bbs_Context* cpA,
75 							 const struct bbs_Complex* ptrA,
76 							 uint16* memPtrA );
77 
78 /** reads object from memory; returns number of words (16-bit) read */
79 uint32 bbs_Complex_memRead( struct bbs_Context* cpA,
80 						    struct bbs_Complex* ptrA,
81 							const uint16* memPtrA );
82 
83 /* ---- \ghd{ exec functions } --------------------------------------------- */
84 
85 /** conjugated value */
86 struct bbs_Complex bbs_Complex_conj( struct bbs_Complex complA );
87 
88 /** returns squared abs value */
89 uint32 bbs_Complex_abs2( struct bbs_Complex complA );
90 
91 /** returns absolute value */
92 uint16 bbs_Complex_abs( struct bbs_Complex complA );
93 
94 /** returns phase value */
95 phase16 bbs_Complex_phase( struct bbs_Complex complA );
96 
97 /** imports abs-phase value */
98 void bbs_Complex_importAPh( struct bbs_Complex* dstPtrA, const struct bbs_APh* srcPtrA );
99 
100 /* ------------------------------------------------------------------------- */
101 
102 #endif /* bbs_COMPLEX_H */
103