English | Español

# Try our Free Online Math Solver! Online Math Solver

 Depdendent Variable

 Number of equations to solve: 23456789
 Equ. #1:
 Equ. #2:

 Equ. #3:

 Equ. #4:

 Equ. #5:

 Equ. #6:

 Equ. #7:

 Equ. #8:

 Equ. #9:

 Solve for:

 Dependent Variable

 Number of inequalities to solve: 23456789
 Ineq. #1:
 Ineq. #2:

 Ineq. #3:

 Ineq. #4:

 Ineq. #5:

 Ineq. #6:

 Ineq. #7:

 Ineq. #8:

 Ineq. #9:

 Solve for:

 Please use this form if you would like to have this math solver on your website, free of charge. Name: Email: Your Website: Msg:

# Math 420 Homework 5

Q1: Cleaning up memory usage:

i. Create a “destructor” function for your Homework 4 dmatrix that frees
allocated array memory and sets the data pointer in the dmatrix to NULL.

ii. Review your Homework 4 dmatrix code and driver routines. Find and
eliminate all instances of memory leakage [ i.e. make sure your destructor is
called before a dmatrix goes out of scope ]. Document all instances where you
had to add or change code . It is sufficient to include your new codes in your
report and annotate the changes by hand .

Q2: Using BLAS and LAPACK:

a) Replace your self-written matrix operations in Homework 4 with functions that call
BLAS and LAPACK to perform the following tasks.

i. matrix A times matrix B
ii. matrix A plus matrix B
iii. scalar c times matrix A
iv. matrix A left divides matrix B

HINTS:

1. Your matrix_multiply routine must call dgemm.

2. You are also likely to use daxpy and dgesv

3. You will need to pay attention to the calling convention when invoking a
Fortran subroutine from C.

4. Q2 part iv is not optional.

5. Modify your dmatrix struct and set/get functions to use a contiguous column
major storage format.

b) Use matrices A and B from Homework 4 Q6 and compute the following using your
new BLAS/LAPACK based operators :

i. Compute C =AB
ii. Compute D=A+C
iii. Compute E=1.2*D
iv. Compute F=A\D

 Prev Next