Exemplo n.º 1
0
  /**
   * Materialize as many of the blocks as possible.
   */
  void project_k (int64_t start, int64_t end) {
    /* Ensure that we can fit this many columns in */
    assert (end < std::numeric_limits<int>::max());
    assert (start < std::numeric_limits<int>::max());

    /* Materialize everything */
    int C = 0;
    for (int64_t i=start; i<end; ++i) {
      /* Get the SNP */
      snp_type SNP = (*map)(i);
     
      /* Skip if filter asks us to skip */
      if ((*filter)(SNP)) continue;
     
      /* Materialize the required vectors */
      (*materializer) (SNP, A_ptr+(C*M));
      ++C;
    }
     
    /* Compute the projections --- A'Y */
    dgemm_ (&TRANS, 
            &NO_TRANS,
            &block_size,        
            &K,        
            &M,       
            &PLUS_ONE, 
            A_ptr,   
            &M,       
            Y_ptr,  
            &M,     
            &PLUS_ONE,
            R_ptr,  
            &block_size);    

    /* Figure out the SNP that can be added (and in which position */
    for (size_t i=0; i<R.size(); ++i) {
      if (result.invalid() || (compare (R[i], result.weight))) {
        result.source = i/block_size;
        result.target = i%block_size;
        result.weight = R[i];
      }
    }
  }
Exemplo n.º 2
0
 /**
  * Extract the maximum value from R. Remember that R is a (block_size,K)
  * dimension matrix. So, when an entry is found, it is pretty easy to tell
  * which row and column it belongs to.
  */
 void check_and_swap (value_type new_result) {
   if (result.invalid() || (compare (new_result.weight, result.weight))) 
     result = new_result;
 }
Exemplo n.º 3
0
 /** 
  * Add up the two matrices.
  */
 void join(projector_t& other) {
   if(result.invalid() || compare (other.result.weight, result.weight))
     result = other.result;
 }