#include <stdio.h>

#include "complex.hpp"
#include "sparse.hpp"

int main()
{
    Complex zero(0, 0), z(1, -2), w(3, 4);
    SparseArray<Complex*> s(&zero);     /* elements are pointers */
    int i;
    s[1] = &z;
    s[4] = &w;

    printf("%g\n", s[4]->Magnitude());
    for (i = 0; i < 6; i++)
        printf("s[%d]: %g%+gi\n", i, s[i]->GetRe(), s[i]->GetIm());
    printf("stored: %d\n", s.NonzeroCount());

    *s[1] += Complex(10, 10);           /* changes z through the pointer */
    printf("z: %g%+gi\n", z.GetRe(), z.GetIm());
    return 0;
}
