21 #include <tensor/tensor.h>
22 #include <tensor/io.h>
26 bool verify_tensor_dimensions(
const Indices &d, index total_size) {
27 index aux = total_size;
31 for (Indices::const_iterator it = d.begin_const(); it != d.end_const();
36 std::cerr <<
"Product of tensor dimensions exceeds data size."
38 <<
"All dimensions: " << d << std::endl
39 <<
"Expected size: " << total_size << std::endl;
42 for (Indices::const_iterator it = d.begin_const(); it != d.end_const();
45 std::cerr <<
"Negative dimension in tensor's dimension #"
46 << (it - d.begin()) << std::endl
47 <<
"All dimensions:" << std::endl
53 std::cerr <<
"Product of tensor dimensions exceeds index range."
55 <<
"All dimensions: " << d << std::endl
56 <<
"Expected size: " << total_size << std::endl;
64 bool verify_tensor_dimensions_match(
const Indices &d1,
const Indices &d2) {
65 if ((d1.size() != d2.size()) || some_unequal(d1, d2)) {
66 std::cerr <<
"A binary operation was attempted among two tensors" << std::endl
67 <<
"with different dimensions:" << std::endl
68 <<
"d1 = " << d1 << std::endl
69 <<
"d2 = " << d2 << std::endl;