Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e55140e
Clean up and augment pod documentation on Matrix related files.
mgage Oct 7, 2017
66acc9a
commit test files
mgage Oct 8, 2017
f6ca7fa
Fix typo in POD docs
mgage Oct 8, 2017
ec2eb88
commit test files and quickMatrixEntry
mgage Oct 8, 2017
3aeecbe
Commit merge from develop_tableau
mgage Oct 8, 2017
9e0a93c
Commit unit test files
mgage Oct 8, 2017
b6d57fe
Merge branch 'develop_plus_tableau' into my_current
mgage Oct 8, 2017
8c636d7
Resolve merge
mgage Oct 8, 2017
0554fe6
Update POD documentation
mgage Oct 9, 2017
41121ab
Add one more test file
mgage Oct 10, 2017
e2b3ef4
Create test pg files 1 through 6abcd. Fix up tableau.pl
mgage Oct 13, 2017
c4cd4fb
Split off subroutine (non-object oriented) versions of tableau method…
mgage Oct 13, 2017
d27bd2a
Updates to tableau that add tableau->cmp(checker=>tableauEquivalence);
mgage Oct 14, 2017
334315b
Fix checks for scalar multiplication to not have to stringify the val…
dpvc Oct 14, 2017
9e0930c
Merge pull request #330 from dpvc/fix-number-check
mgage Oct 14, 2017
f52ddde
Merge branch 'develop' of https://github.com/openwebwork/pg into develop
mgage Oct 14, 2017
f35d5c6
Merge branch 'develop' into my_current
mgage Oct 14, 2017
7efab97
updates to tableau row operations
mgage Oct 15, 2017
e965e7f
More changes to how variables are passed internally
mgage Oct 15, 2017
4061f4e
Add pivoting commands , find_next_pivot, find_next_basis and support.
mgage Oct 21, 2017
2e80c72
Added tests for pivot operations
mgage Oct 24, 2017
dad45b9
Corrected the output of find_next_pivot() and find_next_short_cut_pivot
mgage Oct 24, 2017
32233a1
Reorganize POD documentation
mgage Oct 24, 2017
58b75de
Add dual_lop -- to create a dual of the current tableau
mgage Nov 2, 2017
d167f6d
Update unit tests. include deprecated subroutine lop_pivot_basis
mgage Nov 2, 2017
93b30ad
Add WWAccessor.pm, a version of Class::Accessor ver 0.34 which will…
mgage Nov 7, 2017
09fce12
Update tableau.pl Has some pivot operations coded now
mgage Nov 7, 2017
be1963d
Update unit tests.
mgage Nov 16, 2017
3c25b93
Update primal2dual method.
mgage Nov 16, 2017
58a6f4d
Add separate output for quickMatrixEntry when in TeX mode.
mgage Nov 17, 2017
cc15b49
Add comment
mgage Dec 16, 2017
f2900ed
add tex support
mgage Dec 30, 2017
ca89ab0
improve alignment
mgage Dec 30, 2017
64f139b
update tests
mgage Dec 30, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 79 additions & 45 deletions lib/Matrix.pm
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
=head1 NAME

Matrix - Matrix of Reals
lib/Matrix - Matrix of Reals

Implements overrides for MatrixReal.pm for WeBWorK

=head1 DESCRIPTION

Implements overrides for MatrixReal.pm for WeBWorK
In general it is better to use MathObjects Matrices (Value::Matrix)
in writing PG problem. The answer checking is much superior with better
error messages for syntax errors in student entries. Some of the
subroutines in this file are still used behind the scenes
by Value::Matrix to perform calculations,
such as decompose_LR().


=head1 SYNOPSIS
Expand Down Expand Up @@ -68,8 +74,22 @@ sub _stringify {
return($s);
}

=head3 Accessor functions

(these are deprecated for direct use. Use the covering Methods
provided by MathObject Matrices instead.)

