lmm

package
v0.0.0-...-a7a5a58 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const CONTINUE = 1
View Source
const STOP = 0

Variables

This section is empty.

Functions

func AllCDot

Assumes X and Y are shares for all parties and aggregates at the end

func AllCDotBroadcast

func AllCDotBroadcast(cps *crypto.CryptoParams, mpcObj *mpc.MPC, X crypto.CipherVector, Y crypto.CipherVector) *ckks.Ciphertext

Assumes X and Y are the same for all parties

func AllCacheMul

func AllCacheMul(cps *crypto.CryptoParams, mpcObj *mpc.MPC, lazyMult LazyMultMat, X crypto.CipherMatrix, outLen int) crypto.CipherMatrix

func AllCacheMulVec

func AllCacheMulVec(cps *crypto.CryptoParams, mpcObj *mpc.MPC, lazyMult LazyMult, X crypto.CipherVector, outLen int) crypto.CipherVector

func AllocateAllResources

func AllocateAllResources(n, m int) ([]int, []int)

func CCompare

func CCompare(cryptoParams *crypto.CryptoParams, X *ckks.Ciphertext, Y *ckks.Ciphertext, op string) bool

func CMatMultConst

func CMatMultConst(cryptoParams *crypto.CryptoParams, X crypto.CipherMatrix, a float64) crypto.CipherMatrix

func CMultWithRMatBlock

func CMultWithRMatBlock(params *crypto.CryptoParams, mpcObj *mpc.MPC, cv crypto.CipherVector, rmList []mpc_core.RMat, nElemPerCtx int) []crypto.CipherVector

TODO: Instead of processing each party's multiplication sequentially do it in parallel

func CMultWithRMatBlockParallel

func CMultWithRMatBlockParallel(params *crypto.CryptoParams, mpcObj *mpc.MPC, cv crypto.CipherVector, rmList []mpc_core.RMat, nElemPerCtx int) []crypto.CipherVector

Instead of processing each party's multiplication sequentially do it in parallel by batching

func CPCompare

func CPCompare(cryptoParams *crypto.CryptoParams, X *ckks.Ciphertext, Y float64, op string) bool

func CRands

func CRands(cps *crypto.CryptoParams, n int) crypto.CipherVector

func CZeros

func CZeros(cps *crypto.CryptoParams, n int) crypto.CipherVector

func CalculateVariance

func CalculateVariance(cps *crypto.CryptoParams, mpcObj *mpc.MPC, sqScaledSum crypto.CipherVector, mean crypto.CipherVector, N int, ddof int) crypto.CipherVector

func CipherTextDivide

func CipherTextDivide(cryptoParams *crypto.CryptoParams, mpcObj *mpc.MPC, X crypto.CipherVector, Y crypto.CipherVector, n int) crypto.CipherVector

func CipherTextDivideDummy

func CipherTextDivideDummy(cryptoParams *crypto.CryptoParams, mpcObj *mpc.MPC, X *ckks.Ciphertext, Y *ckks.Ciphertext) *ckks.Ciphertext

func CipherVectorInnerProd2SS

func CipherVectorInnerProd2SS(cryptoParams *crypto.CryptoParams, mpcObj *mpc.MPC, X, Y crypto.CipherVector, nelem int) mpc_core.RElem

func CipherVectorInnerProdSS

func CipherVectorInnerProdSS(cryptoParams *crypto.CryptoParams, mpcObj *mpc.MPC, X crypto.CipherVector, nelem int) mpc_core.RElem

func CipherVectorSqrtInverse

func CipherVectorSqrtInverse(cryptoParams *crypto.CryptoParams, mpcObj *mpc.MPC, X crypto.CipherVector, n int) crypto.CipherVector

func CipherVectorSqrtInverseDummy

func CipherVectorSqrtInverseDummy(cryptoParams *crypto.CryptoParams, X crypto.CipherVector, n int) crypto.CipherVector

dummy

func ComputeEtaMask

func ComputeEtaMask(cps *crypto.CryptoParams, blockToChr []int, chr, B, R int) (crypto.CipherVector, bool)

func ConjGradSolveCipherVec

func ConjGradSolveCipherVec(cps *crypto.CryptoParams, mpcObjs *mpc.ParallelMPC, b crypto.CipherVector, b_len int, initialX crypto.CipherVector, LazyMult LazyMult, max_iter int, refresh_rate int) (crypto.CipherVector, int, bool)

make into batches?

func DummyPlaceInnerSum

func DummyPlaceInnerSum(cryptoParams *crypto.CryptoParams, X *ckks.Ciphertext) *ckks.Ciphertext

func Float64bytes

func Float64bytes(float float64) []byte

func Float64frombytes

func Float64frombytes(bytes []byte) float64

func GenerateIdentity

func GenerateIdentity(delta float64, n int) *mat.DiagDense

func GenerateOnes

func GenerateOnes(delta float64, n int, m int) *mat.Dense

