# Subversion RepositoriesOpenSees

## Regard whitespace Rev 4878 → Rev 4879

/trunk/SRC/reliability/analysis/transformation/NatafProbabilityTransformation.cpp
356,11 → 356,12
{
// Returns the sensitivity of 'u' with respect to [mean, stdv]
// for the given random variable number (rvNumber)
NormalRV aStdNormRV(1,0.0,1.0);

// Need four factors:
// 1) (*inverseLowerCholesky)
// DONE

// 1) (*inverseLowerCholesky) DONE

// 2) Vector z = x_to_z(x);
Vector z(nrv);
this->x_to_z(z);
374,7 → 375,7
}

int rvIndex = theReliabilityDomain->getRandomVariableIndex(rvTag);
DzDmean = theRV->getCDFMeanSensitivity();
DzDmean = theRV->getCDFMeanSensitivity() / aStdNormRV.getPDFvalue( z(rvIndex) );
opserr << "DzDmean is " << DzDmean << endln;

// 4) The hardest part: DinverseLowerCholeskyDmean
409,9 → 410,10
<< " for the correlation matrix." << endln;
}
const Matrix &PerturbedInverseLowerCholesky = someMatrixOperations.getInverseLowerCholesky();
//Matrix DinverseLowerCholeskyDmean = (OrigInverseLowerCholesky - PerturbedInverseLowerCholesky) * (1/h);
Matrix DinverseLowerCholeskyDmean(OrigInverseLowerCholesky);
setCorrelationMatrix(0, 0, 0.0);

// Return the final result (the four factors)
434,11 → 436,12
{
// Returns the sensitivity of 'u' with respect to [mean, stdv]
// for the given random variable number (rvNumber)
NormalRV aStdNormRV(1,0.0,1.0);

// Need four factors:
// 1) (*inverseLowerCholesky)
// DONE

// 1) (*inverseLowerCholesky) DONE

// 2) Vector z = x_to_z(x);
Vector z(nrv);
this->x_to_z(z);
452,7 → 455,7
}

int rvIndex = theReliabilityDomain->getRandomVariableIndex(rvTag);
DzDstdv = theRV->getCDFStdvSensitivity();
DzDstdv = theRV->getCDFStdvSensitivity() / aStdNormRV.getPDFvalue( z(rvIndex) );
opserr << "DzDstdv is " << DzDstdv << endln;

// 4) The hardest part: DinverseLowerCholeskyDmean
487,9 → 490,10
<< " for the correlation matrix." << endln;
}
const Matrix &PerturbedInverseLowerCholesky = someMatrixOperations.getInverseLowerCholesky();
//Matrix DinverseLowerCholeskyDstdv = (OrigInverseLowerCholesky - PerturbedInverseLowerCholesky) * (1/h);
Matrix DinverseLowerCholeskyDstdv(OrigInverseLowerCholesky);
setCorrelationMatrix(0, 0, 0.0);

// Return the final result (the four factors)
/trunk/SRC/reliability/domain/distributions/LognormalRV.cpp
293,10 → 293,10
double rvValue = this->getCurrentValue();
// dFdlambda
dFdP(0) = -1/zeta/zeta/rvValue * getPDFvalue(rvValue);
dFdP(0) = -rvValue * getPDFvalue(rvValue);
// dFdzeta
dFdP(1) = -1/zeta/zeta/zeta/rvValue*(log(rvValue)-lambda) * getPDFvalue(rvValue);
dFdP(1) = -1/zeta*rvValue*(log(rvValue)-lambda) * getPDFvalue(rvValue);
return 0;
}
/trunk/SRC/reliability/domain/distributions/GumbelRV.cpp
136,6 → 136,79
}

double
GumbelRV::getCDFMeanSensitivity(void)
{
// returns dF/dmu
Vector dFdP(2);
Vector dPdmu(2);
getCDFparameterSensitivity(dFdP);
getParameterMeanSensitivity(dPdmu);
return dFdP^dPdmu;
}

double
GumbelRV::getCDFStdvSensitivity(void)
{
// returns dF/dsigma
Vector dFdP(2);
Vector dPdsig(2);
getCDFparameterSensitivity(dFdP);
getParameterStdvSensitivity(dPdsig);
return dFdP^dPdsig;
}

int
GumbelRV::getCDFparameterSensitivity(Vector &dFdP)
{
// returns gradient of F(x) with respect to distribution parameters
double rvValue = this->getCurrentValue();
// dFdu
dFdP(0) = -1 * getPDFvalue(rvValue);
// dFdalpha
dFdP(1) = -(u-rvValue)/alpha * getPDFvalue(rvValue);
return 0;
}

int
GumbelRV::getParameterMeanSensitivity(Vector &dPdmu)
{
// returns gradient of distribution parameters with respect to the mean
// dudmu
dPdmu(0) = 1;
dPdmu(1) = 0;
return 0;
}

int
GumbelRV::getParameterStdvSensitivity(Vector &dPdstdv)
{
// returns gradient of distribution parameters with respect to the stdv
double sig = getStdv();
// dudsig
dPdstdv(0) = -sqrt(6)/pi*euler;
dPdstdv(1) = -pi/sqrt(6)/sig/sig;
return 0;
}

void
GumbelRV::Print(OPS_Stream &s, int flag)
{
/trunk/SRC/reliability/domain/distributions/GumbelRV.h
56,6 → 56,13
double getCDFvalue(double rvValue);
double getInverseCDFvalue(double rvValue);
// sensitivity of CDF with respect to distribution parameters
double getCDFMeanSensitivity(void);
double getCDFStdvSensitivity(void);
int getCDFparameterSensitivity(Vector &dFdP);
int getParameterMeanSensitivity(Vector &dPdmu);
int getParameterStdvSensitivity(Vector &dPdstdv);
// other
void Print(OPS_Stream &s, int flag = 0);