gsl_vector__reim_source.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* vector/reim_source.c
  2. *
  3. * Copyright (C) 2001, 2007 Brian Gough
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. */
  19. QUALIFIED_REAL_VIEW(_gsl_vector, view)
  20. FUNCTION(gsl_vector, real) (QUALIFIED_TYPE(gsl_vector) * v)
  21. {
  22. REAL_TYPE(gsl_vector) s = NULL_VECTOR;
  23. s.data = v->data;
  24. s.size = v->size;
  25. s.stride = MULTIPLICITY * v->stride;
  26. s.block = 0; /* FIXME: should be v->block, but cannot point to
  27. block of different type */
  28. s.owner = 0;
  29. {
  30. QUALIFIED_REAL_VIEW(_gsl_vector,view) view = NULL_VECTOR_VIEW;
  31. view.vector = s;
  32. return view;
  33. }
  34. }
  35. QUALIFIED_REAL_VIEW(_gsl_vector, view)
  36. FUNCTION(gsl_vector, imag) (QUALIFIED_TYPE(gsl_vector) * v)
  37. {
  38. REAL_TYPE(gsl_vector) s = NULL_VECTOR;
  39. s.data = v->data + 1;
  40. s.size = v->size;
  41. s.stride = MULTIPLICITY * v->stride;
  42. s.block = 0; /* FIXME: cannot point to block of different type */
  43. s.owner = 0;
  44. {
  45. QUALIFIED_REAL_VIEW(_gsl_vector,view) view = NULL_VECTOR_VIEW;
  46. view.vector = s;
  47. return view;
  48. }
  49. }