Example #1
0
int omxExpectation::numSummaryStats()
{
	omxMatrix *cov = getComponent("cov");
	if (!cov) {
		Rf_error("%s::numSummaryStats is not implemented (for object '%s')", expType, name);
	}

	omxMatrix *mean = getComponent("means");

	int count = 0;

	omxMatrix *slope = getComponent("slope");
	if (slope) count += slope->rows * slope->cols;

	auto &ti = getThresholdInfo();
	if (ti.size() == 0) {
		// all continuous
		count += triangleLoc1(cov->rows);
		if (mean) count += cov->rows;
		return count;
	}

	count += triangleLoc1(cov->rows - 1);  // covariances
	for (auto &th : ti) {
		// mean + variance
		count += th.numThresholds? th.numThresholds : 2;
	}

	return count;
}
Example #2
0
void QsfpModule::getTransceiverInfo(TransceiverInfo &info) {
    lock_guard<std::mutex> g(qsfpModuleMutex_);
    info.present = present_;
    info.transceiver = type();
    info.port = qsfpImpl_->getNum();
    if (!cacheIsValid()) {
        return;
    }

    if (getSensorInfo(info.sensor)) {
        info.__isset.sensor = true;
    }
    if (getVendorInfo(info.vendor)) {
        info.__isset.vendor = true;
    }
    if (getCableInfo(info.cable)) {
        info.__isset.cable = true;
    }
    if (getThresholdInfo(info.thresholds)) {
        info.__isset.thresholds = true;
    }
    for (int i = 0; i < CHANNEL_COUNT; i++) {
        Channel chan;
        chan.channel = i;
        info.channels.push_back(chan);
    }

    if (getSensorsPerChanInfo(info.channels)) {
        info.__isset.channels = true;
    } else {
        info.channels.clear();
    }
}
Example #3
0
void omxExpectation::asVector1(FitContext *fc, int row, Eigen::Ref<Eigen::VectorXd> out)
{
	loadDefVars(row);
	omxExpectationCompute(fc, this, 0);

	omxMatrix *cov = getComponent("cov");
	if (!cov) {
		Rf_error("%s::asVector is not implemented (for object '%s')", expType, name);
	}

	normalToStdVector(cov, getComponent("means"), getComponent("slope"), thresholdsMat,
			  numOrdinal, getThresholdInfo(), out);
}