A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
#!/usr/bin/env python | |
import sys | |
import csv | |
def MeanAveragePrecision(valid_filename, attempt_filename, at=10): | |
at = int(at) | |
valid = dict() | |
for line in csv.DictReader(open(valid_filename,'r')): | |
valid.setdefault(line['source_node'],set()).update(line['destination_nodes'].split(" ")) |
# Thanks to @danger89 and @Ilothar for updating the gist. | |
# Set the name and the supported language of the project | |
project(hello-world C CXX) | |
# Set the minimum version of cmake required to build this project | |
cmake_minimum_required(VERSION 3.10) | |
# Use the package PkgConfig to detect GTK+ headers/library files | |
find_package(PkgConfig REQUIRED) | |
pkg_check_modules(GTK REQUIRED gtkmm-3.0) |
// "License": Public Domain | |
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like. | |
// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to | |
// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it | |
// an example on how to get the endian conversion functions on different platforms. | |
#ifndef PORTABLE_ENDIAN_H__ | |
#define PORTABLE_ENDIAN_H__ | |
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__) |
/* | |
Delta Compression by Glenn Fiedler. | |
This source code is placed in the public domain. | |
http://gafferongames.com/2015/03/14/the-networked-physics-data-compression-challenge/ | |
*/ | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <assert.h> | |
#include <string.h> |
in vec2 v_texcoord; // texture coords | |
in vec3 v_normal; // normal | |
in vec3 v_binormal; // binormal (for TBN basis calc) | |
in vec3 v_pos; // pixel view space position | |
out vec4 color; | |
layout(std140) uniform Transforms | |
{ | |
mat4x4 world_matrix; // object's world position |
Copyright 2018 Dominik Liebler | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR O |
#include <Eigen/Dense> | |
template <class MatT> | |
Eigen::Matrix<typename MatT::Scalar, MatT::ColsAtCompileTime, MatT::RowsAtCompileTime> | |
pseudoinverse(const MatT &mat, typename MatT::Scalar tolerance = typename MatT::Scalar{1e-4}) // choose appropriately | |
{ | |
typedef typename MatT::Scalar Scalar; | |
auto svd = mat.jacobiSvd(Eigen::ComputeFullU | Eigen::ComputeFullV); | |
const auto &singularValues = svd.singularValues(); | |
Eigen::Matrix<Scalar, MatT::ColsAtCompileTime, MatT::RowsAtCompileTime> singularValuesInv(mat.cols(), mat.rows()); |
cmake_minimum_required(VERSION 3.5) | |
project(user_ops C CXX) | |
set(CMAKE_CXX_STANDARD 14) | |
set (tensorflow_SOURCE_DIR "c:/src/tensorflow.guschmue") | |
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | |
add_definitions(/I${tensorflow_SOURCE_DIR} /I${tensorflow_SOURCE_DIR}/cmake_build) | |
add_definitions(-DEIGEN_AVOID_STL_ARRAY) |