class MATD < $MAT{FLTD,VECD,MATD}


Ancestors
$MAT{_,_,_} NUMERIC_MAT{_,_} MAT{_,_} AREF{_}



Public


Readable Attributes
attr nc:INT; .. Included as nc
**** number of columns built in feature inherited from AREF{*}, asize = nr*nc.
attr nr:INT; .. Included as nr
**** number of rows built in feature inherited from AREF{*}, asize = nr*nc.

Features
aclear .. Included as aclear
**** Set each element of self to nil. Built-in.
aget(ind:INT):T .. Included as aget
**** The element of self with index `ind'. Built-in.
aget(i1,i2:INT):ET .. Included as aget
**** The element with indices `[i1,i2]'.
aset(ind:INT, val:T) .. Included as aset
**** Set the element of self with index `ind' to `val'. Built-in.
aset(i1,i2:INT,val:ET) .. Included as aset
col(i:INT):VT .. Included as col
col(i:INT,v:VT) .. Included as col
contents(arg:SAME) .. Included as contents
copy:SAME .. Included as copy
**** make a value copy.
create(a: ARRAY{ARRAY{ET}}): SAME .. Included as create
**** Create a new array with the same dimensions and values as a, which is an array of arrays(rows). Assume that all the rows of "a" have the same number of elements
create(r,c:INT):SAME .. Included as create
**** Create a matrix with r rows and c columns
create(arg:SAME):SAME .. Included as create
**** Creates a new matrix with the same dimensions (but not the same values) as arg
create_col_matrix(arg:VT):SAME .. Included as create_col_matrix
create_row_matrix(arg:VT):SAME .. Included as create_row_matrix
destructive_det: ET .. Included as destructive_det
**** Destructive determinant of self. Similar to the Gaussian algorithm. The Gaussian algorithm is from Sedgewick: "Algorithms", pp 57-65.
destructive_gauss(x:VT) .. Included as destructive_gauss
**** Solve linear equations. Result in x. self is changed. Raise "Division by Zero" for singular matrices. This algorithm is from Sedgewick: "Algorithms", pp 57-65.
destructive_invert: SAME .. Included as destructive_invert
**** Destructive invert self, return a new matrix. Similar to the Gaussian algorithm. Raise "Division by Zero" for singular matrices. The Gaussian algorithm is from Sedgewick: "Algorithms", pp 57-65.
det: ET .. Included as det
**** Non destructive determinant routine
dimension_str:STR .. Included as dimension_str
**** useful for debugging, prints out "nr = self.nr, nc = self.nc"
element_one:ET .. Included as element_one
**** These may need be redefined for MATCPX et al. This is a hack. Zero and one should really be features in in ET < $RING_ELT, where $RING_ELT gives additive and multiplicative identity.
element_zero:ET .. Included as element_zero
fits(arg:SAME):BOOL .. Included as fits
**** will the contents of 'arg' fit into self, ignoring tranposition.
gauss(x:VT):VT .. Included as gauss
**** Non destructive gaussian routine
ident:SAME .. Included as ident
**** Create an identity matrix of the same shape as self
inplace(s:ET) .. Included as inplace
**** Set all elements to have the value "s"
inplace_arg_minus_arg(arg1,arg2:SAME) .. Included as inplace_arg_minus_arg
inplace_arg_minus_arg_trans(arg1,arg2:SAME) .. Included as inplace_arg_minus_arg_trans
inplace_arg_plus_arg(arg1,arg2:SAME) .. Included as inplace_arg_plus_arg
inplace_arg_plus_arg_trans(arg1,arg2:SAME) .. Included as inplace_arg_plus_arg_trans
inplace_arg_plus_scaled_arg(arg1:SAME,s:ET,arg2:SAME) .. Included as inplace_arg_plus_scaled_arg
inplace_arg_plus_scaled_arg_trans(arg1:SAME,s:ET,arg2:SAME) .. Included as inplace_arg_plus_scaled_arg_trans
inplace_arg_times_arg(arg1,arg2:SAME) .. Included as inplace_arg_times_arg
inplace_arg_times_arg_fast(arg1,arg2:SAME) .. Included as inplace_arg_times_arg_fast
**** self := arg1 * arg2. Basic algorithm: For all i,j, self(i,j) = sum(k) arg1[i,k] * arg2[k,j] t1 = i+j*nr, index through "self". 0 .. asize-1 t2 = i+arg1.nr*k 0 .. arg1.asize-1 t3 = k+j*arg2.nr
inplace_arg_times_arg_trans(arg1,arg2:SAME) .. Included as inplace_arg_times_arg_trans
**** self := arg1 * arg2^T. For all i,j, self[i,j] = sum(k) arg1[i,k] * arg2[j,k]
inplace_arg_trans(arg:SAME) .. Included as inplace_arg_trans
**** self <- arg^T
inplace_arg_trans_minus_arg_trans(arg1,arg2:SAME) .. Included as inplace_arg_trans_minus_arg_trans
inplace_arg_trans_plus_arg_trans(arg1,arg2:SAME) .. Included as inplace_arg_trans_plus_arg_trans
inplace_arg_trans_times_arg(arg1,arg2:SAME) .. Included as inplace_arg_trans_times_arg
**** self := arg1^T * arg2. For all i,j, self[i,j] = sum(k) arg1[k,i] * arg2[k,j] Likely faster than arg * arg, as inner loop is unit stride for both arrays.
inplace_arg_trans_times_arg_trans(arg1,arg2:SAME) .. Included as inplace_arg_trans_times_arg_trans
**** self := arg1^T * arg2^T. For all i,j, self[i,j] = sum(k) arg1[k,i] * arg2[j,k]
inplace_col_plus_scaled_vec(i:INT,s:ET,v:VT) .. Included as inplace_col_plus_scaled_vec
inplace_contents(arg:SAME) .. Included as inplace_contents
**** copy the contents of arg into self.
inplace_contents_from_function(function:ROUT{INT,INT}:ET) .. Included as inplace_contents_from_function
**** Set the contents of the matrix from the function "function"
inplace_elements(s:ET) .. Included as inplace_elements
inplace_ident .. Included as inplace_ident
**** Should work for non rectangular matrices too, non square portion will be set to zero.
inplace_minus_arg(arg:SAME) .. Included as inplace_minus_arg
inplace_minus_arg_trans(arg:SAME) .. Included as inplace_minus_arg_trans
inplace_plus_arg(arg:SAME) .. Included as inplace_plus_arg
inplace_plus_arg_trans(arg:SAME) .. Included as inplace_plus_arg_trans
inplace_plus_scaled_arg(s:ET,arg:SAME) .. Included as inplace_plus_scaled_arg
inplace_plus_scaled_arg_trans(s:ET,arg:SAME) .. Included as inplace_plus_scaled_arg_trans
inplace_plus_scaled_vec_times_vec(s:ET,v1,v2:VT) .. Included as inplace_plus_scaled_vec_times_vec
**** self := self + s*v1*v2^T (Add scaled outer product of v1 and v2 to self. A BLAS operation)
inplace_portion_of_arg(a: SAME) .. Included as inplace_portion_of_arg
**** Copy into self as much of arg as will fit and return it. Don't alter other elements.
inplace_row(i: INT,v: VT) .. Included as inplace_row
inplace_row_plus_scaled_vec(i:INT,s:ET,v:VT) .. Included as inplace_row_plus_scaled_vec
inplace_scaled_by(s:ET) .. Included as inplace_scaled_by
inplace_scaled_col(s:ET,i:INT) .. Included as inplace_scaled_col
inplace_scaled_row(s:ET,i:INT) .. Included as inplace_scaled_row
inplace_submatrix_to_arg(lr,ur:INT, lc,uc:INT,arg:SAME) .. Included as inplace_submatrix_to_arg
**** Set the submatrix of self given by [lr..ur,lc..uc] to be arg. with proposed syntax extension:
___m.submatrix(1,3,2,4)_:=_m2;
inplace_swapped(arg:SAME) .. Included as inplace_swapped
**** Swap the elements of "arg" with self
inplace_swapped_col(i:INT,v:VT) .. Included as inplace_swapped_col
inplace_swapped_row(i:INT,v:VT) .. Included as inplace_swapped_row
inplace_times_diagonal(v1:VT) .. Included as inplace_times_diagonal
**** Set self to be the product of itself with a diagonal matrix whose diagonal entries are the components of v1 truncated or extended with zeroes to be the correct size. Scale the columns of self with the elements of v1 Self <- Self*v1 (as diagonal of a matrix)
inplace_trans .. Included as inplace_trans
**** make self = transpose of self.
inplace_zero .. Included as inplace_zero
**** Set all elements to zero
invert: SAME .. Included as invert
**** Non-destructive inversion
is_eq(m: SAME): BOOL .. Included as is_eq
is_same_shape(arg:SAME):BOOL .. Included as is_same_shape
**** useful in preconditions. Is arg dimensioned the same as self?
is_same_shape_trans(arg:SAME):BOOL .. Included as is_same_shape_trans
**** does arg^T conform to 'self'?
minus(arg:SAME):SAME .. Included as minus
minus_arg(arg:SAME):SAME .. Included as minus_arg
minus_arg_trans(arg:SAME):SAME .. Included as minus_arg_trans
plus(arg:SAME):SAME .. Included as plus
plus_arg(arg:SAME):SAME .. Included as plus_arg
plus_arg_trans(arg:SAME):SAME .. Included as plus_arg_trans
plus_scaled_arg(s:ET,arg:SAME):SAME .. Included as plus_scaled_arg
plus_scaled_arg_trans(s:ET,arg:SAME):SAME .. Included as plus_scaled_arg_trans
reshape(r,c:INT) .. Included as reshape
**** Reshape 'self' to have 'r' rows and 'c' columns but keeping actual data, as laid out in one dimension, in the same place. This only changes the bounds, the data will logically move rows and columns keeping column major layout. Example: [a d]
_____________m1=[b_e]
________________[c_f].
m1.nr = 3, m1.nc = 2. After m1.reshape(2,3):
________________[a_c_e]
_____________m1=[b_d_f]
________________
This feature is NOT in the abstract supertype because it is representation dependent.
row(i:INT):VT .. Included as row
row(i:INT,v:VT) .. Included as row
scaled_by(s:ET):SAME .. Included as scaled_by
size1:INT .. Included as size1
size2:INT .. Included as size2
size: INT .. Included as size
str:STR .. Included as str
**** The string form of self represented as a list of rows, eg. "||1.00,2.33|,|4.5,2.8|,|9.7,3.2||".
submatrix(lr,ur:INT, lc,uc:INT):SAME .. Included as submatrix
times(arg:SAME):SAME .. Included as times
times_arg_trans(arg:SAME):SAME .. Included as times_arg_trans
times_elt(s:ET):SAME .. Included as times_elt
**** Return a new matrix that is self * scalar s Self is unchanged
times_scaled_vec_into_vec(s:ET,arg,dest:VT) .. Included as times_scaled_vec_into_vec
times_vec(arg:VT):VT .. Included as times_vec
**** This is a syntactical sugar expressions (m*v) so it doesn't follow the naming convention.
times_vec_into_vec(arg,dest:VT) .. Included as times_vec_into_vec
trans:SAME .. Included as trans
**** Create a new matrix that is the transpose of self
trans_times_arg(arg:SAME):SAME .. Included as trans_times_arg
trans_times_arg_trans(arg:SAME):SAME .. Included as trans_times_arg_trans
trans_times_scaled_vec_into_vec(s:ET,arg,dest:VT) .. Included as trans_times_scaled_vec_into_vec
trans_times_vec(arg:VT):VT .. Included as trans_times_vec
trans_times_vec_into_vec(arg,dest:VT) .. Included as trans_times_vec_into_vec

