Routines (alphabetical) > Routines: C > CRAMER

# CRAMER

The CRAMER function solves an n by n linear system of equations using Cramer’s rule.

This routine is written in the IDL language. Its source code can be found in the file `cramer.pro` in the `lib` subdirectory of the IDL distribution.

## Examples

Define an array A and right-hand side vector B.

A = [[ 2.0, 1.0, 1.0], $
[ 4.0, -6.0, 0.0], $
[-2.0, 7.0, 2.0]]
B = [3.0, 10.0, -5.0]
;Compute the solution and print.
PRINT, CRAMER(A,B)

IDL prints:

1.00000 -1.00000 2.00000

## Syntax

Result = CRAMER( A, B [, /DOUBLE] [, ZERO=value] )

## Return Value

Returns the solution of an n by n linear system of equations using Cramer’s rule.

## Arguments

### A

An n by n single- or double-precision floating-point array.

### B

An n-element single- or double-precision floating-point vector.

## Keywords

### DOUBLE

Set this keyword to force the computation to be done in double-precision arithmetic.

### ZERO

Use this keyword to set the value of the floating-point zero. A floating-point zero on the main diagonal of a triangular array results in a zero determinant. A zero determinant results in a “Singular matrix” error and stops the execution of CRAMER. For single-precision inputs, the default value is 1.0 ∞ 10-6. For double-precision inputs, the default value is 1.0 ∞ 10-12.

## Version History

Pre 4.0 | Introduced

## See Also

CHOLSOL, GS_ITER, LU_COMPLEX, LUSOL, SVSOL, TRISOL