Skip to content

Instantly share code, notes, and snippets.

View tesch1's full-sized avatar

Michael Tesch tesch1

View GitHub Profile
@tesch1
tesch1 / circ_shift.h
Created December 13, 2018 16:27
Eigen circShift and fftshift and ifftshift
// circ_shift.h
// https://stackoverflow.com/questions/46077242/eigen-modifyable-custom-expression/46301503#46301503
// this file implements circShift, fftshift, and ifftshift for Eigen vectors/matrices.
//
#pragma once
#include <Eigen/Core>
template <bool B> using bool_constant = std::integral_constant<bool, B>;
@tesch1
tesch1 / octout.cpp
Last active October 22, 2018 13:36
ouput Eigen matrices in matlab / octave compatible format
/*
* this stuff can go in a header to make std::complex<> available
*/
/* compile:
clang++ -std=c++11 test3.cpp -I eigen/ -DEIGEN_TOO
*/
typedef double real_t;
#include <iostream>
#include <complex>
@tesch1
tesch1 / mtcombvec.m
Created June 27, 2018 11:37
an implementation of combvec that anyone can use, ie for octave or missing nnet
function c = mtcombvec(varargin)
% my own implementation of combvec for use in octave or without matlab nnet library
%
% takes args of column-vectors, produces all combinations thereof
%
% copyright (c) 2018 Michael Tesch, tesch1@gmail.com
% released under the Apache 2.0 Open Source license.
if length(varargin)==0
@tesch1
tesch1 / texlive17.spec.sh
Last active December 18, 2019 17:55
creates fake rpm for centos/fedora that "provides" all known texlive packages, so other packages cooperate with a local texlive install
#/bin/bash
set -e
SPECFILE=texlive17.spec
cat << EOF > "$SPECFILE"
Name: texlive-FAKE
Version: 2017
Release: 4%{?dist}
Summary: Dummy wrapper for manual texlive install
License: Artistic 2.0 and GPLv2 and GPLv2+ and LGPLv2+ and LPPL and MIT and Public Domain and UCD and Utopia
@tesch1
tesch1 / gist:0c03e43885cd66eceabe
Last active August 29, 2015 14:08
matrix exponentiation function for armadillo - calculate the matrix exponential exp(A) in matlab/octave: expm(A)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Reference:
//
// Cleve Moler, Charles VanLoan,
// Nineteen Dubious Ways to Compute the Exponential of a Matrix,
// Twenty-Five Years Later,
// SIAM Review,