本文整理汇总了C++中TFltVV::GetXDim方法的典型用法代码示例。如果您正苦于以下问题:C++ TFltVV::GetXDim方法的具体用法?C++ TFltVV::GetXDim怎么用?C++ TFltVV::GetXDim使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFltVV
的用法示例。
在下文中一共展示了TFltVV::GetXDim方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetStr
TStr TStrUtil::GetStr(const TFltVV& FltVV, const TStr& DelimiterStr, const TStr& FmtStr) {
TChA ResChA;
for (int i = 0; i < FltVV.GetXDim(); i++) {
for (int j = 0; j < FltVV.GetYDim(); j++) {
ResChA += TFlt::GetStr(FltVV(i,j), FmtStr);
if (j < FltVV.GetYDim() - 1) { ResChA += DelimiterStr; }
}
if (i < FltVV.GetXDim() - 1) { ResChA += '\n'; }
}
return ResChA;
}
示例2: GetNewtonStep
void TLogRegFit::GetNewtonStep(TFltVV& HVV, const TFltV& GradV, TFltV& DeltaLV) {
bool HSingular = false;
for (int i = 0; i < HVV.GetXDim(); i++) {
if (HVV(i,i) == 0.0) {
HVV(i,i) = 0.001;
HSingular = true;
}
DeltaLV[i] = GradV[i] / HVV(i, i);
}
if (! HSingular) {
if (HVV(0, 0) < 0) { // if Hessian is negative definite, convert it to positive definite
for (int r = 0; r < Theta.Len(); r++) {
for (int c = 0; c < Theta.Len(); c++) {
HVV(r, c) = - HVV(r, c);
}
}
TNumericalStuff::SolveSymetricSystem(HVV, GradV, DeltaLV);
}
else {
TNumericalStuff::SolveSymetricSystem(HVV, GradV, DeltaLV);
for (int i = 0; i < DeltaLV.Len(); i++) {
DeltaLV[i] = - DeltaLV[i];
}
}
}
}
示例3: PMultiplyT
void TBowMatrix::PMultiplyT(const TFltVV& B, int ColId, TFltV& Result) const {
IAssert(B.GetXDim() >= PGetRows() && Result.Len() >= PGetCols());
int ColN = PGetCols();
int i, j, len; //TFlt *ResV = Result.BegI();
for (j = 0; j < ColN; j++) {
PBowSpV ColV = ColSpVV[j];
len = ColV->Len(); Result[j] = 0.0;
for (i = 0; i < len; i++) {
Result[j] += ColV->GetWgt(i) * B(ColV->GetWId(i), ColId);
}
}
}
示例4: CenterKernelMatrix
void TKernelUtil::CenterKernelMatrix(TFltVV& K) {
IAssert(K.GetXDim() == K.GetYDim());
const int l = K.GetYDim();
TFltV jK(l); // j'K
double jKj = 0.0; // j'Kj
for (int j = 0; j < l; j++) {
jK[j] = 0.0;
for (int i = 0; i < l; i++)
jK[j] += K(i,j);
jKj += jK[j];
}
double invl = 1.0/l;
for (int i = 0; i < l; i++) {
for (int j = 0; j < l; j++)
K(i,j) = K(i,j) - invl*jK[j] - invl*jK[i] + invl*invl*jKj;
}
}