This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MathNet.Numerics; | |
using MathNet.Numerics.IntegralTransforms; | |
static float? EstimatePitch(int sampleRate, float[] samples) | |
{ | |
// SDF | |
// 1. zero pad | |
var sdf = new Complex32[samples.Length * 2]; | |
for (var i = 0; i < samples.Length; i++) | |
sdf[i] = new Complex32(samples[i], 0f); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>プロジェクト名</title> | |
<style> | |
body { | |
margin: 0; | |
padding: 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Net.Http; | |
using System.Net.Http.Headers; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Xml; | |
namespace HatenaBlogDownloader | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 生成したファイルの出力先ディレクトリ | |
OUTPUT_DIR = 'output' | |
# 学習データとして使う音色 | |
INSTS_FOR_TRAINING = [ | |
# Piano | |
1, 3, 5, 7, 8, | |
# Chromatic Percussion | |
9, 11, 13, 15, | |
# Organ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import copy | |
import typing | |
def sign(x: typing.Union[int, float, 'Decimal1000']) -> int: | |
"""x の符号が正なら 1 、負なら -1 、そうでないなら 0 を返す""" | |
if isinstance(x, Decimal1000): | |
return x.sign() | |
if x < 0: return -1 | |
if x > 0: return 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading; | |
using System.Threading.Tasks; | |
using Grpc.Core; | |
using Grpc.Core.Logging; | |
namespace GrpcMemoryTest | |
{ | |
class Program | |
{ | |
private const string Host = "localhost"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <array> | |
#include <cassert> | |
#include <fstream> | |
#include <iostream> | |
#include <numeric> | |
#include <random> | |
#include <ppl.h> | |
struct integer_info { | |
int value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.CompilerServices; | |
namespace GCTest | |
{ | |
class Program | |
{ | |
static unsafe void Main(string[] args) | |
{ | |
ref var refElm = ref AllocateArray(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int GetDistance(ArraySegment<byte> bs1, ArraySegment<byte> bs2) | |
{ | |
if (bs1.Count != bs2.Count) throw new ArgumentException("bs1 と b2 の長さが違います。"); | |
var count = bs1.Count; | |
var distance = 0; | |
var i = 0; | |
if (Vector.IsHardwareAccelerated) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static byte[] ComputeHashQuickParallel5<TPixel>(int bits, IImageBase<TPixel> image, ArrayPool<ulong> arrayPool) | |
where TPixel : struct, IPixel<TPixel> | |
{ | |
//if (bits % 4 != 0) throw new ArgumentException(); | |
//if (image.Width % bits != 0 || image.Height % bits != 0) throw new ArgumentException(); | |
ulong[] blocks = null, medians = null; | |
try | |
{ |