3
3
[ ![ Build Status] ( https://travis-ci.org/JuliaArrays/FillArrays.jl.svg?branch=master )] ( https://travis-ci.org/JuliaArrays/FillArrays.jl )
4
4
[ ![ codecov] ( https://codecov.io/gh/JuliaArrays/FillArrays.jl/branch/master/graph/badge.svg )] ( https://codecov.io/gh/JuliaArrays/FillArrays.jl )
5
5
6
- Julia package to lazily representing matrices filled with a single entry,
7
- as well as identity matrices. This package exports the following types: ` Eye ` ,
8
- ` Fill ` , ` Ones ` , and ` Zeros ` .
6
+ Julia package to lazily represent matrices filled with a single entry,
7
+ as well as identity matrices. This package exports the following types:
8
+ ` Eye ` , ` Fill ` , ` Ones ` , ` Zeros ` , ` Trues ` and ` Falses ` .
9
9
10
10
11
11
The primary purpose of this package is to present a unified way of constructing
@@ -21,45 +21,33 @@ julia> BandedMatrix(Zeros(5,5), (1, 2))
21
21
22
22
## Usage
23
23
24
- Here are the matrix type4s :
24
+ Here are the matrix types :
25
25
``` julia
26
26
julia> Zeros (5 , 6 )
27
- 5 × 6 Zeros{Float64,2 ,Tuple{Base. OneTo{Int64},Base. OneTo{Int64}}}:
28
- 0.0 0.0 0.0 0.0 0.0 0.0
29
- 0.0 0.0 0.0 0.0 0.0 0.0
30
- 0.0 0.0 0.0 0.0 0.0 0.0
31
- 0.0 0.0 0.0 0.0 0.0 0.0
32
- 0.0 0.0 0.0 0.0 0.0 0.0
33
-
34
- julia> Zeros {Int} (5 , 6 )
35
- 5 × 6 Zeros{Int64,2 ,Tuple{Base. OneTo{Int64},Base. OneTo{Int64}}}:
36
- 0 0 0 0 0 0
37
- 0 0 0 0 0 0
38
- 0 0 0 0 0 0
39
- 0 0 0 0 0 0
40
- 0 0 0 0 0 0
27
+ 5 × 6 Zeros{Float64}
28
+
29
+ julia> Zeros {Int} (2 , 3 )
30
+ 2 × 3 Zeros{Int64}
41
31
42
32
julia> Ones {Int} (5 )
43
- 5 - element Ones{Int64,1 ,Tuple{Base. OneTo{Int64}}}:
44
- 1
45
- 1
46
- 1
47
- 1
48
- 1
49
-
50
- julia> Eye {Int} (5 )
33
+ 5 - element Ones{Int64}
34
+
35
+ julia> Eye {Int} (5 )
51
36
5 × 5 Diagonal{Int64,Ones{Int64,1 ,Tuple{Base. OneTo{Int64}}}}:
52
37
1 ⋅ ⋅ ⋅ ⋅
53
38
⋅ 1 ⋅ ⋅ ⋅
54
39
⋅ ⋅ 1 ⋅ ⋅
55
40
⋅ ⋅ ⋅ 1 ⋅
56
41
⋅ ⋅ ⋅ ⋅ 1
57
42
58
- julia> Fill (5.0f0 , 3 , 2 )
59
- 3 × 2 Fill{Float32,2 ,Tuple{Base. OneTo{Int64},Base. OneTo{Int64}}}:
60
- 5.0 5.0
61
- 5.0 5.0
62
- 5.0 5.0
43
+ julia> Fill (7.0f0 , 3 , 2 )
44
+ 3 × 2 Fill{Float32}: entries equal to 7.0
45
+
46
+ julia> Trues (2 , 3 )
47
+ 2 × 3 Ones{Bool}
48
+
49
+ julia> Falses (2 )
50
+ 2 - element Zeros{Bool}
63
51
```
64
52
65
53
They support conversion to other matrix types like ` Array ` , ` SparseVector ` , ` SparseMatrix ` , and ` Diagonal ` :
@@ -74,16 +62,27 @@ julia> Matrix(Zeros(5, 5))
74
62
75
63
julia> SparseMatrixCSC (Zeros (5 , 5 ))
76
64
5 × 5 SparseMatrixCSC{Float64,Int64} with 0 stored entries
65
+
66
+ julia> Array (Fill (7 , (2 ,3 )))
67
+ 2 × 3 Array{Int64,2 }:
68
+ 7 7 7
69
+ 7 7 7
77
70
```
78
71
79
- There is also support for offset index ranges:
72
+ There is also support for offset index ranges,
73
+ and the type includes the ` axes ` :
80
74
``` julia
81
75
julia> Ones ((- 3 : 2 , 1 : 2 ))
82
- Ones{Float64,2 ,Tuple{UnitRange{Int64},UnitRange{Int64}}} with indices - 3 : 2 × 1 : 2 :
83
- 1.0 1.0
84
- 1.0 1.0
85
- 1.0 1.0
86
- 1.0 1.0
87
- 1.0 1.0
88
- 1.0 1.0
76
+ 6 × 2 Ones{Float64,2 ,Tuple{UnitRange{Int64},UnitRange{Int64}}} with indices - 3 : 2 × 1 : 2
77
+
78
+ julia > Fill ( 7 , (( 0 : 2 ), ( - 1 : 0 )))
79
+ 3 × 2 Fill{Int64, 2 ,Tuple{UnitRange{Int64},UnitRange{Int64}}} with indices 0 : 2 ×- 1 : 0 : entries equal to 7
80
+
81
+ julia > typeof ( Zeros ( 5 , 6 ))
82
+ Zeros{Float64, 2 ,Tuple{Base . OneTo{Int64},Base . OneTo{Int64}}}
89
83
```
84
+
85
+ These types have methods that perform many operations efficiently,
86
+ including elementary algebra operations like multiplication and addition,
87
+ as well as linear algebra methods like
88
+ ` norm ` , ` adjoint ` , ` transpose ` and ` vec ` .
0 commit comments