func GenerateRandMatrix

func GenerateRandMatrix(r *rand.Rand, n int, m int) *mat.Dense

func GenerateRandVector

func GenerateRandVector(r *rand.Rand, n int) *mat.VecDense

func ReadFloatBin

func ReadFloatBin(filename string, nrow int, ncol int) *mat.Dense

func SumNAlongParties

func SumNAlongParties(ind int, n_per []int) int

func WriteFloatBin

func WriteFloatBin(X *mat.Dense, filename string)

Types

type ADMMParams

type ADMMParams struct {
	ATA           *mat.Dense
	ScaledX_iTZ_i *mat.Dense
	ScaledXTZAll  crypto.CipherMatrix
	Z_iTZ_iZTZinv crypto.CipherMatrix
	ScaledZTZ     crypto.CipherMatrix

	ScaledXTZCache crypto.PlainMatrix

	C int
	T int
	// contains filtered or unexported fields
}

each param is required

type ADMM_Wood

type ADMM_Wood struct {
	P int //number of parties
	C int //number of Cov
	T int
	N int

	ScaledAinv      *mat.Dense
	ScaledAinvCache gwas.PlainMatrixDiagCache

	ScaledSX_iTZ_iCache crypto.PlainMatrix
	Z_iTZ_iZTZinv       crypto.CipherMatrix
	AinvSX_iTZ_iCache   crypto.PlainMatrix
	ScaledSXTZAll       crypto.CipherMatrix

	U               crypto.CipherMatrix
	V               crypto.CipherMatrix
	ScaledGinvSSAll []mpc_core.RMat

	X          crypto.CipherVector // local
	Nu         crypto.CipherVector // diff
	Z          crypto.CipherVector // global
	XBarminusZ crypto.CipherVector
	// contains filtered or unexported fields
}

func NewADMM_Wood

func NewADMM_Wood(params *ADMMParams, block, fold int, calcGTicketsChannel chan int) *ADMM_Wood

keep XTZ seperate when multiplying

func (*ADMM_Wood) Run

func (admm *ADMM_Wood) Run(alpha float64, scale float64, initX crypto.CipherVector, num_iterations, block, fold int) crypto.CipherVector

type HorCipherMatrix

type HorCipherMatrix []crypto.CipherMatrix

type HorCipherVector

type HorCipherVector []crypto.CipherVector

type LazyMult

type LazyMult func(x crypto.CipherVector) crypto.CipherVector

type LazyMultMat

type LazyMultMat func(x crypto.CipherMatrix) crypto.CipherMatrix

type REGENIE

type REGENIE struct {
	B    int
	R    int
	Q    int
	K    int
	C    int
	N    int
	M    int
	AllN int

	NProc int

	Z_folds      []*mat.Dense
	Z_kminus     []*mat.Dense
	ZCache       []crypto.PlainMatrix
	ZkminusCache []crypto.PlainMatrix

	ScaledZTZ          crypto.CipherMatrix
	ScaledZTZinvTwice  crypto.CipherMatrix
	ScaledZTZinvSS     mpc_core.RMat
	ScaledZTZinvSqrtSS mpc_core.RMat

	ScaledXTZ          []crypto.CipherMatrix
	ScaledXTZSS        []mpc_core.RMat
	ScaledX_iTZ_i      []*mat.Dense
	ScaledX_iTZ_iCache []crypto.PlainMatrix

	Wkarr    []crypto.CipherMatrix
	WkMean   crypto.CipherVector
	WkInvSig crypto.CipherVector
	// contains filtered or unexported fields
}

func (*REGENIE) AssociationStats

func (reg *REGENIE) AssociationStats(y_hat_LOCO []HorCipherVector) []crypto.CipherVector

returns one CipherVector per block

func (*REGENIE) ComputeStdInv

func (reg *REGENIE) ComputeStdInv() *mat.Dense

func (*REGENIE) ComputeTildePhenoFolds

func (reg *REGENIE) ComputeTildePhenoFolds()

func (*REGENIE) GetBlockSizeInfo

func (reg *REGENIE) GetBlockSizeInfo(b int) (int, int)

func (*REGENIE) GetThreadParallelMPC

func (reg *REGENIE) GetThreadParallelMPC(offset, perBlock int) *mpc.ParallelMPC

func (*REGENIE) Level0

func (reg *REGENIE) Level0()

func (*REGENIE) Level1

func (reg *REGENIE) Level1() []HorCipherVector

func (*REGENIE) LoadAndProcessWkarr

func (reg *REGENIE) LoadAndProcessWkarr()

func (*REGENIE) LoadGFS

func (reg *REGENIE) LoadGFS(isStep1 bool)

func (*REGENIE) Load_Completed_YLOCO

func (reg *REGENIE) Load_Completed_YLOCO() []HorCipherVector

func (*REGENIE) MSE

func (reg *REGENIE) MSE(preds [][]crypto.CipherVector, tilde_pheno []crypto.CipherVector) []*ckks.Ciphertext

