fork/rules_rust

git clone https://git.julia.blue/fork/rules_rust

UebelAndreRan clang-format on all C++ sources (#1396)8fca4381

0.8.1
1.6 KiB48 linesraw
1// Copyright 2017 The Bazel Authors. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//    http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef MATRIX_SRC_MATRIX_H_
16#define MATRIX_SRC_MATRIX_H_
17
18#include <stdint.h>
19#include <stdlib.h>
20
21typedef struct {
22  size_t rows;
23  size_t cols;
24  uint64_t* data;
25} Matrix;
26
27// Constructs a new Matrix from the given data.
28// Matrix returned contains a copy of the data provided.
29Matrix* matrix_new(size_t rows, size_t cols, const uint64_t* data);
30
31// Fetches the value at the specified row and column.
32// Returns 1 if successful, 0 otherwise.
33int matrix_at(const Matrix* matrix, size_t row, size_t col, uint64_t* n);
34
35// Sets the value at the specified row and column.
36// Returns 1 if successful, 0 otherwise.
37int matrix_set(const Matrix* matrix, size_t row, size_t col, uint64_t n);
38
39// Performs an in-place transposition of the matrix.
40void matrix_transpose(Matrix* matrix);
41
42// Returns 1 if the two matrices are equal, 0 otherwise;
43int matrix_equal(const Matrix* a, const Matrix* b);
44
45// Frees the matrix.
46void matrix_free(Matrix* matrix);
47
48#endif  // MATRIX_SRC_MATRIX_H_