libpspm
BandMatrix Class Reference

#include <cubic_spline.h>

Collaboration diagram for BandMatrix:
[legend]

Public Member Functions

 BandMatrix (int size)
 
 BandMatrix (std::vector< Float > _lower, std::vector< Float > _diag, std::vector< Float > _upper)
 
void print ()
 
void solve (std::vector< Float > &y)
 

Public Attributes

int N
 
std::vector< Floatupper
 
std::vector< Floatdiag
 
std::vector< Floatlower
 

Detailed Description

Definition at line 313 of file cubic_spline.h.

Constructor & Destructor Documentation

◆ BandMatrix() [1/2]

BandMatrix::BandMatrix ( int  size)
inline

Definition at line 321 of file cubic_spline.h.

321  {
322  N = size;
323  upper.resize(N);
324  lower.resize(N);
325  diag.resize(N);
326  }
std::vector< Float > upper
Definition: cubic_spline.h:317
std::vector< Float > lower
Definition: cubic_spline.h:319
std::vector< Float > diag
Definition: cubic_spline.h:318

◆ BandMatrix() [2/2]

BandMatrix::BandMatrix ( std::vector< Float _lower,
std::vector< Float _diag,
std::vector< Float _upper 
)
inline

Definition at line 328 of file cubic_spline.h.

328  {
329  N = _upper.size();
330  upper = _upper;
331  lower = _lower;
332  diag = _diag;
333  }
std::vector< Float > upper
Definition: cubic_spline.h:317
std::vector< Float > lower
Definition: cubic_spline.h:319
std::vector< Float > diag
Definition: cubic_spline.h:318

Member Function Documentation

◆ print()

void BandMatrix::print ( )
inline

Definition at line 335 of file cubic_spline.h.

335  {
336  for (int i=0; i<N; ++i){
337  for (int z=0; z<i-1;++z) std::cout << 0 << "\t";
338  if (i > 0) std::cout << lower[i] << "\t";
339  std::cout << diag[i] << "\t";
340  if (i < N-1) std::cout << upper[i] << "\t";
341  for (int z=i+2; z<N; ++z) std::cout << 0 << "\t";
342  std::cout << "\n";
343  }
344  }
std::vector< Float > upper
Definition: cubic_spline.h:317
std::vector< Float > lower
Definition: cubic_spline.h:319
std::vector< Float > diag
Definition: cubic_spline.h:318

◆ solve()

void BandMatrix::solve ( std::vector< Float > &  y)
inline

Definition at line 346 of file cubic_spline.h.

346  {
347  thomas_solve(lower.data(), diag.data(), upper.data(), y.data(), N);
348  }
std::vector< Float > upper
Definition: cubic_spline.h:317
void thomas_solve(double *a, double *b, double *c, double *d, int n)
Definition: cubic_spline.h:35
std::vector< Float > lower
Definition: cubic_spline.h:319
std::vector< Float > diag
Definition: cubic_spline.h:318
Here is the call graph for this function:

Member Data Documentation

◆ diag

std::vector<Float> BandMatrix::diag

Definition at line 318 of file cubic_spline.h.

◆ lower

std::vector<Float> BandMatrix::lower

Definition at line 319 of file cubic_spline.h.

◆ N

int BandMatrix::N

Definition at line 315 of file cubic_spline.h.

◆ upper

std::vector<Float> BandMatrix::upper

Definition at line 317 of file cubic_spline.h.


The documentation for this class was generated from the following file: