Browse Source

cs344: updated matrix

master
lbeckman314 2 years ago
parent
commit
fe068574c6
2 changed files with 192 additions and 13 deletions
  1. 47
    13
      matrix
  2. 145
    0
      p1grading_result

+ 47
- 13
matrix View File

@@ -1,11 +1,12 @@
#!/bin/bash
# author: liam beckman
# created: 2018-04-03
# updated: 2018-04-13
# updated: 2018-04-23
# sources:
# https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
# p1gradingscript, Written by Ryan Gambord (gambordr@oregonstate.edu)
# https://stackoverflow.com/questions/8550385/how-to-read-1-line-from-2-files-sequentially
# https://www.poetryfoundation.org/poems/142199/lines-of-force

# control-c will terminate script execution and remove temporary files
trap "echo; echo 'SIGINT received: Deleting temp files then exiting!'; clean; exit 1" INT
@@ -328,9 +329,7 @@ multiply()
do
for element in $line
do
#echo "element: $element"
arr2+=($element)
#echo arr2
done
done < $1

@@ -414,11 +413,6 @@ multiply()

done < $1


# remove temporary files
#rm -f multiplyLeft$$.temp
#rm -f multiplyRight$$.temp

runtime=$((end-start))
echo $runtime > timeMultiply.temp

@@ -431,23 +425,18 @@ clean()
rm -f addLeft$$.temp
rm -f addRight$$.temp

#rm -f dims$$.temp
rm -f dims*.temp

rm -f mean$$.temp

#rm -f multiplyLeft$$.temp
#rm -f multiplyRight$$.temp
rm -f multiplyLeft*.temp
rm -f multiplyRight*.temp

rm -f stdinLeft$$.temp
rm -f stdinRight$$.temp

#rm -f transpose$$.temp
rm -f transpose*.temp

#rm -f validate$$.temp
rm -f validate*.temp

}
@@ -561,3 +550,48 @@ main()

# call main function with all arguments
main $@


# ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~
# P O E T R Y of the M O N T H
# ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~
#
# Lines of Force
# By Thomas Centolella
#
# ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~
#
# The pleasure of walking a long time on the mountain
# without seeing a human being, much less speaking to one.
#
# And the pleasure of speaking when one is suddenly there.
# The upgrade from wary to tolerant to convivial,
# so unlike two brisk bodies on a busy street
# for whom a sudden magnetic attraction
# is a mistake, awkwardness, something to be sorry for.
#
# But to loiter, however briefly, in a clearing
# where two paths intersect in the matrix of chance.
# To stop here speaking the few words that come to mind.
# A greeting. Some earnest talk of weather.
# A little history of the day.
#
# To stand there then and say nothing.
# To slowly look around past each other.
# Notice the green tang pines exude in the heat
# and the denser sweat of human effort.
#
# To have nothing left to say
# but not wanting just yet to move on.
# The tension between you, a gossamer thread.
# It trembles in the breeze, holding
# the thin light it transmits.
#
# To be held in that
# line of force, however briefly,
# as if it were all that mattered.
#
# And then to move on.
# With equal energy, with equal pleasure.
#
# ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~ * ~

+ 145
- 0
p1grading_result View File

@@ -0,0 +1,145 @@
┏┓ ┏━╸┏━╸╻┏┓╻┏┓╻╻┏┓╻┏━╸ ┏┳┓┏━┓╺┳╸┏━┓╻╻ ╻ ╺┳╸┏━╸┏━┓╺┳╸
┣┻┓┣╸ ┃╺┓┃┃┗┫┃┗┫┃┃┗┫┃╺┓ ┃┃┃┣━┫ ┃ ┣┳┛┃┏╋┛ ┃ ┣╸ ┗━┓ ┃
┗━┛┗━╸┗━┛╹╹ ╹╹ ╹╹╹ ╹┗━┛ ╹ ╹╹ ╹ ╹ ╹┗╸╹╹ ╹ ╹ ┗━╸┗━┛ ╹
Unit test 1: error messages
# (running score = 0/0)
 Passed: too many args to matrix dims (1/1)
 Passed: no args to matrix add (1/1)
 Passed: multiplying incompatible matrices (5/5)
 Passed: adding incompatible matrices (4/4)
 Passed: tranpose unreadable file (2/2)
 Passed: get dims of nonexistent file (1/1)
 Passed: matrix badcommand (1/1)
Unit test 2: matrix dims tests
# (running score = 15/15)
 Passed: Stdin: ("99 68" == "99 68") (3/3)
 Passed: Stdin: ("95 81" == "95 81") (3/3)
 Passed: Stdin: ("99 99" == "99 99") (3/3)
 Passed: File input: ("78 93" == "78 93") (3/3)
 Passed: File input: ("69 80" == "69 80") (3/3)
 Passed: File input: ("61 66" == "61 66") (3/3)
Unit test 3: matrix transpose hardcoded test
# (running score = 33/33)
 Passed: m1 == T(m2) and T(m1) == m2 (10/10)
Unit test 4: matrix transpose involution test
# (running score = 43/43)
 Passed: m1 == T(T(m1)) (5/5)
 Passed: m2 == T(T(m2)) (5/5)
 Passed: m3 == T(T(m3)) (5/5)
Unit test 5: matrix mean test
# (running score = 58/58)
 Passed: zero matrix (2/2)
 Passed: ones matrix (5/5)
 Passed: identity matrix (5/5)
 Passed: hardcoded matrix (15/15)
Unit test 6: matrix add test
# (running score = 85/85)
 Passed: 0 + 0 == 0 (2/2)
 Passed: X + 0 == X (5/5)
 Passed: 0 + X == X (5/5)
 Passed: A + B == B + A (1/1)
 Passed: m1 + m2 == m3 (hardcoded matrix) (15/15)
Unit test 7: matrix multiply test
# (running score = 113/113)
 Passed: I * M == M (5/5)
 Passed: M * I == M (5/5)
 Passed: 0 * M == 0 (5/5)
 Passed: m3 == m1 * m2 (hardcoded matrix) (20/20)
# Final grade: 148/148
┏┓ ┏━╸┏━╸╻┏┓╻┏┓╻╻┏┓╻┏━╸ ┏┳┓┏━┓╺┳╸┏━┓╻╻ ╻ ╺┳╸┏━╸┏━┓╺┳╸
┣┻┓┣╸ ┃╺┓┃┃┗┫┃┗┫┃┃┗┫┃╺┓ ┃┃┃┣━┫ ┃ ┣┳┛┃┏╋┛ ┃ ┣╸ ┗━┓ ┃
┗━┛┗━╸┗━┛╹╹ ╹╹ ╹╹╹ ╹┗━┛ ╹ ╹╹ ╹ ╹ ╹┗╸╹╹ ╹ ╹ ┗━╸┗━┛ ╹
Unit test 1: error messages
# (running score = 0/0)
 Passed: too many args to matrix dims (1/1)
 Passed: no args to matrix add (1/1)
 Passed: multiplying incompatible matrices (5/5)
 Passed: adding incompatible matrices (4/4)
 Passed: tranpose unreadable file (2/2)
 Passed: get dims of nonexistent file (1/1)
 Passed: matrix badcommand (1/1)
Unit test 2: matrix dims tests
# (running score = 15/15)
 Passed: Stdin: ("54 68" == "54 68") (3/3)
 Passed: Stdin: ("84 71" == "84 71") (3/3)
 Passed: Stdin: ("86 84" == "86 84") (3/3)
 Passed: File input: ("78 95" == "78 95") (3/3)
 Passed: File input: ("62 81" == "62 81") (3/3)
 Passed: File input: ("77 69" == "77 69") (3/3)
Unit test 3: matrix transpose hardcoded test
# (running score = 33/33)
 Passed: m1 == T(m2) and T(m1) == m2 (10/10)
