Exemplo n.º 1
0
static ShardInterval *
_readShardInterval(void)
{
	READ_LOCALS(ShardInterval);


	READ_OID_FIELD(relationId);
	READ_CHAR_FIELD(storageType);
	READ_OID_FIELD(valueTypeId);
	READ_INT_FIELD(valueTypeLen);
	READ_BOOL_FIELD(valueByVal);
	READ_BOOL_FIELD(minValueExists);
	READ_BOOL_FIELD(maxValueExists);

	token = citus_pg_strtok(&length); /* skip :minValue */
	if (!local_node->minValueExists)
		token = citus_pg_strtok(&length);		/* skip "<>" */
	else
		local_node->minValue = readDatum(local_node->valueByVal);

	token = citus_pg_strtok(&length); /* skip :maxValue */
	if (!local_node->minValueExists)
		token = citus_pg_strtok(&length);		/* skip "<>" */
	else
		local_node->maxValue = readDatum(local_node->valueByVal);

	READ_UINT64_FIELD(shardId);

	READ_DONE();
}
Exemplo n.º 2
0
void RBM::preTraining(string filename)
{

	for (size_t i = 0; i < selfTrainingTime; i++)
	{

		ifstream fin(filename, ios::in);

		size_t index = 0;
		while (!fin.eof())
		{
			index++;
			shared_ptr<AbstractMatrix> datum = readDatum(fin);
			double err = singleTraining(datum);
			if (index % 1000 == 0)
				printf("count: %d %.4f\n", index, err);
			//this->weight->print();
			//system("pause");

			if (index % selfBatchSize == 0)
				selfUpdate(false);
		}
		selfUpdate(true);

		fin.close();

	}


}
Exemplo n.º 3
0
/*
 * _readConst
 */
static Const *
_readConst(void)
{
	READ_LOCALS(Const);

	READ_OID_FIELD(consttype);
	READ_INT_FIELD(consttypmod);
	READ_INT_FIELD(constlen);
	READ_BOOL_FIELD(constbyval);
	READ_BOOL_FIELD(constisnull);

	token = pg_strtok(&length); /* skip :constvalue */
	if (local_node->constisnull)
		token = pg_strtok(&length);		/* skip "<>" */
	else
		local_node->constvalue = readDatum(local_node->constbyval);

	READ_DONE();
}