Esempio n. 1
0
void Lotkin( AbstractBlockDistMatrix<F>& A, Int n )
{
    DEBUG_ONLY(CallStackEntry cse("Lotkin"))
    Hilbert( A, n );
    // Set first row to all ones
    if( A.ColShift() == 0 )
    {
        const Int localWidth = A.LocalWidth();
        for( Int jLoc=0; jLoc<localWidth; ++jLoc )
            A.SetLocal( 0, jLoc, F(1) );
    } 
}
Esempio n. 2
0
void Hilbert( AbstractBlockDistMatrix<F>& A, Int n )
{
    DEBUG_ONLY(CSE cse("Hilbert"))
    A.Resize( n, n );
    auto hilbertFill = []( Int i, Int j ) { return F(1)/F(i+j+1); };
    IndexDependentFill( A, function<F(Int,Int)>(hilbertFill) );
}
Esempio n. 3
0
void Ris( AbstractBlockDistMatrix<F>& R, Int n )
{
    DEBUG_ONLY(CallStackEntry cse("Ris"))
    R.Resize( n, n );
    const F oneHalf = F(1)/F(2);
    auto risFill = [=]( Int i, Int j ) { return oneHalf/(F(n-i-j)-oneHalf); };
    IndexDependentFill( R, function<F(Int,Int)>(risFill) );
}
Esempio n. 4
0
void Parter( AbstractBlockDistMatrix<F>& P, Int n )
{
    DEBUG_ONLY(CallStackEntry cse("Parter"))
    P.Resize( n, n );
    const F oneHalf = F(1)/F(2);
    auto parterFill = [=]( Int i, Int j ) { return F(1)/(F(i)-F(j)+oneHalf); };
    IndexDependentFill( P, function<F(Int,Int)>(parterFill) );
}
Esempio n. 5
0
void KMS( AbstractBlockDistMatrix<T>& K, Int n, T rho )
{
    DEBUG_ONLY(CallStackEntry cse("KMS"))
    K.Resize( n, n );
    auto kmsFill = 
      [=]( Int i, Int j ) -> T
      { if( i < j ) { return Pow(rho,T(j-i));       } 
        else        { return Conj(Pow(rho,T(i-j))); } };
    IndexDependentFill( K, function<T(Int,Int)>(kmsFill) );
}
Esempio n. 6
0
void Redheffer( AbstractBlockDistMatrix<T>& R, Int n )
{
    DEBUG_ONLY(CSE cse("Redheffer"))
    R.Resize( n, n );
    auto redhefferFill = 
      []( Int i, Int j ) -> T
      { if( j == 0 || ((j+1)%(i+1))==0 ) { return T(1); }
        else                             { return T(0); } };
    IndexDependentFill( R, function<T(Int,Int)>(redhefferFill) );
}
Esempio n. 7
0
void GKS( AbstractBlockDistMatrix<F>& A, Int n )
{
    DEBUG_ONLY(CallStackEntry cse("GKS"))
    A.Resize( n, n );
    auto gksFill = 
      []( Int i, Int j ) -> F
      { if( i < j )       { return -F(1)/Sqrt(F(j+1)); }
        else if( i == j ) { return  F(1)/Sqrt(F(j+1)); }
        else              { return  F(0);            } };
    IndexDependentFill( A, function<F(Int,Int)>(gksFill) );
}
Esempio n. 8
0
void Fourier( AbstractBlockDistMatrix<Complex<Real>>& A, Int n )
{
    DEBUG_ONLY(CallStackEntry cse("Fourier"))
    A.Resize( n, n );
    const Real pi = 4*Atan( Real(1) );
    const Real nSqrt = Sqrt( Real(n) );
    auto fourierFill = 
      [=]( Int i, Int j ) -> Complex<Real>
      { const Real theta = -2*pi*i*j/n;
        return Complex<Real>(Cos(theta),Sin(theta))/nSqrt; };
    IndexDependentFill( A, function<Complex<Real>(Int,Int)>(fourierFill) );
}
Esempio n. 9
0
void Egorov
( AbstractBlockDistMatrix<Complex<Real>>& A,
  std::function<Real(Int,Int)> phase, Int n )
{
    DEBUG_ONLY(CallStackEntry cse("Egorov"))
    A.Resize( n, n );
    auto egorovFill = 
      [&]( Int i, Int j )
      { const Real theta = phase(i,j);
        return Complex<Real>(Cos(theta),Sin(theta)); }; 
    IndexDependentFill( A, std::function<Complex<Real>(Int,Int)>(egorovFill) );
}
Esempio n. 10
0
void Kahan( AbstractBlockDistMatrix<F>& A, Int n, F phi )
{
    DEBUG_ONLY(CSE cse("Kahan"))
    A.Resize( n, n );
    const F zeta = Sqrt(F(1)-phi*Conj(phi));
    typedef Base<F> Real;
    auto kahanFill = 
      [=]( Int i, Int j ) -> F
      { if( i == j )      { return      Pow(zeta,Real(i)); }
        else if(  i < j ) { return -phi*Pow(zeta,Real(i)); }
        else              { return F(0);                   } };
    IndexDependentFill( A, function<F(Int,Int)>(kahanFill) );
}
Esempio n. 11
0
void ThreeValued( AbstractBlockDistMatrix<T>& A, Int m, Int n, double p )
{
    DEBUG_ONLY(CSE cse("ThreeValued"))
    A.Resize( m, n );
    if( A.RedundantRank() == 0 )
        ThreeValued( A.Matrix(), A.LocalHeight(), A.LocalWidth(), p );
    Broadcast( A, A.RedundantComm(), 0 );
}
Esempio n. 12
0
void Identity( AbstractBlockDistMatrix<T>& I, Int m, Int n )
{
    DEBUG_ONLY(CallStackEntry cse("Identity"))
    I.Resize( m, n );
    MakeIdentity( I );
}
Esempio n. 13
0
void Zeros( AbstractBlockDistMatrix<T>& A, Int m, Int n )
{
    DEBUG_ONLY(CallStackEntry cse("Zeros"))
    A.Resize( m, n );
    Zero( A );
}