PRTools contents

PRTools manual

prmemory

PRMEMORY

Set/get size of memory usage

    N = PRMEMORY(N)

    N : The desired / retrieved maximum size data of matrices (in
        matrix elements)

Description

This retoutine sets or retrieves a global variable GLOBALPRMEMORY that  controls the maximum size of data matrices in PRTools. Routines like  KNNC, KNN_MAP, PARZEN_MAP and TESTP make use of it by computing  additional loops and avoiding to define very large distance matrices.  The default for this maximum size is set to 10000000. For most  computers there is no need to reduce it. There is not much speed up  to be expected if it is enlarged.

PRMEMORY gives also the number of elements for which a conversion from  datafiles to datasets is approved.

This facility is illustrated by the following example, using the  routine PRMEM.

Assume that an array of the size [M x K] has to be computed. The  numbers of LOOPS and ROWS are determined which are needed such that  ROWS*K < GLOBALPRMEMORY (a global variable that is initialized in this  routine, if necessary). The final number of rows for the last loop  is returned in LAST.

Example(s)

 [M,K] = size(A);
 [LOOPS,ROWS,LAST] = prmem(M,K);
 if (LOOPS == 1)
  RESULT = < compute the result based on A >
 else
   RESULT = 0;
   for J =1:LOOPS
     if (J == LOOPS), N = LAST; else N = ROWS; end
     NN = (J-1)*ROWS;
     RESULT = RESULT + < compute a partial result based on A(NN+1:NN+N,:) >
    end
 end

PRTools contents

PRTools manual