CNTK/Source/Math/Helpers.h

24 строки
1022 B
C
Исходник Обычный вид История

2014-08-30 03:21:42 +04:00
//
2016-01-18 11:36:17 +03:00
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
2014-08-30 03:21:42 +04:00
//
// helpful macros
2015-09-14 23:18:44 +03:00
// TODO: the file's name is too general to be included from outside; MathHelpers.h?
2016-06-17 18:44:48 +03:00
#pragma once
// iterators
2014-08-30 03:21:42 +04:00
#undef foreach_row
#undef foreach_column
#undef foreach_coord
2014-08-30 03:21:42 +04:00
#undef foreach_row_in_submat
#define foreach_row(_i, _m) for (long _i = 0; _i < (_m).GetNumRows(); _i++)
#define foreach_column(_j, _m) for (long _j = 0; _j < (_m).GetNumCols(); _j++)
#define foreach_coord(_i, _j, _m) \
for (long _j = 0; _j < (_m).GetNumCols(); _j++) \
for (long _i = 0; _i < (_m).GetNumRows(); _i++)
#define foreach_row_in_submat(_i, _istart, _iend, _m) for (long _i = _istart; _i < min(_iend, (_m).GetNumRows()); _i++)
2014-08-30 03:21:42 +04:00
// this functions returns the index of the first column element in the columnwise array representing matrix with _numRows rows
#define column_s_ind_colwisem(_colNum, _numRows) ((_numRows) * (_colNum))