Array2d class
Class to create 2 dimensions Array.
Constructors:
Array2d(List<double> list) // default constructor
Array2d.empty() // empty array
Array2d.fromArray(Array list) // from another array
Array2d.fixed(int length) // from a fixed length
References
- "Jama". https://math.nist.gov/javanumerics/jama/. Retrieved 2019-07-17.
- "numpylinalg.solve". https://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.solve.html. Retrieved 2019-07-19.
Examples
import 'package:scidart/src/numdart/numdart.dart';
var matrix = Array2d.empty();
var line = [1.0 ,2.0 , 3.0];
matrix.add(line);
matrix.add(line);
matrix.add(line);
print(matrix);
/* output:
Array2d([Array([1.0, 2.0, 3.0]), Array([1.0, 2.0, 3.0]), Array([1.0, 2.0, 3.0])])
*/
Constructors
-
Array2d(List<
Array> list) - Array2d.empty()
- Array2d.fixed(int row, int column, {double? initialValue})
- Array2d.fromArray(Array2d list)
- Array2d.fromVector(Array vals, int mRow)
- Construct a matrix from a one-dimensional packed array
Properties
- column → int
-
no setter
- first ↔ Array
-
The first element.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether this collection has no elements.
no setterinherited
- isNotEmpty → bool
-
Whether this collection has at least one element.
no setterinherited
-
iterator
→ Iterator<
Array> -
A new
Iterator
that allows iterating the elements of thisIterable
.no setterinherited -
l
↔ List<
Array?> -
getter/setter pair
- last ↔ Array
-
The last element.
getter/setter pairinherited
- length ↔ int
-
Return the length of Array2d
getter/setter pairoverride
-
reversed
→ Iterable<
Array> -
An Iterable of the objects in this list in reverse order.
no setterinherited
- row → int
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → Array
-
Checks that this iterable has only one element, and returns that element.
no setterinherited
Methods
-
add(
Array element) → void -
Adds
value
to the end of this list, extending the length by one.inherited -
addAll(
Iterable< Array> iterable) → void -
Appends all objects of
iterable
to the end of this list.inherited -
any(
bool test(Array element)) → bool -
Checks whether any element of this iterable satisfies
test
.inherited -
asMap(
) → Map< int, Array> -
An unmodifiable Map view of this list.
inherited
-
cast<
R> () → List< R> -
Returns a view of this list as a list of
R
instances.inherited -
clear(
) → void -
Removes all objects from this list; the length of the list becomes zero.
inherited
-
contains(
Object? element) → bool -
Whether the collection contains an element equal to
element
.inherited -
copy(
) → Array2d - Generate a copy of the current matrix
-
elementAt(
int index) → Array -
Returns the
index
th element.inherited -
every(
bool test(Array element)) → bool -
Checks whether every element of this iterable satisfies
test
.inherited -
expand<
T> (Iterable< T> f(Array element)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
inherited
-
fillRange(
int start, int end, [Array? fill]) → void -
Overwrites a range of elements with
fillValue
.inherited -
firstWhere(
bool test(Array element), {Array orElse()?}) → Array -
The first element that satisfies the given predicate
test
.inherited -
fold<
T> (T initialValue, T combine(T previousValue, Array element)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
-
followedBy(
Iterable< Array> other) → Iterable<Array> -
Creates the lazy concatenation of this iterable and
other
.inherited -
forEach(
void action(Array element)) → void -
Invokes
action
on each element of this iterable in iteration order.inherited -
getColumn(
int column) → Array? - Return Array with the column elements
-
getRange(
int start, int end) → Iterable< Array> -
Creates an Iterable that iterates over a range of elements.
inherited
-
indexOf(
Object? element, [int start = 0]) → int -
The first index of
element
in this list.inherited -
indexWhere(
bool test(Array element), [int start = 0]) → int -
The first index in the list that satisfies the provided
test
.inherited -
insert(
int index, Array element) → void -
Inserts
element
at positionindex
in this list.inherited -
insertAll(
int index, Iterable< Array> iterable) → void -
Inserts all objects of
iterable
at positionindex
in this list.inherited -
isMatrix(
{dynamic throwIfIsNot = true}) → bool -
join(
[String separator = ""]) → String -
Converts each element to a String and concatenates the strings.
inherited
-
lastIndexOf(
Object? element, [int? start]) → int -
The last index of
element
in this list.inherited -
lastIndexWhere(
bool test(Array element), [int? start]) → int -
The last index in the list that satisfies the provided
test
.inherited -
lastWhere(
bool test(Array element), {Array orElse()?}) → Array -
The last element that satisfies the given predicate
test
.inherited -
map<
T> (T f(Array element)) → Iterable< T> -
The current elements of this iterable modified by
toElement
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reduce(
Array combine(Array previousValue, Array element)) → Array -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited
-
remove(
Object? element) → bool -
Removes the first occurrence of
value
from this list.inherited -
removeAt(
int index) → Array -
Removes the object at position
index
from this list.inherited -
removeLast(
) → Array -
Removes and returns the last object in this list.
inherited
-
removeRange(
int start, int end) → void -
Removes a range of elements from the list.
inherited
-
removeWhere(
bool test(Array element)) → void -
Removes all objects from this list that satisfy
test
.inherited -
replaceRange(
int start, int end, Iterable< Array> newContents) → void -
Replaces a range of elements with the elements of
replacements
.inherited -
retainWhere(
bool test(Array element)) → void -
Removes all objects from this list that fail to satisfy
test
.inherited -
setAll(
int index, Iterable< Array> iterable) → void -
Overwrites elements with the objects of
iterable
.inherited -
setRange(
int start, int end, Iterable< Array> iterable, [int skipCount = 0]) → void -
Writes some elements of
iterable
into a range of this list.inherited -
shuffle(
[Random? random]) → void -
Shuffles the elements of this list randomly.
inherited
-
singleWhere(
bool test(Array element), {Array orElse()?}) → Array -
The single element that satisfies
test
.inherited -
skip(
int count) → Iterable< Array> -
Creates an Iterable that provides all but the first
count
elements.inherited -
skipWhile(
bool test(Array element)) → Iterable< Array> -
Creates an
Iterable
that skips leading elements whiletest
is satisfied.inherited -
sort(
[int compare(Array a, Array b)?]) → void -
Sorts this list according to the order specified by the
compare
function.inherited -
subArray2d(
int rowStart, int rowEnd, int colStart, int colEnd) → Array2d - Return a Sub Array2d with the rage of rows columns elements specified
-
sublist(
int start, [int? end]) → List< Array> -
Returns a new list containing the elements between
start
andend
.inherited -
take(
int count) → Iterable< Array> -
Creates a lazy iterable of the
count
first elements of this iterable.inherited -
takeWhile(
bool test(Array element)) → Iterable< Array> -
Creates a lazy iterable of the leading elements satisfying
test
.inherited -
toList(
{bool growable = true}) → List< Array> -
Creates a List containing the elements of this Iterable.
inherited
-
toSet(
) → Set< Array> -
Creates a Set containing the same elements as this iterable.
inherited
-
toString(
) → String -
Convert an Array2d object to a String representation
override
-
where(
bool test(Array element)) → Iterable< Array> -
Creates a new lazy Iterable with all elements that satisfy the
predicate
test
.inherited -
whereType<
T> () → Iterable< T> -
Creates a new lazy Iterable with all elements that have type
T
.inherited
Operators
-
operator *(
Array2d b) → Array2d - Multiply two arrays with the same size
-
operator +(
List< Array> b) → List<Array> -
Add two arrays with the same size
override
-
operator -(
Array2d b) → Array2d - Subtract two arrays with the same size
-
operator /(
Array2d b) → Array2d - Divide two arrays with the same size
-
operator ==(
Object b) → bool -
compare two arrays
override
-
operator [](
int index) → Array -
The object at the given
index
in the list.override -
operator []=(
int index, Array value) → void -
Sets the value at the given
index
in the list tovalue
.override