Re: [ng-spice] Kernel
On Wed, 20 Oct 1999, Arno wrote:
> typedef double sample_t;
^^^^^^
Good, but how to take into account for complex data ???
We may modify:
> enum si_units { SECOND, METER, KILOGRAM, AMPERE, SI_UNITS };
enum field { REAL, COMPLEX };
> char scalar_unit[SI_UNITS] = {0, 0, 0, 0};
> char time_unit[SI_UNITS] = {1, 0, 0, 0};
> char distance_unit[SI_UNITS] = {0, 1, 0, 0};
> char mass_unit[SI_UNITS] = {0, 0, 1, 0};
> char current_unit[SI_UNITS] = {0, 0, 1, 0};
>
> struct sample {
> int size; /* length of the sample */
> char *units; /* physical measurement units */
char *field; /* type of data */
> sample_t *data; /* has size SIZE */
> };
>
> struct measurement {
> int count; /* number of dependent variables */
> struct sample indep; /* independent variable */
> struct sample *data; /* dependent variables */
^^^^^^^^^^^^^^^^^^^^
What about a linked list of samples ?
It is intereseting the SI_UNITS sticked to each sample, we can use int *
so that we can use negative mumbers: think about a frequency, it's
dimensions are sec^-1, and so on. With this system we can even perform
constincency checks on mathematical ops.
What do you think ?
Paolo
Partial thread listing:
- Re: [ng-spice] Kernel, (continued)