Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
020951d
secant functionality added
AbhijitRaut04 Oct 20, 2024
cd658c7
test cases checked
AbhijitRaut04 Oct 21, 2024
61dd8a5
huge_negative.json unformat
AbhijitRaut04 Oct 21, 2024
1a3044c
Examples fixed
AbhijitRaut04 Oct 26, 2024
4f9cfcd
Merge branch 'stdlib-js:develop' into develop
AbhijitRaut04 Oct 26, 2024
20d3800
Merge branch 'develop' of https://github.com/AbhijitRaut04/stdlib int…
AbhijitRaut04 Oct 26, 2024
a7396d8
Apply suggestions from code review
kgryte Oct 26, 2024
7a2c270
Spacing conventions followed and required changes made
AbhijitRaut04 Oct 27, 2024
d0ebc38
Merge branch 'develop' of https://github.com/AbhijitRaut04/stdlib int…
AbhijitRaut04 Oct 27, 2024
2733e3e
Merge branch 'stdlib-js:develop' into develop
AbhijitRaut04 Oct 29, 2024
52900e0
necessary changes made
AbhijitRaut04 Oct 29, 2024
5ab6d39
Merge branch 'develop' of https://github.com/AbhijitRaut04/stdlib int…
AbhijitRaut04 Oct 29, 2024
6f04f94
chore: apply suggestions from code review
Planeshifter Oct 29, 2024
a630f41
chore: update relative path
Planeshifter Oct 29, 2024
2cb28a7
Merge branch 'stdlib-js:develop' into develop
AbhijitRaut04 Oct 31, 2024
c30cdec
Merge branch 'stdlib-js:develop' into develop
AbhijitRaut04 Nov 13, 2024
0735981
add c implementation for minmax
AbhijitRaut04 Nov 13, 2024
0d34bb5
example.out
AbhijitRaut04 Nov 13, 2024
cbaa9a0
add manifest.json
AbhijitRaut04 Nov 13, 2024
89d15a4
pyp files added
AbhijitRaut04 Nov 13, 2024
64bb538
dependency resolved
AbhijitRaut04 Nov 14, 2024
72be084
removed minmax dependency
AbhijitRaut04 Nov 14, 2024
8b45444
return datatype changed
AbhijitRaut04 Nov 14, 2024
0339052
licensce years corrected
AbhijitRaut04 Nov 14, 2024
8f1f317
years corrected
AbhijitRaut04 Nov 14, 2024
6ca0a3f
unary to binary converted
AbhijitRaut04 Nov 14, 2024
3346b22
update
AbhijitRaut04 Nov 14, 2024
dd3e865
removed cephes
AbhijitRaut04 Nov 14, 2024
d5b8312
Merge branch 'stdlib-js:develop' into develop
AbhijitRaut04 Nov 15, 2024
67e9010
manifest update
AbhijitRaut04 Nov 15, 2024
bf6f9e0
Merge branch 'develop' of https://github.com/AbhijitRaut04/stdlib int…
AbhijitRaut04 Nov 15, 2024
d800f25
manifest updated
AbhijitRaut04 Nov 15, 2024
9035a6c
_
AbhijitRaut04 Nov 15, 2024
c43128a
update package.json
AbhijitRaut04 Nov 15, 2024
674fdd0
''
AbhijitRaut04 Nov 15, 2024
da8bf36
add dynamic allocation for result
AbhijitRaut04 Nov 15, 2024
4be1efa
implementation changed
AbhijitRaut04 Nov 15, 2024
4f592a2
changes updated
AbhijitRaut04 Nov 15, 2024
0f722f7
void changed to double
AbhijitRaut04 Nov 15, 2024
fbe9c46
return
AbhijitRaut04 Nov 15, 2024
9e9c7fa
examples updated
AbhijitRaut04 Nov 15, 2024
3c8ec0e
wrapper added for minmax
AbhijitRaut04 Nov 15, 2024
0598ee5
wrapper modified
AbhijitRaut04 Nov 15, 2024
c89beac
benchs examples
AbhijitRaut04 Nov 15, 2024
1f95c46
return changed to double instead double *
AbhijitRaut04 Nov 16, 2024
a4dbf3c
Merge branch 'stdlib-js:develop' into develop
AbhijitRaut04 Nov 16, 2024
6a0ad2f
native.js updated
AbhijitRaut04 Nov 16, 2024
1ebac1d
Merge branch 'develop' of https://github.com/AbhijitRaut04/stdlib int…
AbhijitRaut04 Nov 16, 2024
8baa0ac
Merge branch 'stdlib-js:develop' into develop
AbhijitRaut04 Nov 17, 2024
d44c982
Merge remote-tracking branch 'upstream/develop' into develop
stdlib-bot Nov 18, 2024
ab4c30f
changes made
AbhijitRaut04 Nov 18, 2024
480eca1
Merge branch 'develop' of https://github.com/AbhijitRaut04/stdlib int…
AbhijitRaut04 Nov 18, 2024
ce381ba
changes made
AbhijitRaut04 Nov 18, 2024
ea1137f
changes reverted
AbhijitRaut04 Nov 18, 2024
a84f7ee
native implementation updated
AbhijitRaut04 Nov 18, 2024
42e7d33
update native
AbhijitRaut04 Nov 18, 2024
6770168
revrt
AbhijitRaut04 Nov 18, 2024
47fe186
revert
AbhijitRaut04 Nov 18, 2024
0235838
addon.c
AbhijitRaut04 Nov 18, 2024
f1dc537
removed minmax
AbhijitRaut04 Nov 18, 2024
a112be1
restored changes in minmaxabs branch
AbhijitRaut04 Nov 18, 2024
e2b2ca9
add c implementation for minmaxabs
AbhijitRaut04 Nov 19, 2024
48e64a2
Merge branch 'stdlib-js:develop' into minmaxabs
AbhijitRaut04 Nov 19, 2024
48ec24a
minor changes
AbhijitRaut04 Nov 19, 2024
6cbbb2c
minor issue resolved
AbhijitRaut04 Nov 19, 2024
cd376c5
newline added at end of test.native.js
AbhijitRaut04 Nov 19, 2024
0943874
spacing corrected
AbhijitRaut04 Nov 19, 2024
bdd7eba
Merge branch 'stdlib-js:develop' into minmaxabs
AbhijitRaut04 Nov 20, 2024
c3ae957
changes wrt to other pr
AbhijitRaut04 Nov 21, 2024
b762f4c
fix: resolve lint errors
stdlib-bot Nov 22, 2024
40dd028
Delete lib/node_modules/@stdlib/math/base/special/minmax/benchmark/ju…
AbhijitRaut04 Nov 26, 2024
0315886
benchmark.jl
AbhijitRaut04 Nov 26, 2024
4e465b6
Merge branch 'minmaxabs' of https://github.com/AbhijitRaut04/stdlib i…
AbhijitRaut04 Nov 26, 2024
0cccb71
Merge branch 'stdlib-js:develop' into minmaxabs
AbhijitRaut04 Dec 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
104 changes: 90 additions & 14 deletions lib/node_modules/@stdlib/math/base/special/minmaxabs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,96 @@ for ( i = 0; i < 100; i++ ) {

<!-- /.examples -->

<!-- C interface documentation. -->

* * *

<section class="c">

## C APIs

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- C usage documentation. -->

<section class="usage">

### Usage

```c
#include "stdlib/math/base/special/minmaxabs.h"
```

#### stdlib_base_minmaxabs( x, y, &minabs, &maxabs )

Gets minimum and maximum absolute values in a single pass.

```c
stdlib_base_minmaxabs( 4.2, 3.14, &minabs, &maxabs );

stdlib_base_minmaxabs( +0.0, -0.0, &minabs, &maxabs );
```

The function accepts the following arguments:

- **x**: `[in] double` input value.
- **y**: `[in] double` input value.
- **minabs**: `[out] double*` destination for the minimum part.
- **maxabs**: `[out] double*` destination for the maximum part.

```c
void stdlib_base_minmaxabs( const double x, const double y, double *minabs, double *maxabs );
```

</section>

<!-- /.usage -->

<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

</section>

<!-- /.notes -->

<!-- C API usage examples. -->

<section class="examples">

### Examples

```c
#include "stdlib/math/base/special/minmaxabs.h"
#include <stdio.h>
int main( void ) {
const double x[] = { 4.2, 2.0, -2.0, 1.0, -1.0, 3.9, -3.14, 5.0, -5.0, 1.0/0.0, -1.0/0.0, 0.0/0.0 };
const double y[] = { 3.14, 0.0, -0.0, 1.0, -1.0, 5.9, -3.14, 6.0, -6.0, 1.0/0.0, -1.0/0.0, 0.0/0.0 };
double minabs;
double maxabs;
int i;

for ( i = 0; i < 12; i++ ) {
stdlib_base_minmaxabs( x[ i ], y[ i ], &minabs, &maxabs );
printf( "x: %lf => minabs: %lf, y: %lf, minmaxabs(x, y): %lf\n", x[ i ], y[ i ], minabs, maxabs );
}
}
```

</section>

<!-- /.examples -->

</section>

<!-- /.c -->

<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">
Expand All @@ -131,14 +221,6 @@ for ( i = 0; i < 100; i++ ) {

<section class="related">

* * *

## See Also

- <span class="package-name">[`@stdlib/math/base/special/maxabs`][@stdlib/math/base/special/maxabs]</span><span class="delimiter">: </span><span class="description">return the maximum absolute value.</span>
- <span class="package-name">[`@stdlib/math/base/special/minabs`][@stdlib/math/base/special/minabs]</span><span class="delimiter">: </span><span class="description">return the minimum absolute value.</span>
- <span class="package-name">[`@stdlib/math/base/special/minmax`][@stdlib/math/base/special/minmax]</span><span class="delimiter">: </span><span class="description">return the minimum and maximum values.</span>

</section>

<!-- /.related -->
Expand All @@ -149,12 +231,6 @@ for ( i = 0; i < 100; i++ ) {

<!-- <related-links> -->

[@stdlib/math/base/special/maxabs]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/maxabs

[@stdlib/math/base/special/minabs]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/minabs

[@stdlib/math/base/special/minmax]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/minmax

<!-- </related-links> -->

</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
var randu = require( '@stdlib/random/base/uniform' );
var isArray = require( '@stdlib/assert/is-array' );
var minabs = require( '@stdlib/math/base/special/minabs' );
var maxabs = require( '@stdlib/math/base/special/maxabs' );
Expand All @@ -37,10 +37,11 @@ bench( pkg, function benchmark( b ) {
var z;
var i;

x = ( randu()*1000.0 ) - 500.0;
y = ( randu()*1000.0 ) - 500.0;

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = ( randu()*1000.0 ) - 500.0;
y = ( randu()*1000.0 ) - 500.0;
z = minmaxabs( x, y );
if ( z.length !== 2 ) {
b.fail( 'should have expected length' );
Expand All @@ -63,10 +64,11 @@ bench( pkg+':assign', function benchmark( b ) {

out = [ 0.0, 0.0 ];

x = ( randu()*1000.0 ) - 500.0;
y = ( randu()*1000.0 ) - 500.0;

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = ( randu()*1000.0 ) - 500.0;
y = ( randu()*1000.0 ) - 500.0;
z = minmaxabs.assign( x, y, out, 1, 0 );
if ( z.length !== 2 ) {
b.fail( 'should have expected length' );
Expand All @@ -86,10 +88,11 @@ bench( pkg+'::minabs,maxabs', function benchmark( b ) {
var z;
var i;

x = ( randu()*1000.0 ) - 500.0;
y = ( randu()*1000.0 ) - 500.0;

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = ( randu()*1000.0 ) - 500.0;
y = ( randu()*1000.0 ) - 500.0;
z = [ minabs( x, y ), maxabs( x, y ) ];
if ( z.length !== 2 ) {
b.fail( 'should have expected length' );
Expand All @@ -111,10 +114,11 @@ bench( pkg+'::minabs,maxabs,memory_reuse', function benchmark( b ) {

z = [ 0.0, 0.0 ];

x = ( randu()*1000.0 ) - 500.0;
y = ( randu()*1000.0 ) - 500.0;

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = ( randu()*1000.0 ) - 500.0;
y = ( randu()*1000.0 ) - 500.0;
z[ 0 ] = minabs( x, y );
z[ 1 ] = maxabs( x, y );
if ( z.length !== 2 ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
#/
# @license Apache-2.0
#
# Copyright (c) 2024 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.
#/

# VARIABLES #

ifndef VERBOSE
QUIET := @
else
QUIET :=
endif

# Determine the OS ([1][1], [2][2]).
#
# [1]: https://en.wikipedia.org/wiki/Uname#Examples
# [2]: http://stackoverflow.com/a/27776822/2225624
OS ?= $(shell uname)
ifneq (, $(findstring MINGW,$(OS)))
OS := WINNT
else
ifneq (, $(findstring MSYS,$(OS)))
OS := WINNT
else
ifneq (, $(findstring CYGWIN,$(OS)))
OS := WINNT
else
ifneq (, $(findstring Windows_NT,$(OS)))
OS := WINNT
endif
endif
endif
endif

# Define the program used for compiling C source files:
ifdef C_COMPILER
CC := $(C_COMPILER)
else
CC := gcc
endif

# Define the command-line options when compiling C files:
CFLAGS ?= \
-std=c99 \
-O3 \
-Wall \
-pedantic

# Determine whether to generate position independent code ([1][1], [2][2]).
#
# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options
# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option
ifeq ($(OS), WINNT)
fPIC ?=
else
fPIC ?= -fPIC
endif

# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`):
INCLUDE ?=

# List of source files:
SOURCE_FILES ?=

# List of libraries (e.g., `-lopenblas -lpthread`):
LIBRARIES ?=

# List of library paths (e.g., `-L /foo/bar -L /beep/boop`):
LIBPATH ?=

# List of C targets:
c_targets := benchmark.out


# RULES #

#/
# Compiles source files.
#
# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`)
# @param {string} [CFLAGS] - C compiler options
# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`)
# @param {string} [SOURCE_FILES] - list of source files
# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`)
# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`)
#
# @example
# make
#
# @example
# make all
#/
all: $(c_targets)

.PHONY: all

#/
# Compiles C source files.
#
# @private
# @param {string} CC - C compiler (e.g., `gcc`)
# @param {string} CFLAGS - C compiler options
# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`)
# @param {string} SOURCE_FILES - list of source files
# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`)
# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`)
#/
$(c_targets): %.out: %.c
$(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES)

#/
# Runs compiled benchmarks.
#
# @example
# make run
#/
run: $(c_targets)
$(QUIET) ./$<

.PHONY: run

#/
# Removes generated files.
#
# @example
# make clean
#/
clean:
$(QUIET) -rm -f *.o *.out

.PHONY: clean
Loading
Loading