Added doc comments [skip ci]

This commit is contained in:
Andrew Kane
2024-06-30 21:52:12 -07:00
parent da54ecc504
commit 762ec863e2
5 changed files with 8 additions and 0 deletions

View File

@@ -46,6 +46,7 @@ pub struct MfModel {
pub q: *const c_float,
}
/// Loss functions.
#[repr(C)]
#[derive(Clone, Copy)]
pub enum Loss {

View File

@@ -2,6 +2,7 @@ use std::error;
use std::ffi::NulError;
use std::fmt;
/// An error.
#[derive(Debug, Eq, PartialEq)]
pub enum Error {
Io,

View File

@@ -1,20 +1,24 @@
use crate::bindings::{MfNode, MfProblem};
/// A matrix.
pub struct Matrix {
data: Vec<MfNode>,
}
impl Matrix {
/// Creates a new matrix.
pub fn new() -> Self {
Self { data: Vec::new() }
}
/// Creates a new matrix with a minimum capacity.
pub fn with_capacity(capacity: usize) -> Self {
Self {
data: Vec::with_capacity(capacity),
}
}
/// Adds a value to the matrix.
pub fn push(&mut self, row_index: i32, column_index: i32, value: f32) {
assert!(row_index >= 0);
assert!(column_index >= 0);

View File

@@ -4,6 +4,7 @@ use std::ffi::CString;
use std::path::Path;
use std::slice::Chunks;
/// A model.
#[derive(Debug)]
pub struct Model {
pub(crate) model: *mut MfModel,

View File

@@ -1,6 +1,7 @@
use crate::bindings::*;
use crate::{Error, Loss, Matrix, Model};
/// A set of parameters.
pub struct Params {
param: MfParameter,
}