Skip to content

Instantly share code, notes, and snippets.

View rmcgibbo's full-sized avatar

Robert T. McGibbon rmcgibbo

View GitHub Profile
@rmcgibbo
rmcgibbo / bfgs_only_fprime.cpp
Last active August 12, 2017 03:42
BFGS optimization with only information about the function gradient (no knowledge of the function value). I've coded it in C++ (boost uBLAS) and python (numpy). Most of the code is copied directly from scipy.optimize._minimize_bfgs, with only minor modifications.
/* Copyright (c) 2013, SciPy Developers, Robert McGibbon
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
@rmcgibbo
rmcgibbo / install.md
Last active October 14, 2021 00:17
Scientific Python From Source, with MKL

Scientific Python From Source

This document will walk you through compiling your own scientific python distribution from source, without sudo, on a linux machine. The core numpy and scipy libraries will be linked against Intel MKL for maximum performance.

This procedure has been tested with Rocks Cluster Linux 6.0 (Mamba) and CentOS 6.3.

Compiling Python From Source

@rmcgibbo
rmcgibbo / proposal.md
Last active July 3, 2017 13:24
IPython Tab Completion

Proposal

Abstract

The IPython tab completion machinery is messy, complicated, and difficult to extend. The IPython pull request 2701, for instance, envisioned a feature -- tab completion based on function-specific annotations -- which, because of the current sub-optimal completion API, required a quite a bit of hacking into the core completer logic to execute. This proposal envisions a refactoring of the IPython tab completion machinery -- largely IPython/core/completer.py, IPython/core/completerlib.py, and a little bit of IPython/core/interactiveshell.py -- in a way that simplifies and unifies the codebase while providing a powerful and flexible public-facing API, enabling its extensibility in 3rd party projects.

History of the Tab Completion Machinery

  • Started closely tied to GNU readline, and to the stdlib's rlcompleter.py module
  • Hacked to be able to work with non-readline frontends, like the notebook and qtconsole.
@rmcgibbo
rmcgibbo / roothan.ipynb
Last active December 14, 2015 01:39
Roothan-Hall MSM (Noe)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rmcgibbo
rmcgibbo / mpiutils.py
Created March 15, 2013 20:04
Context manager for mpi4py that selectively executes its body on the root node
import sys
import inspect
def mpi_rank(comm=None):
"""Get the rank of the curent MPI node
Parameters
----------
comm : mpi communicator, optional
The MPI communicator. By default, we use the COMM_WORLD
##########################################################################
# this script was generated by openmm-builder. to customize it further,
# you can save the file to disk and edit it with your favorite editor.
##########################################################################
from __future__ import print_function
from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from sys import stdout
##########################################################################
# this script was generated by openmm-builder. to customize it further,
# you can save the file to disk and edit it with your favorite editor.
##########################################################################
from __future__ import print_function
from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from sys import stdout
##########################################################################
# this script was generated by openmm-builder. to customize it further,
# you can save the file to disk and edit it with your favorite editor.
##########################################################################
from __future__ import print_function
from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from sys import stdout
##########################################################################
# this script was generated by openmm-builder. to customize it further,
# you can save the file to disk and edit it with your favorite editor.
##########################################################################
from __future__ import print_function
from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from sys import stdout
##########################################################################
# this script was generated by openmm-builder. to customize it further,
# you can save the file to disk and edit it with your favorite editor.
##########################################################################
from __future__ import print_function
from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from sys import stdout