/[ascend]/trunk/ascend/linear/mtx_vector.c
ViewVC logotype

Diff of /trunk/ascend/linear/mtx_vector.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2335 by jpye, Wed Dec 15 06:35:43 2010 UTC revision 2336 by jpye, Sun Dec 26 03:44:24 2010 UTC
# Line 25  Line 25 
25  #include <ascend/general/mem.h>  #include <ascend/general/mem.h>
26  #include <math.h>  #include <math.h>
27    
28    #define MTXVECTOR_DEBUG
29    
30  struct vec_vector *vec_create(int32 low, int32 high)  struct vec_vector *vec_create(int32 low, int32 high)
31  {                                                                  {                                                                
32    struct vec_vector *result;    struct vec_vector *result;
# Line 35  struct vec_vector *vec_create(int32 low, Line 37  struct vec_vector *vec_create(int32 low,
37    
38    result->rng = NULL;    result->rng = NULL;
39    result->vec = NULL;    result->vec = NULL;
40    #ifdef MTXVECTOR_DEBUG
41      /* set these elements to zero only if we're debugging (eg valgrinding) */
42      result->accurate = 0;
43      result->norm2 = 0;
44    #endif
45    if (0 != vec_init(result, low, high)) {    if (0 != vec_init(result, low, high)) {
46      ASC_FREE(result);      ASC_FREE(result);
47      result = NULL;      result = NULL;
# Line 61  int vec_init(struct vec_vector *vec, int Line 68  int vec_init(struct vec_vector *vec, int
68    
69    new_size = high + 1;    new_size = high + 1;
70    if (NULL == vec->vec) {    if (NULL == vec->vec) {
71    #ifdef MTXVECTOR_DEBUG
72        /* set these elements to zero only if we're debugging (eg valgrinding) */
73        vec->vec = ASC_NEW_ARRAY_CLEAR(real64,new_size);
74    #else
75      vec->vec = ASC_NEW_ARRAY(real64,new_size);      vec->vec = ASC_NEW_ARRAY(real64,new_size);
76    #endif
77      if (NULL == vec->vec) {      if (NULL == vec->vec) {
78        ASC_FREE(vec->rng);        ASC_FREE(vec->rng);
79        vec->rng = NULL;        vec->rng = NULL;

Legend:
Removed from v.2335  
changed lines
  Added in v.2336

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22