Iters
col_elt!(once col:INT):ET .. Included as col_elt!
**** Yield elements by varying index 1 and holding index 2 at `col'. The elements of a "column" col
col_ind!:INT .. Included as col_ind!
**** Yield each value of the second index in order. The columns
diag_elt!: ET .. Included as diag_elt!
**** Yield values along the diagonal (square in smaller dimension)
elt!: ET .. Included as elt!
**** Yield all elements in row major order
elt1!(once i1:INT):ET .. Included as elt1!
**** Yield elements by varying index 2 and holding index 1 at `i1'. The elements of a row "i1" this is the same as row_elt!
elt2!(once i2:INT):ET .. Included as elt2!
**** Yield elements by varying index 1 and holding index 2 at `i2'. The elements of a "column" i2 this is the same as col_elt!
ind1!: INT .. Included as ind1!
**** Yield each value of the first index in order. The rows
ind2!:INT .. Included as ind2!
**** Yield each value of the second index in order. The columns
inds!:TUP{INT,INT} .. Included as inds!
**** Yield tuples of the indices of self in lexicographical order.
inplace_col!(once col:INT, val:ET) .. Included as inplace_col!
**** Set to val elements with varying index 1 and index 2 fixed at `col'. i.e. setting the column col
inplace_diag_elt!(val:ET) .. Included as inplace_diag_elt!
**** Set values along the diagonal (square in smaller dimension)
inplace_elt!(val:ET) .. Included as inplace_elt!
**** Set all elements in row major order
inplace_row!(once row:INT, val:ET) .. Included as inplace_row!
**** Set to val elements with varying index 2 and index 1 fixed at `row'. i.e. setting a row "row"
row_elt!(once row:INT):ET .. Included as row_elt!
**** Yield elements by varying index 2 and holding index 1 at `row'. The elements of a row "row"
row_ind!: INT .. Included as row_ind!
**** Yield each value of the first index in order. The rows
set1!(once i1:INT, val:ET) .. Included as set1!
**** Set to val elements with varying index 2 and index 1 fixed at `i1'. i.e. setting the row i1 this is the same as set_row!
set2!(once i2:INT, val:ET) .. Included as set2!
**** Set to val elements with varying index 1 and index 2 fixed at `i2'. i.e. setting the column i2 this is the same as set_col!
set_col!(once i2:INT, val:ET) .. Included as set_col!
**** Set to val elements with varying index 1 and index 2 fixed at `i2'. i.e. setting the column i2
set_row!(once i1:INT, val:ET) .. Included as set_row!
**** Set to val elements with varying index 2 and index 1 fixed at `i1'. i.e. setting the row i1


Private

acopy(beg,num,srcbeg:INT, src:SAME) .. Included as acopy
**** Copy `num' elements from `src' to self starting at index `beg' of self and index `srcbeg' of `src'. Built-in.
acopy(beg,num:INT, src:SAME) .. Included as acopy
**** Copy `num' elements from `src' to self starting at index `beg' of self.
acopy(beg:INT, src:SAME) .. Included as acopy
**** Copy as many elements from `src' to self as will fit when starting at index `beg' of self.
acopy(src:SAME) .. Included as acopy
**** Copy as many elements from `src' to self as will fit. Built-in.
aelt!(once beg:INT):T .. Included as aelt!
**** Yield each element of self starting at `beg'. Built-in.
aelt!(once beg,once num:INT):T .. Included as aelt!
**** Yield `num' successive elements of self starting at index `beg'. Built-in.
aelt!(once beg,once num,once step:INT):T .. Included as aelt!
**** Yield `num' elements of self starting at `beg' and stepping by `step' which must not be zero. Built-in.
aelt!:T .. Included as aelt!
**** Yield each element of self in order. Built-in.
aind!:INT .. Included as aind!
**** Yield the indices of self in order.
array_ptr:C_PTR .. Included as array_ptr
aset!(val:T) .. Included as aset!
**** Set successive elements of self to the values `val'. Built-in.
aset!(once beg:INT,val:T) .. Included as aset!
**** Set successive elements of self starting at `beg' to the values `val'.
aset!(once beg,once num:INT,val:T) .. Included as aset!
**** Set `num' successive elements of self starting at `beg' to the values `val'.
aset!(once beg,once num,once step:INT, val:T) .. Included as aset!
**** Set `num' elements of self starting at `beg' stepping by `step' to the values `val'. `step' must not be zero.
asize:INT .. Included as asize
**** The number of elements in self. Classes which inherit this may replace this by a constant to get constant sized objects (and the compiler may optimize certain operations in this case). Built-in.
create(n:INT):SAME .. Included as create
**** A new array with `n' elements.
is_legal_aelts_arg( beg, num, step:INT) :BOOL .. Included as is_legal_aelts_arg
**** True if the arguments are legal values for `aelts'.
attr nc:INT; .. Included as nc
**** number of columns built in feature inherited from AREF{*}, asize = nr*nc.
attr nr:INT; .. Included as nr
**** number of rows built in feature inherited from AREF{*}, asize = nr*nc.

The Sather Home Page