Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Jul 1, 2024
1 parent c116522 commit 7979735
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,7 @@ This release closes the following issue:

##### Features

- [`8248b4a`](https://github.com/stdlib-js/stdlib/commit/8248b4a4c72d7a981a72075583561b98646c8068) - add macro to convert a stride to an index offset
- [`123f7f9`](https://github.com/stdlib-js/stdlib/commit/123f7f945a9154c7518c6c0837110e0712811b5f) - add `blas/base/diagonal-types`
- [`9174c02`](https://github.com/stdlib-js/stdlib/commit/9174c02e42ca651f8959fff0626ae8147a75ee09) - add `blas/base/shared`

Expand Down Expand Up @@ -2143,6 +2144,8 @@ A total of 35 people contributed to this release. Thank you to the following con

<details>

- [`5418177`](https://github.com/stdlib-js/stdlib/commit/5418177d92f26a6d99bd53d19713f2fa0d536b27) - **refactor:** use macro to convert stride to offset _(by Athan Reines)_
- [`8248b4a`](https://github.com/stdlib-js/stdlib/commit/8248b4a4c72d7a981a72075583561b98646c8068) - **feat:** add macro to convert a stride to an index offset _(by Athan Reines)_
- [`c3895df`](https://github.com/stdlib-js/stdlib/commit/c3895df672126473f5803e93b529bcdd0775c75a) - **refactor:** use utility to resolve an index offset _(by Athan Reines)_
- [`1654659`](https://github.com/stdlib-js/stdlib/commit/1654659445a6dee281706379770c9cb0498c36c7) - **refactor:** update implementation to reduce code duplication [(#2480)](https://github.com/stdlib-js/stdlib/pull/2480) _(by Aman Bhansali, Athan Reines)_
- [`4d08374`](https://github.com/stdlib-js/stdlib/commit/4d0837401b68ebd4e5b8c38e0214158dbe410a07) - **refactor:** reduce code duplication [(#2479)](https://github.com/stdlib-js/stdlib/pull/2479) _(by Aman Bhansali, Athan Reines)_
Expand Down
12 changes: 2 additions & 10 deletions base/dcopy/src/dcopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,8 @@ void API_SUFFIX(c_dcopy)( const CBLAS_INT N, const double *X, const CBLAS_INT st
}
return;
}
if ( strideX < 0 ) {
ix = (1-N) * strideX;
} else {
ix = 0;
}
if ( strideY < 0 ) {
iy = (1-N) * strideY;
} else {
iy = 0;
}
ix = STDLIB_BLAS_BASE_STRIDE2OFFSET( N, strideX );
iy = STDLIB_BLAS_BASE_STRIDE2OFFSET( N, strideY );
for ( i = 0; i < N; i++ ) {
Y[ iy ] = X[ ix ];
ix += strideX;
Expand Down
1 change: 1 addition & 0 deletions base/shared/include/stdlib/blas/base/shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
#define STDLIB_BLAS_BASE_SHARED_H

#include "shared/cblas.h"
#include "shared/macros.h"

#endif // !STDLIB_BLAS_BASE_SHARED_H
47 changes: 47 additions & 0 deletions base/shared/include/stdlib/blas/base/shared/macros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2023 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef STDLIB_BLAS_BASE_SHARED_MACROS_H
#define STDLIB_BLAS_BASE_SHARED_MACROS_H

/*
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
*/
#ifdef __cplusplus
extern "C" {
#endif

/**
* Macro for converting a stride to an index offset.
*
* @param N number of indexed elements
* @param stride index increment
*
* @example
* #include <stdint.h>
*
* int64_t offset = STDLIB_BLAS_BASE_STRIDE2OFFSET( 10, -10 );
* // returns 90
*/
#define STDLIB_BLAS_BASE_STRIDE2OFFSET( N, stride ) ( ( (stride) > 0 ) ? 0 : ( 1-(N) ) * (stride) )

#ifdef __cplusplus
}
#endif

#endif // !STDLIB_BLAS_BASE_SHARED_MACROS_H

0 comments on commit 7979735

Please sign in to comment.