Skip to content

Instantly share code, notes, and snippets.

@s-trinh
s-trinh / atan2_approximation.c
Created March 16, 2016 15:08 — forked from volkansalma/atan2_approximation.c
optimized atan2 approximation
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
float atan2_approximation1(float y, float x);
float atan2_approximation2(float y, float x);
int main()
{
float x = 1;
@s-trinh
s-trinh / canny.cpp
Created March 16, 2016 15:09 — forked from egonSchiele/canny.cpp
Adding automatic thresholding to cvCanny in OpenCV
// new
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
@s-trinh
s-trinh / Natives.java
Created February 12, 2020 20:07 — forked from apangin/Natives.java
JNI array access benchmark
package bench;
import org.openjdk.jmh.annotations.*;
@State(Scope.Benchmark)
public class Natives {
byte[] array;
@Param({"16", "256", "4096", "65536", "1048576"})
int length;
// http://cpp.sh/7ox7f
#include <iostream>
#include <string>
#include <cmath>
#include <limits>
#include <iomanip>
void print_double(const std::string& str, double val)
{
std::cout << str << ": " << std::setprecision(std::numeric_limits<double>::max_digits10) << val << std::endl;