Skip to content

Instantly share code, notes, and snippets.

View komasaru's full-sized avatar

mk-mode komasaru

View GitHub Profile
@komasaru
komasaru / calc.cpp
Last active July 31, 2020 01:13
C++ source code to calculate a simple regression curve(2d).
#include "calc.hpp"
#include <iostream>
#include <sstream>
#include <vector>
/**
* @brief 単回帰曲線(2次)の計算
*
* @param[ref] a (double)
@komasaru
komasaru / calc.cpp
Last active May 19, 2020 02:08
C++ source code to calculate a simple linear regression line.
#include "calc.hpp"
#include <iostream>
#include <sstream>
#include <vector>
/**
* @brief 単回帰直線の計算
*
* @param[ref] 切片 a (double)
@komasaru
komasaru / csv.cpp
Created March 7, 2020 04:50
C++ source code to read csv data(v2).
#include "csv.hpp"
#include <iostream>
#include <string>
#include <vector>
// getline: 1行取得し、必要に応じて伸張
int Csv::getline(std::string& str) {
char c;
@komasaru
komasaru / inverse_matrix.f95
Created February 5, 2020 02:50
Fortran 95 source code to calculate an inverse matrix by cofactor matrix.
!****************************************************
! 逆行列の計算(余因子行列)
!
! DATE AUTHOR VERSION
! 2019.12.24 mk-mode.com 1.00 新規作成
!
! Copyright(C) 2013 mk-mode.com All Rights Reserved.
!****************************************************
!
module const
@komasaru
komasaru / determinant.f95
Created February 5, 2020 02:29
Fortran 95 source code to calculate a determinant by cofactor expansion.
!****************************************************
! 行列式の計算(余因子展開)
!
! DATE AUTHOR VERSION
! 2019.12.23 mk-mode.com 1.00 新規作成
!
! Copyright(C) 2013 mk-mode.com All Rights Reserved.
!****************************************************
!
module const
@komasaru
komasaru / test_inverse_matrix.rb
Created February 4, 2020 05:01
Ruby script to calculate an inverse matrix by cofactor matrix.
#! /usr/local/bin/ruby
#***************************************************************
# Ruby script to calculate an inverse matrix by cofactor matrix.
#***************************************************************
#
class TestInverseMatrix
#MTX = [
# [2]
#]
#MTX = [
@komasaru
komasaru / test_determinant.rb
Created February 4, 2020 04:45
Ruby script to calculate a determinant by cofactor expansion.
#! /usr/local/bin/ruby
#**************************************************************
# Ruby script to calculate a determinant by cofactor expansion.
#**************************************************************
#
class TestDeterminant
#MTX = [
# [1]
#]
#MTX = [
@komasaru
komasaru / adjusted_coefficient_of_determination.f95
Created February 2, 2020 02:07
Fortran 95 source code to calculate an adjusted coefficent of determination for multiple regression.
!****************************************************
! 重回帰分析(説明変数2個)決定係数計算
!
! DATE AUTHOR VERSION
! 2019.12.18 mk-mode.com 1.00 新規作成
!
! Copyright(C) 2019 mk-mode.com All Rights Reserved.
!****************************************************
!
module const
@komasaru
komasaru / adjusted_coefficient_of_determination.rb
Created February 2, 2020 01:55
Ruby script to calculate an adjusted coefficient of determination.
#! /usr/local/bin/ruby
#*******************************************************************
# Ruby script to calculate an adjusted coefficient of determination.
#*******************************************************************
#
class AdjustedCoefficientOfDetermination
# 説明変数と目的変数
X = [
[17.5, 17.0, 18.5, 16.0, 19.0, 19.5, 16.0, 18.0, 19.0, 19.5],
[30 , 25 , 20 , 30 , 45 , 35 , 25 , 35 , 35 , 40 ]
@komasaru
komasaru / regression_multi_3e.f95
Created January 31, 2020 02:15
Fortran 95 source code to compute multiple regression equations.(3 explanatory variables)
!****************************************************
! 重回帰式計算(説明(独立)変数3個限定)
!
! date name version
! 2019.12.08 mk-mode.com 1.00 新規作成
!
! Copyright(C) 2019 mk-mode.com All Rights Reserved.
!****************************************************
!
module const