Skip to content

Instantly share code, notes, and snippets.

View lorenzoriano's full-sized avatar

Lorenzo Riano lorenzoriano

  • Industrial Next
  • San Francisco
View GitHub Profile
@lorenzoriano
lorenzoriano / timer.h
Last active December 16, 2015 08:29
C++ class for accurate time measurement
#ifndef TIMER_H
#define TIMER_H
#include <ctime>
//link with rt (-lrt)
class timer {
public:
timer() {
import numpy as np,numpy.linalg
def _getAplus(A):
eigval, eigvec = np.linalg.eig(A)
Q = np.matrix(eigvec)
xdiag = np.matrix(np.diag(np.maximum(eigval, 0)))
return Q*xdiag*Q.T
def _getPs(A, W=None):
W05 = np.matrix(W**.5)
import inspect
import sys
import os
class DebugPrint(object):
def __init__(self, f):
self.f = f
def write(self, text):
import numpy as n
import scipy.interpolate
import scipy.ndimage
def congrid(a, newdims, method='linear', centre=False, minusone=False):
'''Arbitrary resampling of source array to new dimension sizes.
Currently only supports maintaining the same number of dimensions.
To use 1-D arrays, first promote them to shape (x,1).
Uses the same parameters and creates the same co-ordinate lookup points
@lorenzoriano
lorenzoriano / ros_get_paths.py
Created May 21, 2012 23:33
Get Paths Script
#!/usr/bin/env python
import sys
rospkgs = sys.argv[1:]
import roslib
for rospkg in rospkgs:
roslib.load_manifest(rospkg)
paths = [path for path in sys.path if not path.startswith('/usr')]
#create a set to remove repetitions