gsl_matrix__prop_source.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* matrix/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_matrix, isnull) (const TYPE (gsl_matrix) * m)
  21. {
  22. const size_t size1 = m->size1;
  23. const size_t size2 = m->size2;
  24. const size_t tda = m->tda ;
  25. size_t i, j, k;
  26. for (i = 0; i < size1 ; i++)
  27. {
  28. for (j = 0; j < size2; j++)
  29. {
  30. for (k = 0; k < MULTIPLICITY; k++)
  31. {
  32. if (m->data[(i * tda + j) * MULTIPLICITY + k] != 0.0)
  33. {
  34. return 0;
  35. }
  36. }
  37. }
  38. }
  39. return 1;
  40. }
  41. int
  42. FUNCTION (gsl_matrix, ispos) (const TYPE (gsl_matrix) * m)
  43. {
  44. const size_t size1 = m->size1;
  45. const size_t size2 = m->size2;
  46. const size_t tda = m->tda ;
  47. size_t i, j, k;
  48. for (i = 0; i < size1 ; i++)
  49. {
  50. for (j = 0; j < size2; j++)
  51. {
  52. for (k = 0; k < MULTIPLICITY; k++)
  53. {
  54. if (m->data[(i * tda + j) * MULTIPLICITY + k] <= 0.0)
  55. {
  56. return 0;
  57. }
  58. }
  59. }
  60. }
  61. return 1;
  62. }
  63. int
  64. FUNCTION (gsl_matrix, isneg) (const TYPE (gsl_matrix) * m)
  65. {
  66. const size_t size1 = m->size1;
  67. const size_t size2 = m->size2;
  68. const size_t tda = m->tda ;
  69. size_t i, j, k;
  70. for (i = 0; i < size1 ; i++)
  71. {
  72. for (j = 0; j < size2; j++)
  73. {
  74. for (k = 0; k < MULTIPLICITY; k++)
  75. {
  76. if (m->data[(i * tda + j) * MULTIPLICITY + k] >= 0.0)
  77. {
  78. return 0;
  79. }
  80. }
  81. }
  82. }
  83. return 1;
  84. }
  85. int
  86. FUNCTION (gsl_matrix, isnonneg) (const TYPE (gsl_matrix) * m)
  87. {
  88. const size_t size1 = m->size1;
  89. const size_t size2 = m->size2;
  90. const size_t tda = m->tda ;
  91. size_t i, j, k;
  92. for (i = 0; i < size1 ; i++)
  93. {
  94. for (j = 0; j < size2; j++)
  95. {
  96. for (k = 0; k < MULTIPLICITY; k++)
  97. {
  98. if (m->data[(i * tda + j) * MULTIPLICITY + k] < 0.0)
  99. {
  100. return 0;
  101. }
  102. }
  103. }
  104. }
  105. return 1;
  106. }