This file contains 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
val array = Array.ofDim[Int](2, 3) | |
println(array.deep) | |
/* Output | |
Array(Array(0, 0, 0), Array(0, 0, 0)) | |
*/ |
This file contains 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 <iostream> | |
#include <boost/version.hpp> | |
using namespace std; | |
int main() | |
{ | |
cout << ( BOOST_VERSION / 100000 ) << "." << ( BOOST_VERSION / 100 % 1000 ) << "." << BOOST_VERSION % 100; | |
} |
This file contains 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 <ilcplex/ilocplex.h> | |
#include <iostream> | |
#include <cstdlib> | |
#include <ctime> | |
using namespace std; | |
const int num_of_threads = 1; | |
int main () { |
This file contains 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
libraryDependencies += "org.apache.commons" % "commons-math3" % "3.2" |
This file contains 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
# coding: utf-8 | |
import time | |
def fib(n): | |
nums = [] | |
a, b = 1, 1 | |
# while b <= n: | |
while len(nums) <= n: | |
a, b = b, a+b |
This file contains 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
# -*- coding: utf-8 -*- | |
# date: 2015/05/28 | |
# author: @taki__taki__ | |
# packages | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# direction (N=0, E=1, S=2, W=3) | |
class Direction(object): |
This file contains 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
# -*- coding: utf-8 -*- | |
# author: @taki__taki__ | |
# date: 30/06/2015 | |
from random import random | |
from math import exp | |
class SA(object): | |
# function | |
def f(self, x): |
This file contains 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
# -*- coding: utf-8 -*- | |
# author: @cocomoff | |
# date: 30/06/2015 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
if __name__ == '__main__': | |
x = np.arange(-50, 50, 1, dtype='float') | |
z = x / 10.0 |
This file contains 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
R = 6371000 # Radius of the Earth | |
S1 = Point(35.18028,136.90667) # Nagoya | |
S2 = Point(35.68944,139.69167) # Tokyo | |
# ground distance | |
function dG(Si::Point, Sj::Point) | |
φi, λi = deg2rad(Si.φ), deg2rad(Si.λ) | |
φj, λj = deg2rad(Sj.φ), deg2rad(Sj.λ) | |
v1 = sin( (φj - φi) / 2 ) | |
v2 = sin( (λj - λi) / 2 ) |
This file contains 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
# example: http://www.fujilab.dnj.ynu.ac.jp/lecture/system2.pdf | |
using JuMP | |
using Clp | |
m = Model(solver = ClpSolver()) | |
@variable(m, 0 <= x1 <= Inf) | |
@variable(m, 0 <= x2 <= Inf) | |
# 目的関数 |
OlderNewer