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