home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / clib / progs / meschach / !Meschach / c / maxint < prev    next >
Encoding:
Text File  |  1994-01-13  |  1.2 KB  |  55 lines

  1. ree(matrix);
  2.       error(E_MEM,"m_get");
  3.    }
  4.    else if (mem_info_is_on()) {
  5.       mem_bytes(TYPE_MAT,0,m*n*sizeof(Real));
  6.    }
  7. #else
  8.    matrix->base = (Real *)NULL;
  9. #endif
  10.    if ((matrix->me = (Real **)calloc(m,sizeof(Real *))) == 
  11.        (Real **)NULL )
  12.    {    free(matrix->base);    free(matrix);
  13.     error(E_MEM,"m_get");
  14.      }
  15.    else if (mem_info_is_on()) {
  16.       mem_bytes(TYPE_MAT,0,m*sizeof(Real *));
  17.    }
  18.    
  19. #ifndef SEGMENTED
  20.    /* set up pointers */
  21.    for ( i=0; i<m; i++ )
  22.      matrix->me[i] = &(matrix->base[i*n]);
  23. #else
  24.    for ( i = 0; i < m; i++ )
  25.      if ( (matrix->me[i]=NEW_A(n,Real)) == (Real *)NULL )
  26.        error(E_MEM,"m_get");
  27.      else if (mem_info_is_on()) {
  28.     mem_bytes(TYPE_MAT,0,n*sizeof(Real));
  29.        }
  30. #endif
  31.    
  32.    return (matrix);
  33. }
  34.  
  35.  
  36. /* px_get -- gets a PERM of given 'size' by dynamic memory allocation
  37.    -- Note: initialized to the identity permutation */
  38. PERM    *px_get(size)
  39. int    size;
  40. {
  41.    PERM    *permute;
  42.    int    i;
  43.  
  44.    if (size < 0)
  45.      error(E_NEG,"px_get");
  46.  
  47.    if ((permute=NEW(PERM)) == (PERM *)NULL )
  48.      error(E_MEM,"px_get");
  49.    else if (mem_info_is_on()) {
  50.       mem_bytes(TYPE_PERM,0,sizeof(PERM));
  51.       mem_numvar(TYPE_PERM,1);
  52.    }
  53.    
  54.    permute->size = permute->max_size = size;
  55.    if ((permute->pe = NEW_A(si