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
#!/bin/python3 | |
from copy import deepcopy | |
from typing import Union | |
import asn1tools | |
def hackTemplatedType(memberDict: dict, templatedTypeDict: dict, name: str): | |
""" | |
Hack the templated type by replacing it in memberDict. |
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 <math.h> | |
#include <gtsam/geometry/Pose3.h> | |
class CustomPose3AttitudeFactor | |
: public gtsam::NoiseModelFactor1<gtsam::Pose3> { | |
protected: | |
gtsam::Point3 nZ_, bRef_; | |
public: |
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 <vector> | |
#include <boost/graph/adjacency_list.hpp> | |
#include <boost/graph/filtered_graph.hpp> | |
#include <boost/graph/graphviz.hpp> | |
#include <boost/graph/maximum_weighted_matching.hpp> | |
using namespace boost; | |
typedef property<edge_weight_t, float, property<edge_index_t, uint64_t> > |
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
function f = himmelblau(x) | |
%*****************************************************************************80 | |
% | |
%% HIMMELBLAU computes the Himmelblau function. | |
% | |
% Discussion: | |
% | |
% This function has 4 global minima: |
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
# imports | |
import pygame | |
import sys | |
import random | |
from pygame.locals import * | |
# setting display variables | |
WINDOWWIDTH = 600 # the width of the game window | |
WINDOWHEIGHT = WINDOWWIDTH # the height of the game window | |
GAPSIZE = 0 # gap size between boxes |
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
function [minx, minf, iter, funev] = bfgs(ffunc, gfunc, n, x0, epsfun, epsgrad, epsx, maxiter, maxfun) | |
% | |
% ******************* | |
% * MANDATORY INPUT * | |
% ******************* | |
% ffunc : A string indicating the function evaluation file. For example, | |
% if the file name is 'fMyFunction.m', then ffunc should be | |
% 'fMyFunction'. | |
% gfunc : A string indicating the gradient evaluation file. For example, | |
% if the file name is 'gadient.m', then gfunc should be |
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
function [S, count] = adaptive_simpson(f, a, b, epsilon, level, level_max) | |
% Evaluates the integral of f using Adaptive Simpson | |
% over [a, b] such that 1 / 15 * abs(S^(2) - S^(1)) < e. | |
count = 1; | |
level = level + 1; | |
h = b - a; | |
c = (a + b) / 2; | |
f_a = f(a); | |
f_c = f(c); | |
f_b = f(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
function stock = get_yahoo_stockdata3(ticker,d1,d2,freq) | |
% Updated from v3 when in May 2017, yahoo went and changed how stock data | |
% was shown on web pages. | |
% | |
% INPUTS: | |
% | |
% ticker <-- Yahoo ticker symbol for desired security. This can be a char | |
% string for a single stock, or data can be retrieved for | |
% multiple stocks by using a cellstr array. | |
% |
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
function [L, U, P] = lu_spp(A) | |
% [L, U, P] = lu_spp(A) computes a unit lower triangular matrix L, | |
% an upper triangular matrix U, and a permutation matrix P such that | |
% P * A = L * U. | |
% The LU factorization is computed using scaled partial pivoting. | |
% for the n x m matrix A, n == m | |
size_A = size(A); | |
if(size_A(1) ~= size_A(2)) | |
return |
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
function [L, U, P] = lu_pp(A) | |
% [L, U, P] = lu_pp(A) computes a unit lower triangular matrix L, | |
% an upper triangular matrix U, and a permutation matrix P such that | |
% P * A = L * U. | |
% The LU factorization is computed using partial pivoting. | |
% for the n x m matrix A, n == m | |
size_A = size(A); | |
if(size_A(1) ~= size_A(2)) | |
return |
NewerOlder