예제 #1
0
IntervalMatrix Fnc::eval_matrix(const IntervalVector& x) const {
	not_implemented("eval_matrix");
	return IntervalMatrix(0,0);
}
void _pthread_tsd_cleanup4(pthread_t self)
{
	not_implemented();
}
예제 #3
0
IntervalVector FncKhunTucker::eval_vector(const IntervalVector& x_lambda, const BitSet& components) const {

	if (components.size()!=n+nb_mult) {
		not_implemented("FncKhunTucker: 'eval_vector' for selected components");
		//J.resize(n+nb_mult,n+nb_mult);
	}

	IntervalVector res(n+nb_mult);

	// Variables in x_lambda are organized as follows:
	// x - lambda0 - mu - lambda - beta

	IntervalVector x=x_lambda.subvector(0,n-1);

	int lambda0=n;	// The index of lambda0 in the box x_lambda is nb_var.

	int l=lambda0; // multipliers indices counter. The first multiplier is lambda0.

	// vector corresponding to the "gradient expression" lambda_0*dg + lambda_1*dg_1 + ... (init
	IntervalVector grad=x_lambda[l] * df.eval_vector(x); // init

	l++;

	IntervalVector gx;

	if (!active.empty()) {
		gx=sys.f_ctrs.eval_vector(x,active);
	}
	// normalization equation lambda_0 + ... = 1.0
	res[lambda0] = x_lambda[lambda0] - 1.0; // init

	for (BitSet::const_iterator i=ineq.begin(); i!=ineq.end(); ++i) {
		grad += x_lambda[l] * dg[i].eval_vector(x);
		res[l] = x_lambda[l] * gx[i];
		res[lambda0] += x_lambda[l];
		l++;
	}

	for (BitSet::const_iterator i=eq.begin(); i!=eq.end(); ++i) {
		grad += x_lambda[l] * dg[i].eval_vector(x);
		res[l] = gx[i];
		res[lambda0] += sqr(x_lambda[l]);
		l++;
	}

	for (BitSet::const_iterator v=bound_left.begin(); v!=bound_left.end(); ++v) {
		grad[v] -= x_lambda[l];
		res[l] = x_lambda[l] * (-x[v]+sys.box[v].lb());
		res[lambda0] += x_lambda[l];
		l++;
	}

	for (BitSet::const_iterator v=bound_right.begin(); v!=bound_right.end(); ++v) {
		grad[v] += x_lambda[l];
		res[l] = x_lambda[l] * (x[v]-sys.box[v].ub());
		res[lambda0] += x_lambda[l];
		l++;
	}

	assert(l==nb_mult+n);

	res.put(0, grad);

	return res;
}
예제 #4
0
파일: abi-arm.cpp 프로젝트: shixiao/hhvm
PhysReg r_svcreq_sf() { not_implemented(); }
예제 #5
0
파일: abi-arm.cpp 프로젝트: cgvarela/hhvm
PhysReg rarg_simd(size_t i) {
  not_implemented();
}
예제 #6
0
size_t DecodedInstruction::size() const {
  not_implemented();
  return size_t{0};
}
예제 #7
0
int handle_client_connection() {
    char buffer[8096];
    int buffer_len; // Length of buffer

    char method[256];
    char url[256];
    char version[256];

    int i = 0, // Used to iterate over the first line to get method, url, version
        j = 0;

    // Read first line
    buffer_len = read_line(client_sockfd, buffer, sizeof(buffer));

    // Unable to read from socket, not sure what to do in this case
    if (buffer_len <= 0) {
        return -1;
    }

    fprintf(stderr, "==== Read Next Request ====\n");

    // Get Method (e.g. GET, POST, etc)
    while ((i < (sizeof(method) - 1)) && (!isspace(buffer[i]))) {
        method[i] = buffer[i];
        i++;
    }
    method[i] = '\0';

    // fprintf(stderr, "method: %s\n", method);

    // Skip over spaces
    while (i < buffer_len && isspace(buffer[i])) {
        i++;
    }

    // Get URL
    j = 0;
    while (i < buffer_len && (j < (sizeof(url) - 1)) && !isspace(buffer[i])) {
        url[j] = buffer[i];
        i++;
        j++;
    }
    url[j] = '\0';

    // fprintf(stderr, "url: %s\n", url);

    // Skip over spaces
    while (i < buffer_len && isspace(buffer[i])) {
        i++;
    }

    j = 0;
    while (j < sizeof(version) - 1 && !isspace(buffer[i])) {
        version[j] = buffer[i];
        i++;
        j++;
    }
    version[j] = '\0';

    // fprintf(stderr, "version: %s\n", version);

    read_headers();

    if (header_err_flag) {
        keep_alive = FALSE;
        bad_request();
        return -1;
    }

    if (content_length > 0) {
        content = (char*) malloc(content_length + 1);
        read_socket(client_sockfd, content, content_length);
    }

    // fprintf(stderr, "Content-Length: %d\n", content_length);
    // fprintf(stderr, "Connection (keep_alive): %d\n", keep_alive);
    // fprintf(stderr, "Cookie: %d\n", cookie);
    // fprintf(stderr, "If-Modified-Since Valid Time: %d\n", time_is_valid);
    // fprintf(stderr, "If-Modified-Since Time: %p\n", if_modified_since);
    if (content != NULL) {
        // fprintf(stderr, "Content: %s\n", content);
    }

    /***********************************************************/
    /*       Full message has been read, respond to client     */
    /***********************************************************/

    if (strcmp(method, "GET") != 0) {
        // Inform client we don't support method
        fprintf(stderr, "Method Not Allowed: %s\n", method);
        method_not_allowed();    
        return 0;
    }

    if (cookie) {
        // Inform client we don't support cookies
        not_implemented();
        return 0;
    }

    if (not_eng) {
        // Inform client we only support English
        not_implemented();
        return 0;
    }

    if (!acceptable_text) {
        // Inform client we only support plain text
        not_implemented();
        return 0;
    }

    if (!acceptable_charset) {
        // Inform client we only support ASCII
        not_implemented();
        return 0;
    }

    // Fix filename
    char file_path[512];
    sprintf(file_path, "htdocs%s", url);
    if (file_path[strlen(file_path)-1] == '/') {
        file_path[strlen(file_path)-1] = '\0';
    }

    // fprintf(stderr, "%s\n", file_path);

    int fname_valid = is_valid_fname(file_path);

    struct stat file_info;

    if (!fname_valid) {
        // invalid filename
        fprintf(stderr, "403 Forbidden: Invalid file name\n");
        forbidden();
        return 0;
    }

    if (stat(file_path, &file_info)) {
        fprintf(stderr, "404 Not Found: Stat failed\n");
        // Stat failed
        not_found();
        return 1;
    }

    if (!S_ISREG(file_info.st_mode)) {
        // Not a file
        forbidden();
        fprintf(stderr, "403 Forbidden: Not a regular file\n");
        return 0;
    }


    if (!(file_info.st_mode & S_IRUSR)) {
        // No read permissions
        forbidden();
        fprintf(stderr, "403 Forbidden: No read permissions\n");
        return 0;
    }

    FILE *f = fopen(file_path, "r");
    if (f == NULL) {
        // No file
        not_found();
        fprintf(stderr, "404 Not Found: Unable to open file\n");
        return 0;
    }

    if (if_modified_since != NULL) {
        struct tm *last_modified = gmtime(&file_info.st_mtime);

        time_t last = mktime(last_modified);
        time_t since = mktime(if_modified_since);

        double diff = difftime(last, since);
        if (diff <= 0) {
            fprintf(stderr, "304 Not Modified\n");
            not_modified();
            return 0;
        }
    }

    fprintf(stderr, "All looks good, serving up content in %s\n", file_path);

    char *file_contents = NULL;
    int contents_length = 0;
    char line[512];

    while (fgets(line, sizeof(line), f) != NULL) {
        if (file_contents != NULL) {
            char *new_contents = (char*) malloc(contents_length + strlen(line) + 1);
            strcpy(new_contents, file_contents);
            strcpy(new_contents + strlen(new_contents), line);
            contents_length += strlen(line);

            free(file_contents);
            file_contents = new_contents;
        } else {
            file_contents = (char*) malloc(strlen(line) + 1);
            strcpy(file_contents, line);
            contents_length += strlen(line);
        }
    }
    fclose(f);

    // fprintf(stderr, "File Contents:\n");

    // fprintf(stderr, "%s\n", file_contents);

    ok(file_contents);

    return 0;
}
예제 #8
0
std::shared_ptr<XmlNode> DomainEnergyControl_000::getXml(UIntN domainIndex)
{
	throw not_implemented();
}
예제 #9
0
double DomainEnergyControl_000::getRaplEnergyUnit(UIntN participantIndex, UIntN domainIndex)
{
	throw not_implemented();
}
예제 #10
0
void Fnc::generate_used_vars() const {
	not_implemented("generate_comp");
}
예제 #11
0
void compound_bitfield_impl::set(size_t index, value_type value)
{
    throw not_implemented();
}
예제 #12
0
void Fnc::print_expr(std::ostream& os) const {
	not_implemented("print_expr");
}
예제 #13
0
void Fnc::jacobian(const IntervalVector& x, IntervalMatrix& J) const {
	not_implemented("jacobian");
}
예제 #14
0
void Fnc::gradient(const IntervalVector& x, IntervalVector& g) const {
	not_implemented("gradient");
}
예제 #15
0
XmlNode* DomainPixelClockControl_000::getXml(UIntN domainIndex)
{
    throw not_implemented();
}
예제 #16
0
UInt32 DomainEnergyControl_000::getRaplEnergyCounterWidth(UIntN participantIndex, UIntN domainIndex)
{
	throw not_implemented();
}
bool LinearRelaxFixed::goal_linearization(const IntervalVector& box, LinearSolver& lp_solver){
	not_implemented(" LinearRelaxFixed::goal_linearization not yet implemented");
	return false;
}
예제 #18
0
Power DomainEnergyControl_000::getInstantaneousPower(UIntN participantIndex, UIntN domainIndex)
{
	throw not_implemented();
}
예제 #19
0
HPHP::jit::ConditionCode DecodedInstruction::jccCondCode() const {
  not_implemented();
  return HPHP::jit::CC_None;
}
예제 #20
0
void DomainEnergyControl_000::setEnergyThreshold(UIntN participantIndex, UIntN domainIndex, UInt32 energyThreshold)
{
	throw not_implemented();
}
예제 #21
0
파일: abi-arm.cpp 프로젝트: shixiao/hhvm
RegSet interp_one_cf_regs() {
  not_implemented();
}
예제 #22
0
void DomainEnergyControl_000::setEnergyThresholdInterruptDisable(
	UIntN participantIndex,
	UIntN domainIndex)
{
	throw not_implemented();
}
예제 #23
0
파일: abi-arm.cpp 프로젝트: shixiao/hhvm
PhysReg r_svcreq_arg(size_t i) { not_implemented(); }
예제 #24
0
void DomainEnergyControl_000::sendActivityLoggingDataIfEnabled(UIntN participantIndex, UIntN domainIndex)
{
	throw not_implemented();
}
예제 #25
0
int
malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap)
{
	int ret;
	size_t i;
	const char *f;

#define	APPEND_C(c) do {						\
	if (i < size)							\
		str[i] = (c);						\
	i++;								\
} while (0)
#define	APPEND_S(s, slen) do {						\
	if (i < size) {							\
		size_t cpylen = (slen <= size - i) ? slen : size - i;	\
		memcpy(&str[i], s, cpylen);				\
	}								\
	i += slen;							\
} while (0)
#define	APPEND_PADDED_S(s, slen, width, left_justify) do {		\
	/* Left padding. */						\
	size_t pad_len = (width == -1) ? 0 : ((slen < (size_t)width) ?	\
	    (size_t)width - slen : 0);					\
	if (left_justify == false && pad_len != 0) {			\
		size_t j;						\
		for (j = 0; j < pad_len; j++)				\
			APPEND_C(' ');					\
	}								\
	/* Value. */							\
	APPEND_S(s, slen);						\
	/* Right padding. */						\
	if (left_justify && pad_len != 0) {				\
		size_t j;						\
		for (j = 0; j < pad_len; j++)				\
			APPEND_C(' ');					\
	}								\
} while (0)
#define GET_ARG_NUMERIC(val, len) do {					\
	switch (len) {							\
	case '?':							\
		val = va_arg(ap, int);					\
		break;							\
	case '?' | 0x80:						\
		val = va_arg(ap, unsigned int);				\
		break;							\
	case 'l':							\
		val = va_arg(ap, long);					\
		break;							\
	case 'l' | 0x80:						\
		val = va_arg(ap, unsigned long);			\
		break;							\
	case 'q':							\
		val = va_arg(ap, long long);				\
		break;							\
	case 'q' | 0x80:						\
		val = va_arg(ap, unsigned long long);			\
		break;							\
	case 'j':							\
		val = va_arg(ap, intmax_t);				\
		break;							\
	case 't':							\
		val = va_arg(ap, ptrdiff_t);				\
		break;							\
	case 'z':							\
		val = va_arg(ap, ssize_t);				\
		break;							\
	case 'z' | 0x80:						\
		val = va_arg(ap, size_t);				\
		break;							\
	case 'p': /* Synthetic; used for %p. */				\
		val = va_arg(ap, uintptr_t);				\
		break;							\
	default: not_reached();						\
	}								\
} while (0)

	i = 0;
	f = format;
	while (true) {
		switch (*f) {
		case '\0': goto label_out;
		case '%': {
			bool alt_form = false;
			bool zero_pad = false;
			bool left_justify = false;
			bool plus_space = false;
			bool plus_plus = false;
			int prec = -1;
			int width = -1;
			unsigned char len = '?';

			f++;
			if (*f == '%') {
				/* %% */
				APPEND_C(*f);
				break;
			}
			/* Flags. */
			while (true) {
				switch (*f) {
				case '#':
					assert(alt_form == false);
					alt_form = true;
					break;
				case '0':
					assert(zero_pad == false);
					zero_pad = true;
					break;
				case '-':
					assert(left_justify == false);
					left_justify = true;
					break;
				case ' ':
					assert(plus_space == false);
					plus_space = true;
					break;
				case '+':
					assert(plus_plus == false);
					plus_plus = true;
					break;
				default: goto label_width;
				}
				f++;
			}
			/* Width. */
			label_width:
			switch (*f) {
			case '*':
				width = va_arg(ap, int);
				f++;
				break;
			case '0': case '1': case '2': case '3': case '4':
			case '5': case '6': case '7': case '8': case '9': {
				uintmax_t uwidth;
				set_errno(0);
				uwidth = malloc_strtoumax(f, (char **)&f, 10);
				assert(uwidth != UINTMAX_MAX || get_errno() !=
				    ERANGE);
				width = (int)uwidth;
				if (*f == '.') {
					f++;
					goto label_precision;
				} else
					goto label_length;
				break;
			} case '.':
				f++;
				goto label_precision;
			default: goto label_length;
			}
			/* Precision. */
			label_precision:
			switch (*f) {
			case '*':
				prec = va_arg(ap, int);
				f++;
				break;
			case '0': case '1': case '2': case '3': case '4':
			case '5': case '6': case '7': case '8': case '9': {
				uintmax_t uprec;
				set_errno(0);
				uprec = malloc_strtoumax(f, (char **)&f, 10);
				assert(uprec != UINTMAX_MAX || get_errno() !=
				    ERANGE);
				prec = (int)uprec;
				break;
			}
			default: break;
			}
			/* Length. */
			label_length:
			switch (*f) {
			case 'l':
				f++;
				if (*f == 'l') {
					len = 'q';
					f++;
				} else
					len = 'l';
				break;
			case 'j':
				len = 'j';
				f++;
				break;
			case 't':
				len = 't';
				f++;
				break;
			case 'z':
				len = 'z';
				f++;
				break;
			default: break;
			}
			/* Conversion specifier. */
			switch (*f) {
				char *s;
				size_t slen;
			case 'd': case 'i': {
				intmax_t val JEMALLOC_CC_SILENCE_INIT(0);
				char buf[D2S_BUFSIZE];

				GET_ARG_NUMERIC(val, len);
				s = d2s(val, (plus_plus ? '+' : (plus_space ?
				    ' ' : '-')), buf, &slen);
				APPEND_PADDED_S(s, slen, width, left_justify);
				f++;
				break;
			} case 'o': {
				uintmax_t val JEMALLOC_CC_SILENCE_INIT(0);
				char buf[O2S_BUFSIZE];

				GET_ARG_NUMERIC(val, len | 0x80);
				s = o2s(val, alt_form, buf, &slen);
				APPEND_PADDED_S(s, slen, width, left_justify);
				f++;
				break;
			} case 'u': {
				uintmax_t val JEMALLOC_CC_SILENCE_INIT(0);
				char buf[U2S_BUFSIZE];

				GET_ARG_NUMERIC(val, len | 0x80);
				s = u2s(val, 10, false, buf, &slen);
				APPEND_PADDED_S(s, slen, width, left_justify);
				f++;
				break;
			} case 'x': case 'X': {
				uintmax_t val JEMALLOC_CC_SILENCE_INIT(0);
				char buf[X2S_BUFSIZE];

				GET_ARG_NUMERIC(val, len | 0x80);
				s = x2s(val, alt_form, *f == 'X', buf, &slen);
				APPEND_PADDED_S(s, slen, width, left_justify);
				f++;
				break;
			} case 'c': {
				unsigned char val;
				char buf[2];

				assert(len == '?' || len == 'l');
				assert_not_implemented(len != 'l');
				val = va_arg(ap, int);
				buf[0] = val;
				buf[1] = '\0';
				APPEND_PADDED_S(buf, 1, width, left_justify);
				f++;
				break;
			} case 's':
				assert(len == '?' || len == 'l');
				assert_not_implemented(len != 'l');
				s = va_arg(ap, char *);
				slen = (prec == -1) ? strlen(s) : prec;
				APPEND_PADDED_S(s, slen, width, left_justify);
				f++;
				break;
			case 'p': {
				uintmax_t val;
				char buf[X2S_BUFSIZE];

				GET_ARG_NUMERIC(val, 'p');
				s = x2s(val, true, false, buf, &slen);
				APPEND_PADDED_S(s, slen, width, left_justify);
				f++;
				break;
			}
			default: not_implemented();
			}
			break;
		} default: {
			APPEND_C(*f);
			f++;
			break;
		}}
	}
	label_out:
	if (i < size)
		str[i] = '\0';
	else
		str[size - 1] = '\0';
	ret = i;

