forked from klusta-team/klustakwik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linalg.h
40 lines (35 loc) · 1.26 KB
/
linalg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* linalg.h
*
* Linear algebra
*
* Created on: 13 Nov 2011
* Author: dan
*/
#ifndef LINALG_H_
#define LINALG_H_
#include "numerics.h"
// Matrix which has the form of a block matrix and a nonzero diagonal
// Unmasked gives the indices corresponding to the block matrix
// Masked gives the indices corresponding to the diagonal
class BlockPlusDiagonalMatrix
{
public:
vector<scalar> Block;
vector<scalar> Diagonal;
vector<integer> *Unmasked;
vector<integer> *Masked;
integer NumUnmasked, NumMasked;
BlockPlusDiagonalMatrix(vector<integer> &_Masked, vector<integer> &_Unmasked);
void compare(scalar *Flat);
};
integer Cholesky(SafeArray<scalar> &In, SafeArray<scalar> &Out, integer D);
integer MaskedCholesky(SafeArray<scalar> &In, SafeArray<scalar> &Out, integer D, vector<integer> &Masked, vector<integer> &Unmasked);
integer BPDCholesky(BlockPlusDiagonalMatrix &In, BlockPlusDiagonalMatrix &Out);
void TriSolve(SafeArray<scalar> &M, SafeArray<scalar> &x, SafeArray<scalar> &Out, integer D);
void MaskedTriSolve(SafeArray<scalar> &M, SafeArray<scalar> &x,
SafeArray<scalar> &Out, integer D,
vector<integer> &Masked, vector<integer> &Unmasked);
void BPDTriSolve(BlockPlusDiagonalMatrix &M, SafeArray<scalar> &x,
SafeArray<scalar> &Out);
#endif /* LINALG_H_ */