Re: [ng-spice] Kernel


To ng-spice@ieee.ing.uniroma1.it
From Paolo Nenzi <pnenzi@ieee.ing.uniroma1.it>
Date Thu, 21 Oct 1999 21:53:44 +0200 (CEST)
Delivered-To mailing list ng-spice@ieee.ing.uniroma1.it
In-Reply-To <19991020221055.A27868@cgmd95104.chello.nl >
Mailing-List contact ng-spice-help@ieee.ing.uniroma1.it; run by ezmlm
Reply-To ng-spice@ieee.ing.uniroma1.it



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: