public final class Mata extends Object
public static int printMataMatrix(String[] args) {
String name = args[0];
long numCol = Mata.getMataColTotal(name);
long numRow = Mata.getMataRowTotal(name);
if (Mata.isTypeReal(name)) {
for (long i = 0; i < numRow; i++) {
for (long j = 0; j < numCol; j++) {
double value = Mata.getMataRealAt(name, i, j);
String index = "[" + (i + 1) + ", " + (j + 1) + "]";
SFIToolkit.displayln(index + " = " + value);
}
}
}
else {
String type = Mata.getMataEltype(name);
SFIToolkit.errorln("Matrix is type " + type + "; real expected");
return (3250);
}
return 0;
}
. mata
// Matrix must be global for sfi.Mata to access
mat = (1, 3, 5 \ 5, 6, 4)
. end
. javacall Examples printMataMatrix, jar(examples.jar) args(mat)
[1, 1] = 1.0
[1, 2] = 3.0
[1, 3] = 5.0
[2, 1] = 5.0
[2, 2] = 6.0
[2, 3] = 4.0
Modifier and Type | Method and Description |
---|---|
static double[] |
getComplexAt(double[] matrix,
int colCount,
int row,
int col)
Get an element from a previously returned matrix.
|
static void |
getComplexValues(double[] complex,
Double real,
Double imaginary)
Get the real and imaginary parts from a complex result.
|
static int |
getMataCol(String name)
Deprecated.
This method is not capable of returning the correct
result if the number of columns exceeds 2^31-1. Use
getMataColTotal(String) instead. |
static long |
getMataColTotal(String name)
Get the number of columns in a Mata matrix.
|
static double[] |
getMataComp(String name)
Deprecated.
This method is not capable of returning the
matrix if the resulting array would exceed 2^31-1 elements. Use
getMataCompAt(String, long, long) instead. |
static double[] |
getMataCompAt(String name,
int row,
int col)
Deprecated.
This method is not capable of accessing rows or columns
beyond 2^31-1. Use
getMataCompAt(String, long, long)
instead. |
static double[] |
getMataCompAt(String name,
long row,
long col)
Read a complex Mata matrix element.
|
static String |
getMataEltype(String name)
Get the type of a Mata object.
|
static double[] |
getMataReal(String name)
Deprecated.
This method is not capable of returning the
matrix if the resulting array would exceed 2^31-1 elements. Use
getMataRealAt(String, long, long) instead. |
static double |
getMataRealAt(String name,
int row,
int col)
Deprecated.
This method is not capable of accessing rows or columns
beyond 2^31-1. Use
getMataRealAt(String, long, long)
instead. |
static double |
getMataRealAt(String name,
long row,
long col)
Read a real Mata matrix element.
|
static int |
getMataRow(String name)
Deprecated.
This method is not capable of returning the correct
result if the number of rows exceeds 2^31-1. Use
getMataRowTotal(String) instead. |
static long |
getMataRowTotal(String name)
Get the number of rows in a Mata matrix.
|
static String[] |
getMataString(String name)
Deprecated.
This method is not capable of returning the
matrix if the resulting array would exceed 2^31-1 elements. Use
getMataStringAt(String, long, long) instead. |
static String |
getMataStringAt(String name,
int row,
int col)
Deprecated.
This method is not capable of accessing rows or columns
beyond 2^31-1. Use
getMataStringAt(String, long, long)
instead. |
static String |
getMataStringAt(String name,
long row,
long col)
Read a string Mata matrix element.
|
static double |
getRealAt(double[] matrix,
int colCount,
int row,
int col)
Get an element from a previously returned matrix.
|
static String |
getStringAt(String[] matrix,
int colCount,
int row,
int col)
Get an element from a previously returned matrix.
|
static boolean |
isTypeComplex(String name)
Determine if the matrix type is complex.
|
static boolean |
isTypeReal(String name)
Determine if the matrix type is real.
|
static boolean |
isTypeString(String name)
Determine if the matrix type is string.
|
public static double getRealAt(double[] matrix, int colCount, int row, int col)
matrix
- The matrix.colCount
- The number of columns in the matrix.
This value can be obtained from
getMataColTotal()
.row
- Zero-based row number.col
- Zero-based column number.public static String getStringAt(String[] matrix, int colCount, int row, int col)
matrix
- The matrix.colCount
- The number of columns in the matrix.
This value can be obtained from
getMataColTotal()
.row
- Zero-based row number.col
- Zero-based column number.public static double[] getComplexAt(double[] matrix, int colCount, int row, int col)
matrix
- The matrix.colCount
- The number of columns in the matrix.
This value can be obtained from
getMataColTotal()
.row
- Zero-based row number.col
- Zero-based column number.public static void getComplexValues(double[] complex, Double real, Double imaginary)
public static double getMataRealAt(String name, long row, long col)
name
- Name of the Mata matrix.row
- Zero-based row number.col
- Zero-based column number.@Deprecated public static double getMataRealAt(String name, int row, int col)
getMataRealAt(String, long, long)
instead.name
- Name of the Mata matrix.row
- Zero-based row number.col
- Zero-based column number.public static double[] getMataCompAt(String name, long row, long col)
name
- Name of the Mata matrix.row
- Zero-based row number.col
- Zero-based column number.@Deprecated public static double[] getMataCompAt(String name, int row, int col)
getMataCompAt(String, long, long)
instead.name
- Name of the Mata matrix.row
- Zero-based row number.col
- Zero-based column number.public static String getMataStringAt(String name, long row, long col)
@Deprecated public static String getMataStringAt(String name, int row, int col)
getMataStringAt(String, long, long)
instead.public static long getMataRowTotal(String name)
name
- Name of the Mata matrix.@Deprecated public static int getMataRow(String name)
getMataRowTotal(String)
instead.name
- Name of the Mata matrix.public static long getMataColTotal(String name)
name
- Name of the Mata matrix.@Deprecated public static int getMataCol(String name)
getMataColTotal(String)
instead.name
- Name of the Mata matrix.public static boolean isTypeComplex(String name)
name
- Name of the Mata matrix.public static boolean isTypeReal(String name)
name
- Name of the Mata matrix.public static boolean isTypeString(String name)
name
- Name of the Mata matrix.@Deprecated public static double[] getMataReal(String name)
getMataRealAt(String, long, long)
instead.name
- Name of the Mata matrix.@Deprecated public static double[] getMataComp(String name)
getMataCompAt(String, long, long)
instead.name
- Name of the Mata matrix.@Deprecated public static String[] getMataString(String name)
getMataStringAt(String, long, long)
instead.name
- Name of the Mata matrix.String
array containing the matrix values. Returns
null if an error occurs.