| 140 | |
| 141 | |
| 142 | N_Vector N_VNew(integer N, machEnvType machEnv) |
| 143 | { |
| 144 | N_Vector v; |
| 145 | int N_local, N_global; |
| 146 | |
| 147 | if (N <= 0) return(NULL); |
| 148 | if (machEnv == NULL) return(NULL); |
| 149 | |
| 150 | N_local = machEnv->local_vec_length; |
| 151 | N_global = machEnv->global_vec_length; |
| 152 | |
| 153 | v = (N_Vector) malloc(sizeof *v); |
| 154 | if (v == NULL) return(NULL); |
| 155 | |
| 156 | v->data = (real *) malloc(N_local * sizeof(real)); |
| 157 | if (v->data == NULL) { |
| 158 | free(v); |
| 159 | return(NULL); |
| 160 | } |
| 161 | |
| 162 | v->length = N_local; |
| 163 | v->global_length = N_global; |
| 164 | |
| 165 | v->machEnv = (machEnvType) malloc(sizeof *machEnv); |
| 166 | if (v->machEnv == NULL) { |
| 167 | free(v->data); |
| 168 | free(v); |
| 169 | return(NULL); |
| 170 | } |
| 171 | memcpy(v->machEnv,machEnv,sizeof *machEnv); |
| 172 | |
| 173 | return(v); |
| 174 | } |
| 175 | |
| 176 | |
| 177 | void N_VFree(N_Vector x) |
no outgoing calls
no test coverage detected