gsl_vector__prop_source.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /* vector/prop_source.c
  2. *
  3. * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 Gerard Jungman, 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. int
  20. FUNCTION (gsl_vector, isnull) (const TYPE (gsl_vector) * v)
  21. {
  22. const size_t n = v->size;
  23. const size_t stride = v->stride ;
  24. size_t j;
  25. for (j = 0; j < n; j++)
  26. {
  27. size_t k;
  28. for (k = 0; k < MULTIPLICITY; k++)
  29. {
  30. if (v->data[MULTIPLICITY * stride * j + k] != 0.0)
  31. {
  32. return 0;
  33. }
  34. }
  35. }
  36. return 1;
  37. }
  38. int
  39. FUNCTION (gsl_vector, ispos) (const TYPE (gsl_vector) * v)
  40. {
  41. const size_t n = v->size;
  42. const size_t stride = v->stride ;
  43. size_t j;
  44. for (j = 0; j < n; j++)
  45. {
  46. size_t k;
  47. for (k = 0; k < MULTIPLICITY; k++)
  48. {
  49. if (v->data[MULTIPLICITY * stride * j + k] <= 0.0)
  50. {
  51. return 0;
  52. }
  53. }
  54. }
  55. return 1;
  56. }
  57. int
  58. FUNCTION (gsl_vector, isneg) (const TYPE (gsl_vector) * v)
  59. {
  60. const size_t n = v->size;
  61. const size_t stride = v->stride ;
  62. size_t j;
  63. for (j = 0; j < n; j++)
  64. {
  65. size_t k;
  66. for (k = 0; k < MULTIPLICITY; k++)
  67. {
  68. if (v->data[MULTIPLICITY * stride * j + k] >= 0.0)
  69. {
  70. return 0;
  71. }
  72. }
  73. }
  74. return 1;
  75. }
  76. int
  77. FUNCTION (gsl_vector, isnonneg) (const TYPE (gsl_vector) * v)
  78. {
  79. const size_t n = v->size;
  80. const size_t stride = v->stride ;
  81. size_t j;
  82. for (j = 0; j < n; j++)
  83. {
  84. size_t k;
  85. for (k = 0; k < MULTIPLICITY; k++)
  86. {
  87. if (v->data[MULTIPLICITY * stride * j + k] < 0.0)
  88. {
  89. return 0;
  90. }
  91. }
  92. }
  93. return 1;
  94. }