Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# cogent.maths.matrix_logarithm.logm

All Samples(14)  |  Call(6)  |  Derive(0)  |  Import(8)

ModelRnaSequence
from operator import add, sub, mul, div
from cogent.maths.matrix_logarithm import logm
from cogent.maths.stats.util import FreqsI
from cogent.maths.matrix_exponentiation import FastExponentiator as expm
def toRates(self, normalize=False):
"""Returns rate matrix. Does not normalize by default."""
return Rates(logm(self._data), self.Alphabet, self.Name, normalize)

def random(cls, Alphabet, diags=None):

ModelRnaSequence
from operator import add, sub, mul, div
from cogent.maths.matrix_logarithm import logm
from cogent.maths.stats.util import FreqsI
from cogent.maths.matrix_exponentiation import FastExponentiator as expm
def toRates(self, normalize=False):
"""Returns rate matrix. Does not normalize by default."""
return Rates(logm(self._data), self.Alphabet, self.Name, normalize)

def random(cls, Alphabet, diags=None):

from cogent.maths.stats.test import std # numpy.std is biased
from cogent.maths.matrix_exponentiation import FastExponentiator as expm
from cogent.maths.matrix_logarithm import logm
#note: corrcoef and cov assume rows are observations, cols are variables
from numpy import log, newaxis as NewAxis, array, zeros, product, sqrt, ravel,\

from cogent.maths.stats.test import std # numpy.std is biased
from cogent.maths.matrix_exponentiation import FastExponentiator as expm
from cogent.maths.matrix_logarithm import logm
#note: corrcoef and cov assume rows are observations, cols are variables
from numpy import log, newaxis as NewAxis, array, zeros, product, sqrt, ravel,\

#!/usr/bin/env python
"""Unit tests for matrix logarithm."""
from numpy import array
from cogent.util.unit_test import TestCase, main
from cogent.maths.matrix_logarithm import logm, logm_taylor
[ 0.23022035,  0.22306947,  0.06995306,  0.47675713]])

q = logm(p)
self.assertFloatEqual(q, \
array([[-0.15572053,  0.04947485,  0.01918653,  0.08705915],
def test_logm_taylor(self):
"""logm_taylor should return same result as logm"""
q_eig = logm([[ 0.86758487,  0.05575623,  0.0196798 ,  0.0569791 ],
[ 0.01827347,  0.93312148,  0.02109664,  0.02750842],
[ 0.04782582,  0.1375742 ,  0.80046869,  0.01413129],

#!/usr/bin/env python
"""Unit tests for matrix logarithm."""
from numpy import array
from cogent.util.unit_test import TestCase, main
from cogent.maths.matrix_logarithm import logm, logm_taylor
[ 0.23022035,  0.22306947,  0.06995306,  0.47675713]])

q = logm(p)
self.assertFloatEqual(q, \
array([[-0.15572053,  0.04947485,  0.01918653,  0.08705915],
def test_logm_taylor(self):
"""logm_taylor should return same result as logm"""
q_eig = logm([[ 0.86758487,  0.05575623,  0.0196798 ,  0.0569791 ],
[ 0.01827347,  0.93312148,  0.02109664,  0.02750842],
[ 0.04782582,  0.1375742 ,  0.80046869,  0.01413129],

from numpy import average, asarray, sqrt, identity, diagonal, trace, \
array, sum
from cogent.maths.matrix_logarithm import logm
from cogent.maths.matrix_exponentiation import FastExponentiator as expm