a simple class for continued fractions introduced
This commit is contained in:
		
							parent
							
								
									c6356c0c76
								
							
						
					
					
						commit
						5544ea4ee7
					
				@ -1,6 +1,6 @@
 | 
				
			|||||||
lib_LTLIBRARIES = libla.la
 | 
					lib_LTLIBRARIES = libla.la
 | 
				
			||||||
include_HEADERS = simple.h vecmat3.h quaternion.h fortran.h cuda_la.h auxstorage.h  davidson.h   laerror.h    mat.h          qsort.h             vec.h bisection.h   diis.h       la.h         noncblas.h     smat.h bitvector.h   fourindex.h  la_traits.h  nonclass.h     sparsemat.h sparsesmat.h csrmat.h conjgrad.h    gmres.h      matexp.h     permutation.h   polynomial.h
 | 
					include_HEADERS = simple.h vecmat3.h quaternion.h fortran.h cuda_la.h auxstorage.h  davidson.h   laerror.h    mat.h          qsort.h             vec.h bisection.h   diis.h       la.h         noncblas.h     smat.h bitvector.h   fourindex.h  la_traits.h  nonclass.h     sparsemat.h sparsesmat.h csrmat.h conjgrad.h    gmres.h      matexp.h     permutation.h   polynomial.h contfrac.h
 | 
				
			||||||
libla_la_SOURCES = simple.cc quaternion.cc vecmat3.cc vec.cc mat.cc smat.cc sparsemat.cc sparsesmat.cc csrmat.cc laerror.cc noncblas.cc  bitvector.cc strassen.cc nonclass.cc cuda_la.cc fourindex.cc permutation.cc polynomial.cc
 | 
					libla_la_SOURCES = simple.cc quaternion.cc vecmat3.cc vec.cc mat.cc smat.cc sparsemat.cc sparsesmat.cc csrmat.cc laerror.cc noncblas.cc  bitvector.cc strassen.cc nonclass.cc cuda_la.cc fourindex.cc permutation.cc polynomial.cc contfrac.cc
 | 
				
			||||||
check_PROGRAMS = t test
 | 
					check_PROGRAMS = t test
 | 
				
			||||||
t_SOURCES = t.cc t2.cc 
 | 
					t_SOURCES = t.cc t2.cc 
 | 
				
			||||||
test_SOURCES = test.cc
 | 
					test_SOURCES = test.cc
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										43
									
								
								contfrac.cc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								contfrac.cc
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,43 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					    LA: linear algebra C++ interface library
 | 
				
			||||||
 | 
					    Copyright (C) 2022 Jiri Pittner <jiri.pittner@jh-inst.cas.cz> or <jiri@pittnerovi.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    This program is free software: you can redistribute it and/or modify
 | 
				
			||||||
 | 
					    it under the terms of the GNU General Public License as published by
 | 
				
			||||||
 | 
					    the Free Software Foundation, either version 3 of the License, or
 | 
				
			||||||
 | 
					    (at your option) any later version.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					    GNU General Public License for more details.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "contfrac.h"
 | 
				
			||||||
 | 
					#include <stdio.h>
 | 
				
			||||||
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					#include <math.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace LA {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/***************************************************************************//**
 | 
				
			||||||
 | 
					 * forced instantization in the corresponding object file
 | 
				
			||||||
 | 
					 ******************************************************************************/
 | 
				
			||||||
 | 
					template class ContFrac<int>;
 | 
				
			||||||
 | 
					template class ContFrac<unsigned int>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define INSTANTIZE(T) \
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					INSTANTIZE(int)
 | 
				
			||||||
 | 
					INSTANTIZE(unsigned int)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}//namespace
 | 
				
			||||||
							
								
								
									
										45
									
								
								contfrac.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								contfrac.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,45 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					    LA: linear algebra C++ interface library
 | 
				
			||||||
 | 
					    Copyright (C) 2022 Jiri Pittner <jiri.pittner@jh-inst.cas.cz> or <jiri@pittnerovi.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    This program is free software: you can redistribute it and/or modify
 | 
				
			||||||
 | 
					    it under the terms of the GNU General Public License as published by
 | 
				
			||||||
 | 
					    the Free Software Foundation, either version 3 of the License, or
 | 
				
			||||||
 | 
					    (at your option) any later version.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    This program is distributed in the hope that it will be useful,
 | 
				
			||||||
 | 
					    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
				
			||||||
 | 
					    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
				
			||||||
 | 
					    GNU General Public License for more details.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    You should have received a copy of the GNU General Public License
 | 
				
			||||||
 | 
					    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef _CONTFRAC_H
 | 
				
			||||||
 | 
					#define _CONTFRAC_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "la_traits.h"
 | 
				
			||||||
 | 
					#include "vec.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace LA {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					template <typename T>
 | 
				
			||||||
 | 
					class ContFrac : public NRVec<T> {
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
						ContFrac():  NRVec<T>() {};
 | 
				
			||||||
 | 
						template<int SIZE>  ContFrac(const T (&a)[SIZE]) : NRVec<T>(a) {};
 | 
				
			||||||
 | 
						ContFrac(const NRVec<T> &v) : NRVec<T>(v) {}; //allow implicit conversion from NRVec
 | 
				
			||||||
 | 
						ContFrac(const int n) : NRVec<T>(n+1) {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int length() const {return NRVec<T>::size()-1;};
 | 
				
			||||||
 | 
						void resize(const int n, const bool preserve=true) {NRVec<T>::resize(n+1,preserve);}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}//namespace
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										1
									
								
								la.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								la.h
									
									
									
									
									
								
							@ -42,6 +42,7 @@
 | 
				
			|||||||
#include "csrmat.h"
 | 
					#include "csrmat.h"
 | 
				
			||||||
#include "vec.h"
 | 
					#include "vec.h"
 | 
				
			||||||
#include "polynomial.h"
 | 
					#include "polynomial.h"
 | 
				
			||||||
 | 
					#include "contfrac.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
using namespace LA;
 | 
					using namespace LA;
 | 
				
			||||||
typedef NRMat<int> NRIMat;
 | 
					typedef NRMat<int> NRIMat;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user