TiledArray
0.7.0
truncate.h
Go to the documentation of this file.
1
/*
2
* This file is a part of TiledArray.
3
* Copyright (C) 2015 Virginia Tech
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*
18
* Justus Calvin
19
* Department of Chemistry, Virginia Tech
20
*
21
* truncate.h
22
* Apr 15, 2015
23
*
24
*/
25
26
#ifndef TILEDARRAY_CONVERSIONS_TRUNCATE_H__INCLUDED
27
#define TILEDARRAY_CONVERSIONS_TRUNCATE_H__INCLUDED
28
29
#include <
TiledArray/conversions/foreach.h
>
30
31
namespace
TiledArray
{
32
34
template
<
typename
,
typename
>
class
DistArray;
35
class
DensePolicy;
36
class
SparsePolicy;
37
39
43
template
<
typename
Tile>
44
inline
void
truncate
(
DistArray<Tile, DensePolicy>
& array) { }
45
47
50
template
<
typename
Tile>
51
inline
void
truncate
(
DistArray<Tile, SparsePolicy>
& array) {
52
typedef
typename
DistArray<Tile, SparsePolicy>::value_type
value_type;
53
array =
54
foreach
(array, [] (value_type& result_tile,
const
value_type& arg_tile) {
55
typename
detail::scalar_type<value_type>::type
norm
= arg_tile.norm();
56
result_tile = arg_tile;
// Assume this is shallow copy
57
return
norm
;
58
});
59
}
60
61
}
// namespace TiledArray
62
63
#endif // TILEDARRAY_CONVERSIONS_TRUNCATE_H__INCLUDED
TiledArray::truncate
void truncate(DistArray< Tile, DensePolicy > &array)
Truncate a dense Array.
Definition:
truncate.h:44
foreach.h
TiledArray::norm
decltype(auto) norm(const Tile< Arg > &arg)
Vector 2-norm of a tile.
Definition:
tile.h:930
TiledArray::detail::scalar_type
Type trait for extracting the scalar type of tensors and arrays.
Definition:
type_traits.h:539
TiledArray
Definition:
conjgrad.h:34
TiledArray::DistArray
Forward declarations.
Definition:
clone.h:32
TiledArray::Tile
An N-dimensional shallow copy wrapper for tile objects.
Definition:
tile.h:80
TiledArray
conversions
truncate.h
Generated on Mon Aug 27 2018 08:19:28 for TiledArray by
1.8.14