func (*REGENIE) MulXStream

func (reg *REGENIE) MulXStream(cps *crypto.CryptoParams, x crypto.CipherMatrix, fold int, block int, kminus bool, computeSquaredSum bool) (crypto.CipherMatrix, []float64)

//xXT where X is defined by a fold and a block

func (*REGENIE) MulXTStreamFold

func (reg *REGENIE) MulXTStreamFold(cps *crypto.CryptoParams, x crypto.CipherMatrix, fold int, block int, computeSquaredSum bool) (crypto.CipherMatrix, []float64)

func (*REGENIE) MulXTStreamKminus

func (reg *REGENIE) MulXTStreamKminus(cps *crypto.CryptoParams, x HorCipherMatrix, fold int, block int, computeSquaredSum bool) (crypto.CipherMatrix, []float64)

xX where X is defined by a fold and a block

func (*REGENIE) MulZCache

func (reg *REGENIE) MulZCache(cps *crypto.CryptoParams, x crypto.CipherMatrix, fold int, kminus bool) crypto.CipherMatrix

func (*REGENIE) MulZTCache

func (reg *REGENIE) MulZTCache(cps *crypto.CryptoParams, x crypto.CipherMatrix, fold int) crypto.CipherMatrix

func (*REGENIE) MultLazyCMatParallel

func (reg *REGENIE) MultLazyCMatParallel(cps *crypto.CryptoParams, mpcObjs *mpc.ParallelMPC, X crypto.CipherMatrix, Y crypto.CipherMatrix, mean, stdinv crypto.CipherVector, n int) crypto.CipherMatrix

func (*REGENIE) MultLazyCMatTParallel

func (reg *REGENIE) MultLazyCMatTParallel(cps *crypto.CryptoParams, mpcObjs *mpc.ParallelMPC, X crypto.CipherMatrix, Y crypto.CipherMatrix, mean, stdinv crypto.CipherVector, n int) crypto.CipherMatrix

n is the size of Y and X ciphervectors

func (*REGENIE) PrecomputeVals

func (reg *REGENIE) PrecomputeVals(step1 bool)

func (*REGENIE) RidgeRegressionADMMWood

func (reg *REGENIE) RidgeRegressionADMMWood(cps *crypto.CryptoParams, mpcObjs *mpc.ParallelMPC, lambdas []float64, Z_iTZ_iZTZinv crypto.CipherMatrix, ATA_k *mat.Dense, ScaledX_iTZ_i *mat.Dense, XTy crypto.CipherVector, fold, block int, calcGTicketsChannel chan int) crypto.CipherMatrix

func (*REGENIE) RidgeRegressionCGD

func (reg *REGENIE) RidgeRegressionCGD(cps *crypto.CryptoParams, mpcObj *mpc.MPC, lambdas []float64, fold, block int) crypto.CipherMatrix

DUMMY FUNCTION

func (*REGENIE) RidgeRegressionLevel1

func (reg *REGENIE) RidgeRegressionLevel1(cps *crypto.CryptoParams, mpcObjs *mpc.ParallelMPC, Wkarr []crypto.CipherMatrix, mean, stdinv, WTy crypto.CipherVector, k int, lambdas []float64) crypto.CipherMatrix

func (*REGENIE) RunLevel0OnSpecificBlocks

func (reg *REGENIE) RunLevel0OnSpecificBlocks(spec map[int][]int)

func (*REGENIE) RunREGENIE

func (reg *REGENIE) RunREGENIE()

func (*REGENIE) RunStep1

func (reg *REGENIE) RunStep1() []HorCipherVector

func (*REGENIE) RunStep2

func (reg *REGENIE) RunStep2(yLOCO []HorCipherVector)

func (*REGENIE) SaveMatDenseToFile

func (reg *REGENIE) SaveMatDenseToFile(x *mat.Dense, fname string, k, b int)

func (*REGENIE) XtildeMulStream

func (reg *REGENIE) XtildeMulStream(cps *crypto.CryptoParams, mpcObj *mpc.MPC, x crypto.CipherMatrix, fold int, block int, kminus bool) crypto.CipherMatrix

func (*REGENIE) XtildeMulVecStream

func (reg *REGENIE) XtildeMulVecStream(cps *crypto.CryptoParams, mpcObj *mpc.MPC, x crypto.CipherVector, fold int, block int, kminus bool) crypto.CipherVector

func (*REGENIE) XtildeTMulStreamLocal

func (reg *REGENIE) XtildeTMulStreamLocal(cps *crypto.CryptoParams, mpcObj *mpc.MPC, x crypto.CipherMatrix, fold, block int) crypto.CipherMatrix

func (*REGENIE) XtildeTMulVecStreamLocal

func (reg *REGENIE) XtildeTMulVecStreamLocal(cps *crypto.CryptoParams, mpcObj *mpc.MPC, x crypto.CipherVector, fold, block int) crypto.CipherVector

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL