56 template<
typename dtype>
69 std::ifstream file(inFilename.c_str(), std::ios::in | std::ios::binary);
75 file.seekg(0, std::ifstream::end);
76 const uint32 fileSize =
static_cast<uint32>(file.tellg());
77 file.seekg(0, std::ifstream::beg);
79 std::vector<char> fileBuffer;
80 fileBuffer.reserve(fileSize);
81 file.read(fileBuffer.data(), fileSize);
83 if (file.bad() || file.fail())
90 NdArray<dtype> returnArray(
reinterpret_cast<dtype*
>(fileBuffer.data()), fileSize /
sizeof(dtype));
96 if (!(inSep ==
" " || inSep ==
"\t" || inSep ==
"\n"))
101 std::vector<dtype> values;
103 std::ifstream file(inFilename.c_str());
110 std::getline(file, line);
112 std::istringstream iss(line);
118 values.push_back(value);
121 catch (
const std::invalid_argument& ia)
123 std::cout <<
"Warning: fromfile: line " << lineNumber <<
"\n" << ia.what() << std::endl;
127 std::cout <<
"Warning: fromfile: line " << lineNumber << std::endl;