Commit 4fd1b451 authored by Syl's avatar Syl
Browse files

Fixed testesti

parents 95c0c65b 516d8d99
......@@ -11,17 +11,24 @@ try:
except AttributeError:
numpy_include = numpy.get_numpy_include()
print( sys.argv)
if '--disable-openmp' in sys.argv:
if '--icc' in sys.argv:
USE_ICC = True
USE_ICC = False
libs = ['m']
use_icc = True if '--icc' in sys.argv else False
extra = ['-std=c99']
if use_icc:
extra = ['-std=gnu99']
libs += ['gomp', 'iomp5']
extra += ['-openmp']
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/* #include <chealpix.h> */
......@@ -12,8 +12,8 @@ import healpy as hp
import math
from scipy import special
from simulation import extrapolpixwin
from xqml_utils import getstokes, progress_bar
from .simulation import extrapolpixwin
from .xqml_utils import getstokes, progress_bar
import _libcov as clibcov
......@@ -18,14 +18,14 @@ import random as rd
from xqml_utils import getstokes, pd_inv
from estimators import El
from estimators import CovAB
from estimators import CrossGisherMatrix
from estimators import CrossWindowFunction
from estimators import yQuadEstimator, ClQuadEstimator
from estimators import biasQuadEstimator
from libcov import compute_ds_dcb, S_bins_MC, compute_S, covth_bins_MC, compute_PlS, SignalCovMatrix
from .estimators import El
from .estimators import CovAB
from .estimators import CrossGisherMatrix
from .estimators import CrossWindowFunction
from .estimators import yQuadEstimator, ClQuadEstimator
from .estimators import biasQuadEstimator
from .libcov import compute_ds_dcb, S_bins_MC, compute_S, covth_bins_MC, compute_PlS, SignalCovMatrix
__all__ = ['xQML']
......@@ -368,3 +368,55 @@ def IsInvertible(F):
# P *= binsnorm
# return P, Q, ell, ellval
class Sym(np.ndarray):
# wrapper class for numpy array for symmetric matrices. New attribute can pack matrix to optimize storage.
# Usage:
# If you have a symmetric matrix A as a shape (n,n) numpy ndarray, Sym(A).packed is a shape (n(n+1)/2,) numpy array
# that is a packed version of A. To convert it back, just wrap the flat list in Sym(). Note that Sym(Sym(A).packed)
def __new__(cls, input_array):
obj = np.asarray(input_array).view(cls)
if len(obj.shape) == 1:
l = obj.copy()
p = obj.copy()
m = int((np.sqrt(8 * len(obj) + 1) - 1) / 2)
sqrt_m = np.sqrt(m)
if np.isclose(sqrt_m, np.round(sqrt_m)):
A = np.zeros((m, m))
for i in range(m):
A[i, i:] = l[:(m-i)]
A[i:, i] = l[:(m-i)]
l = l[(m-i):]
obj = np.asarray(A).view(cls)
obj.packed = p
raise ValueError('One dimensional input length must be a triangular number.')
elif len(obj.shape) == 2:
if obj.shape[0] != obj.shape[1]:
raise ValueError('Two dimensional input must be a square matrix.')
packed_out = []
for i in range(obj.shape[0]):
packed_out.append(obj[i, i:])
obj.packed = np.concatenate(packed_out)
raise ValueError('Input array must be 1 or 2 dimensional.')
return obj
def __array_finalize__(self, obj):
if obj is None: return
self.packed = getattr(obj, 'packed', None)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment