more documentation + clean up
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Christian Zimmermann 2024-02-03 22:02:01 +01:00
parent 5eff4cfe3f
commit c478bf0fae
65 changed files with 544 additions and 334 deletions

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file bin/config.cc
@brief Program for printing cnorxz configurations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include <cstdlib>
#include <iostream>

View file

@ -2,10 +2,9 @@
/**
@file include/array/array.cc.h
@brief ...
@brief Array main header for template implementations.
Copyright (c) 2022 Christian Zimmermann. All rights reserved.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/

View file

@ -2,10 +2,9 @@
/**
@file include/array/array.h
@brief ...
@brief Array main header.
Copyright (c) 2022 Christian Zimmermann. All rights reserved.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/

View file

@ -2,11 +2,11 @@
/**
@file include/base/config.h
@brief runtime config functions
@brief Runtime config functions declarations.
Declare functions returning version and configuration infos
Declare functions returning version and configuration infos.
Copyright (c) 2022 Christian Zimmermann. All rights reserved.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/

View file

@ -2,9 +2,9 @@
/**
@file include/base/to_string.h
@brief String converter
@brief String converter declarations.
Declaration of functions that convert a given object/type to a string
Declaration of functions that convert a given object/type to a string.
Copyright (c) 2022 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de

View file

@ -2,7 +2,7 @@
/**
@file include/base/uuid.h
@brief uuid implementation
@brief cnorxz uuid declaration.
Copyright (c) 2022 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/cnorxz.cc.h
@brief cnorxz main template header
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "base/base.cc.h"
#include "memory/memory.cc.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/operation/extensions/avx.cc.h
@brief Register type implementaions for AVX.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_avx_cc_h__
#define __cxz_avx_cc_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/operation/extensions/avx.h
@brief Register type specialization for AVX.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_avx_h__
#define __cxz_avx_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/operation/extensions/extensions.cc.h
@brief Operation extensions template implementations main header.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_extensions_cc_h__
#define __cxz_extensions_cc_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/operation/extensions/extensions.h
@brief Operation extensions main header.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_extensions_h__
#define __cxz_extensions_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/operation/extensions/reg.cc.h
@brief Register type template implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_reg_cc_h__
#define __cxz_reg_cc_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/operation/extensions/reg.h
@brief Register type declaration.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_reg_h__
#define __cxz_reg_h__

View file

@ -1,9 +1,18 @@
// -*- C++ -*-
/**
@file include/operation/op_types.cc.h
@brief Operation types template implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_op_types_cc_h__
#define __cxz_op_types_cc_h__
#include "op_types.h"
//#include "xpr/xpr.h"
#include "op_utility.h"
#include "extensions/extensions.h"

View file

@ -1,4 +1,13 @@
// -*- C++ -*-
/**
@file include/operation/op_types.h
@brief Operation types declarations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_op_types_h__
#define __cxz_op_types_h__

View file

@ -1,10 +1,19 @@
// -*- C++ -*-
/**
@file include/operation/op_utility.cc.h
@brief Operation utilities template implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_op_utility_cc_h__
#define __cxz_op_utility_cc_h__
#include "op_utility.h"
#include "xpr/pos_type.h"
//#include "operation/op_types.h"
namespace CNORXZ
{

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/operation/op_utility.h
@brief Operation utilities declarations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_op_utility_h__
#define __cxz_op_utility_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/operation/operation.cc.h
@brief Operation main header for template implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "op_types.cc.h"
#include "op_utility.cc.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/operation/operation.h
@brief Operation main header.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "op_types.h"
#include "op_utility.h"

View file

@ -2,7 +2,7 @@
/**
@file include/ranges/dindex.h
@brief DIndex declaration
@brief DIndex declaration.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de

View file

@ -2,8 +2,7 @@
/**
@file include/ranges/index_format.h
@brief ...
@brief Index formats declaration.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de

View file

@ -2,7 +2,7 @@
/**
@file include/ranges/index_pack.h
@brief Index pack declaration
@brief Index pack declarations.
Index packs are sets of indices. In contrast to multi-indices like
(G)MIndex or YIndex, there is no format that can be used to determine
@ -10,7 +10,7 @@
Nevertheless, a function pos() is implemented, which just returns
the same value as lex().
Copyright (c) 2022 Christian Zimmermann. All rights reserved.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/

View file

@ -2,12 +2,12 @@
/**
@file include/ranges/range_base.h
@brief RangeBase declaration
@brief RangeBase declaration.
Include basic headers containing defintions and macros
used throughout this library
Copyright (c) 2022 Christian Zimmermann. All rights reserved.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/buf_xpr.cc.h
@brief Buffer xpression template implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "buf_xpr.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/buf_xpr.h
@brief Buffer xpression declarations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "xpr_base.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/for.cc.h
@brief For expressions template implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_for_cc_h__
#define __cxz_for_cc_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/for.h
@brief For expressions declarations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_for_h__
#define __cxz_for_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/func.cc.h
@brief Special function objects implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_func_cc_h__
#define __cxz_func_cc_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/func.h
@brief Special function objects declarations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_func_h__
#define __cxz_func_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/index_id.cc.h
@brief Index ID type template implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_index_id_cc_h__
#define __cxz_index_id_cc_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/index_id.h
@brief Index ID type declarations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_index_id_h__
#define __cxz_index_id_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/pos_type.cc.h
@brief Position types template implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_pos_type_cc_h__
#define __cxz_pos_type_cc_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/pos_type.h
@brief Position types declarations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_pos_type_h__
#define __cxz_pos_type_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/vpos_type.cc.h
@brief Dynamic position types template implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_vpos_type_cc_h__
#define __cxz_vpos_type_cc_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/vpos_type.h
@brief Dynamic position types declarations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_vpos_type_h__
#define __cxz_vpos_type_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/xpr.cc.h
@brief Xpression template implementations main header.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "vpos_type.cc.h"
#include "pos_type.cc.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/xpr.h
@brief Xpression main header.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "vpos_type.h"
#include "pos_type.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/xpr_base.cc.h
@brief Xpression base template implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_xpr_base_cc_h__
#define __cxz_xpr_base_cc_h__

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file include/xpr/xpr_base.h
@brief Xpression base declarations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __cxz_xpr_base_h__
#define __cxz_xpr_base_h__

View file

@ -1,3 +1,15 @@
// -*- C++ -*-
/**
@file lib/base/config.cc
@brief Runtime config functions implementations.
Declare functions returning version and configuration infos.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "base/config.h"

View file

@ -1,3 +1,15 @@
// -*- C++ -*-
/**
@file lib/base/to_string.cc
@brief String converter implementations.
Declaration of functions that convert a given object/type to a string.
Copyright (c) 2022 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "base/base.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file lib/base/uuid.cc
@brief cnorxz uuid implementation.
Copyright (c) 2022 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include <random>
#include <ctime>

View file

@ -2,10 +2,9 @@
/**
@file lib/memory/memcount.cc
@brief ...
@brief Implementation of MemCount member functions.
Copyright (c) 2022 Christian Zimmermann. All rights reserved.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file lib/ranges/crange.cc
@brief CRange and CIndex member function implementation.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "ranges/ranges.h"
#include "ranges/prange.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file lib/ranges/dindex.cc
@brief DIndex implementation.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "ranges/ranges.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file lib/ranges/index_format.cc
@brief Index formats implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "ranges/index_format.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file lib/ranges/index_pack.cc
@brief Index pack implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "ranges/ranges.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file lib/ranges/range_base.cc
@brief RangeBase implementation.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "ranges/ranges.h"
#include "array/array.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file lib/ranges/yrange.cc
@brief YRange and YIndex implementations.
Copyright (c) 2022 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "ranges/ranges.h"
#include "array/array.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file opt/cereal/tests/cereal_unit_test.cc
@brief cnorxz cereal unit tests.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include <cstdlib>
#include <iostream>

View file

@ -1,7 +1,7 @@
// -*- C++ -*-
/**
@file opt/hdf5/include/h5_type_id.h
@file opt/hdf5/include/h5_type_id.cc.h
@brief TypeId template implementation.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.

View file

@ -1,7 +1,7 @@
// -*- C++ -*-
/**
@file opt/hdf5/include/types.h
@file opt/hdf5/include/h5_types.h
@brief Declaration of hdf5 related library types
This file contains the declaration of all hdf5 related library types

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file opt/hdf5/lib/h5_dataset.cc
@brief Dataset implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "h5_dataset.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file opt/hdf5/lib/h5_file.cc
@brief Group implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "h5_file.h"
#include <fstream>

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file opt/hdf5/lib/h5_group.cc
@brief Group implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "h5_group.h"
#include "h5_table.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file opt/hdf5/lib/h5_table.cc
@brief Table implementations.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include <hdf5_hl.h>
#include "h5_table.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file opt/hdf5/tests/h5_basic_unit_test.cc
@brief cnorxz hdf5 basic unit tests.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include <cstdlib>
#include <iostream>

View file

@ -1,10 +1,19 @@
// -*- C++ -*-
/**
@file tests/index_format_test.cc
@brief Index format unit tests.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include <cstdlib>
#include <iostream>
#include "gtest/gtest.h"
//#include "cnorxz.h"
#include "ranges/ranges.h"
#include "array/array.h"

View file

@ -1,4 +1,13 @@
// -*- C++ -*-
/**
@file tests/marray_unit_test.cc
@brief MArray unit tests.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include <cstdlib>
#include <iostream>

View file

@ -1,304 +0,0 @@
// -*- C++ -*-
#include <cstdlib>
#include <iostream>
#include <cassert>
#include "cnorxz.h"
#include "conversions.h"
#include <ctime>
#include <cmath>
#include <chrono>
#define ONLY_SPIN
namespace MAT = CNORXZ;
namespace {
double xround(double arg)
{
return roundf(arg * 100000.) / 100000.;
}
using namespace MAT;
template <class Factory>
void swapFactory(std::shared_ptr<RangeFactoryBase>& fptr)
{
auto nptr = std::make_shared<Factory>();
fptr = nptr;
}
template <class Factory, typename T>
void swapFactory(std::shared_ptr<RangeFactoryBase>& fptr, std::initializer_list<T> ilist)
{
vector<T> tmp = ilist;
auto nptr = std::make_shared<Factory>( tmp );
fptr = nptr;
}
template <class Factory, typename T>
void swapFactory(std::shared_ptr<RangeFactoryBase>& fptr, vector<T>& ilist)
{
vector<T> tmp = ilist;
auto nptr = std::make_shared<Factory>( tmp );
fptr = nptr;
}
template <class Factory, class... Rs>
void swapMFactory(std::shared_ptr<RangeFactoryBase>& fptr, const Rs&... rs)
{
auto nptr = std::make_shared<Factory>( rs... );
fptr = nptr;
}
template <typename... Ts>
auto mkt(Ts&&... ts) -> decltype(std::make_tuple(ts...))
{
return std::make_tuple(ts...);
}
template <typename... Ts>
auto mkts(Ts&&... ts) -> decltype(std::make_tuple(ts...))
{
return std::make_tuple(static_cast<size_t>( ts )...);
}
#ifndef ONLY_SPIN
class OpTest_Performance
{
public:
typedef SingleRangeFactory<size_t,SpaceType::ANY> SRF;
typedef SRF::oType SRange;
typedef MultiRangeFactory<SRange,SRange> MRF;
typedef MRF::oType MRange;
OpTest_Performance()
{
vector<size_t> initvec1(vs1);
cv1.resize(vs1);
for(size_t i = 0; i != vs1; ++i){
initvec1[i] = i;
cv1[i] = sqrt( static_cast<double>(i)*0.53 );
}
vector<size_t> initvec2(vs2);
cv2.resize(vs2*vs1);
for(size_t i = 0; i != vs2; ++i){
initvec2[i] = i;
for(size_t j = 0; j != vs1; ++j){
cv2[i*vs1 + j] = static_cast<double>(i) * sin(static_cast<double>(j)*0.4);
}
}
swapFactory<SRF>(rfbptr, initvec1);
sr1ptr = std::dynamic_pointer_cast<SRange>(rfbptr->create());
swapFactory<SRF>(rfbptr, initvec2);
sr2ptr = std::dynamic_pointer_cast<SRange>(rfbptr->create());
swapMFactory<MRF>(rfbptr, sr2ptr, sr1ptr);
mrptr = std::dynamic_pointer_cast<MRange>(rfbptr->create());
}
void PCheck();
private:
//const size_t vs1 = 10000;
//const size_t vs2 = 1000;
const size_t vs1 = 4000;
const size_t vs2 = 2500;
std::shared_ptr<RangeFactoryBase> rfbptr;
std::shared_ptr<SRange> sr1ptr;
std::shared_ptr<SRange> sr2ptr;
std::shared_ptr<MRange> mrptr;
vector<double> cv1;
vector<double> cv2;
};
#endif
class OpTest_Spin
{
public:
typedef ClassicRF CRF;
typedef ClassicRange CR;
typedef SpinRF SRF;
typedef SpinRange SR;
typedef MultiRangeFactory<SR,SR,SR,SR,SR,SR,SR,SR> SR8F;
typedef SR8F::oType SR8;
static const size_t os = 3000;
static const size_t is = 65536;
static const size_t s = is*os;
OpTest_Spin()
{
data.resize(is);
for(size_t i = 0; i != is; ++i){
double arg = static_cast<double>( i - s ) - 0.1;
data[i] = sin(arg);
//VCHECK(data[i]);
}
SRF f;
sr = std::dynamic_pointer_cast<SR>(f.create());
CRF cf(os);
cr = std::dynamic_pointer_cast<CR>(cf.create());
}
void contract();
private:
vector<double> data;
std::shared_ptr<SR> sr;
std::shared_ptr<CR> cr;
};
void OpTest_Spin::contract()
{
Array<double,SR,SR,SR,SR,SR,SR,SR,SR> ma( sr, sr, sr, sr, sr, sr, sr, sr, data);
Array<double,CR,SR,SR> res1( cr, sr, sr );
auto ii = MAT::getIndex<CR>(cr);
auto jj = MAT::getIndex<CR>(cr);
auto alpha = MAT::getIndex<SR>();
auto beta = MAT::getIndex<SR>();
auto gamma = MAT::getIndex<SR>();
auto delta = MAT::getIndex<SR>();
auto deltap = MAT::getIndex<SR>();
//auto deltap = MAT::getIndex<GenSingleRange<size_t,SpaceType::NONE,1>>();
auto mix = MAT::mkMIndex( jj, alpha, beta, gamma );
vector<double> vres(4*4*os);
for(size_t d = 0; d != 4; ++d){
for(size_t p = 0; p != 4; ++p){
const size_t tidx = d*4 + p;
vres[tidx] = 0.;
}
}
auto begin2 = std::chrono::system_clock::now();
double* vrptr = vres.data();
double* dptr = data.data();
for(size_t i = 0; i != os; ++i){
for(size_t d = 0; d != 4; ++d){
for(size_t j = 0; j != os; ++j) {
for(size_t a = 0; a != 4; ++a){
for(size_t b = 0; b != 4; ++b){
for(size_t c = 0; c != 4; ++c){
const size_t tidx = i*4*4 + d*4;
const size_t sidx = /*i*65536 +*/ d*4*4*4*4*4*4*4 + a*5*4*4*4*4*4 + b*5*4*4*4 + c*5*4;
double* xvrptr = vrptr + tidx;
double* xdptr = dptr + sidx;
#pragma omp simd aligned(xvrptr, xdptr: 32)
for(int p = 0; p < 4; p++){
xvrptr[p] += xdptr[p];
}
}
}
}
}
}
}
auto end2 = std::chrono::system_clock::now();
std::cout << "vector - for loop time: " << std::chrono::duration<double>(end2-begin2).count()
<< std::endl;
auto begin = std::chrono::system_clock::now();
//for(size_t i = 0; i != os; ++i){
res1(ii ,delta, deltap).par() += ma(delta, alpha, alpha, beta, beta, gamma, gamma, deltap).c(mix);
//tcast<v256>(res1)(ii ,delta, deltap).par() += tcast<v256>(ma)(delta, alpha, alpha, beta, beta, gamma, gamma, deltap).c(mix);
//}
auto end = std::chrono::system_clock::now();
std::cout << "Array time: " << std::chrono::duration<double>(end-begin).count()
<< std::endl;
assert( xround(res1.at(mkts(0,0,0))) == xround(vres[0]) );
assert( xround(res1.at(mkts(0,0,1))) == xround(vres[1]) );
assert( xround(res1.at(mkts(0,0,2))) == xround(vres[2]) );
assert( xround(res1.at(mkts(0,0,3))) == xround(vres[3]) );
assert( xround(res1.at(mkts(0,1,0))) == xround(vres[4]) );
assert( xround(res1.at(mkts(0,1,1))) == xround(vres[5]) );
assert( xround(res1.at(mkts(0,1,2))) == xround(vres[6]) );
assert( xround(res1.at(mkts(0,1,3))) == xround(vres[7]) );
assert( xround(res1.at(mkts(0,2,0))) == xround(vres[8]) );
assert( xround(res1.at(mkts(0,2,1))) == xround(vres[9]) );
assert( xround(res1.at(mkts(0,2,2))) == xround(vres[10]) );
assert( xround(res1.at(mkts(0,2,3))) == xround(vres[11]) );
assert( xround(res1.at(mkts(0,3,0))) == xround(vres[12]) );
assert( xround(res1.at(mkts(0,3,1))) == xround(vres[13]) );
assert( xround(res1.at(mkts(0,3,2))) == xround(vres[14]) );
assert( xround(res1.at(mkts(0,3,3))) == xround(vres[15]) );
std::cout << "ratio: "
<< std::chrono::duration<double>(end-begin).count() / std::chrono::duration<double>(end2-begin2).count()
<< std::endl;
}
#ifndef ONLY_SPIN
void OpTest_Performance::PCheck()
{
Array<double,MRange> ma2(mrptr, cv2);
Array<double,SRange> ma1(sr1ptr, cv1);
Array<double,MRange> res(mrptr);
auto si1 = MAT::getIndex(sr1ptr);
auto si2 = MAT::getIndex(sr2ptr);
auto mi = MAT::getIndex(mrptr);
(*mi)(si2, si1);
std::clock_t begin = std::clock();
res(mi) = ma2(mi) * ma1(si1);
std::clock_t end = std::clock();
std::cout << "Array time: " << static_cast<double>( end - begin ) / CLOCKS_PER_SEC
<< std::endl;
vector<double> res2(vs1*vs2);
std::clock_t begin2 = std::clock();
for(size_t i = 0; i != vs2; ++i){
for(size_t j = 0; j != vs1; ++j){
res2[i*vs1 + j] = cv1[j] * cv2[i*vs1 + j];
}
}
std::clock_t end2 = std::clock();
std::cout << "vector - for loop time: " << static_cast<double>( end2 - begin2 ) / CLOCKS_PER_SEC
<< std::endl;
std::cout << "ratio: " << static_cast<double>( end - begin ) / static_cast<double>( end2 - begin2 ) << std::endl;
assert( xround( res.at(mkt(7,9)) ) == xround(res2[7*vs1 + 9]) );
//assert( xround( res.at(mkt(700,900)) ) == xround(res2[700*vs1 + 900]) );
}
#endif
} // anonymous namspace
int main(int argc, char** argv)
{
#ifndef ONLY_SPIN
OpTest_Performance pt;
pt.PCheck();
#endif
OpTest_Spin st;
st.contract();
return 0;
}

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file tests/operation_unit_test.cc
@brief Operation unit tests.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include <cstdlib>
#include <iostream>

View file

@ -1,10 +1,19 @@
// -*- C++ -*-
/**
@file tests/range_unit_test.cc
@brief Range unit tests.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include <cstdlib>
#include <iostream>
#include "gtest/gtest.h"
//#include "cnorxz.h"
#include "ranges/ranges.h"
#include "array/array.h"

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file tests/test_numbers.cc
@brief Test numbers instanciation.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "test_numbers.h"
@ -5,6 +15,8 @@ namespace CNORXZ
{
namespace Test
{
/** @cond 0 */
Vector<Double> Numbers::sCont;
/** @endcond */
}
}

View file

@ -1,10 +1,18 @@
// -*- C++ -*-
/**
@file tests/test_numbers.h
@brief Test numbers utilities.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#ifndef __test_numbers_h__
#define __test_numbers_h__
#include <fstream>
//#include "base/types.h"
//#include "base/assert.h"
#include "base/base.h"
namespace CNORXZ

View file

@ -1,3 +1,13 @@
// -*- C++ -*-
/**
@file tests/xpr_unit_test.cc
@brief Xpression unit tests.
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
Mail: chizeta@f3l.de
**/
#include "gtest/gtest.h"