Skip to main content

UNKNOWN

Project description

Python and C++ implementation of the generalized Rybicki Press algorithm for solving matrices of the form:

K_{ij} = sum_p a_p exp(-b_p |t_i - t_j|)

The method was developed by Sivaram Ambikasaran and you must cite his paper if you use this code in your work.

This interface allows complex bs and the parameters are specified as log-amplitudes, log-Q-factors, and frequencies. A frequency can be set to None if it is meant to be non-periodic.

A simple benchmark shows that this scales as O(N):

import time
import numpy as np
import matplotlib.pyplot as pl

from ess import GRPSolver

solver = GRPSolver(
    np.log([10.0, 5.0]),  # log-amplitudes
    np.log([0.1, 10.0]),  # log-Q-factors
    [None, 50.0],         # frequencies
)

N = 2**np.arange(5, 20)
times = np.empty((len(N), 3))

t = np.random.rand(np.max(N))
yerr = np.random.uniform(0.1, 0.2, len(t))
b = np.random.randn(len(t))

for i, n in enumerate(N):
    strt = time.time()
    solver.compute(t[:n], yerr[:n])
    times[i, 0] = time.time() - strt

    strt = time.time()
    solver.log_determinant
    times[i, 1] = time.time() - strt

    strt = time.time()
    solver.apply_inverse(b[:n])
    times[i, 2] = time.time() - strt
https://raw.github.com/dfm/ess/master/python/demo.png

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

genrp-0.0.1.dev1.tar.gz (70.9 kB view details)

Uploaded Source

File details

Details for the file genrp-0.0.1.dev1.tar.gz.

File metadata

  • Download URL: genrp-0.0.1.dev1.tar.gz
  • Upload date:
  • Size: 70.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for genrp-0.0.1.dev1.tar.gz
Algorithm Hash digest
SHA256 9e709181d574a12a35a42f18d19d5c69c8be71b8190074f767e2ec67f4c267dd
MD5 4c423e9b267534f8eb0c4d5061fc0df4
BLAKE2b-256 b869d62d60541de1a823e41523b3708f772ee2e92faea784f7de2e07a432907b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page