Skip to content

Commit a7893c2

Browse files
authored
Merge branch 'stdlib-js:develop' into blas/dindexofrow
2 parents de804e5 + ed59264 commit a7893c2

13 files changed

Lines changed: 1008 additions & 2 deletions

File tree

docs/contributing/zulip_guide.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2026 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
<!-- lint disable expected-html-sections -->
22+
23+
# Zulip Guide
24+
25+
> Guide to the stdlib Zulip chat.
26+
27+
This guide provides best practices and community norms for the [**stdlib Zulip chat**][stdlib-zulip], home of the stdlib community (see [announcement][zulip-announcement]). Everyone is welcome to join or browse the web-public channels (which you can see without signing up). The community norms and guidelines provided in this document are to help ensure that everyone can get the most out of this platform and, hopefully, have a positive experience.
28+
29+
## Getting Started
30+
31+
When you first join, a welcome bot will greet you and share some tips specific to stdlib on how to participate effectively. If you're new to Zulip, you may also want to check out [Zulip's official getting started guide][zulip-getting-started] for a quick overview of how the platform works. If you've used other chat platforms, such as Slack or Discord, things should feel pretty familiar. The one key difference is that Zulip organizes conversations into "topics" rather than "threads". This allows for more focused discussions and makes it easier to follow specific conversations without getting lost in a stream of messages. For more on this, see [Zulip's introduction to topics][zulip-intro-to-topics].
32+
33+
We encourage you to come say hello and tell us a bit about yourself in the [**#introductions**][stdlib-introductions] channel.
34+
35+
## Community Norms
36+
37+
### Where to post
38+
39+
First and foremost, whenever possible, try to post your questions **in public** (rather than sending direct messages, a.k.a. DMs). Asking questions in public is the fastest way to get a response, as more people can help, _plus_ it's likely that someone else will benefit from finding out the answer to your question. The stdlib team is active in the chat, so you shouldn't need to use **@-mentions** by default.
40+
41+
Each channel has a description (don't worry too much about posting in the "right" channel—moderators can help [move content][zulip-move-content] if needed), and conversations are organized into [**topics**][zulip-intro-to-topics]. If you're starting a new discussion, try to pick a brief, descriptive topic name that captures the subject of your message. Topic names also help others find relevant information from past conversations (learn more about [Zulip search filters here][zulip-search-filters]). You can edit a topic name at any time, so if you realize that your original topic name isn't quite right, feel free to update it.
42+
43+
Because it's easy to move content around, please **do NOT cross-post**. Not only can this be confusing, but you risk duplication of effort if multiple people respond to the same question in different channels.
44+
45+
#### Channels
46+
47+
When you first join, you'll automatically be subscribed to several "default" channels. However, there are more channels you might want to explore.
48+
49+
The channels are roughly organized into categories in the left-hand sidebar. At the bottom, you can click on "Browse Channels" to see the full list.
50+
51+
Some categories and channels of interest include:
52+
53+
- **General Interest**
54+
55+
- **announcements**: Announcements everyone should see, including new releases, blog posts, and public events.
56+
- **general**: General topics.
57+
- **office-hours**: Information related to stdlib's weekly [office hours][stdlib-office-hours].
58+
- **water-cooler**: A place to discuss random topics, unrelated to stdlib and its development.
59+
60+
- **Feedback & Support**
61+
62+
- **case-studies**: Using stdlib in your application? Got a cool new demo? Share it here!
63+
- **feedback**: Post your reactions to or feedback on using stdlib.
64+
- **problems**: For reporting and discussing issues in using stdlib.
65+
- **user-questions**: For questions about how to accomplish your goals with stdlib.
66+
67+
- **GSOC**
68+
69+
- **gsoc-questions**: Interested in participating in Google Summer of Code? Have questions? Ask here!
70+
71+
- **Contributors**
72+
73+
- **dev**: General development topics.
74+
- **dev-questions**: Ask questions related to developing stdlib.
75+
- **getting-started**: Are you a new contributor? Post your questions here!
76+
- **introductions**: Interested in contributing to stdlib? Please introduce yourself here!
77+
- **review-requests**: Requests for PR reviews.
78+
79+
- **Development**: Channels related to specific stdlib namespaces, and other areas such as documentation and tooling.
80+
81+
- **GitHub**: These are feeds generated from GitHub activity, such as new issues and pull requests. You can use these channels to keep up with the latest activity in the project.
82+
83+
- **Other**
84+
85+
- **sandbox**: Experiment with Zulip here.
86+
- **zulip**: Questions and discussion about using Zulip.
87+
88+
### Custom Linkifiers
89+
90+
We've set up some [custom linkifiers][zulip-linkifiers] to make it easy to share links to GitHub issues and pull requests. If you type **`#1234`** in a message, it will automatically link to the issue or PR with that number in the main [stdlib GitHub repository][stdlib-github-repo]. There's also a special linkifier for the [stdlib Google Summer of Code repo][stdlib-gsoc-repo]; you simply type **`#G{id-number}`**. Note that these work for both issues and pull requests (GitHub uses the same numbering for both).
91+
92+
### Code of Conduct
93+
94+
The [stdlib Code of Conduct][stdlib-code-of-conduct] applies to all community spaces, including stdlib's Zulip. Should you encounter an issue, [Zulip's reporting tools][zulip-reporting] and our moderation team will be notified and available to assist.
95+
96+
## Feedback and Suggestions
97+
98+
If you have feedback or suggestions about improving our Zulip community, don't hesitate to share your thoughts. We have a special meta channel, [**#zulip**][stdlib-zulip-channel], for discussing community-related topics. For more general feedback, there's also the aptly-named [**#feedback**][stdlib-feedback-channel] channel.
99+
100+
The best part of open source is the community, so we're committed to making our Zulip a welcoming and inclusive space for everyone. We look forward to chatting with you there!
101+
102+
<section class="links">
103+
104+
[stdlib-zulip]: https://stdlib.zulipchat.com
105+
106+
[zulip-announcement]: https://blog.stdlib.io/announcing-zulip/
107+
108+
[stdlib-code-of-conduct]: https://github.com/stdlib-js/stdlib/blob/develop/CODE_OF_CONDUCT.md
109+
110+
[zulip-reporting]: https://zulip.com/help/report-a-message
111+
112+
[zulip-getting-started]: https://zulip.com/help/getting-started-with-zulip
113+
114+
[zulip-intro-to-topics]: https://zulip.com/help/introduction-to-topics
115+
116+
[stdlib-introductions]: https://stdlib.zulipchat.com/#narrow/channel/546733-introductions
117+
118+
[zulip-move-content]: https://zulip.com/help/move-content-to-another-channel
119+
120+
[zulip-search-filters]: https://zulip.com/help/search-for-messages#search-filters
121+
122+
[zulip-linkifiers]: https://zulip.com/help/add-a-custom-linkifier
123+
124+
[stdlib-github-repo]: https://github.com/stdlib-js/stdlib
125+
126+
[stdlib-gsoc-repo]: https://github.com/stdlib-js/google-summer-of-code
127+
128+
[stdlib-zulip-channel]: https://stdlib.zulipchat.com/#narrow/channel/546662-zulip
129+
130+
[stdlib-feedback-channel]: https://stdlib.zulipchat.com/#narrow/channel/546708-feedback
131+
132+
[stdlib-office-hours]: https://github.com/stdlib-js/meetings/issues?q=sort:updated-desc%20is:issue%20label:%22Office%20Hours%22
133+
134+
</section>
135+
136+
<!-- /.links -->
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2026 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# gcircshift
22+
23+
> Circularly shift the elements of a one-dimensional ndarray by a specified number of positions.
24+
25+
<section class="intro">
26+
27+
</section>
28+
29+
<!-- /.intro -->
30+
31+
<section class="usage">
32+
33+
## Usage
34+
35+
```javascript
36+
var gcircshift = require( '@stdlib/blas/ext/base/ndarray/gcircshift' );
37+
```
38+
39+
#### gcircshift( arrays )
40+
41+
Circularly shifts the elements of a one-dimensional ndarray by a specified number of positions.
42+
43+
```javascript
44+
var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
45+
var ndarray = require( '@stdlib/ndarray/base/ctor' );
46+
47+
var xbuf = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];
48+
var x = new ndarray( 'generic', xbuf, [ 5 ], [ 1 ], 0, 'row-major' );
49+
50+
var k = scalar2ndarray( 2, {
51+
'dtype': 'generic'
52+
});
53+
54+
var out = gcircshift( [ x, k ] );
55+
// returns <ndarray>[ 4.0, 5.0, 1.0, 2.0, 3.0 ]
56+
```
57+
58+
The function has the following parameters:
59+
60+
- **arrays**: array-like object containing a one-dimensional input ndarray and a zero-dimensional ndarray specifying the number of positions to shift.
61+
62+
</section>
63+
64+
<!-- /.usage -->
65+
66+
<section class="notes">
67+
68+
## Notes
69+
70+
- The input ndarray is shifted **in-place** (i.e., the input ndarray is **mutated**).
71+
72+
</section>
73+
74+
<!-- /.notes -->
75+
76+
<section class="examples">
77+
78+
## Examples
79+
80+
<!-- eslint no-undef: "error" -->
81+
82+
```javascript
83+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
84+
var ndarray = require( '@stdlib/ndarray/base/ctor' );
85+
var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
86+
var ndarray2array = require( '@stdlib/ndarray/to-array' );
87+
var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' );
88+
var gcircshift = require( '@stdlib/blas/ext/base/ndarray/gcircshift' );
89+
90+
var xbuf = discreteUniform( 10, -100, 100, {
91+
'dtype': 'generic'
92+
});
93+
var x = new ndarray( 'generic', xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' );
94+
console.log( ndarray2array( x ) );
95+
96+
var k = scalar2ndarray( 3, {
97+
'dtype': 'generic'
98+
});
99+
console.log( 'Shift:', ndarraylike2scalar( k ) );
100+
101+
gcircshift( [ x, k ] );
102+
console.log( ndarray2array( x ) );
103+
```
104+
105+
</section>
106+
107+
<!-- /.examples -->
108+
109+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
110+
111+
<section class="related">
112+
113+
</section>
114+
115+
<!-- /.related -->
116+
117+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
118+
119+
<section class="links">
120+
121+
</section>
122+
123+
<!-- /.links -->
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2026 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
25+
var pow = require( '@stdlib/math/base/special/pow' );
26+
var format = require( '@stdlib/string/format' );
27+
var ndarray = require( '@stdlib/ndarray/base/ctor' );
28+
var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
29+
var pkg = require( './../package.json' ).name;
30+
var gcircshift = require( './../lib' );
31+
32+
33+
// VARIABLES //
34+
35+
var options = {
36+
'dtype': 'generic'
37+
};
38+
39+
40+
// FUNCTIONS //
41+
42+
/**
43+
* Creates a benchmark function.
44+
*
45+
* @private
46+
* @param {PositiveInteger} len - array length
47+
* @returns {Function} benchmark function
48+
*/
49+
function createBenchmark( len ) {
50+
var xbuf;
51+
var x;
52+
var k;
53+
54+
xbuf = uniform( len, 0.0, 100.0, options );
55+
x = new ndarray( options.dtype, xbuf, [ len ], [ 1 ], 0, 'row-major' );
56+
57+
k = scalar2ndarray( 3, options );
58+
59+
return benchmark;
60+
61+
/**
62+
* Benchmark function.
63+
*
64+
* @private
65+
* @param {Benchmark} b - benchmark instance
66+
*/
67+
function benchmark( b ) {
68+
var out;
69+
var i;
70+
71+
b.tic();
72+
for ( i = 0; i < b.iterations; i++ ) {
73+
out = gcircshift( [ x, k ] );
74+
if ( typeof out !== 'object' ) {
75+
b.fail( 'should return an ndarray' );
76+
}
77+
}
78+
b.toc();
79+
if ( xbuf[ i%len ] !== xbuf[ i%len ] ) {
80+
b.fail( 'should not return NaN' );
81+
}
82+
b.pass( 'benchmark finished' );
83+
b.end();
84+
}
85+
}
86+
87+
88+
// MAIN //
89+
90+
/**
91+
* Main execution sequence.
92+
*
93+
* @private
94+
*/
95+
function main() {
96+
var len;
97+
var min;
98+
var max;
99+
var f;
100+
var i;
101+
102+
min = 1; // 10^min
103+
max = 6; // 10^max
104+
105+
for ( i = min; i <= max; i++ ) {
106+
len = pow( 10, i );
107+
f = createBenchmark( len );
108+
bench( format( '%s:len=%d', pkg, len ), f );
109+
}
110+
}
111+
112+
main();

0 commit comments

Comments
 (0)