Unit test 4: matrix transpose involution test
# (running score = 43/43)
 Passed: m1 == T(T(m1)) (5/5)
 Passed: m2 == T(T(m2)) (5/5)
 Passed: m3 == T(T(m3)) (5/5)
Unit test 5: matrix mean test
# (running score = 58/58)
 Passed: zero matrix (2/2)
 Passed: ones matrix (5/5)
 Passed: identity matrix (5/5)
 Passed: hardcoded matrix (15/15)
Unit test 6: matrix add test
# (running score = 85/85)
 Passed: 0 + 0 == 0 (2/2)
 Passed: X + 0 == X (5/5)
 Passed: 0 + X == X (5/5)
 Passed: A + B == B + A (1/1)
 Passed: m1 + m2 == m3 (hardcoded matrix) (15/15)
Unit test 7: matrix multiply test
# (running score = 113/113)
 Passed: I * M == M (5/5)
 Passed: M * I == M (5/5)
 Passed: 0 * M == 0 (5/5)
 Passed: m3 == m1 * m2 (hardcoded matrix) (20/20)
# Final grade: 148/148
┏┓ ┏━╸┏━╸╻┏┓╻┏┓╻╻┏┓╻┏━╸ ┏┳┓┏━┓╺┳╸┏━┓╻╻ ╻ ╺┳╸┏━╸┏━┓╺┳╸
┣┻┓┣╸ ┃╺┓┃┃┗┫┃┗┫┃┃┗┫┃╺┓ ┃┃┃┣━┫ ┃ ┣┳┛┃┏╋┛ ┃ ┣╸ ┗━┓ ┃
┗━┛┗━╸┗━┛╹╹ ╹╹ ╹╹╹ ╹┗━┛ ╹ ╹╹ ╹ ╹ ╹┗╸╹╹ ╹ ╹ ┗━╸┗━┛ ╹
Unit test 1: error messages
# (running score = 0/0)
 Passed: too many args to matrix dims (1/1)
 Passed: no args to matrix add (1/1)
 Passed: multiplying incompatible matrices (5/5)
 Passed: adding incompatible matrices (4/4)
 Passed: tranpose unreadable file (2/2)
 Passed: get dims of nonexistent file (1/1)
 Passed: matrix badcommand (1/1)
Unit test 2: matrix dims tests
# (running score = 15/15)
 Passed: Stdin: ("100 78" == "100 78") (3/3)
 Passed: Stdin: ("55 78" == "55 78") (3/3)
 Passed: Stdin: ("96 70" == "96 70") (3/3)
 Passed: File input: ("61 72" == "61 72") (3/3)
 Passed: File input: ("74 61" == "74 61") (3/3)
 Passed: File input: ("77 63" == "77 63") (3/3)
Unit test 3: matrix transpose hardcoded test
# (running score = 33/33)
 Passed: m1 == T(m2) and T(m1) == m2 (10/10)
Unit test 4: matrix transpose involution test
# (running score = 43/43)
 Passed: m1 == T(T(m1)) (5/5)
 Passed: m2 == T(T(m2)) (5/5)
 Passed: m3 == T(T(m3)) (5/5)
Unit test 5: matrix mean test
# (running score = 58/58)
 Passed: zero matrix (2/2)
 Passed: ones matrix (5/5)
 Passed: identity matrix (5/5)
 Passed: hardcoded matrix (15/15)
Unit test 6: matrix add test
# (running score = 85/85)
 Passed: 0 + 0 == 0 (2/2)
 Passed: X + 0 == X (5/5)
 Passed: 0 + X == X (5/5)
 Passed: A + B == B + A (1/1)
 Passed: m1 + m2 == m3 (hardcoded matrix) (15/15)
Unit test 7: matrix multiply test
# (running score = 113/113)
 Passed: I * M == M (5/5)
 Passed: M * I == M (5/5)
 Passed: 0 * M == 0 (5/5)
 Passed: m3 == m1 * m2 (hardcoded matrix) (20/20)
# Final grade: 148/148


Loading…
Cancel
Save