Ejemplo n.º 1
0
     M1 & hr2k (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2, const M3 &m3) 
 {
         return m1 = 
           t1 * m1 
         + t2 * prod (m2, herm (m3)) 
         + type_traits<T2>::conj (t2) * prod (m3, herm (m2));
     }
Ejemplo n.º 2
0
int do_memory_type(int n, W workspace) {
   typedef typename boost::numeric::bindings::traits::type_traits<T>::real_type real_type ;
   typedef std::complex< real_type >                                            complex_type ;

   typedef ublas::matrix<T, ublas::column_major> matrix_type ;
   typedef ublas::vector<T>                      vector_type ;

   // Set matrix
   matrix_type a( n, n );
   vector_type tau( n );

   randomize( a );
   matrix_type a2( a );
   matrix_type a3( a );

   // Compute QR factorization.
   lapack::geqrf( a, tau, workspace ) ;

   // Apply the orthogonal transformations to a2
   lapack::ormqr( 'L', transpose<T>::value, a, tau, a2, workspace );

   // The upper triangular parts of a and a2 must be equal.
   if (norm_frobenius( upper_part( a - a2 ) )
            > std::numeric_limits<real_type>::epsilon() * 10.0 * norm_frobenius( upper_part( a ) ) ) return 255 ;

   // Generate orthogonal matrix
   lapack::orgqr( a, tau, workspace );

   // The result of lapack::ormqr and the equivalent matrix product must be equal.
   if (norm_frobenius( a2 - prod(herm(a), a3) )
            > std::numeric_limits<real_type>::epsilon() * 10.0 * norm_frobenius( a2 ) ) return 255 ;

   return 0 ;
} // do_value_type()
Ejemplo n.º 3
0
void splinePoint(float t, float* x, float* y, float* z){
    int i;
    float out;

    i = interval(pt, t);
    out = (t - pt[i])/(pt[i+1]-pt[i]);

    if(t <= movePath[g_npoint-1].t){
        *x = herm(movePath[i].p.x, movePath[i].vx, movePath[i+1].p.x, movePath[i+1].vx, out);
        *y = herm(movePath[i].p.y, movePath[i].vy, movePath[i+1].p.y, movePath[i+1].vy, out);
        *z = herm(movePath[i].p.z, movePath[i].vz, movePath[i+1].p.z, movePath[i+1].vz, out);
    }else{
        *x = movePath[g_npoint-1].p.x;
        *y = movePath[g_npoint-1].p.y;
        *z = movePath[g_npoint-1].p.z;
    }
}
Ejemplo n.º 4
0
     M1 & hrk (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2) 
 {
         return m1 = t1 * m1 + t2 * prod (m2, herm (m2));
     }