hmmer-3.3/src/p7_spensemble.c
/* Function:  p7_spensemble_Create()
 * Synopsis:  Allocates a <P7_SPENSEMBLE>
 * Incept:    SRE, Wed Jan  9 10:00:14 2008 [Janelia]
 *
 * Purpose:   Create a new <P7_SPENSEMBL> with specified initial
 *            allocation sizes: <init_n> for the number of sampled
 *            segment pairs, <init_epc> for the range over
 *            which one of a domain's (i,j,k,m) sampled endpoints
 *            falls, and <init_sigc> for the number of significant
 *            clusters (domains) that will be defined.
 *            
 *            The values of these initial allocations are only
 *            relevant to tuning memory performance, because the
 *            object is reallocated/grown as needed. You can make
 *            guesses, and the better your guess, the fewer
 *            reallocations will be needed; but everything will work
 *            fine regardless of what these initial allocations are.
 *            
 *            A <P7_SPENSEMBLE> is designed to be reused for many
 *            target sequences and/or models, to minimize alloc/free
 *            calls.
 *            
 * Args:      init_n     - initial allocation for # of sampled segment pairs
 *            init_epc   - initial allocation for maximum endpoint range
 *            init_sigc  - initial allocation for # of significant clusters, domains
 *
 * Returns:   a pointer to the new <P7_SPENSEMBLE>.
 *
 * Throws:    <NULL> on allocation failure.
 */
p7_spensemble_Create()
Synopsis:  Allocates a 
Incept:    SRE, Wed Jan  9 10:00:14 2008 [Janelia]

Create a new  with specified initial
allocation sizes:  for the number of sampled
segment pairs,  for the range over
which one of a domain's (i,j,k,m) sampled endpoints
falls, and  for the number of significant
clusters (domains) that will be defined.

The values of these initial allocations are only
relevant to tuning memory performance, because the
object is reallocated/grown as needed. You can make
guesses, and the better your guess, the fewer
reallocations will be needed; but everything will work
fine regardless of what these initial allocations are.

A  is designed to be reused for many
target sequences and/or models, to minimize alloc/free
calls.

init_n     - initial allocation for # of sampled segment pairs
init_epc   - initial allocation for maximum endpoint range
init_sigc  - initial allocation for # of significant clusters, domains

a pointer to the new .

 on allocation failure.
p7_spensemble_Create () Synopsis : Allocates a Incept : SRE Wed Jan 9 10 : 00 : 14 2008 [ Janelia ] Create a new with specified initial allocation sizes : for the number of sampled segment pairs for the range over which one of a domain ' s ( i j k m ) sampled endpoints falls and for the number of significant clusters ( domains ) that will be defined . The values of these initial allocations are only relevant to tuning memory performance because the object is reallocated / grown as needed . You can make guesses and the better your guess the fewer reallocations will be needed ; but everything will work fine regardless of what these initial allocations are . A is designed to be reused for many target sequences and / or models to minimize alloc / free calls . init_n - initial allocation for # of sampled segment pairs init_epc - initial allocation for maximum endpoint range init_sigc - initial allocation for # of significant clusters domains a pointer to the new . on allocation failure .
P7_SPENSEMBLE *
p7_spensemble_Create(int init_n, int init_epc, int init_sigc)
{
  P7_SPENSEMBLE *sp = NULL;
  int            status;
  ESL_ALLOC(sp, sizeof(P7_SPENSEMBLE));
  sp->sp            = NULL;
  sp->workspace     = NULL;
  sp->assignment    = NULL;
  sp->epc           = NULL;
  sp->sigc          = NULL;
  sp->nalloc        = init_n;
  sp->epc_alloc     = init_epc;
  sp->nsigc_alloc   = init_sigc;
  ESL_ALLOC(sp->sp,         sizeof(struct p7_spcoord_s) * sp->nalloc);
  ESL_ALLOC(sp->workspace,  sizeof(int)                 * sp->nalloc * 2); 
  ESL_ALLOC(sp->assignment, sizeof(int)                 * sp->nalloc);
  ESL_ALLOC(sp->epc,        sizeof(int)                 * sp->epc_alloc);
  ESL_ALLOC(sp->sigc,       sizeof(struct p7_spcoord_s) * sp->nsigc_alloc);
  sp->nsamples  = 0;
  sp->n         = 0;
  sp->nc        = 0;
  sp->nsigc     = 0;
  return sp;
 ERROR:
  p7_spensemble_Destroy(sp);
  return NULL;
}
P7_SPENSEMBLE * p7_spensemble_Create ( int init_n , int init_epc , int init_sigc ) { P7_SPENSEMBLE * sp = NULL ; int status ; ESL_ALLOC ( sp , sizeof ( P7_SPENSEMBLE ) ) ; sp -> sp = NULL ; sp -> workspace = NULL ; sp -> assignment = NULL ; sp -> epc = NULL ; sp -> sigc = NULL ; sp -> nalloc = init_n ; sp -> epc_alloc = init_epc ; sp -> nsigc_alloc = init_sigc ; ESL_ALLOC ( sp -> sp , sizeof ( struct p7_spcoord_s ) * sp -> nalloc ) ; ESL_ALLOC ( sp -> workspace , sizeof ( int ) * sp -> nalloc * 2 ) ; ESL_ALLOC ( sp -> assignment , sizeof ( int ) * sp -> nalloc ) ; ESL_ALLOC ( sp -> epc , sizeof ( int ) * sp -> epc_alloc ) ; ESL_ALLOC ( sp -> sigc , sizeof ( struct p7_spcoord_s ) * sp -> nsigc_alloc ) ; sp -> nsamples = 0 ; sp -> n = 0 ; sp -> nc = 0 ; sp -> nsigc = 0 ; return sp ; ERROR : p7_spensemble_Destroy ( sp ) ; return NULL ; }
Function:  p7_spensemble_Create()
 Synopsis:  Allocates a <P7_SPENSEMBLE>
 Incept:    SRE, Wed Jan  9 10:00:14 2008 [Janelia]
Function : p7_spensemble_Create () Synopsis : Allocates a <P7_SPENSEMBLE > Incept : SRE Wed Jan 9 10 : 00 : 14 2008 [ Janelia ]
/* workspace is 2n */