# error_A: The l_1 distance between two thin matrices up to a column... In TopicScore: The Topic SCORE Algorithm to Fit Topic Models

## Description

This function computes l_1 distance between two thin matrices up to a column permuation, that is to find the smallest sum of absolute value entry-wise difference between two matrices over all possible permutations over the columns of the first matrix. This can be done either universially or greedily.

## Usage

 `1` ```error_A(A, A_hat, type = "u") ```

## Arguments

 `A` The first p-by-K matrix. `A_hat` The second p-by-K matrix. `type` The search type for the best permutation. If it's 'u', the search is done universially, that is over all possible permuations of the columns of A. If it's 'g', the search is done greedily, that is at kth step find the closest column in the remaining columns of A to the kth column of A_hat in terms of l_1 distance. Greedy search may result in sub-optimal solutions, but it can be computed much faster than the universal way when K is large. The default value is 'u'.

## Value

The l_1 distance.

Minzhe Wang

## Examples

 ```1 2 3 4 5``` ```# The example uses the runif() function in the 'stats' package A <- matrix(runif(10*3),10,3) A_hat <- A + 0.1*matrix(runif(10*3),10,3) error_A(A, A_hat) error_A(A, A_hat, type='g') ```

TopicScore documentation built on June 6, 2019, 5:06 p.m.