{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Symmetric Matrix Vector Multiply Routines (stored in lower triangle)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook walks you through how to implement $ y := A x + y $ where $ A $ is symmetric. The challenge is to only access the matrix by columns."
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Getting started"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We will use some functions that are part of our laff library (of which this function will become a part) as well as some routines from the FLAME API (Application Programming Interface) that allows us to write code that closely resembles how we typeset algorithms using the FLAME notation. These functions are imported with the \"import laff as laff\" and \"import flame\" statements."
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Algorithm for the case where the matrix is stored in upper triangular part of $ A $"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"The routine
Symv_u_unb_var3( A, x, y )
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This routine, given symmetric matrix $ A \\in \\mathbb{R}^{n \\times n} $, $ x \\in \\mathbb{R}^n $, and $ y \\in \\mathbb{R}^n $, computes $ y := A x + y $. The \"_u_\" in the name of the routine indicates that $ A $ is stored in the upper triangular part of the matrix.\n",
"\n",
"The specific laff functions you may want to consider using are\n",
"
laff.dots( x, y, alpha )
which computes $ \\alpha := x^T y + \\alpha $. laff.axpy( alpha, x, y )
which computes $ y := \\alpha x + y $. Symv_l_unb_var3( A, x, y )
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This routine, given symmetric matrix $ A \\in \\mathbb{R}^{n \\times n} $, $ x \\in \\mathbb{R}^n $, and $ y \\in \\mathbb{R}^n $, computes $ y := A x + y $. The \"_l_\" in the name of the routine indicates that $ A $ is stored in the lower triangular part of the matrix.\n",
"\n",
"The specific laff functions you may want to consider using are\n",
" laff.dots( x, y, alpha )
which computes $ \\alpha := x^T y + \\alpha $. laff.axpy( alpha, x, y )
which computes $ y := \\alpha x + y $.