L($matrix) - return matrix L of the LR decomposition
R($matrix) - return matrix R of the LR decomposition
PL($matrix) return
PR($matrix

Original matrix is P_L * L * R *P_R
# obtain the Left Right matrices of the decomposition and the two pivot permutation matrices
# the original is M = PL*L*R*PR

=cut

sub L {
my $matrix = shift;
my $rows = $matrix->[1];
Expand Down Expand Up @@ -119,10 +139,14 @@ sub PR { # use this permuation on the right PL*L*R*PR =M
}
# obtain the Left Right matrices of the decomposition and the two pivot permutation matrices
# the original is M = PL*L*R*PR
=head4


=item rh_options

Method $matrix->rh_options

Meant for internal use when dealing with MatrixReal1

=cut

sub rh_options {
Expand All @@ -132,14 +156,18 @@ sub rh_options {
$self->[$MatrixReal1::OPTION_ENTRY]; # provides a reference to the options hash MEG
}

=head4

Method $matrix->trace

=item trace

Method: $matrix->trace
Returns: scalar which is the trace of the matrix.

Used by MathObject Matrices for calculating the trace.
Deprecated for direct use in PG questions.

=cut


sub trace {
my $self = shift;
my $rows = $self->[1];
Expand All @@ -152,9 +180,12 @@ sub trace {
$sum;
}

=head4

Method $matrix->new_from_array_ref
=item new_from_array_ref

Method $new_matrix = $matrix->new_from_array_ref ([[a,b,c],[d,e,f]])

Deprecated in favor of using creation tools for MathObject Matrices

=cut

Expand All @@ -168,21 +199,25 @@ sub new_from_array_ref { # this will build a matrix or a row vector from [a, b
$matrix;
}

=head4
=item array_ref

Method $matrix->array_ref

Converts Matrix from an ARRAY to an ARRAY reference.

=cut

sub array_ref {
my $this = shift;
$this->[0];
}

=head4
=item list

Method $matrix->list

Converts a Matrix column vector to an ARRAY (list).

=cut

sub list { # this is used only for column vectors
Expand All @@ -196,29 +231,14 @@ sub list { # this is used only for column vectors
@list;
}

=head4

Method $matrix->new_from_list

=cut

sub new_from_list { # this builds a row vector from an array
my $class = shift;
my @list = @_;
my $cols = @list;
my $rows = 1;
my $matrix = new Matrix($rows, $cols);
my $i=1;
while(@list) {
my $elem = shift(@list);
$matrix->assign($i++,1, $elem);
}
$matrix;
}

=head4
=item new_row_matrix

Method $matrix->new_row_matrix

Deprecated -- there are better tools for MathObject Matrices.

Create a row 1 by n matrix from a list. This subroutine appears to be broken

=cut

Expand All @@ -236,10 +256,12 @@ sub new_row_matrix { # this builds a row vector from an array
$matrix;
}

=head4
=item proj

Method $matrix->proj

Provides behind the scenes calculations for MathObject Matrix->proj
Deprecated for direct use in favor of methods of MathObject matrix

=cut

sub proj{
Expand All @@ -248,9 +270,12 @@ sub proj{
$self * $self ->proj_coeff($vec);
}

=head4
=item proj_coeff

Method $matrix->proj_coeff

Provides behind the scenes calculations for MathObject Matrix->proj_coeff
Deprecated for direct use in favor of methods of MathObject matrix

=cut

Expand All @@ -267,10 +292,12 @@ sub proj_coeff{
$x_vector;
}

=head4
=item new_column_matrix

Method $matrix->new_column_matrix

Create column matrix from an ARRAY reference (list reference)

=cut

sub new_column_matrix {
Expand All @@ -286,13 +313,15 @@ sub new_column_matrix {
$matrix;
}

=head4

This method takes an array of column vectors, or an array of arrays,
and converts them to a matrix where each column is one of the previous
vectors.
=item new_from_col_vecs

Method $matrix->new_from_col_vecs

Deprecated: The tools for creating MathObjects Matrices are simpler.
This method takes an array of column vectors, or an array of arrays,
and converts them to a matrix where each column is one of the previous
vectors.


=cut

Expand Down Expand Up @@ -341,9 +370,11 @@ sub new_from_col_vecs

=cut

=head4
=item cp

Method $matrix->new_from_col_vecs
Function: cp()

Provides ability to use perl complex numbers. N

=cut

Expand All @@ -354,7 +385,7 @@ sub cp { # MEG makes new copies of complex number
return $w;
}

=head4
=item copy

Method $matrix->copy

Expand Down Expand Up @@ -397,7 +428,7 @@ sub copy

# MEG added 6/25/03 to accomodate complex entries

=head4
=item conj

Method $matrix->conj

Expand All @@ -409,7 +440,7 @@ sub conj {
$elem;
}

=head4
=item transpose

Method $matrix->transpose

Expand Down Expand Up @@ -458,10 +489,13 @@ sub transpose
$matrix1;
}

=head4
=item decompose_LR

Method $matrix->decompose_LR

Used by MathObjects Matrix for LR decomposition
Deprecated for direct use in PG problems.

=cut

sub decompose_LR
Expand Down
2 changes: 1 addition & 1 deletion lib/Value.pm
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ sub class {

#
# Get an element from a point, vector, matrix, or list
#
# An index (3,4) indicates row 3, column 4 -- NOT a slice of a one dimensional list
sub extract {
my $M = shift; my $i; my @indices = @_;
return unless Value::isValue($M);
Expand Down
Loading