Skip to content

Instantly share code, notes, and snippets.

View vitaut's full-sized avatar
🇺🇦

Victor Zverovich vitaut

🇺🇦
View GitHub Profile
#include "mp/nl-reader.h"
enum Expr {OTHER, CONST};
struct ExprCounter : mp::NullNLHandler<Expr> {
int num_divs;
ExprCounter() : num_divs(0) {}
Expr OnBinary(mp::expr::Kind kind, Expr lhs, Expr rhs) {
if (kind == mp::expr::DIV && rhs != CONST)
++num_divs;
#define FMT_HEADER_ONLY
#include "format.h"
struct Syschar {
char c;
Syschar(char c = 0) : c(c) {}
operator char() const { return c; }
};
namespace fmt {
#include "asl.h"
int main() {
ASL *asl = ASL_alloc(ASL_read_fg);
FILE *f = jac0dim("test.nl", 0);
fg_read(f, 0);
fint ne = 0;
double x[] = { 0, 0 };
double objval = asl->p.Objval(asl, 0, x, &ne);
printf("%g %d\n", objval, ne);
/*
Formatting library for C++
Copyright (c) 2012 - present, Victor Zverovich
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
#include <benchmark/benchmark.h>
#include <fmt/compile.h>
#include <fmt/os.h>
#include <cstdio>
#include <fstream>
#if 1 //__cpp_lib_concepts>=201907L
#include "../fast_io/include/fast_io.h"
#include "../fast_io/include/fast_io_device.h"
#include <benchmark/benchmark.h>
#include <fmt/chrono.h>
#include <fmt/compile.h>
#include <ctime>
static void year_month_day_strftime(benchmark::State& state) {
srand(0);
tm t;
t.tm_year = rand() % 10000 - 1900;