Skip to content

Instantly share code, notes, and snippets.

View lambday's full-sized avatar

Soumyajit De lambday

  • Meta
  • London
  • 13:16 (UTC)
View GitHub Profile
# Tag public
template <typename T>
class Tag
{
public:
// registers tag in object
Tag(SGObject* object, const char* name);
};
@debasishg
debasishg / gist:d9b6d984df3cc4681eb1
Last active November 23, 2022 06:26
Useful links on Convex Optimization
from pylab import *
from shogun.Mathematics import LogDetEstimator
from shogun.Mathematics import ProbingSampler
from shogun.Library import SerialComputationEngine
from shogun.Mathematics import LogRationalApproximationCGM
from shogun.Mathematics import RealSparseMatrixOperator
from shogun.Mathematics import LanczosEigenSolver
from shogun.Mathematics import CCGMShiftedFamilySolver
from shogun.Mathematics import Statistics
anonymous
anonymous / gist:6381240
Created August 29, 2013 17:53
from pylab import *
from shogun.Mathematics import LogDetEstimator
from shogun.Mathematics import ProbingSampler
from shogun.Library import SerialComputationEngine
from shogun.Mathematics import LogRationalApproximationCGM
from shogun.Mathematics import RealSparseMatrixOperator
from shogun.Mathematics import LanczosEigenSolver
from shogun.Mathematics import CCGMShiftedFamilySolver
from shogun.Mathematics import Statistics
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 2013 Soumyajit De
*/
#include <shogun/lib/common.h>
function_that_estimates_logdet
{
CSparseMatrixOperator<float64_t> *op
CSerialComputationEngine *e
CLogRationalApproximationCOCGM log_op(op, e)
// or CLogRationalApproximationIndividual log_op(op, e)
CProbingSampler *sampler
CLogDetEstimator est(log_op, e, sampler)
SGVector<float64_t> samples=est.sample(num_logdet_estimates)
}
@karlnapf
karlnapf / gist:5787975
Created June 15, 2013 12:34
probe a graph colouring
function [V,colours] = probe( colours)
%% function [V] = probe(A,p)
% Creates a probing matrix based on a graph colouring of A using the
% algorithm in "J. Tang and Y. Saad, A probing method for computing the diagonal of the matrix
% inverse" (2010).
%
% REQUIRES: Matgraph toolbox http://www.ams.jhu.edu/~ers/matgraph/
%
% Input: colours - A graph colouring (of A^p probably)
%
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 2013 Heiko Strathmann
*/
#include <shogun/lib/config.h>
@karlnapf
karlnapf / gist:5371082
Last active December 16, 2015 03:38
how to sample a Gaussian given covariance or precision with symamd
% samples from N(mu, C) in case type=='cov', and from N(mu, C^(-1)) in case
% type=='prec'. z is optional and must be drawn from N(0,I), inds is a
% permutations vector that is applied to C before sampling (doesnt effect
% the output, just efficiency, smyamd is used as default)
function sample=gaussian_sampler_symamd(mu, C, type, z, inds)
if nargin<3
type='prec';
end
if nargin <4
@jboner
jboner / latency.txt
Last active December 13, 2025 00:11
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD