# MatCreateADA

Creates a matrix M=A^T D1 A + D2.

## Synopsis

    #include "mat.h"
    int MatCreateADA(Mat mat,Vec D1, Vec D2, Mat *J)

Collective on matrix

## Input Parameters

| mat | - matrix of arbitrary type
| D1 | - A vector
| D2 | - A vector

## Output Parameters

J -New matrix whose operations are defined in terms of mat, D1, and D2.

## Notes

The user provides the input data and is responsible for destroying this data after matrix J has been destroyed. The operation MatMult(A,D2,D1) must be well defined. Before calling the operation MatGetDiagonal(), the function MatADAComputeDiagonal() must be called. The matrices A and D1 must be the same during calls to MatADAComputeDiagonal() and MatGetDiagonal().

## See Also

MatCreate()

Level:developer
Location:src/petsctao/matrix/normalmat.c
TAO Solver Index
Table of Contents