Category Archives: Uncategorized

ngspice not honoring initial conditions?

This is a common gotcha! Add UIC to your .TRANS like e.g. .TRAN 1ns 100ns UIC Otherwise initial conditions will simply be ignored. See http://www.ngspice.com/spice3f5_doc/4.3.9.php

Posted in Uncategorized | Leave a comment

A csv reader based on Haskell-cassava library : performance

I implemented my own csv reader using cassava library. The reader from missingh library was taking too long (~ 17 seconds) for a file with 43200 lines. I compared the result with python-numpy and python-pandas csv reader. Below is rough … Continue reading

Posted in Haskell, Uncategorized | Tagged , , | Leave a comment

Thresholding numpy array, well sort of

Here is a test case >>> import numpy as np >>> a = np.array( [ 0.0, 1, 2, 0.2, 0.0, 0.0, 2, 3] ) I want to turn all non-zero elements of this array to 1. I can do it … Continue reading

Posted in Python, Uncategorized | Tagged , | Leave a comment

Safe level of mercury in soil, water and food

Following are verbatim from book chapter ( http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3096006/ ) . Air The World Health Organization guideline value for inorganic mercury vapor is 1 μg/m3 as an annual average.227 A tolerable concentration is 0.2 μg/m3 for long-term inhalation exposure to elemental … Continue reading

Posted in Uncategorized | Tagged | Leave a comment

Benchmark ODE solver: GSL V/s Boost Odeint library

For our neural simulator, MOOSE, we use GNU Scientific Library (GSL) for random number generation, for solving system of non-linear equations, and for solving ODE system. Recently I checked the performance of GSL ode solver V/s Boost ode solver; both … Continue reading

Posted in Biological systems, Numerical computation, Uncategorized | Tagged , , , , | Leave a comment

Multi-dimentional root fiding using Newton-Raphson method

In short, It does the same thing as GNU-gsl `gnewton` solver for finding roots of a system of non-linear system. The standard caveats apply when finding the multi-dimensional roots. https://bestw.gnu.org/software/gsl/manual/html_node/Multidimensional-Root_002dFinding.html#Multidimensional-Root_002dFinding The templated class (must be compiled with  -std=c++11). It uses … Continue reading

Posted in Uncategorized | Tagged , , , , | Leave a comment

Performance of random number generator (mersenne twister)

I compared 4 implementations of mersenne twister (mt19937, 32 bit) algorithm: C++-11 standard template library <random>, boost, GNU Scientific Library, and our own implementation for MOOSE simulator. The code is here (You can customize the code to run it on … Continue reading

Posted in Algorithms, Uncategorized | Tagged , , , , , | Leave a comment