Skip to content

Changes directory structure of stdlib as discussed in #216 #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jul 28, 2020
4 changes: 2 additions & 2 deletions WORKFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ experienced contributors will help it through all 5 steps.
always better than large. It is OK to implement only a few functions of a
new module, and continue work on the others in a later PR. All new
functionality goes into an "experimental" namespace
(`stdlib_experimental_*.f90`). As part of the PR, when submitting a new
(`version: experimental`). As part of the PR, when submitting a new
public facing API, please provide the initial draft of the specification
document as well as the the initial reference implementation of this
document as well as the initial reference implementation of this
specification. The
[specification is a document](https://stdlib.fortran-lang.org/page/specs/index.html)
that describes the API and
Expand Down
16 changes: 8 additions & 8 deletions doc/specs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ This is and index/directory of the specifications (specs) for each new module/fe

## Experimental Features & Modules

- [error](./stdlib_experimental_error.html) - Catching and handling errors
- [IO](./stdlib_experimental_io.html) - Input/output helper & convenience
- [linalg](./stdlib_experimental_linalg.html) - Linear Algebra
- [optval](./stdlib_experimental_optval.html) - Fallback value for optional arguments
- [quadrature](./stdlib_experimental_quadrature.html) - Numerical integration
- [stats](./stdlib_experimental_stats.html) - Descriptive Statistics
- [error](./stdlib_error.html) - Catching and handling errors
- [IO](./stdlib_io.html) - Input/output helper & convenience
- [linalg](./stdlib_linalg.html) - Linear Algebra
- [optval](./stdlib_optval.html) - Fallback value for optional arguments
- [quadrature](./stdlib_quadrature.html) - Numerical integration
- [stats](./stdlib_stats.html) - Descriptive Statistics

## Missing specs

- [ascii](https://github.com/fortran-lang/stdlib/blob/master/src/stdlib_experimental_ascii.f90)
- [kinds](https://github.com/fortran-lang/stdlib/blob/master/src/stdlib_experimental_kinds.f90)
- [ascii](https://github.com/fortran-lang/stdlib/blob/master/src/stdlib_ascii.f90)
- [kinds](https://github.com/fortran-lang/stdlib/blob/master/src/stdlib_kinds.f90)

## Released/Stable Features & Modules

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: experimental_error
title: error
---

# Catching and handling errors
Expand All @@ -8,6 +8,10 @@ title: experimental_error

## `check` - Checks the value of a logical condition

### Status

Experimental

### Description

Checks the value of a logical condition.
Expand Down Expand Up @@ -43,7 +47,7 @@ If `condition` is `.false`., and:

```fortran
program demo_check1
use stdlib_experimental_error, only: check
use stdlib_error, only: check
implicit none
integer :: a = 1
! If a /= 5, stops the program with exit code 1 and prints 'Check failed.'
Expand All @@ -52,7 +56,7 @@ end program demo_check1
```
```fortran
program demo_check2
use stdlib_experimental_error, only: check
use stdlib_error, only: check
implicit none
integer :: a = 1
! If a /= 5, stops the program with exit code 1 and prints 'a == 5 failed.'
Expand All @@ -61,7 +65,7 @@ end program demo_check2
```
```fortran
program demo_check3
use stdlib_experimental_error, only: check
use stdlib_error, only: check
implicit none
integer :: a = 1
! If a /= 5, prints 'a == 5 failed.', but doesn't stop the program.
Expand All @@ -70,7 +74,7 @@ end program demo_check2
```
```fortran
program demo_check3
use stdlib_experimental_error, only: check
use stdlib_error, only: check
implicit none
integer :: a = 1
! If a /= 5, stops the program with exit code 77 and prints 'a == 5 failed.'
Expand All @@ -80,13 +84,17 @@ end program demo_check3

## `error_stop` - aborts the program

### Status

Experimental

### Description

Aborts the program with a message and a nonzero exit code.

### Syntax

`call [[stdlib_experimental_error(module):error_stop(interface)]](msg, code)`
`call [[stdlib_error(module):error_stop(interface)]](msg, code)`

### Arguments

Expand All @@ -104,7 +112,7 @@ Without error code:

```fortran
program demo_error_stop1
use stdlib_experimental_error, only: error_stop
use stdlib_error, only: error_stop
implicit none
call error_stop("Invalid argument")
end program demo_error_stop1
Expand All @@ -114,7 +122,7 @@ With error code:

```fortran
program demo_error_stop2
use stdlib_experimental_error, only: error_stop
use stdlib_error, only: error_stop
implicit none
call error_stop("Invalid argument", code = 123)
end program demo_error_stop2
Expand Down
26 changes: 19 additions & 7 deletions doc/specs/stdlib_experimental_io.md → doc/specs/stdlib_io.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: experimental_IO
title: IO
---

# IO
Expand All @@ -8,12 +8,16 @@ title: experimental_IO

## `loadtxt` - load a 2D array from a text file

### Status

Experimental

### Description
Loads a rank-2 `array` from a text file.

### Syntax

`call [[stdlib_experimental_io(module):loadtxt(interface)]](filename, array)`
`call [[stdlib_io(module):loadtxt(interface)]](filename, array)`

### Arguments

Expand All @@ -29,7 +33,7 @@ Returns an allocated rank-2 `array` with the content of `filename`.

```fortran
program demo_loadtxt
use stdlib_experimental_io, only: loadtxt
use stdlib_io, only: loadtxt
implicit none
real, allocatable :: x(:,:)
call loadtxt('example.dat', x)
Expand All @@ -39,13 +43,17 @@ end program demo_loadtxt

## `open` - open a file

### Status

Experimental

### Description

Returns the unit number of a file opened to read, to write, or to read and write. The file might be a text file or a binary file. All files are opened using a streamed access.

### Syntax

`u = [[stdlib_experimental_io(module):open(function)]](filename [, mode] [, iostat])`
`u = [[stdlib_io(module):open(function)]](filename [, mode] [, iostat])`

### Arguments

Expand Down Expand Up @@ -80,7 +88,7 @@ The result is a scalar of type `integer`.

```fortran
program demo_open
use stdlib_experimental_io, only: open
use stdlib_io, only: open
implicit none
integer :: u
u = open('example.dat', 'wt')
Expand All @@ -92,12 +100,16 @@ end program demo_open

## `savetxt` - save a 2D array into a text file

### Status

Experimental

### Description
Saves a rank-2 `array` into a text file.

### Syntax

`call [[stdlib_experimental_io(module):savetxt(interface)]](filename, array)`
`call [[stdlib_io(module):savetxt(interface)]](filename, array)`

### Arguments

Expand All @@ -113,7 +125,7 @@ Provides a text file called `filename` that contains the rank-2 `array`.

```fortran
program demo_savetxt
use stdlib_experimental_io, only: savetxt
use stdlib_io, only: savetxt
implicit none
real :: x(3,2) = 1
call savetxt('example.dat', x)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: experimental_linalg
title: linalg
---

# Linear Algebra
Expand All @@ -8,13 +8,17 @@ title: experimental_linalg

## `diag` - Create a diagonal array or extract the diagonal elements of an array

### Status

Experimental

### Description

Create a diagonal array or extract the diagonal elements of an array

### Syntax

`d = [[stdlib_experimental_linalg(module):diag(interface)]](a [, k])`
`d = [[stdlib_linalg(module):diag(interface)]](a [, k])`

### Arguments

Expand All @@ -30,7 +34,7 @@ Returns a diagonal array or a vector with the extracted diagonal elements.

```fortran
program demo_diag1
use stdlib_experimental_linalg, only: diag
use stdlib_linalg, only: diag
implicit none
real, allocatable :: A(:,:)
integer :: i
Expand All @@ -40,7 +44,7 @@ end program demo_diag1

```fortran
program demo_diag2
use stdlib_experimental_linalg, only: diag
use stdlib_linalg, only: diag
implicit none
real :: v(:)
real, allocatable :: A(:,:)
Expand All @@ -52,7 +56,7 @@ end program demo_diag2

```fortran
program demo_diag3
use stdlib_experimental_linalg, only: diag
use stdlib_linalg, only: diag
implicit none
integer, parameter :: n = 10
real :: c(n), ul(n-1)
Expand All @@ -66,7 +70,7 @@ end program demo_diag3

```fortran
program demo_diag4
use stdlib_experimental_linalg, only: diag
use stdlib_linalg, only: diag
implicit none
integer, parameter :: n = 12
real :: A(n,n)
Expand All @@ -79,7 +83,7 @@ end program demo_diag4

```fortran
program demo_diag5
use stdlib_experimental_linalg, only: diag
use stdlib_linalg, only: diag
implicit none
integer, parameter :: n = 3
real :: A(n,n)
Expand All @@ -93,13 +97,17 @@ end program demo_diag5

## `eye` - Construct the identity matrix

### Status

Experimental

### Description

Construct the identity matrix

## Syntax

`I = [[stdlib_experimental_linalg(module):eye(function)]](n)`
`I = [[stdlib_linalg(module):eye(function)]](n)`

### Arguments

Expand All @@ -113,7 +121,7 @@ Returns the identity matrix, i.e. a square matrix with ones on the main diagonal

```fortran
program demo_eye1
use stdlib_experimental_linalg, only: eye
use stdlib_linalg, only: eye
implicit none
real :: a(3,3)
A = eye(3)
Expand All @@ -122,21 +130,25 @@ end program demo_eye1

```fortran
program demo_eye2
use stdlib_experimental_linalg, only: eye, diag
use stdlib_linalg, only: eye, diag
implicit none
print *, all(eye(4) == diag([1,1,1,1])) ! prints .true.
end program demo_eye2
```

## `trace` - Trace of a matrix

### Status

Experimental

### Description

Trace of a matrix (rank-2 array)

### Syntax

`result = [stdlib_experimental_linalg(module):trace(interface)](A)`
`result = [stdlib_linalg(module):trace(interface)](A)`

### Arguments

Expand All @@ -149,7 +161,7 @@ Returns the trace of the matrix, i.e. the sum of diagonal elements.
### Example
```fortran
program demo_trace
use stdlib_experimental_linalg, only: trace
use stdlib_linalg, only: trace
implicit none
real :: A(3,3)
A = reshape([1,2,3,4,5,6,7,8,9],[3,3])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: experimental_optval
title: optval
---

# Default values for optional arguments
Expand All @@ -8,6 +8,10 @@ title: experimental_optval

## `optval` - fallback value for optional arguments

### Status

Experimental

### Description

Returns `x` if it is present, otherwise `default`.
Expand All @@ -16,7 +20,7 @@ This function is intended to be called in a procedure with one or more `optional

### Syntax

`result = [[stdlib_experimental_optval(module):optval(interface)]](x, default)`
`result = [[stdlib_optval(module):optval(interface)]](x, default)`

### Arguments

Expand All @@ -32,7 +36,7 @@ If `x` is present, the result is `x`, otherwise the result is `default`.

```fortran
program demo_optval
use stdlib_experimental_optval, only: optval
use stdlib_optval, only: optval
implicit none
print *, root(64.0)
! 8.0
Expand Down
Loading