Beispiel #1
0
// --------- begin of function SERes::far_sound ----------//
//
// as same as far_sound, but no cut_off volume
// usually used in acknowlege voice
//
void SERes::far_sound(short xLoc, short yLoc, short frame,
	char subjectType,short subjectId, char *action, char objectType,short objectId)
{
	//### begin trevor 20/8 ###//
	if( !config.sound_effect_flag )
		return;
	//### end trevor 20/8 ###//

	short relXLoc = xLoc - (world.zoom_matrix->top_x_loc + world.zoom_matrix->disp_x_loc/2);
	short relYLoc = yLoc - (world.zoom_matrix->top_y_loc + world.zoom_matrix->disp_y_loc/2);
	PosVolume posv(relXLoc, relYLoc);
	RelVolume relVolume( posv, 200, MAX_MAP_WIDTH );
	if( !config.pan_control )
		relVolume.ds_pan = 0;
	SEInfo *seInfo;

	if( relVolume.rel_vol < 80)
		relVolume.rel_vol = 80;

	if( (seInfo=scan(subjectType, subjectId, action, objectType, objectId))
		!= NULL && frame == seInfo->out_frame)
	{
		se_output->request(seInfo->effect_id, relVolume );
	}
}
      inline
      int posv (CBLAS_UPLO const uplo, SymmA& a, MatrB& b) {
#ifndef BOOST_NUMERIC_BINDINGS_NO_STRUCTURE_CHECK 
        BOOST_STATIC_ASSERT((boost::is_same<
          typename traits::matrix_traits<SymmA>::ordering_type,
          typename traits::matrix_traits<MatrB>::ordering_type
        >::value)); 
#endif 

        CBLAS_ORDER const stor_ord
          = enum_cast<CBLAS_ORDER const>
          (storage_order<
#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS
            typename traits::matrix_traits<SymmA>::ordering_type
#else
            typename SymmA::orientation_category 
#endif 
           >::value); 

        int const n = traits::matrix_size1 (a);
        int const nrhs = stor_ord == CblasColMajor
          ? traits::matrix_size2 (b)
          : traits::matrix_size1 (b); 
        assert (n == traits::matrix_size2 (a)); 
        assert (n == (stor_ord == CblasColMajor
                      ? traits::matrix_size1 (b)
                      : traits::matrix_size2 (b))); 

        return posv (stor_ord, uplo, n, nrhs, 
                     traits::matrix_storage (a), 
                     traits::leading_dimension (a),
                     traits::matrix_storage (b),
                     traits::leading_dimension (b));
      }
Beispiel #3
0
  template <class T> void ht_grappa_solve_spd_system(hoNDArray<T> *A, hoNDArray<T> *B) {
    /*
      We are swithcing off OpenMP threading before this call to posv. There seems to be a bad interaction between openmp, cuda, and BLAS.
      So far this problem has only been observed from *.cu files (or in functions called from *.cu files) but the problem may be more general.

      This is a temporary fix that we should keep an eye on.
     */

    hoNDArray<T> A_ori;
    A_ori = *A;

    try
    {
        posv(*A, *B);
    }
    catch(...)
    {
        // it is found that if signal is very very high, the posv can throw exceptions due to ill-conditioned matrix of A
        // hesv does not require A to be a positive-definite matrix, but an n-by-n symmetric matrix

        GERROR_STREAM("ht_grappa_solve_spd_system : posv(*A, *B) throws exceptions ... ");
        *A = A_ori;
        hesv(*A, *B);
        GERROR_STREAM("ht_grappa_solve_spd_system : hesv(*A, *B) is called ");
    }
  }
Beispiel #4
0
VectorType
cholesky_solve(MatrixType a, const VectorType& y)
{
    // set up Ax = y
    MatrixType y1(linalg::size(y), 1, 0);
    column(y1, 0) = y;

    // solve
    posv(a, y1);

    return linalg::column(y1, 0);
}
 inline
 int cholesky_solve (SymmA& a, MatrB& b) {
   return posv (a, b); 
 }