/* -*- mode: c; c-default-style: "bsd"; -*- */
/* Copyright (c) 2020-2022 Charlie Burnett <burne251@umn.edu> */
/* SPDX-License-Identifier: ISC OR Apache-2.0 */

#include "util_hidden.h"

struct complex *
complex_init(real_t real, real_t imaginary)
{
	struct complex *complex;
	complex = ezalloc(sizeof(*complex));
	complex->imaginary = imaginary;
	complex->real = real;
	return complex;
}

real_t
complex_get_imaginary(struct complex *complex)
{
	return complex->imaginary;
}
real_t
complex_get_real(struct complex *complex)
{
	return complex->real;
}
void
complex_destroy(struct complex *complex)
{
	free(complex);
}
void
complex_set_imaginary(struct complex *complex, real_t imaginary)
{
	complex->imaginary = imaginary;
}
void
complex_set_real(struct complex *complex, real_t real)
{
	complex->real = real;
}