#undef APPEND_C
#undef APPEND_S
#undef APPEND_PADDED_S
#undef GET_ARG_NUMERIC
	return (ret);
}
예제 #26
0
void DebugProcessor::gather_physics()
{
  not_implemented();
}
예제 #27
0
void DomainPerformanceControl_003::updateBasedOnConfigTdpInformation(UIntN participantIndex, UIntN domainIndex,
    ConfigTdpControlSet configTdpControlSet, ConfigTdpControlStatus configTdpControlStatus)
{
    throw not_implemented();
}
예제 #28
0
void DomainPixelClockControl_000::setPixelClockControl(UIntN participantIndex, UIntN domainIndex,
    const PixelClockDataSet& pixelClockDataSet)
{
    throw not_implemented();
}
예제 #29
0
void FncKhunTucker::jacobian(const IntervalVector& x_lambda, IntervalMatrix& J, const BitSet& components, int v) const {

	if (components.size()!=n+nb_mult) {
		not_implemented("FncKhunTucker: 'jacobian' for selected components");
		//J.resize(n+nb_mult,n+nb_mult);
	}

	IntervalVector x=x_lambda.subvector(0,n-1);

	int lambda0=n;	// The index of lambda0 in the box x_lambda is nb_var.

	int l=lambda0; // mutipliers indices counter. The first multiplier is lambda0.

	// matrix corresponding to the "Hessian expression" lambda_0*d^2f+lambda_1*d^2g_1+...=0
	IntervalMatrix hessian=x_lambda[l] * df.jacobian(x,v<n? v : -1); // init
	if (v==-1 || v==l) J.put(0, l, df.eval_vector(x), false);

	l++;

	IntervalVector gx;
	if (!active.empty())
		gx = sys.f_ctrs.eval_vector(x,active);

	// normalization equation (init)
	J[lambda0].put(0,Vector::zeros(n));
	J[lambda0][lambda0]=1.0;

	IntervalVector dgi(n); // store dg_i([x]) (used in several places)

	for (BitSet::const_iterator i=ineq.begin(); i!=ineq.end(); ++i) {
		hessian += x_lambda[l] * dg[i].jacobian(x,v<n? v : -1);
		dgi=dg[i].eval_vector(x);
		J.put(0, l, dgi, false);

		J.put(l, 0, (x_lambda[l]*dgi), true);
		J.put(l, n, Vector::zeros(nb_mult), true);
		J[l][l]=gx[i];

		J[lambda0][l] = 1.0;

		l++;
	}

	for (BitSet::const_iterator i=ineq.begin(); i!=ineq.end(); ++i) {
		hessian += x_lambda[l] * dg[i].jacobian(x,v<n? v : -1);
		dgi=dg[i].eval_vector(x);
		J.put(0, l, dgi, false);

		J.put(l, 0, dgi, true);
		J.put(l, n, Vector::zeros(nb_mult), true);

		J[lambda0][l] = 2*x_lambda[l];

		l++;
	}

	for (BitSet::const_iterator v=bound_left.begin(); v!=bound_left.end(); ++v) {
		// this constraint does not contribute to the "Hessian expression"
		dgi=Vector::zeros(n);
		dgi[v]=-1.0;
		J.put(0, l, dgi, false);

		J.put(l, 0, (x_lambda[l]*dgi), true);
		J.put(l, n, Vector::zeros(nb_mult), true);
		J[l][l]=(-x[v]+sys.box[v].lb());

		J[lambda0][l] = 1.0;
		l++;
	}


	for (BitSet::const_iterator v=bound_right.begin(); v!=bound_right.end(); ++v) {
		// this constraint does not contribute to the "Hessian expression"
		dgi=Vector::zeros(n);
		dgi[v]=1.0;
		J.put(0, l, dgi, false);

		J.put(l, 0, (x_lambda[l]*dgi), true);
		J.put(l, n, Vector::zeros(nb_mult), true);
		J[l][l]=(x[v]-sys.box[v].ub());

		J[lambda0][l] = 1.0;
		l++;
	}

	assert(l==nb_mult+n);

	J.put(0,0,hessian);

}
예제 #30
0
IntervalVector Fnc::eval_vector(const IntervalVector& box) const {
	not_implemented("eval_vector");
	return IntervalVector(0);
}